[Biopython] Superposition
Mark Livingstone
livingstonemark at gmail.com
Sat May 12 02:06:07 UTC 2012
Hi Guys,
Thanks to Andrew and others for help in my previous message. I have
gone through various incarnations of my code, and suddenly found this
simple code works for the small test I have done.
I am using the datafiles from:
Kellogg, E. H., Leaver-Fay, A., & Baker, D. (2011). Role of
conformational sampling in computing mutation-induced changes in
protein structure and stability. Proteins, 79(3), 830–838.
doi:10.1002/prot.22921
These files have been modified so that there are matched PDBs which
vary only by one mutated residue, and I am trying to carbon alpha
superimpose the PDB which is the Mutanttype over the Wildtype and save
to a PDB - which I seem to have fluked how to do. I am still working
on the code for directory traversal so I have not tried it on the
hundreds of matched PDBs yet.
Is there anything in this code which is going to bite me? How can I improve it?
------------------------------------------------------------------------------------
#!/usr/bin/env python
# Wildtype (wt) = reference, Mutanttype (mt) = alternate
from Bio.PDB import *
#parsing the PDBs
parser = PDBParser(PERMISSIVE=1)
l_wt_atoms = []
l_mt_atoms = []
pdb_out_filename = "./1bti_aligned.pdb"
wt_structure = parser.get_structure("1bpi", './1bpi.pdb')
mt_structure = parser.get_structure("1bti", './1bti.pdb')
wt_model = wt_structure[0]
mt_model = mt_structure[0]
wt_chain = wt_model["A"]
mt_chain = mt_model["A"]
for wt_residue in wt_chain:
resnum = wt_residue.get_id()[1]
l_wt_atoms.append( wt_residue['CA'])
for mt_residue in mt_chain:
resnum = mt_residue.get_id()[1]
l_mt_atoms.append( mt_residue['CA'])
##SuperImpose
sup = Superimposer()
## Specify the atom lists
## ""wildtype"" and ""mutanttype"" are lists of Atom objects
## The mt atoms will be put on the wt atoms
sup.set_atoms(l_wt_atoms, l_mt_atoms)
## Print rotation/translation/rmsd
print "ROTRAN: ", sup.rotran
print "RMS: ", sup.rms
## Apply rotation/translation to the moving atoms
sup.apply(l_mt_atoms)
print "Saving aligned structure as PDB file %s" % pdb_out_filename
io=PDBIO()
io.set_structure(mt_structure)
io.save(pdb_out_filename)
print "Done"
------------------------------------------------------------------------------------
Thanks in advance,
Mark Livingstone
B.InfoTech (Hons) Student
Griffith University
School of ICT
Southport Qld Australia
More information about the Biopython
mailing list