mailRe: X-H vector orientations


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on February 17, 2009 - 22:29:
Hi,

Sorry for not getting back to this message earlier, I've had a few
deadlines lately.  Please see below for more.


On Wed, Feb 4, 2009 at 9:16 PM, Sébastien Morin
<sebastien.morin.1@xxxxxxxxx> wrote:
Hi Ed,

I tried what you proposed...

========================
from generic_fns.mol_res_spin import spin_loop
pipe.create()
sequence.read()
structure.read_pdb()
structure.vectors()
for spin, spin_id in spin_loop(return_id=True):
   print "%s %s" % (spin_id, spin.xh_vect)
========================

However, there is something quite annoying (but predictable)... If the
sequence used contains residues for which the N-H vector does not exist
(e.g. N-terminal residue, or proline), the spin loop will produce an
error message such as:

========================
for spin, spin_id in spin_loop(return_id=True):
   print "%s %s" % (spin_id, spin.xh_vect)

Traceback (most recent call last):
 File "<console>", line 2, in <module>
AttributeError: 'SpinContainer' object has no attribute 'xh_vect'
========================

This can be solved using the hasattr() function.  So in the spin loop have:

    if not hasattr(spin, 'xh_vect'):
        continue

This will skip all spins with no XH vectors.  You can make the output
a bit fancier if you set the spin_loop() argument full_info to True as
this will then return the molecule name, residue name, residue number,
and the spin container which contains the atom name and number.

Regards,

Edward



Related Messages


Powered by MHonArc, Updated Thu Feb 19 02:20:21 2009