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