#-----------------------------------------------------------
# -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
# vi: set ts=2 noet:
#
# INSTALL
#
# Installation instructions for the Rosetta design wizard.
#
# Authors:  Matt O'Meara
#
# Creation Date:  18 September 2007
#
#------------------------------------------------------------------------------------------
# (c) Copyright Rosetta Commons Member Institutions.
# (c) This file is part of the Rosetta software suite and is made available under license.
# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
# (c) For more information, see http://www.rosettacommons.org. Questions about this can be
# (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
# See http:# www.rosettacommons.org/license
#
#


Welcome!

Rosetta Design Wizard is a plugin for PyMol that allows one to use the
basic functionality of Rosetta within a graphical user environment
computational biologists are familar with.

*************
Requirements:
*************

(In general this is what is needed.  For system specific requirements, see below)

3) python -> tested with version 2.4 and 2.5.  Python 2.6 may not work ("as" becomes a keyword).
             Rosetta Design Wizard must be compiled with the same version of Python!

2) pymol -> Tested with PyMOL version 1.0 and 1.1 but it should work with PyMol SVN trunk as well.
            See notes PyMOL notes below for a more thurough discussion.

4) gcc   -> tested with 4.2 and 4.0 but probably should work with gcc 3.4 and gcc 4.x

***********
To install:
***********

0) edit project.settings and add 'rdwizard' to the 'src' dictionary key.

1) run 'scons rdwizard mode=release -j#' from the mini root directory,
Where # is replaced with the number of processors you have.
MAKE SURE SCons is using the *same* copy of Python that was used to build PyMOL.

2) run PyMol with sufficient permissions to write to the plugin directory ( probably as root ) 

3) in PyMol, click 'Install Plugin...', from the Plugin menu and find:

    mini_base_dir/src/rdwizard/rdwizard_launcher.py

4) restart PyMol

5) click 'Rosetta Design Wizard' from the wizard menu to run

6) the first time it is run, it will ask for the directory of the mini rosetta database.

*************
To Uninstall:
*************

The installation of the Rosetta Design Wizard puts the file rdwizard_lanucher.py in spot where PyMol can find it when it loads.  

    $python mini_base_dir/src/rdwizard/uninstall.py
 



***************************
How to Install PyMOL on OSX
***************************

Install fink

On clean install of OSX (8/08) I had to install
xcode: 
(possibly this comes on the OS cd shipped with the computer?)
goto http://connect.apple.com 
join the  Aple Developer Connection
click downloads and then Developer tools from the Downloads menu on the right
scroll down to the Xcode x.x Developer Tools
click the Xcode x.x Develper DVD (Disk Image)
open installer and follow directions 



$sudo fink install python24 libpng3 freetype2 freetype2-dev
# make sure these are all installed with out error

#It is important to use the fink python is used, ie '/sw/' is following path
# Using the "wrong" Python will cause PyMOL to crash on startup once RDW is loaded.
$which python2.4
/sw/bin/python2.4

#Make sure the latest version of Python Mega Widgets is installed
$python2.4
>>>import Pmw
>>>Pmw._version
'1.3'

#if not the tar.gz can be downloaded from sourceforge at
$wget http://downloads.sourceforge.net/pmw/Pmw.1.3.2.tar.gz?modtime=1190624315&big_mirror=0 /tmp/Pmw.1.3.2.tar.gz
$cd /tmp
$tar xzvf Pmw.1.3.2.tar.gz .
$cd Pmw.1.3.4
$sudo python2.4 setup.py install #<- important to use python2.4!

#download the pymol source
$svn co https://pymol.svn.sourceforge.net/svnroot/pymol/trunk /tmp/pymol
$cd /tmp/pymol

python2.4 setup.py build
sudo python2.4 setup.py install
sudo python2.4 setup2.py install

#NOTE: I had to comment out lines 305-313 in pymol/layer5/main.c
 because of an error durring compilation.  Maybe you won't have to?

***************************

# Downloading tarballs and doing "configure, make, make install" for python, libpng, freetype, etc
# is NOT recommended:  there a dozen total dependencies (or more), and some fail silently.

# However, one *can* use MacPorts instead of Fink.
# Again, make sure to use the Python installed by MacPorts
# both for compiling PyMOL *and* for running SCons on MiniRosetta.
# Note that Tcl/Tk/Tkinter will also be installed (via py25-pmw);
# trying to use the Mac system versions will result in non-functioning PyMOL.
$sudo port install python25 py25-hashlib py25-pmw freetype libpng

# There is a symlink bug in the MacPorts installation of Python 2.5 that must be fixed
# for SCons to find libpython automatically (http://trac.macports.org/ticket/17998):
$sudo rm /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
$sudo mv /opt/local/lib/python2.5 /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib
$sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ /opt/local/lib/python2.5

# If you're planning to develope RDW, you should get SWIG as well.
# Be warned, this has a *ridiculous* number of dependencies!
$sudo port install swig

# Make sure the PyMOL setup scripts can find your newly-install libraries:
$cd /tmp/pymol && ln -s /opt/local ext

# I had to modify PyMOL's setup.py in the appropriate places for OS X 10.4 (should be ~ obvious where):
# - add "/System/Library/Frameworks/GLUT.framework/Headers" to include dirs
# - add "-framework","GLUT" to list of frameworks
# - remove "-lglut" from list of libraries
# This may not be necessary for all versions of PyMOL or all versions of OS X,
# or you may have to make the opposite changes...

$which python2.5
/opt/local/python2.5
$python2.5 setup.py build
$sudo python2.5 setup.py install
$sudo python2.5 setup2.py install

# To the "pymol" script generated by the build process, add this line:
export PYMOL_WD="$(pwd)"

# MUST use the same Python when compiling MiniRosetta --
# this is used to auto-detect appropriate Python headers and libs.
# If you have problems, modify SConscript.rdwizard by hand -- cpath, libpath, and rdw_env[ 'LIBS' ].
$cd ~/mini
$python2.5 external/scons-local/scons.py rdwizard

*******************************
What to do in case of problems:
*******************************

This software is currently in Beta so it has not been tested fully on
all systems.  There are two major hurdles, the first is making the
bindings work and the second is interfacing with PyMol.


To help narrow down the problem, see if the follow work:

run
$mini_root/build/src/platform/specific/path/rdwizard/stand_alone_bindings.some-extension
pass into it the path to the database, a pdb file and a resfile.
There is an example pdb file and resfile in $mini_root/src/rdwizard/

If that works run
$mini_root/build/src/platform/specifi/path/rdwizard/test_bindings.py
pass into it the path to the database and a pdb file.


************
Known Issues
************

******************
Building on Ubuntu
******************

If running 'scons rdwizard' fails because it cannot find 'Python.h', run

$sudo aptitude install python-dev

as Ubuntu doesn't install it by default.

********************************
Incompatible Python API Problem:
********************************

In order for the bindings to be compatible with pymol, they must be
built linking against the same version of the Python API.  Since the
pre-built free version of pymol is old, it is likely it is built
against a Python API library that is older than the most current one
on your system.  

Try building PyMol from source using the same verison of python that
scons uses.  


It appears that if the versions are incompatable, it will still run
but just produce a warning.










If you have to do anything special to make Rosetta Design Wizard work,
please help to make sure the changes make it into the code/build
system, either by checking in changes yourself or emailing Matt
O'Meara what you did.  This is very much appreciated!












Send comments, suggestions, and bug reports to Matt O'Meara
<mattjomeara@gmail.com>.


