[MMTK] MMTK and missing residues
Konrad Hinsen
hinsen@cnrs-orleans.fr
24 Oct 2002 10:43:16 +0200
Sabine Beraud <sabine@nmr.clarku.edu> writes:
> still did not resolve my problem since the 2 solutions that you
> proposed me (and which would be perfect for me) give me error
> messages that I am not able to resolve (yes, yes I tried!!).
The joys of running untested code :-)
> cts.py", line 52, in __getattr__
> return getattr(self.type, attr)
> AttributeError: 'GroupType' instance has no attribute 'setBondAttributes'
Right, that's a problem. No immediate solution, sorry. findHydrogens()
was written for molecules and my attempt at bending it to make it work
on part of a molecule was not so successful...
You could try the following "quick and dirty" hack: in MMTK/ChemicalObjects.py,
look for the the routine findHydrogenPositions (line 703 in my version) and
replace
self.setBondAttributes()
try:
self.setBondAttributes()
except AttributError:
pass
and at the end
finally:
self.clearBondAttributes()
by
finally:
try:
self.clearBondAttributes(
except AttributError:
pass
Then the code I posted should run. Those changes have no adverse effect
in normal operation, but could hide some errors in erroneous calls.
> 2. In the second solution:
...
> n1 = (known[1].position()-r).normal()
> File
> "/opt/gnu/lib/python2.0/Python-2.0/lib/python2.0/site-packages/Scientific/Geomet
> ry/VectorModule.py", line 142, in normal
> raise ZeroDivisionError, "Can't normalize a zero-length vector"
> ZeroDivisionError: Can't normalize a zero-length vector
That just means that you have two neighbouring atoms whose positions are
undefined, so their distance vector becomes zero by assigning the same
fake position to every undefined atom. One way out is assigning random
positions:
from MMTK.Random import randomPointInBox
for atom in chain.atomList():
if atom.position() is None and atom.symbol != 'H':
atom.setPosition(randomPointInBox(10.))
atom.fake_position = 1
else:
atom.fake_position = 0
chain.findHydrogenPositions()
for atom in chain.atomList():
if atom.fake_position:
atom.setPosition(None)
del atom.fake_position
Konrad.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron | Fax: +33-2.38.63.15.17
45071 Orleans Cedex 2 | Deutsch/Esperanto/English/
France | Nederlands/Francais
-------------------------------------------------------------------------------