mailr17131 - /branches/interatomic/generic_fns/sequence.py


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

Header


Content

Posted by edward on July 02, 2012 - 17:35:
Author: bugman
Date: Mon Jul  2 17:35:38 2012
New Revision: 17131

URL: http://svn.gna.org/viewcvs/relax?rev=17131&view=rev
Log:
The sequence.attach_protons user function now ignores spins with pre-existing 
attached protons.


Modified:
    branches/interatomic/generic_fns/sequence.py

Modified: branches/interatomic/generic_fns/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/sequence.py?rev=17131&r1=17130&r2=17131&view=diff
==============================================================================
--- branches/interatomic/generic_fns/sequence.py (original)
+++ branches/interatomic/generic_fns/sequence.py Mon Jul  2 17:35:38 2012
@@ -27,6 +27,7 @@
 from types import IntType, NoneType
 
 # relax module imports.
+from generic_fns.interatomic import return_interatom_list
 from generic_fns.mol_res_spin import count_molecules, count_residues, 
count_spins, create_molecule, create_residue, create_spin, 
exists_mol_res_spin_data, generate_spin_id, return_molecule, return_residue, 
return_spin, set_spin_element, set_spin_isotope, spin_id_to_data_list, 
spin_loop
 import pipes
 from relax_errors import RelaxError, RelaxDiffMolNumError, 
RelaxDiffResNumError, RelaxDiffSeqError, RelaxDiffSpinNumError, 
RelaxFileEmptyError, RelaxInvalidSeqError, RelaxNoSequenceError, 
RelaxSequenceError
@@ -42,12 +43,32 @@
     mol_names = []
     res_nums = []
     res_names = []
-    for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
+    for spin, mol_name, res_num, res_name, spin_id in 
spin_loop(full_info=True, return_id=True):
         # The spin is already a proton.
         if hasattr(spin, 'element') and spin.element == 'H':
             continue
 
+        # Get the interatomic data container.
+        interatoms = return_interatom_list(spin_id)
+        proton_found = False
+        if len(interatoms):
+            for i in range(len(interatoms)):
+                # Get the attached spin.
+                spin_attached = return_spin(interatoms[i].spin_id1)
+                if id(spin_attached) == id(spin):
+                    spin_attached = return_spin(interatoms[i].spin_id2)
+
+                # Is it a proton?
+                if hasattr(spin_attached, 'element') and 
spin_attached.element == 'H' or spin.name == 'H':
+                    proton_found = True
+                    break
+
+        # Attached proton found.
+        if proton_found:
+            continue
+
         # Store the sequence info.
+        print spin
         mol_names.append(mol_name)
         res_nums.append(res_num)
         res_names.append(res_name)




Related Messages


Powered by MHonArc, Updated Mon Jul 02 18:00:02 2012