[MMTK] Ignoring side chains
Peter
mmtk at maubp.freeserve.co.uk
Tue Jan 24 14:14:24 CET 2006
khinsen at cea.fr wrote:
> Peter wrote:
>
>> Yes, another PDB problem to report ;)
>
> Are you working through the whole PDB?
No, I'm "only" trying to parse 494 PDB files.
I want to extract (just) the protein backbone psi/phi angles, but I'm
beginning to appreciate just how nasty some PDB files can be.
As I don't care about the side chains for this application (and they
often contain errors that MMTK doesn't like), I have experimented with
the following idea: Adding a method to delete every non-backbone atom
(before building the model)
I understand that this something you may not want to add to
MMTK/Scientific, but what I propose is adding the following methods in
Scientific/IO/PDB.py to do this, based on the existing deleteHydrogens()
method:
class Group:
def deleteAllExceptBackbone(self):
"""Removes all peptide sidechains atoms, and any terminal atoms
"""
delete = []
for a in self.atom_list:
if a.name not in ['N','CA','C','O'] :
delete.append(a)
for a in delete:
self.deleteAtom(a)
class Chain:
def deleteAllExceptBackbone(self):
"""Removes all peptide sidechains atoms, and any terminal atoms
"""
for r in self.residues:
r.deleteAllExceptBackbone()
class Structure:
def deleteAllExceptBackbone(self):
"""Removes all peptide sidechains atoms, and any terminal atoms
"""
for r in self.residues:
r.deleteAllExceptBackbone()
In addition, I would also make the following change so that we can
delete "duplicate entries" without causing a key error (see also my
email about 1BTY and deleteHydrogens):
class Group:
def deleteAtom(self, atom):
"""Removes |atom| (an Atom object) from the group. An exception
will be raised if |atom| is not part of the group.
"""
self.atom_list.remove(atom)
#Made this conditional to cope with duplicate entries
#where deleting second entry would fail:
if atom.name in self.atoms :
del self.atoms[atom.name]
This allows the following code to be used, which used to fail at the
createPeptideChains line:
import MMTK.PDB
import MMTK.Proteins
configuration = MMTK.PDB.PDBConfiguration("5CYT.pdb")
configuration.deleteHydrogens() #redundant
configuration.deleteAllExceptBackbone()
chains = configuration.createPeptideChains(model = "no_hydrogens")
protein = MMTK.Proteins.Protein(chains)
Thank you
Peter
More information about the mmtk
mailing list