https://wiki.pymol.org/api.php?action=feedcontributions&user=Cank&feedformat=atomPyMOL Wiki - User contributions [en]2024-03-28T22:55:54ZUser contributionsMediaWiki 1.35.1https://wiki.pymol.org/index.php?title=Cealign_plugin&diff=13272Cealign plugin2009-04-21T22:59:42Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Download and install cealign (download instructions below)<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py". These are located in the cealign directory you previously downloaded.<br />
* Voila!<br />
* Note that the above python version must match the same version that is used by PyMOL. If you are using the pre-compiled version of MacPyMOL, the above instructions won't work.<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Cealign&diff=2964Cealign2009-04-21T22:59:42Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Download and install cealign (download instructions below)<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py". These are located in the cealign directory you previously downloaded.<br />
* Voila!<br />
* Note that the above python version must match the same version that is used by PyMOL. If you are using the pre-compiled version of MacPyMOL, the above instructions won't work.<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Cealign_plugin&diff=13271Cealign plugin2009-04-21T22:40:48Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Download and install cealign (download instructions below)<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py". These are located in the cealign directory you previously downloaded.<br />
* Voila!<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Cealign&diff=2963Cealign2009-04-21T22:40:48Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Download and install cealign (download instructions below)<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py". These are located in the cealign directory you previously downloaded.<br />
* Voila!<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Cealign_plugin&diff=13270Cealign plugin2009-04-21T22:34:50Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Download and install cealign (download instructions below)<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py".<br />
* Voila!<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Cealign&diff=2962Cealign2009-04-21T22:34:50Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Download and install cealign (download instructions below)<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py".<br />
* Voila!<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Cealign_plugin&diff=13269Cealign plugin2009-04-21T22:29:06Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Install cealign<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py".<br />
* Voila!<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Cealign&diff=2961Cealign2009-04-21T22:29:06Z<p>Cank: /* Mac OS X (10.5) */</p>
<hr />
<div>== Introduction ==<br />
<br />
'''Go directly to [[Cealign#Version_0.8-RBS|DOWNLOAD]]'''<br />
<br />
This page is the home page of the open-source CEAlign PyMOL plugin. The CE algorithm is a fast and accurate protein structure alignment algorithm, pioneered by Drs. Shindyalov and Bourne (See <br />
References). There are a few changes from the original CE publication (See Notes). <br />
<br />
The source code is implemented in C with the rotations finally done by Numpy in Python. Because the computationally complex portion of the code is written in C, it's quick. That is, on my machines --- relatively fast 64-bit machines --- I can align two 400+ amino acid structures in about 0.300 s with the C++ implementation.<br />
<br />
This plugs into PyMol very easily. See [[Cealign#The_Code|the code]] and [[Cealign#Examples|examples]] for installation and usage.<br />
<br />
== Comparison to PyMol ==<br />
'''Why should you use this?'''<br />
<br />
PyMOL's structure alignment algorithm is fast and robust. However, its first step is to perform a sequence alignment of the two selections. Thus, proteins in the '''twilight zone''' or those having a low sequence identity, may not align well. Because CE is a structure-based alignment, this is not a problem. Consider the following example. The image at LEFT was the result of CE-aligning two proteins (1C0M chain B to 1BCO). The result is '''152''' aligned (alpha carbons) residues (not atoms) at '''4.96 Angstroms'''. The image on the RIGHT shows the results from PyMol's align command: an alignment of '''221 atoms''' (not residues) at an RMSD of '''15.7 Angstroms'''.<br />
<br />
<gallery><br />
Image:cealign_ex1.png|Cealign's results (152 aligned; 4.96 Ang.)<br />
Image:pymol_align.png|PyMol's results (763 atoms; 18.4 Ang. )<br />
</gallery><br />
<br />
=== Fit vs. optAlign ===<br />
====Take Home messages====<br />
* [[fit]] and [[optAlign]] perform nearly equally as well<br />
* if you need an algorithm with an appropriate reference, use [[optAlign]] (references at bottom of page).<br />
* [[fit]] is faster -- if you're aligning many structures, use it over [[optAlign]]<br />
<br />
====Discussion====<br />
[[optAlign]] is a function within the [[Cealign]] package that performs the optimal superposition of two objects of equal length. [[optAlign]] follows the Kabsch algorithm which is a closed form, and provably optimal solution to the problem. [[fit]] on the other hand uses the Jacobi rotations to iteratively arrive at the solution of optimal superposition. The difference in error between [[optAilgn]] and [[fit]] seems to be a non-issue (see below) as they both arrive at equivalent solutions for the rotation matrix. The two algorithms are undertake different approaches to orthogonally diagonalizing the correlation matrix.<br />
<br />
PyMOL's [[fit]] is fast and works well. If you have to use something with a known reference then check out the "optAlign" function from the qkabsch.py file that comes with this [[Calign]] package. If not, you can just use [[fit]] and avoid installing new software. :-)<br />
<br />
optAlign is slower than fit. I just tested both on a sample NMR ensemble; and, while not an extensive validation of "fit" it shows that (1) fit is faster; and (2) fit gets the same exact RMSD as "optAlign" (when optAlign is told to use all atoms, not just CA). To make optAlign use all atoms and not just the alpha-carbon backbones, comment out (that is, put a "#" at the start of lines 183 and 184 in qkabsch.py, where it says "CUT HERE").<br />
<br />
<source lang="python"><br />
fetch 1nmr<br />
split_states 1nmr<br />
delete 1nmr<br />
<br />
# compare fit and optAlign RMSDs<br />
for x in cmd.get_names(): print cmd.fit("1nmr_0001", x)<br />
for x in cmd.get_names(): optAlign(x, "1nmr_0001")<br />
</source><br />
<source lang="bash"><br />
# results from fit<br />
0.0<br />
4.50344991684<br />
5.33588504791<br />
5.78613853455<br />
7.25597000122<br />
6.67145586014<br />
3.25131297112<br />
3.36766290665<br />
6.74802017212<br />
5.1579709053<br />
5.96959495544<br />
6.68093347549<br />
4.13217163086<br />
5.51539039612<br />
6.24266338348<br />
6.03838825226<br />
5.01363992691<br />
5.33336305618<br />
6.87617444992<br />
7.797062397<br />
<br />
#results from optAlign<br />
RMSD=0.000000<br />
RMSD=4.503450<br />
RMSD=5.335886<br />
RMSD=5.786138<br />
RMSD=7.255970<br />
RMSD=6.671456<br />
RMSD=3.251313<br />
RMSD=3.367663<br />
RMSD=6.748021<br />
RMSD=5.157971<br />
RMSD=5.969595<br />
RMSD=6.680934<br />
RMSD=4.132172<br />
RMSD=5.515390<br />
RMSD=6.242664<br />
RMSD=6.038388<br />
RMSD=5.013640<br />
RMSD=5.333363<br />
RMSD=6.876174<br />
RMSD=7.797062<br />
</source><br />
<br />
== Examples ==<br />
=== Usage ===<br />
==== Syntax ====<br />
<br />
CEAlign has the semantic, and syntactic formalism of<br />
<source lang="python"><br />
cealign MASTER, TARGET<br />
</source><br />
where a post-condition of the algorithm is that the coordinates of the '''MASTER''' protein are unchanged. This allows for easier multi-protein alignments. For example,<br />
<source lang="python"><br />
cealign 1AUE, 1BZ4<br />
cealign 1AUE, 1B68<br />
cealign 1AUE, 1A7V<br />
cealign 1AUE, 1CPR<br />
</source><br />
will superimpose all the TARGETS onto the MASTER.<br />
<br />
=====Examples=====<br />
<source lang="python"><br />
cealign 1cll and i. 42-55, 1ggz and c. A<br />
cealign 1kao, 1ctq<br />
cealign 1fao, 1eaz<br />
</source><br />
<br />
=====Multiple Structure Alignments=====<br />
Use the '''alignto''' command, now provided with cealign. Just type,<br />
<source lang="python"><br />
alignto PROT<br />
</source><br />
to align all your proteins in PyMOL to the one called, '''PROT'''.<br />
<br />
=== Results ===<br />
See '''Changes''' for updates. But, overall, the results here are great.<br />
<br />
<gallery><br />
Image:v7_1fao_1eaz.png|EASY: 1FAO vs. 1EAZ; 96 residues, 1.28 Ang<br />
Image:v7_1cbs_1hmt.png|EASY: 1CBS vs. 1HMT; 128 residues, 2.01 Ang<br />
Image:v7_1a15_1b50.png|MODERATE: 1A15 vs 1B50; 56 residues, 2.54 Ang.<br />
Image:v7_1oan_1s6n.png|EASY: 1OAN vs. 1S6N (state 1); 96 residues aligned to 3.83 Ang. RMSD.<br />
Image:v7_1rlw_1byn.png|HARD: 1RLW to 1BYN; 104 residues; 2.21 Ang.<br />
Image:v7_1ten_3hhr.png|HARD: 1TEN vs. 3HHR; 80 residues, 2.91 Ang.<br />
Image:v7_2sim_1nsb.png|HARD: 2SIM vs. 1NSB; 272 residues, 4.93 Ang.<br />
Image:v7_1cew_1mol.png|HARD: 1CEW vs. 1MOL; 80 residues, 4.03 Ang.<br />
</gallery><br />
<br />
== Installation ==<br />
<br />
===Mac OS X (10.5)===<br />
[[Image:Cealign mac os x.png|300px|thumb|center|CEAlign running on Mac OS X (10.5)]]<br />
* Install PyMOL under fink.<br />
* Install Numpy for fink:<br />
<source lang="bash"><br />
/sw/bin/fink install scipy-core-py25<br />
</source><br />
* Install cealign<br />
<source lang="bash"><br />
sudo /sw/bin/python setup.py install<br />
</source><br />
* In PyMOL, run the two scripts needed for cealing: "cealign.py" and "qkabsch.py".<br />
* Voila!<br />
<br />
===Windows systems===<br />
This is a quick and dirty method to get it working on Win32 right now, more details coming soon.<br />
====Requirements====<br />
* Latest PyMol, installed on your system<br />
* Numpy for python 2.4 -- quick download of just what's needed: http://users.umassmed.edu/Shivender.Shandilya/pymol/numpy.zip<br />
* Pre-compiled ccealign.pyd python module: http://users.umassmed.edu/Shivender.Shandilya/pymol/ccealign.zip<br />
* Modified pymolrc: http://users.umassmed.edu/Shivender.Shandilya/pymol/pymolrc<br />
* cealign.py and qkabsch.py from the Cealign-0.8-RBS package: download below<br />
<br />
====Directions====<br />
# Unzip the numpy.zip file, which will give you a folder named '''numpy'''<br />
# Move this entire folder to: C:\Program Files\DeLano Scientific\PyMOL\modules\ (or the corresponding location on your system)<br />
# Unzip ccealign.zip, which will give you a file called '''ccealign.pyd'''<br />
# Move this pyd file to: C:\Program Files\DeLano Scientific\PyMOL\py24\DLLs\ (or the corresponding location on your system)<br />
# Copy the downloaded '''pymolrc''' file to: C:\Program Files\DeLano Scientific\PyMOL\ (or the corresponding location on your system)<br />
# Extract and copy the files cealign.py and qkabsch.py from the Cealign-0.8-RBS package to: C:\Program Files\DeLano Scientific\PyMOL\py24\Lib\ (or the corresponding location on your system)<br />
# Run PyMol and load some molecules<br />
# Run this command in Pymol: '''cealign molecule1, molecule2'''<br />
# Enjoy!<br />
<br />
===*nix systems===<br />
====Requirements====<br />
* C compiler<br />
* Python 2.4+ with distutils<br />
* Numpy<br />
** for User-compiled PyMOL: <source lang="python">python setup.py install</source><br />
** for the precompiled version of PyMOL <source lang="python">python setup.py install --prefix "" --root /DIR_TO/pymol/ext/</source><br />
<br />
====Directions====<br />
# uncompress the distribution file '''cealign-VERSION.tgz'''<br />
# cd cealign-VERSION<br />
# sudo python setup.py install # if you installed by PyMOL by hand<br />
## python setup.py install --prefix "" --root /DIR/TO/pymol/ext/ # if you are using the precompiled binary download<br />
# insert "run DIR_TO_CEALIGN/cealign.py" and "run DIR_TO_CEALIGN/qkabsch.py" into your '''.pymolrc''' file, or just run the two Python scripts by hand.<br />
# load some molecules<br />
# run, '''cealign molecule1, molecule2'''<br />
# enjoy<br />
<br />
=====Pre-compiled Hackish Install=====<br />
For those people that prefer to use the pre-compiled version of PyMOL, here are the basics for your install. '''This is a poor method of installing Cealign. I suggest users compile and install their own PyMOL.''' The final goal is to get <br />
# '''ccealign.so''' module into '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# numpy installed (get the numpy directory into (or linked into) '''PYMOL/ext/lib/python2.4/site-packages'''<br />
# and be able to run cealign.py and qkabsch.py from PyMOL.<br />
If you can do the above three steps, '''cealign''' should run from the pre-compiled PyMOL.<br />
<br />
In more detail, on a completely fictitious machine --- that is, I created the following commands from a fake machine and I don't expect a copy/paste of this to work '''anywhere''', but the commands should be helpful enough to those who need it:<br />
<source lang="python"><br />
# NOTES:<br />
# This is fake code: don't copy/paste it.<br />
#<br />
# PYMOL='dir to precompiled PyMOL install'<br />
# CEALIGN='dir where you will unpack cealign'<br />
# replace lib with lib64 for x86-64<br />
# install numpy<br />
apt-get install numpy<br />
<br />
# link numpy to PyMOL<br />
ln -s /usr/local/lib/python2.4/site-packages/numpy PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# download and install Cealign<br />
wget http://www.pymolwiki.org/images/e/ed/Cealign-0.6.tar.bz2<br />
tar -jxvf Cealign-0.6.tar.bz2<br />
cd cealign-0.6<br />
sudo python setup.py build<br />
cp build/lib-XYZ-linux/ccealign.so PYMOL/ext/lib/python2.4/site-packages<br />
<br />
# run pymol and try it out<br />
pymol<br />
run CEALIGN/cealign.py<br />
run CEALIGN/qkabsch.py<br />
fetch 1cew 1mol, async=0<br />
cealign 1c, 1m<br />
</source><br />
<br />
== The Code ==<br />
Please unpack and read the documentation. All comments/questions should be directed to Jason Vertrees (javertre _at_ utmb ...dot... edu). <br />
<br />
'''LATEST IS v0.8-RBS'''. (Dedicated to Bryan Sutton for allowing me to use his computer for testing.)<br />
<br />
=== Version 0.8-RBS ===<br />
* '''Download: [[Media:Cealign-0.8-RBS.tar.bz2|CE Align v0.8-RBS]] (bz2)'''<br />
* '''Download: [[Media:Cealign-0.8-RBS.zip|CE Align v0.8-RBS]] (zip)'''<br />
<br />
=== Beta Version 0.9 ===<br />
Use at your own peril. Please report any problems or inconsistent alignments to this discussion page, or to me directly; my email address all over this page.<br />
<br />
'''Improvements/Changes''':<br />
* All C++<br />
** So, faster<br />
** comes with the dependencies built in<br />
* No numpy<br />
<br />
''' Download: [[Media:Cealign-0.9.zip|CE Align v0.9]] (zip)'''<br />
<br />
== Coming Soon ==<br />
* Windows binary<br />
* Linux Binaries (32bit, x86-64)<br />
* Better instructions for precompiled distributions<br />
* Optimization<br />
<br />
== Updates ==<br />
<br />
=== 2008-03-25 ===<br />
Pure C++ code released. See the beta version above.<br />
<br />
=== 2007-04-14 ===<br />
v0.8-RBS source updated. Found the bug that had been plaguing 32-bit machines. This should be the last release for a little while.<br />
<br />
Also, I provide the option of aligning based solely upon RMSD or upon the better CE-Score. See the '''References''' for information on the '''CE Score'''.<br />
<br />
== Troubleshooting ==<br />
<br />
Post your problems/solutions here.<br />
<br />
=== Unicode Issues in Python/Numpy ===<br />
'''Problem''': Running/Installing cealign gives<br />
<source lang="python"><br />
Traceback (most recent call last):<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parser.py",<br />
line 308, in parse<br />
File "/home/byron/software/pymol_1.00b17/pymol/modules/pymol/parsing.py",<br />
line 410, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 36, in ?<br />
import core<br />
File "/usr/lib/python2.4/site-packages/numpy/core/__init__.py", line 5, in ?<br />
import multiarray<br />
ImportError: /home/byron/software/pymol/ext/lib/python2.4/site-packages/numpy/core/multiarray.so:<br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
where the important line is<br />
<source lang="python"><br />
undefined symbol: _PyUnicodeUCS4_IsWhitespace<br />
</source><br />
<br />
This problem indicates that your Numpy Unicode is using a different byte-size for unicode characters than is the Python distribution your PyMOL is running from. For example, this can happen if you use the pre-built PyMOL and some other pre-built Numpy package.<br />
<br />
<br />
<br />
'''Solution''': Hand-install Numpy.<br />
<br />
<br />
=== LinAlg Module Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/usr/lib/python2.4/site-packages/pymol/parser.py", line 285, in parse<br />
parsing.run_file(exp_path(args[nest][0]),pymol_names,pymol_names)<br />
File "/usr/lib/python2.4/site-packages/pymol/parsing.py", line 407, in run_file<br />
execfile(file,global_ns,local_ns)<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 40, in ?<br />
import linalg<br />
ImportError: No module named linalg<br />
</source><br />
<br />
<br />
<br />
'''Solution''': You do not have the linear algebra module installed (or Python can't find it) on your machine. One workaround is to install [http://www.scipy.org/ Scientific Python]. (on debian/ubuntu this can be done by: sudo apt-get install python-scipy) Another is to reinstall the Numpy package from source, ensuring that you have the necessary requirements for the linear algebra module (linpack, lapack, fft, etc.).<br />
<br />
=== CCEAlign & NumPy Modules Not Found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>run cealign.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "/usr/local/pymol/scripts/cealign-0.1/cealign.py", line 59, in ?<br />
from ccealign import ccealign<br />
ImportError: No module named ccealign<br />
run qkabsch.py<br />
Traceback (most recent call last):<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parser.py", line 297, in parse<br />
File "/home/local/warren/MacPyMOL060530/build/Deployment/MacPyMOL.app/pymol/modules/pymol/parsing.py", line 408, in run_file<br />
File "qkabsch.py", line 86, in ?<br />
import numpy<br />
ImportError: No module named numpy<br />
</source><br />
<br />
<br />
<br />
'''Solution''': This problem occurs under [http://www.apple.com/macosx Apple Mac OS X] if (a) the Apple's python executable on your machine (/usr/bin/python, currently version 2.3.5) is superseded by [http://fink.sourceforge.net/ Fink]'s python executable (/sw/bin/python, currently version 2.5) and (b) you are using [http://delsci.com/rel/099/#MacOSX precompiled versions of PyMOL] (MacPyMOL, PyMOLX11Hybrid or PyMOL for Mac OS X/X11). These executables ignore Fink's python and instead use Apple's - so, in order to run CE Align, one must install NumPy (as well as CE Align itself) using Apple's python. To do so, first download the [http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103 Numpy source code archive] (currently version 1.0.1), unpack it, change directory to numpy-1.0.1 and specify the full path to Apple's python executable during installation: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>. Then, donwload the [http://www.pymolwiki.org/index.php/Cealign#The_Code CE Align source code archive] (currently version 0.2), unpack it, change directory to cealign-0.2 and finally install CE Align as follows: <tt>sudo /usr/bin/python setup.py install | tee install.log</tt>.<br />
[[User:Lucajovine|Luca Jovine]] 05:11, 25 January 2007 (CST).<br />
<br />
=== The Function SimpAlign() is not found ===<br />
'''Problem''': Running CE Align gives the following error message:<br />
<source lang="python"><br />
PyMOL>cealign 1CLL,1GGZ<br />
Traceback (most recent call last):<br />
File "C:\Program Files (x86)\DeLano Scientific\PyMOL/modules\pymol\parser.py", line 203, in parse<br />
result=apply(kw[nest][0],args[nest],kw_args[nest])<br />
File "py24/Lib/cealign.py", line 177, in cealign<br />
curScore = simpAlign( matA, matB, mol1, mol2, stored.mol1, stored.mol2, align=0, L=len(matA) )<br />
NameError: global name 'simpAlign' is not defined<br />
</source><br />
I am running PyMOL v. 0.99rc6 on Win XP Professional x64 edition version 2003 sp2 and have followed the windows install procedure as described above.<br />
<br />
'''Answer''': This simply means that PyMOL couldn't find the simplAlign function. To let PyMOL know about this, you must run the following commands before running [[cealign]]:<br />
<source lang="python"><br />
run /your/path/to/cealign/qkabsch.py<br />
run /your/path/to/cealign/cealign.py<br />
</source><br />
but most people that use cealign would just put these two lines in their '''.pymolrc''' file.<br />
<br />
=== Short Alignments Don't Work ===<br />
If you are trying to align fewer than 16 residues then use [[align]], [[super]], or [[optAlign]]. CE uses a window size of 8; and to build a path of more than one window, you need 2*8=16 residues. I will insert some code to re-route small alignments to one of the aforementioned alignment algorithms.<br />
<br />
=== It Worked A Second Ago! ===<br />
[[Image:Rewind.png|thumb|right|Showing the rewind button to rewind to state 1.]]<br />
<br />
If you were using cealign (or alignto) and now the commands don't work -- that is, they return an RMSD, but don't actually superimpose the objects, then you have a simple problem dealing with states. Most likely the cause of this oddness was (1) when you issued "cealign prot1, prot2" one of them was actually an ensemble of states or (2) you are trying to align to proteins with only one state, but are not looking at state one (because the last protein you were considering had more than one state and you quit editing that protein on a state that's not state 1). To fix this, use the rewind button to get the proteins back into state 1 & reissue the cealign/alignto command.<br />
<br />
== References ==<br />
Text taken from PubMed and formatted for the wiki. The first reference is the most important for this code.<br />
<br />
# Shindyalov IN, Bourne PE. '''Protein structure alignment by incremental combinatorial extension (CE) of the optimal path.''' ''Protein Eng.'' 1998 Sep;11(9):739-47. PMID: 9796821 [PubMed - indexed for MEDLINE]<br />
# Jia Y, Dewey TG, Shindyalov IN, Bourne PE. '''A new scoring function and associated statistical significance for structure alignment by CE.''' ''J Comput Biol.'' 2004;11(5):787-99. PMID: 15700402 [PubMed - indexed for MEDLINE]<br />
# Pekurovsky D, Shindyalov IN, Bourne PE. '''A case study of high-throughput biological data processing on parallel platforms.''' ''Bioinformatics.'' 2004 Aug 12;20(12):1940-7. Epub 2004 Mar 25. PMID: 15044237 [PubMed - indexed for MEDLINE]<br />
# Shindyalov IN, Bourne PE. '''An alternative view of protein fold space.''' ''Proteins.'' 2000 Feb 15;38(3):247-60. PMID: 10713986 [PubMed - indexed for MEDLINE]<br />
<br />
== License ==<br />
The CEAlign and all its subprograms that I wrote, are released under the open source Free BSD License (BSDL).<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:Structure_Alignment|Cealign]]</div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9652Save sep2009-04-21T22:22:54Z<p>Cank: </p>
<hr />
<div>== Description ==<br />
Saves all objects as separate PDB files. Useful if you want to do things like combine separate *.pse files.<br />
== Code ==<br />
<br />
<source lang="python"><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <prefix><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</source><br />
<br />
[[Category:Script Library]]<br />
[[Category:States]]<br />
[[Category:Saving]]</div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9651Save sep2009-04-14T22:30:50Z<p>Cank: </p>
<hr />
<div>== Description ==<br />
Saves all objects as separate PDB files. Useful if you want to do things like combine separate *.pse files.<br />
== Code ==<br />
<br />
<source lang="python"><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <prefix><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</source><br />
<br />
[[Category:Script Library]]</div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9650Save sep2009-04-14T22:30:33Z<p>Cank: </p>
<hr />
<div>== Description ==<br />
Saves all objects as separate PDB files. Useful if you want to do things like combine separate *.pse files.<br />
== Code ==<br />
<br />
<source lang="python"><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <prefix><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</source><br />
<br />
{{Category:Scripting}}</div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9649Save sep2009-04-14T22:30:12Z<p>Cank: </p>
<hr />
<div>== Description ==<br />
Saves all objects as separate PDB files. Useful if you want to do things like combine separate *.pse files.<br />
== Code ==<br />
<br />
<source lang="python"><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <prefix><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</source><br />
<br />
{{Category:Script Library}}</div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9648Save sep2009-04-14T22:29:58Z<p>Cank: </p>
<hr />
<div>== Description ==<br />
Saves all objects as separate PDB files. Useful if you want to do things like combine separate *.pse files.<br />
== Code ==<br />
<br />
<source lang="python"><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <prefix><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</source></div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9647Save sep2009-04-14T22:29:09Z<p>Cank: </p>
<hr />
<div><source lang="python"><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <prefix><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</source></div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9646Save sep2009-04-14T22:28:40Z<p>Cank: </p>
<hr />
<div><source lang="python"><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <files>, <object><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</source></div>Cankhttps://wiki.pymol.org/index.php?title=Save_sep&diff=9645Save sep2009-04-14T22:28:03Z<p>Cank: New page: <code> from pymol import cmd import glob import re def save_sep(prefix=''): """ save_sep <files>, <object> saves multiple objects into multiple files using an optional prefix name....</p>
<hr />
<div><code><br />
from pymol import cmd<br />
import glob<br />
import re<br />
<br />
def save_sep(prefix=''):<br />
"""<br />
save_sep <files>, <object><br />
<br />
saves multiple objects into multiple files using an optional prefix name.<br />
<br />
e.g. save_sep prefix<br />
"""<br />
obj_list = cmd.get_names('models')<br />
<br />
if obj_list:<br />
for i in range(len(obj_list)):<br />
# if ( obj == '' ):<br />
obj_name = "%s%s.pdb" % (prefix, obj_list[i])<br />
cmd.save(obj_name, obj_list[i])<br />
print "Saving %s" % obj_name<br />
else:<br />
print "No objects found"<br />
<br />
cmd.extend('save_sep',save_sep)<br />
<br />
</code></div>Cankhttps://wiki.pymol.org/index.php?title=Plugins&diff=7932Plugins2009-04-01T20:00:18Z<p>Cank: /* Using Fink */</p>
<hr />
<div>Plugins are modules which can add functionality to Pymol.<br />
<br />
== Plugins on OS X ==<br />
<br />
=== Using MacPyMOL ===<br />
The standard OS X Pymol application, MacPyMOL.app does not run with the Tcl/Tk interface which is required for plugins to work. However, a quick renaming of the program from MacPyMOL.app to PyMOLX11Hybrid.app makes the application run as an X11 application, and plugins are now available.<br />
<br />
To rename the executable, right click (or control click) on MacPyMOL and choose "Get Info" in the Panel. Change the Name & Extension to PyMOLX11Hybrid.app. This name can also be changed using the mv command in Terminal.app. <br />
<br />
Once this change is made, half of the program will show up under the X11 icon, and half will show up under the MacPyMOL icon.<br />
<br />
=== Using Fink ===<br />
An alternative to renaming MacPyMOL is to download the PyMOL installation using [[Fink]]:<br />
<br />
<pre><br />
fink install pymol-py25<br />
</pre><br />
<br />
<br />
[[Category:Plugins]]</div>Cankhttps://wiki.pymol.org/index.php?title=Plugins&diff=12734Plugins2009-04-01T20:00:07Z<p>Cank: /* Plugins on OS X */</p>
<hr />
<div>Plugins are modules which can add functionality to Pymol.<br />
<br />
== Plugins on OS X ==<br />
<br />
=== Using MacPyMOL ===<br />
The standard OS X Pymol application, MacPyMOL.app does not run with the Tcl/Tk interface which is required for plugins to work. However, a quick renaming of the program from MacPyMOL.app to PyMOLX11Hybrid.app makes the application run as an X11 application, and plugins are now available.<br />
<br />
To rename the executable, right click (or control click) on MacPyMOL and choose "Get Info" in the Panel. Change the Name & Extension to PyMOLX11Hybrid.app. This name can also be changed using the mv command in Terminal.app. <br />
<br />
Once this change is made, half of the program will show up under the X11 icon, and half will show up under the MacPyMOL icon.<br />
<br />
=== Using Fink ===<br />
An alternative to renaming MacPyMOL is to download the PyMOL installation using [[Fink]]:<br />
<br />
<code><br />
fink install pymol-py25<br />
</code><br />
<br />
<br />
[[Category:Plugins]]</div>Cankhttps://wiki.pymol.org/index.php?title=APBS&diff=3721APBS2009-04-01T18:58:46Z<p>Cank: /* Introduction */</p>
<hr />
<div>== Introduction ==<br />
[[Image:Rna_surface_apbs.png|thumb|APBS-generated electrostatic surface displayed in PyMOL]]<br />
[http://apbs.sourceforge.net APBS], the Adaptive Poisson-Boltzmann Solver, is a [http://www.oreilly.com/openbook/freedom/ freely] available macromolecular electrostatics calculation program released under the [http://www.gnu.org/copyleft/gpl.html GPL]. It is a cost-effective but uncompromised alternative to [http://trantor.bioc.columbia.edu/grasp/ GRASP], and it can be used within pymol. Pymol can display the results of the calculations as an electrostatic potential molecular surface.<br />
<br />
PyMol currently supports the '''APBS plugin''' written by Michael Lerner. This plugin makes it possible to run APBS from within PyMOL, and then display the results as a color-coded electrostatic surface (units k<sub>b</sub>T/e<sub>c</sub>) in the molecular display window (as with the image to the right). See [http://apbs.wustl.edu/MediaWiki/index.php/APBS_electrostatics_in_PyMOL the APBS wiki] for more details, including instructions on how to download, install and use the plugin.<br />
<br />
'''Nucleic acids may prove problematic for the apbs plugin.''' If so, use the [http://pdb2pqr.sourceforge.net/ pdb2pqr] command-line tool to create a pqr file manually, instead of using the plugin to generate it. Then direct the APBS GUI on the [http://www-personal.umich.edu/~mlerner/PyMOL/images/main.png main menu] to read the pqr file you '''externally generated.'''<br />
<br />
==Required Dependencies==<br />
[http://apbs.sourceforge.net APBS] and its dependencies like [http://pdb2pqr.sourceforge.net pdb2pqr] and [http://scicomp.ucsd.edu/~mholst/codes/maloc/ maloc] are [http://www.oreilly.com/openbook/freedom/ freely] available under the [http://www.gnu.org/copyleft/gpl.html GPL]. The author of the software however [http://agave.wustl.edu/apbs/download/ asks that users register] with him to aid him in obtaining grant funding.<br />
<br />
----<br />
===Installing the Dependencies on OS X===<br />
#First, [http://agave.wustl.edu/apbs/download/ register] your use of the software. This will keep everyone happy.<br />
#Second, if you don't already have the [http://fink.sourceforge.net fink package management system], now is a good time to get it. Here is a [http://xanana.ucsc.edu/~wgscott/xtal/wiki/index.php/Quick_Start quick-start set of instructions] for getting X-windows, compilers, and fink all installed. <br />
#Once you are up and going, [http://xanana.ucsc.edu/~wgscott/xtal/wiki/index.php/How_to_Activate_the_Unstable_Branch activate the unstable branch in fink], and then issue the commands<br />
<source lang="bash"><br />
fink self-update<br />
fink install apbs<br />
</source><br />
or if you want to use the multi-processor version, issue<br />
<source lang="bash"><br />
fink self-update<br />
fink install apbs<br />
</source><br />
Then install the X-windows based version of pymol using the command<br />
<source lang="bash"><br />
fink install pymol-py25<br />
</source><br />
Note that the fink version of pymol '''already has''' the latest version of the APBS plugin. You are set to go!<br />
<br />
Further details, as well as screen shots, are given [http://www.pymolwiki.org/index.php/MAC_Install#Install_APBS_and_friends_with_fink elsewhere in this wiki].<br />
<br />
===Installing the Dependencies on Linux===<br />
<br />
====From Scratch====<br />
Note that this tutorial assumes you're using the bash shell and have root privileges<br />
<OL><LI><br />
Obtain APBS and MALOC from...<br><br />
APBS = http://apbs.sourceforge.net (currently 0.4)<br><br />
MALOC = http://www.fetk.org/codes/maloc/index.html#download (currently 0.1-2)<BR><br />
<LI>Set up some environment variables & directories (temporary for building)<br />
<source lang="bash"><br />
$ export FETK_SRC=/<building directory>/temp_apbs<br />
$ export FETK_PREFIX=/usr/local/apbs-0.4.0 (or wherever you want it to live)<br />
$ export FETK_INCLUDE=${FETK_PREFIX}/include<br />
$ export FETK_LIBRARY=${FETK_PREFIX}/lib<br />
$ mkdir -p ${FETK_SRC} ${FETK_INCLUDE} ${FETK_LIBRARY}<br />
</source></LI><br />
<LI>Unpack the source packages<br />
<source lang="bash"><br />
$ cd ${FETK_SRC}<br />
$ gzip -dc maloc-0.1-2.tar.gz | tar xvf -<br />
$ gzip -dc apbs-0.4.0.tar.gz | tar xvf -<br />
</source><br />
</LI><br />
<LI>Compile MALOC<br />
<source lang="bash"><br />
$ cd ${FETK_SRC}/maloc<br />
$ ./configure --prefix=${FETK_PREFIX}</source><br />
If everything went well, then<br />
<source lang="bash"><br />
$ make; make install</source></LI><br />
<LI>Go get a coffee. Compilation/installation takes about 15 minutes on a 3GHz computer with 1GB of RAM.</LI><br />
<LI>Now on to compiling APBS itself<br />
<source lang="bash"><br />
$ cd ${FETK_SRC}/apbs-0.4.0<br />
$ ./configure --prefix=${FETK_PREFIX}</source><br />
If all goes well:<br />
<source lang="bash"><br />
$ make all; make install</source></LI><br />
<LI>No time for coffee. Takes about 5 minutes on that fast computer.</LI><br />
<LI> There will now be an APBS binary at<br />
<source lang="bash">/usr/local/apbs-0.4.0/bin/i686-intel-linux/apbs</source></LI><br />
<LI> Make appropriate links<br />
<source lang="bash"><br />
$ ln -s /usr/local/apbs-0.4.0/bin/i686-intel-linux/apbs /usr/local/bin/apbs<br />
</source></LI><br />
<LI> Get rid of /<building directory dir>/temp_apbs<br />
<LI> Open PyMOL and make sure that the APBS plugin points to /usr/local/bin/apbs<br />
<LI> Rock and or Roll.<br />
</OL><br />
<br />
====Pre-Packaged====<br />
=====RPMs=====<br />
<br />
A variety of RPMs are available from the [http://sourceforge.net/project/showfiles.php?group_id=148472&package_id=163734&release_id=378273 APBS downloads website]. Again, please [http://agave.wustl.edu/apbs/download/ register] your use of the software if you have not yet done so.<br />
<br />
=====Debian packages=====<br />
<br />
For ubuntu and other debian linux distributions, probably the simplest thing is to download a promising looking rpm, convert it with the program [http://kitenet.net/programs/alien/ alien], and then install the [http://xanana.ucsc.edu/linux newly generated debian package] with the command<br />
<source lang="bash"><br />
sudo dpkg -i apbs*.deb<br />
</source><br />
<br />
=====Gentoo=====<br />
<br />
You have to install apbs and pdb2pqr. Both are masked via keywords atm. Type as root:<br />
<source lang="bash"><br />
echo sci-chemistry/pdb2pqr >> /etc/portage/package.keywords<br />
echo sci-chemistry/apbs >> /etc/portage/package.keywords<br />
emerge -av sci-chemistry/apbs sci-chemistry/pdb2pqr<br />
</source><br />
<br />
== Troubleshooting ==<br />
* If the B-factor is <math>\geq 100,</math> then APBS doesn't properly read in the PDB file and thus outputs garbage (or dies). To fix this, set all b factors to be less than 100. <source lang="python">alter all, b=min(b,99.9)</source> The problem stems from how to parse a PDB file. The PDB file originally was written when most people used FORTRAN programs, and so the file format was specified by columns, not by the more modern comma separated value format we tend to prefer today. For the latest on the PDB format see the [http://www.wwpdb.org/docs.html new PDB format docs].<br />
* APBS has problems, sometimes, in reading atoms with alternate conformations. You can remove the alternate locations with a simple script [[removeAlt]].<br />
* ObjectMapLoadDXFile-Error: as of this writing (9-23-2008) a known problem exists, and the Baker lab is working on it.<br />
<br />
==Further contributions and edits are needed.==</div>Cankhttps://wiki.pymol.org/index.php?title=Python&diff=9270Python2009-03-11T19:11:02Z<p>Cank: </p>
<hr />
<div>== DESCRIPTION ==<br />
Issuing the '''[[Python]]''' command will put you into a stateful pseudo-interactive Python session. Or, more simply it's stateful in that you can invoke the Python session write some code, end the session, then restart the session and your data will be saved (see Example 1). It's pseudo-interactive in that you don't get feedback until you type "python end," upon which your code is run the output appears.<br />
<br />
This is a helpful command for testing different scripting or state-editing strategies for movie making.<br />
<br />
== USAGE ==<br />
<source lang="python"><br />
# start the session<br />
python<br />
<br />
# ...<br />
# your Python code goes here<br />
# ...<br />
<br />
# end the session<br />
python end<br />
</source><br />
<br />
<br />
== EXAMPLES ==<br />
*Start the session. Set x to 10. End the session. Restart the session and see if the value of x is recalled.<br />
<source lang="python"><br />
python<br />
x = 10<br />
print x<br />
python end<br />
</source><br />
<br />
<source lang="python"><br />
python<br />
print x<br />
python end<br />
</source><br />
<br />
Output: <br />
10<br />
<br />
== Python Version ==<br />
Python scripts and commands used within PyMOL can only be written using the current version of Python that is supported by your version of PyMOL. To determine which version of Python you can use, type the following command into PyMOL:<br />
<source lang="python"><br />
print sys.version <br />
</source><br />
<br />
Note that this version of Python is not necessarily related to the version that you may have installed on your system.<br />
<br />
This command can also be used to ensure that code you are distributing can be supported by the user's system. <br />
<br />
<br />
[[Category:Commands|Python]]</div>Cankhttps://wiki.pymol.org/index.php?title=Load_model&diff=7846Load model2009-03-11T18:40:16Z<p>Cank: Redirecting to Load Model</p>
<hr />
<div>#REDIRECT [[Load Model]]</div>Cankhttps://wiki.pymol.org/index.php?title=Pymolrc&diff=9876Pymolrc2009-03-11T18:36:41Z<p>Cank: </p>
<hr />
<div>When Pymol [[Launching PyMOL|launches]], it will read custom settings and functions from a .pymolrc file.<br />
<br />
On a linux-type system, this file will be located in /path/to/home/.pymolrc. <br />
<br />
An example of a .pymolrc file is:<br />
<br />
<source lang="python"><br />
# this will run the script in the specified location<br />
run /path/to/home/pymol/load_sep.py<br />
<br />
set movie_loop, 0<br />
set two_sided_lighting, 1<br />
<br />
set label_size, 60<br />
set label_outline_color, 1<br />
set label_color, 0<br />
set label_position, [0, 0, 10]<br />
<br />
# for images:<br />
# antialias =1 smooths jagged edges, 0 turns it off<br />
set antialias = 1<br />
<br />
# stick_radius -adjust thickness of atomic bonds<br />
set stick_radius = 0.3<br />
<br />
</source><br />
<br />
<br />
== See Also ==<br />
[[Launching PyMOL]]<br />
<br />
[[Category:Launching]]</div>Cankhttps://wiki.pymol.org/index.php?title=Pymolrc&diff=9875Pymolrc2009-03-11T18:35:56Z<p>Cank: </p>
<hr />
<div>When Pymol [[Launching PyMOL|launches]], it will read custom settings and functions from a .pymolrc file.<br />
<br />
On a linux-type system, this file will be located in /path/to/home/.pymolrc. <br />
<br />
An example of a .pymolrc file is:<br />
<br />
<source lang="python"><br />
# this will run the script in the specified location<br />
run /path/to/home/pymol/load_sep.py<br />
<br />
set movie_loop, 0<br />
set two_sided_lighting, 1<br />
<br />
set label_size, 60<br />
set label_outline_color, 1<br />
set label_color, 0<br />
set label_position, [0, 0, 10]<br />
<br />
# for images:<br />
# antialias =1 smooths jagged edges, 0 turns it off<br />
set antialias = 1<br />
<br />
# stick_radius -adjust thickness of atomic bonds<br />
set stick_radius = 0.3<br />
<br />
</source><br />
<br />
<br />
== See Also ==<br />
[[Launching PyMOL]]</div>Cankhttps://wiki.pymol.org/index.php?title=Simple_Scripting&diff=10213Simple Scripting2009-03-11T18:32:58Z<p>Cank: </p>
<hr />
<div>''This page discusses writing your own simple scripts for PyMOL. If you're looking to download scripts try the [[:Category:Script_Library|Script Library]]. ''<br />
<br />
One of the more powerful features of PyMOL is that it supports Python scripting. That gives you the power of using all the Python libraries, especially the [http://docs.python.org/api/api.html the Python API] to write programs in other languages and then send the results back into PyMOL. Some useful extensions to PyMOL can be found in our [[:Category:Script_Library|Script Library]]. <br />
<br />
= General Scripts =<br />
General PyMOL scripting is done in Python. It's really quite simple, just write your function (following a couple simple rules) and then let PyMOL know about it by using the '''[[extend|cmd.extend]]''' command. Here's the simple recipe for writing your own simple scripts for PyMOL:<br />
<br />
'''To write them''':<br />
#Write the function, let's call it '''doSimpleThing''', in a Python file, let's call the file '''pyProgram.py'''.<br />
#Add the following command to the end of the '''pyProgram.py''' file <source lang="python">cmd.extend("doSimpleThing",doSimpleThing)</source><br />
<br />
'''To use them''':<br />
# simply import the script into PyMOL: <source lang="python">run /home/userName/path/toscript/pyProgram.py</source><br />
# Then, just type the name of the command: ''doSimpleThing'' and pass any needed arguments.<br />
<br />
That's it. Your script can, through Python, import any modules you need and also edit modify objects in PyMOL.<br />
<br />
== Getting PyMOL Data into your Script ==<br />
To get PyMOL data into your script you will need to somehow get access to the PyMOL objects and pull out the data. For example, if you want the atomic coordinates of a selection of alpha carbon atoms your Python function may do something like this (all PyMOL functions are referenced in the See Also section, below):<br />
<source lang="python"><br />
# Import PyMOL's stored module. This will allow us with a <br />
# way to pull out the PyMOL data and modify it in our script.<br />
# See below.<br />
from pymol import stored<br />
<br />
def functionName( userSelection ):<br />
# this array will be used to hold the coordinates. It<br />
# has access to PyMOL objects and, we have access to it.<br />
stored.alphaCarbons = []<br />
<br />
# let's just get the alpha carbons, so make the<br />
# selection just for them<br />
userSelection = userSelection + " and n. CA"<br />
<br />
# iterate over state 1, or the userSelection -- this just means<br />
# for each item in the selection do what the next parameter says.<br />
# And, that is to append the (x,y,z) coordinates to the stored.alphaCarbon<br />
# array.<br />
cmd.iterate_state(1, selector.process(userSelection), "stored.alphaCarbons.append([x,y,z])")<br />
<br />
# stored.alphaCarbons now has the data you want.<br />
<br />
... do something to your coordinates ...<br />
</source><br />
<br />
=== Getting Data From your Script into PyMOL ===<br />
Usually this step is easier. To get your data into PyMOL, it's usually through modifying some object, rotating a molecule, for example. To do that, you can use the [[alter]] or [[alter_state]] commands. Let's say for example, that we have translated the molecular coordinates from the last example by some vector (we moved the alpha carbons). Now, we want to make the change and see it in PyMOL. To write the coordinates back we do:<br />
<source lang="python"><br />
# we need to know which PyMOL object to modify. There could be many molecules and objects<br />
# in the session, and we don't want to ruin them. The following line, gets the object<br />
# name from PyMOL<br />
objName = cmd.identify(sel2,1)[0][0]<br />
<br />
# Now, we alter each (x,y,z) array for the object, by popping out the values<br />
# in stored.alphaCarbons. PyMOL should now reflect the changed coordinates.<br />
cmd.alter_state(1,objName,"(x,y,z)=stored.alphaCarbons.pop(0)")<br />
</source><br />
<br />
== Example ==<br />
Here's a script I wrote for [[cealign]]. It takes two selections '''of equal length''' and computes the optimal overlap, and aligns them. See [[Kabsch]] for the original code. Because this tutorial is for scripting and not optimal superposition, the original comments have been removed.<br />
<br />
<source lang="python"><br />
def optAlign( sel1, sel2 ):<br />
"""<br />
@param sel1: First PyMol selection with N-atoms<br />
@param sel2: Second PyMol selection with N-atoms<br />
"""<br />
<br />
# make the lists for holding coordinates<br />
# partial lists<br />
stored.sel1 = []<br />
stored.sel2 = []<br />
# full lists<br />
stored.mol1 = []<br />
stored.mol2 = []<br />
<br />
# -- CUT HERE<br />
sel1 = sel1 + " and N. CA"<br />
sel2 = sel2 + " and N. CA"<br />
# -- CUT HERE<br />
<br />
# This gets the coordinates from the PyMOL objects<br />
cmd.iterate_state(1, selector.process(sel1), "stored.sel1.append([x,y,z])")<br />
cmd.iterate_state(1, selector.process(sel2), "stored.sel2.append([x,y,z])")<br />
<br />
# ...begin math that does stuff to the coordinates...<br />
mol1 = cmd.identify(sel1,1)[0][0]<br />
mol2 = cmd.identify(sel2,1)[0][0]<br />
cmd.iterate_state(1, mol1, "stored.mol1.append([x,y,z])")<br />
cmd.iterate_state(1, mol2, "stored.mol2.append([x,y,z])")<br />
assert( len(stored.sel1) == len(stored.sel2))<br />
L = len(stored.sel1)<br />
assert( L > 0 )<br />
COM1 = numpy.sum(stored.sel1,axis=0) / float(L)<br />
COM2 = numpy.sum(stored.sel2,axis=0) / float(L)<br />
stored.sel1 = stored.sel1 - COM1<br />
stored.sel2 = stored.sel2 - COM2<br />
E0 = numpy.sum( numpy.sum(stored.sel1 * stored.sel1,axis=0),axis=0) + numpy.sum( numpy.sum(stored.sel2 * stored.sel2,axis=0)<br />
,axis=0)<br />
reflect = float(str(float(numpy.linalg.det(V) * numpy.linalg.det(Wt))))<br />
if reflect == -1.0:<br />
S[-1] = -S[-1]<br />
V[:,-1] = -V[:,-1]<br />
RMSD = E0 - (2.0 * sum(S))<br />
RMSD = numpy.sqrt(abs(RMSD / L))<br />
U = numpy.dot(V, Wt)<br />
# ...end math that does stuff to the coordinates...<br />
<br />
# update the _array_ of coordinates; not PyMOL the coords in the PyMOL object<br />
stored.sel2 = numpy.dot((stored.mol2 - COM2), U) + COM1<br />
stored.sel2 = stored.sel2.tolist()<br />
<br />
# This updates PyMOL. It is removing the elements in <br />
# stored.sel2 and putting them into the (x,y,z) coordinates<br />
# of mol2.<br />
cmd.alter_state(1,mol2,"(x,y,z)=stored.sel2.pop(0)")<br />
<br />
print "RMSD=%f" % RMSD<br />
<br />
cmd.orient(sel1 + " and " + sel2)<br />
<br />
# The extend command makes this runnable as a command, from PyMOL.<br />
cmd.extend("optAlign", optAlign)<br />
</source><br />
<br />
== Basic Script Body ==<br />
Want an easy block of working code to start your function from? Just copy/paste the following into your Python editor and get going!<br />
<source lang="python"><br />
#<br />
# -- basicCodeBlock.py<br />
#<br />
from pymol import cmd, stored<br />
<br />
def yourFunction( arg1, arg2 ):<br />
#<br />
# Your code goes here<br />
#<br />
print "Hello, PyMOLers"<br />
print "You passed in %s and %s" % (arg1, arg2)<br />
print "I will return them to you in a list. Here you go."<br />
return (arg1, arg2)<br />
<br />
cmd.extend( "yourFunction", yourFunction );<br />
</source><br />
<br />
[[Category:Development]]<br />
[[Category:Tutorials]]<br />
[[Category:States]]<br />
[[Category:Scripting]]</div>Cankhttps://wiki.pymol.org/index.php?title=Scripting&diff=9681Scripting2009-03-11T18:32:32Z<p>Cank: Redirecting to Simple Scripting</p>
<hr />
<div>#REDIRECT [[Simple Scripting]]</div>Cankhttps://wiki.pymol.org/index.php?title=Scripting_FAQa&diff=9683Scripting FAQa2009-03-11T18:31:21Z<p>Cank: Scripting FAQa moved to Scripting FAQs</p>
<hr />
<div>#REDIRECT [[Scripting FAQs]]</div>Cankhttps://wiki.pymol.org/index.php?title=Scripting_FAQs&diff=8756Scripting FAQs2009-03-11T18:31:21Z<p>Cank: Scripting FAQa moved to Scripting FAQs</p>
<hr />
<div>==Script within a Structure==<br />
Q: Is there a way to embed a script within a PDB structure?<br />
<br />
A: Yes, there are two ways<br />
* Use the [[Read_Pdbstr]] command like,<br />
delete all<br />
cmd.read_pdbstr("""HETATM 1985 O00 MOH 132 18.797 6.477 -12.112 0.00 0.00 O\<br />
HETATM 1988 H03 MOH 132 18.437 7.229 -11.665 0.00 0.00 H\<br />
HETATM 1989 C04 MOH 132 17.737 5.662 -12.563 0.00 0.00 C\<br />
HETATM 1990 H05 MOH 132 18.129 4.785 -13.080 0.00 0.00 H\<br />
HETATM 1991 H06 MOH 132 17.096 6.211 -13.253 0.00 0.00 H\<br />
HETATM 1992 H07 MOH 132 17.130 5.322 -11.722 0.00 0.00 H""","mymolecule")<br />
show sticks<br />
<br />
Don't forget the backslashes there -- it's one long command.<br />
[http://chips.csb.ki.se/pymol/msg02104.html Example]<br />
<br />
* Or, as Warren noted, you can do with with a "p1m" file, which is like a "pml" file, but data can be included as well. Also note that p1m files are intended for web publishing, so embedded Python is disallowed. In p1m files, there is an "embed" command that enables this for PDB, MOL, MOL2, SDF, and XPLOR data. It works like this:<br />
embed tag, format<br />
****REPLACE THIS LINE WITH YOUR DATA FILE****<br />
embed end<br />
<br />
load_embedded tag<br />
where tag is some identifier of your choice.<br />
<br />
==Scripting and Command Line Options==<br />
PyMol will allow you to use command line options in a script. That means, the following<br />
<source lang="python"><br />
pymol -qrc script.py arg1 arg2<br />
</source><br />
will work if you add a double-hyphen before the first argument in order<br />
to signal Pymol to stop interpreting arguments:<br />
<br />
<source lang="python"><br />
pymol -qrc script.py -- arg1 arg2<br />
</source><br />
<br />
Then your script can get these arguments as follows:<br />
<br />
<source lang="python"><br />
from sys import argv<br />
my_argv =3D argv[argv.index("--"):]<br />
print my_argv[1], my_argv[2]<br />
</source><br />
<br />
[[Category:Scripting]]</div>Cankhttps://wiki.pymol.org/index.php?title=Scripting&diff=9680Scripting2009-03-11T18:31:13Z<p>Cank: Scripting moved to Scripting FAQa</p>
<hr />
<div>#REDIRECT [[Scripting FAQa]]</div>Cankhttps://wiki.pymol.org/index.php?title=Scripting_FAQs&diff=8755Scripting FAQs2009-03-11T18:31:13Z<p>Cank: Scripting moved to Scripting FAQa</p>
<hr />
<div>==Script within a Structure==<br />
Q: Is there a way to embed a script within a PDB structure?<br />
<br />
A: Yes, there are two ways<br />
* Use the [[Read_Pdbstr]] command like,<br />
delete all<br />
cmd.read_pdbstr("""HETATM 1985 O00 MOH 132 18.797 6.477 -12.112 0.00 0.00 O\<br />
HETATM 1988 H03 MOH 132 18.437 7.229 -11.665 0.00 0.00 H\<br />
HETATM 1989 C04 MOH 132 17.737 5.662 -12.563 0.00 0.00 C\<br />
HETATM 1990 H05 MOH 132 18.129 4.785 -13.080 0.00 0.00 H\<br />
HETATM 1991 H06 MOH 132 17.096 6.211 -13.253 0.00 0.00 H\<br />
HETATM 1992 H07 MOH 132 17.130 5.322 -11.722 0.00 0.00 H""","mymolecule")<br />
show sticks<br />
<br />
Don't forget the backslashes there -- it's one long command.<br />
[http://chips.csb.ki.se/pymol/msg02104.html Example]<br />
<br />
* Or, as Warren noted, you can do with with a "p1m" file, which is like a "pml" file, but data can be included as well. Also note that p1m files are intended for web publishing, so embedded Python is disallowed. In p1m files, there is an "embed" command that enables this for PDB, MOL, MOL2, SDF, and XPLOR data. It works like this:<br />
embed tag, format<br />
****REPLACE THIS LINE WITH YOUR DATA FILE****<br />
embed end<br />
<br />
load_embedded tag<br />
where tag is some identifier of your choice.<br />
<br />
==Scripting and Command Line Options==<br />
PyMol will allow you to use command line options in a script. That means, the following<br />
<source lang="python"><br />
pymol -qrc script.py arg1 arg2<br />
</source><br />
will work if you add a double-hyphen before the first argument in order<br />
to signal Pymol to stop interpreting arguments:<br />
<br />
<source lang="python"><br />
pymol -qrc script.py -- arg1 arg2<br />
</source><br />
<br />
Then your script can get these arguments as follows:<br />
<br />
<source lang="python"><br />
from sys import argv<br />
my_argv =3D argv[argv.index("--"):]<br />
print my_argv[1], my_argv[2]<br />
</source><br />
<br />
[[Category:Scripting]]</div>Cankhttps://wiki.pymol.org/index.php?title=Category:Scripting&diff=4059Category:Scripting2009-03-11T18:29:16Z<p>Cank: New page: This category contains articles related to writing custom-scripts for PyMOL.</p>
<hr />
<div>This category contains articles related to writing custom-scripts for PyMOL.</div>Cankhttps://wiki.pymol.org/index.php?title=Simple_Scripting&diff=10212Simple Scripting2009-03-11T18:28:47Z<p>Cank: </p>
<hr />
<div>One of the more powerful features of PyMOL is that it supports Python scripting. That gives you the power of using all the Python libraries, especially the [http://docs.python.org/api/api.html the Python API] to write programs in other languages and then send the results back into PyMOL. Some useful extensions to PyMOL can be found in our [[:Category:Script_Library|Script Library]]. <br />
<br />
''This page discusses writing your own simple scripts for PyMOL. If you're looking to download scripts try the [[:Category:Script_Library|Script Library]]. ''<br />
<br />
= General Scripts =<br />
General PyMOL scripting is done in Python. It's really quite simple, just write your function (following a couple simple rules) and then let PyMOL know about it by using the '''[[extend|cmd.extend]]''' command. Here's the simple recipe for writing your own simple scripts for PyMOL:<br />
<br />
'''To write them''':<br />
#Write the function, let's call it '''doSimpleThing''', in a Python file, let's call the file '''pyProgram.py'''.<br />
#Add the following command to the end of the '''pyProgram.py''' file <source lang="python">cmd.extend("doSimpleThing",doSimpleThing)</source><br />
<br />
'''To use them''':<br />
# simply import the script into PyMOL: <source lang="python">run /home/userName/path/toscript/pyProgram.py</source><br />
# Then, just type the name of the command: ''doSimpleThing'' and pass any needed arguments.<br />
<br />
That's it. Your script can, through Python, import any modules you need and also edit modify objects in PyMOL.<br />
<br />
== Getting PyMOL Data into your Script ==<br />
To get PyMOL data into your script you will need to somehow get access to the PyMOL objects and pull out the data. For example, if you want the atomic coordinates of a selection of alpha carbon atoms your Python function may do something like this (all PyMOL functions are referenced in the See Also section, below):<br />
<source lang="python"><br />
# Import PyMOL's stored module. This will allow us with a <br />
# way to pull out the PyMOL data and modify it in our script.<br />
# See below.<br />
from pymol import stored<br />
<br />
def functionName( userSelection ):<br />
# this array will be used to hold the coordinates. It<br />
# has access to PyMOL objects and, we have access to it.<br />
stored.alphaCarbons = []<br />
<br />
# let's just get the alpha carbons, so make the<br />
# selection just for them<br />
userSelection = userSelection + " and n. CA"<br />
<br />
# iterate over state 1, or the userSelection -- this just means<br />
# for each item in the selection do what the next parameter says.<br />
# And, that is to append the (x,y,z) coordinates to the stored.alphaCarbon<br />
# array.<br />
cmd.iterate_state(1, selector.process(userSelection), "stored.alphaCarbons.append([x,y,z])")<br />
<br />
# stored.alphaCarbons now has the data you want.<br />
<br />
... do something to your coordinates ...<br />
</source><br />
<br />
=== Getting Data From your Script into PyMOL ===<br />
Usually this step is easier. To get your data into PyMOL, it's usually through modifying some object, rotating a molecule, for example. To do that, you can use the [[alter]] or [[alter_state]] commands. Let's say for example, that we have translated the molecular coordinates from the last example by some vector (we moved the alpha carbons). Now, we want to make the change and see it in PyMOL. To write the coordinates back we do:<br />
<source lang="python"><br />
# we need to know which PyMOL object to modify. There could be many molecules and objects<br />
# in the session, and we don't want to ruin them. The following line, gets the object<br />
# name from PyMOL<br />
objName = cmd.identify(sel2,1)[0][0]<br />
<br />
# Now, we alter each (x,y,z) array for the object, by popping out the values<br />
# in stored.alphaCarbons. PyMOL should now reflect the changed coordinates.<br />
cmd.alter_state(1,objName,"(x,y,z)=stored.alphaCarbons.pop(0)")<br />
</source><br />
<br />
== Example ==<br />
Here's a script I wrote for [[cealign]]. It takes two selections '''of equal length''' and computes the optimal overlap, and aligns them. See [[Kabsch]] for the original code. Because this tutorial is for scripting and not optimal superposition, the original comments have been removed.<br />
<br />
<source lang="python"><br />
def optAlign( sel1, sel2 ):<br />
"""<br />
@param sel1: First PyMol selection with N-atoms<br />
@param sel2: Second PyMol selection with N-atoms<br />
"""<br />
<br />
# make the lists for holding coordinates<br />
# partial lists<br />
stored.sel1 = []<br />
stored.sel2 = []<br />
# full lists<br />
stored.mol1 = []<br />
stored.mol2 = []<br />
<br />
# -- CUT HERE<br />
sel1 = sel1 + " and N. CA"<br />
sel2 = sel2 + " and N. CA"<br />
# -- CUT HERE<br />
<br />
# This gets the coordinates from the PyMOL objects<br />
cmd.iterate_state(1, selector.process(sel1), "stored.sel1.append([x,y,z])")<br />
cmd.iterate_state(1, selector.process(sel2), "stored.sel2.append([x,y,z])")<br />
<br />
# ...begin math that does stuff to the coordinates...<br />
mol1 = cmd.identify(sel1,1)[0][0]<br />
mol2 = cmd.identify(sel2,1)[0][0]<br />
cmd.iterate_state(1, mol1, "stored.mol1.append([x,y,z])")<br />
cmd.iterate_state(1, mol2, "stored.mol2.append([x,y,z])")<br />
assert( len(stored.sel1) == len(stored.sel2))<br />
L = len(stored.sel1)<br />
assert( L > 0 )<br />
COM1 = numpy.sum(stored.sel1,axis=0) / float(L)<br />
COM2 = numpy.sum(stored.sel2,axis=0) / float(L)<br />
stored.sel1 = stored.sel1 - COM1<br />
stored.sel2 = stored.sel2 - COM2<br />
E0 = numpy.sum( numpy.sum(stored.sel1 * stored.sel1,axis=0),axis=0) + numpy.sum( numpy.sum(stored.sel2 * stored.sel2,axis=0)<br />
,axis=0)<br />
reflect = float(str(float(numpy.linalg.det(V) * numpy.linalg.det(Wt))))<br />
if reflect == -1.0:<br />
S[-1] = -S[-1]<br />
V[:,-1] = -V[:,-1]<br />
RMSD = E0 - (2.0 * sum(S))<br />
RMSD = numpy.sqrt(abs(RMSD / L))<br />
U = numpy.dot(V, Wt)<br />
# ...end math that does stuff to the coordinates...<br />
<br />
# update the _array_ of coordinates; not PyMOL the coords in the PyMOL object<br />
stored.sel2 = numpy.dot((stored.mol2 - COM2), U) + COM1<br />
stored.sel2 = stored.sel2.tolist()<br />
<br />
# This updates PyMOL. It is removing the elements in <br />
# stored.sel2 and putting them into the (x,y,z) coordinates<br />
# of mol2.<br />
cmd.alter_state(1,mol2,"(x,y,z)=stored.sel2.pop(0)")<br />
<br />
print "RMSD=%f" % RMSD<br />
<br />
cmd.orient(sel1 + " and " + sel2)<br />
<br />
# The extend command makes this runnable as a command, from PyMOL.<br />
cmd.extend("optAlign", optAlign)<br />
</source><br />
<br />
== Basic Script Body ==<br />
Want an easy block of working code to start your function from? Just copy/paste the following into your Python editor and get going!<br />
<source lang="python"><br />
#<br />
# -- basicCodeBlock.py<br />
#<br />
from pymol import cmd, stored<br />
<br />
def yourFunction( arg1, arg2 ):<br />
#<br />
# Your code goes here<br />
#<br />
print "Hello, PyMOLers"<br />
print "You passed in %s and %s" % (arg1, arg2)<br />
print "I will return them to you in a list. Here you go."<br />
return (arg1, arg2)<br />
<br />
cmd.extend( "yourFunction", yourFunction );<br />
</source><br />
<br />
[[Category:Development]]<br />
[[Category:Tutorials]]<br />
[[Category:States]]<br />
[[Category:Scripting]]</div>Cankhttps://wiki.pymol.org/index.php?title=Scripts&diff=9685Scripts2009-03-11T18:27:43Z<p>Cank: Redirecting to Simple Scripting</p>
<hr />
<div>#REDIRECT [[Simple Scripting]]</div>Cankhttps://wiki.pymol.org/index.php?title=Chempy&diff=5065Chempy2009-03-11T18:26:45Z<p>Cank: </p>
<hr />
<div>Chempy is a python-importable module that can be used to write PyMOL-executable [[scripts]].</div>Cankhttps://wiki.pymol.org/index.php?title=Chempy&diff=5064Chempy2009-03-11T18:26:32Z<p>Cank: New page: Chempy is a python-importable module that can be used to write PyMOL-executable scripts.</p>
<hr />
<div>Chempy is a python-importable module that can be used to write PyMOL-executable scripts.</div>Cankhttps://wiki.pymol.org/index.php?title=Vdw&diff=10611Vdw2009-03-11T17:58:23Z<p>Cank: </p>
<hr />
<div>vdw is an atomic property available in PyMOL that defines the atomic radius. It can be changed using the [[alter]] command.</div>Cankhttps://wiki.pymol.org/index.php?title=Vdw&diff=10610Vdw2009-03-11T17:57:58Z<p>Cank: New page: vdw is an atomic property available in PyMOL. It can be changed using the alter command.</p>
<hr />
<div>vdw is an atomic property available in PyMOL. It can be changed using the [[alter]] command.</div>Cankhttps://wiki.pymol.org/index.php?title=Pymolrc&diff=9873Pymolrc2009-03-10T22:27:49Z<p>Cank: </p>
<hr />
<div>When Pymol launches, it will read custom settings and functions from a .pymolrc file.<br />
<br />
On a linux-type system, this file will be located in /path/to/home/.pymolrc. <br />
<br />
An example of a .pymolrc file is:<br />
<br />
<pre><br />
# this will run the script in the specified location<br />
run /path/to/home/pymol/load_sep.py<br />
<br />
set movie_loop, 0<br />
set two_sided_lighting, 1<br />
<br />
set label_size, 60<br />
set label_outline_color, 1<br />
set label_color, 0<br />
set label_position, [0, 0, 10]<br />
<br />
# for images:<br />
# antialias =1 smooths jagged edges, 0 turns it off<br />
set antialias = 1<br />
<br />
# stick_radius -adjust thickness of atomic bonds<br />
set stick_radius = 0.3<br />
<br />
</pre><br />
<br />
<br />
== See Also ==<br />
[[Launching PyMOL]]</div>Cankhttps://wiki.pymol.org/index.php?title=Pymolrc&diff=9872Pymolrc2009-03-10T22:02:50Z<p>Cank: /* See Also */</p>
<hr />
<div>When Pymol launches, it will read custom settings and functions from a .pymolrc file.<br />
<br />
On a linux-type system, this file will be located in /path/to/home/.pymolrc. <br />
<br />
An example of a .pymolrc file is:<br />
<br />
<pre><br />
# this will run the script in the specified location<br />
run /path/to/home/pymol/load_sep.py<br />
<br />
set movie_loop, 0<br />
set two_sided_lighting, 1<br />
<br />
set label_size, 60<br />
set label_outline_color, 1<br />
set label_color, 0<br />
set label_position, [0, 0, 10]<br />
<br />
# for images:<br />
# antialias =1 smooths jagged edges, 0 turns it off<br />
set antialias = 1<br />
<br />
# stick_radius -adjust thickness of atomic bonds<br />
set stick_radius = 0.3<br />
<br />
# Below is an function that can be used to turn on special settings <br />
# when you are creating an image for publication: <br />
def imageSettings():<br />
set depth_cue = 1<br />
set two_sided_lighting = 1<br />
set ray_interior_color = grey20<br />
<br />
cmd.extend('imageSettings', imageSettings);<br />
<br />
</pre><br />
<br />
<br />
== See Also ==<br />
[[Launching PyMOL]]</div>Cankhttps://wiki.pymol.org/index.php?title=Pymolrc&diff=9871Pymolrc2009-03-10T22:02:27Z<p>Cank: New page: When Pymol launches, it will read custom settings and functions from a .pymolrc file. On a linux-type system, this file will be located in /path/to/home/.pymolrc. An example of a .pymol...</p>
<hr />
<div>When Pymol launches, it will read custom settings and functions from a .pymolrc file.<br />
<br />
On a linux-type system, this file will be located in /path/to/home/.pymolrc. <br />
<br />
An example of a .pymolrc file is:<br />
<br />
<pre><br />
# this will run the script in the specified location<br />
run /path/to/home/pymol/load_sep.py<br />
<br />
set movie_loop, 0<br />
set two_sided_lighting, 1<br />
<br />
set label_size, 60<br />
set label_outline_color, 1<br />
set label_color, 0<br />
set label_position, [0, 0, 10]<br />
<br />
# for images:<br />
# antialias =1 smooths jagged edges, 0 turns it off<br />
set antialias = 1<br />
<br />
# stick_radius -adjust thickness of atomic bonds<br />
set stick_radius = 0.3<br />
<br />
# Below is an function that can be used to turn on special settings <br />
# when you are creating an image for publication: <br />
def imageSettings():<br />
set depth_cue = 1<br />
set two_sided_lighting = 1<br />
set ray_interior_color = grey20<br />
<br />
cmd.extend('imageSettings', imageSettings);<br />
<br />
</pre><br />
<br />
<br />
== See Also ==<br />
[[Launching Pymol]]</div>Cankhttps://wiki.pymol.org/index.php?title=Get_extent&diff=7990Get extent2009-03-10T21:52:31Z<p>Cank: Redirecting to Get Extent</p>
<hr />
<div>#REDIRECT [[Get Extent]]</div>Cankhttps://wiki.pymol.org/index.php?title=Get_position&diff=6026Get position2009-03-10T21:51:50Z<p>Cank: Redirecting to Get Position</p>
<hr />
<div>#REDIRECT [[Get Position]]</div>Cankhttps://wiki.pymol.org/index.php?title=Get_Position&diff=5995Get Position2009-03-10T21:50:26Z<p>Cank: </p>
<hr />
<div>== Overview ==<br />
[[Get_Position]] gets the 3D coordinates of the center of the viewer window..<br />
<br />
== Syntax ==<br />
<source lang="python"><br />
# print the coordinates for center of mass<br />
zoom<br />
print cmd.get_position()<br />
</source><br />
<br />
[[Category:Commands|get_position]]</div>Cankhttps://wiki.pymol.org/index.php?title=Get_Extent&diff=5972Get Extent2009-03-10T21:49:16Z<p>Cank: </p>
<hr />
<div>===DESCRIPTION===<br />
'''get_extent''' returns the minimum and maximum XYZ coordinates of a selection as an array:<br />
<pre>[ [ min-X , min-Y , min-Z ],[ max-X, max-Y , max-Z ]]</pre><br />
<br />
Typing this command returns the coordinates for all atoms. To return the coordinates of the default selection type:<br />
<br />
<pre>get_extent sele</pre><br />
<br />
===PYMOL API===<br />
<source lang="python"><br />
cmd.get_extent(string selection="(all)", state=0 )<br />
</source><br />
<br />
[[Category:Commands|get_extent]]<br />
[[Category:States]]</div>Cankhttps://wiki.pymol.org/index.php?title=Commands&diff=7594Commands2009-03-10T21:42:11Z<p>Cank: </p>
<hr />
<div>Commands are functions in pymol that are used for viewing, manipulating, and storing molecules.<br />
<br />
You can get a list of some common commands by typing "help commands" into the pymol command line. Typing this in to version 1.1r1 returns the following:<br />
<br />
<code><br />
INPUT/OUTPUT load save delete quit<br />
VIEW turn move clip rock<br />
show hide enable disable<br />
reset refresh rebuild <br />
zoom origin orient <br />
view get_view set_view<br />
MOVIES mplay mstop mset mdo<br />
mpng mmatrix frame<br />
rewind middle ending<br />
forward backward<br />
IMAGING png mpng<br />
RAY TRACING ray <br />
MAPS isomesh isodot<br />
DISPLAY cls viewport splash <br />
SELECTIONS select mask <br />
SETTINGS set button<br />
ATOMS alter alter_state <br />
EDITING create replace remove h_fill remove_picked<br />
edit bond unbond h_add fuse <br />
undo redo protect cycle_valence attach<br />
FITTING fit rms rms_cur pair_fit <br />
intra_fit intra_rms intra_rms_cur <br />
COLORS color set_color<br />
HELP help commands<br />
DISTANCES dist <br />
STEREO stereo<br />
SYMMETRY symexp<br />
SCRIPTS @ run<br />
LANGUAGE alias extend<br />
</code><br />
<br />
[[Category:Commands]]</div>Cankhttps://wiki.pymol.org/index.php?title=Commands&diff=7593Commands2009-03-10T21:42:01Z<p>Cank: </p>
<hr />
<div>Commands are functions in pymol that are used for viewing, manipulating, and storing molecules.<br />
<br />
You can get a list of some common commands by typing "help commands" into the pymol command line. Typing this in to version 1.1r1 returns the following:<br />
<br />
<code><br />
<br />
COMMANDS<br />
<br />
INPUT/OUTPUT load save delete quit<br />
VIEW turn move clip rock<br />
show hide enable disable<br />
reset refresh rebuild <br />
zoom origin orient <br />
view get_view set_view<br />
MOVIES mplay mstop mset mdo<br />
mpng mmatrix frame<br />
rewind middle ending<br />
forward backward<br />
IMAGING png mpng<br />
RAY TRACING ray <br />
MAPS isomesh isodot<br />
DISPLAY cls viewport splash <br />
SELECTIONS select mask <br />
SETTINGS set button<br />
ATOMS alter alter_state <br />
EDITING create replace remove h_fill remove_picked<br />
edit bond unbond h_add fuse <br />
undo redo protect cycle_valence attach<br />
FITTING fit rms rms_cur pair_fit <br />
intra_fit intra_rms intra_rms_cur <br />
COLORS color set_color<br />
HELP help commands<br />
DISTANCES dist <br />
STEREO stereo<br />
SYMMETRY symexp<br />
SCRIPTS @ run<br />
LANGUAGE alias extend<br />
</code><br />
<br />
[[Category:Commands]]</div>Cankhttps://wiki.pymol.org/index.php?title=Commands&diff=7592Commands2009-03-10T21:41:41Z<p>Cank: </p>
<hr />
<div>Commands are functions in pymol that are used for viewing, manipulating, and storing molecules.<br />
<br />
You can get a list of some common commands by typing "help commands" into the pymol command line. Typing this in to version 1.1r1 returns the following:<br />
<br />
<code><br />
COMMANDS<br />
<br />
INPUT/OUTPUT load save delete quit<br />
VIEW turn move clip rock<br />
show hide enable disable<br />
reset refresh rebuild <br />
zoom origin orient <br />
view get_view set_view<br />
MOVIES mplay mstop mset mdo<br />
mpng mmatrix frame<br />
rewind middle ending<br />
forward backward<br />
IMAGING png mpng<br />
RAY TRACING ray <br />
MAPS isomesh isodot<br />
DISPLAY cls viewport splash <br />
SELECTIONS select mask <br />
SETTINGS set button<br />
ATOMS alter alter_state <br />
EDITING create replace remove h_fill remove_picked<br />
edit bond unbond h_add fuse <br />
undo redo protect cycle_valence attach<br />
FITTING fit rms rms_cur pair_fit <br />
intra_fit intra_rms intra_rms_cur <br />
COLORS color set_color<br />
HELP help commands<br />
DISTANCES dist <br />
STEREO stereo<br />
SYMMETRY symexp<br />
SCRIPTS @ run<br />
LANGUAGE alias extend<br />
</code><br />
<br />
[[Category:Commands]]</div>Cankhttps://wiki.pymol.org/index.php?title=Commands&diff=7591Commands2009-03-10T21:40:26Z<p>Cank: New page: Commands are functions in pymol that are used for viewing, manipulating, and storing molecules. <code>COMMANDS INPUT/OUTPUT load save delete quit VIEW tur...</p>
<hr />
<div>Commands are functions in pymol that are used for viewing, manipulating, and storing molecules.<br />
<br />
<code>COMMANDS<br />
<br />
INPUT/OUTPUT load save delete quit<br />
VIEW turn move clip rock<br />
show hide enable disable<br />
reset refresh rebuild <br />
zoom origin orient <br />
view get_view set_view<br />
MOVIES mplay mstop mset mdo<br />
mpng mmatrix frame<br />
rewind middle ending<br />
forward backward<br />
IMAGING png mpng<br />
RAY TRACING ray <br />
MAPS isomesh isodot<br />
DISPLAY cls viewport splash <br />
SELECTIONS select mask <br />
SETTINGS set button<br />
ATOMS alter alter_state <br />
EDITING create replace remove h_fill remove_picked<br />
edit bond unbond h_add fuse <br />
undo redo protect cycle_valence attach<br />
FITTING fit rms rms_cur pair_fit <br />
intra_fit intra_rms intra_rms_cur <br />
COLORS color set_color<br />
HELP help commands<br />
DISTANCES dist <br />
STEREO stereo<br />
SYMMETRY symexp<br />
SCRIPTS @ run<br />
LANGUAGE alias extend<br />
</code><br />
<br />
[[Category:Commands]]</div>Cankhttps://wiki.pymol.org/index.php?title=Caver&diff=5017Caver2009-02-26T20:29:02Z<p>Cank: </p>
<hr />
<div>[http://loschmidt.chemi.muni.cz/caver/index.php CAVER] provides rapid, accurate and fully automated calculation of pathways leading from buried cavities to outside solvent in static and dynamic protein structures. Study of these pathways is important in drug design and molecular enzymology to understand binding of inhibitors to the receptors, substrate binding and product egress from the enzyme active sites. Calculated pathways can be visualized by graphic program PyMol dissecting anatomy and dynamics of entrance tunnels. CAVER allows analysis of any molecular structure including proteins, nucleic acids, inorganic materials, etc.<br />
<br />
References:<br />
<br />
Petřek M., Otyepka M., Banáš P., Košinová P., Koča J. and Damborský J., [http://loschmidt.chemi.muni.cz/peg/abstracts/bmcbioinf06.html CAVER: A New Tool to Explore Routes from Protein Clefts, Pockets and Cavities], BMC Bioinformatics 2006, 7: 316<br />
<br />
Damborský J., Petřek M., Banáš P., Otyepka M., [http://loschmidt.chemi.muni.cz/peg/abstracts/btj07a.html Identification of Tunnels in Proteins, Nucleic Acids, Inorganic Materials and Molecular Ensembles], Biotechnology Journal 2007, 2: 62-67 <br />
<br />
<br />
[[Image:Caver.png]]<br />
<br />
[[Category:Surfaces and Voids|Caver]]<br />
[[Category:Nucleic_Acids|Caver]]<br />
[[Category:Biochemical_Properties]]<br />
[[Category:Plugins]]</div>Cankhttps://wiki.pymol.org/index.php?title=Plugins&diff=12733Plugins2009-02-26T19:45:45Z<p>Cank: /* Plugins on OS X */</p>
<hr />
<div>Plugins are modules which can add functionality to Pymol.<br />
<br />
== Plugins on OS X ==<br />
The standard OS X Pymol application, MacPyMOL.app does not run with the Tcl/Tk interface which is required for plugins to work. However, a quick renaming of the program from MacPyMOL.app to PyMOLX11Hybrid.app makes the application run as an X11 application, and plugins are now available.<br />
<br />
To rename the executable, right click (or control click) on MacPyMOL and choose "Get Info" in the Panel. Change the Name & Extension to PyMOLX11Hybrid.app. This name can also be changed using the mv command in Terminal.app. <br />
<br />
Once this change is made, half of the program will show up under the X11 icon, and half will show up under the MacPyMOL icon.<br />
<br />
[[Category:Plugins]]</div>Cankhttps://wiki.pymol.org/index.php?title=Plugins&diff=12732Plugins2009-02-26T19:40:40Z<p>Cank: </p>
<hr />
<div>Plugins are modules which can add functionality to Pymol.<br />
<br />
== Plugins on OS X ==<br />
The standard OS X Pymol application, MacPyMOL.app does not run with the Tcl/Tk interface which is required for plugins to work. However, a quick renaming of the program from MacPyMOL.app to PyMOLX11Hybrid.app makes the application run as an X11 application, and plugins are now available.<br />
<br />
To rename the executable, right click (or control click) on MacPyMOL and choose "Get Info" in the Panel. Change the Name & Extension to PyMOLX11Hybrid.app. This name can also be changed using the mv command in Terminal.app. <br />
<br />
[[Category:Plugins]]</div>Cank