I struggled with the same problem and i find two module which can solve structural protein alignment in python.
Please take a look to the link: https://github.com/charnley/rmsd
You can explore the algorithm by using examples, which are exist in the zip file. The only think you have to do is extract the "ATOMS" with x,y,z coordinates from PDB files.
There is also a tool call biopython, which have a Bio.PDB module to align PDB files. here is the link: http://combichem.blogspot.com.tr/2013/08/aligning-pdb-structures-with-biopython.html
You can use PyMOL to calculate alignment. To do this follow this steps:
- run PyMOL
- type this command to load your proteins: fetch pdbId1 and fetch pdbId2 *
- Use command: rms_cur pdbId1, pdbId2 to calculate RMSD value betweend your structures
*where pdbId1 and pdbId2 is identifier of your protein in PDB database.
UCSF Chimera option:
NB, pychimera takes a little more involved installation compared to pymol, but I really like it.
The code below should work inside chimera's python interpreter though I believe with no extra configuration.
from MatchMaker import (match, CP_BEST, GAP_OPEN, GAP_EXTEND, defaults, MATRIX, ITER_CUTOFF) chimera.openModels.open(model1,type="PDB") chimera.openModels.open(model2,type="PDB") all_models = chimera.openModels.list(modelTypes=[chimera.Molecule]) mod0 = all_models mod1 = all_models for atoms1, atoms2, rmsd, fullRmsd in match(CP_BEST,[mod0, mod1],defaults[MATRIX], "nw",defaults[GAP_OPEN],defaults[GAP_EXTEND]): mol0_name = atoms2.molecule mol1_name = atoms1.molecule printmol0_name.name + "\t" + mol2_name.name + "\t" + str(rmsd))
In Biopython, the Bio.SVDSuperimposer class will quickly align the two PDB structures and compute the RMSD. See this Bio.PDB FAQ, and search the page for "RMSD", or read the PDB section of the Biopython tutorial.