mailr16986 - in /branches/interatomic: generic_fns/sequence.py user_functions/sequence.py


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

Header


Content

Posted by edward on June 20, 2012 - 00:32:
Author: bugman
Date: Wed Jun 20 00:32:25 2012
New Revision: 16986

URL: http://svn.gna.org/viewcvs/relax?rev=16986&view=rev
Log:
Created the sequence.attach_proton user function.

This will be useful for analyses which are missing structural data.


Modified:
    branches/interatomic/generic_fns/sequence.py
    branches/interatomic/user_functions/sequence.py

Modified: branches/interatomic/generic_fns/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/sequence.py?rev=16986&r1=16985&r2=16986&view=diff
==============================================================================
--- branches/interatomic/generic_fns/sequence.py (original)
+++ branches/interatomic/generic_fns/sequence.py Wed Jun 20 00:32:25 2012
@@ -27,12 +27,34 @@
 from types import IntType, NoneType
 
 # relax module imports.
-from generic_fns.mol_res_spin import count_molecules, count_residues, 
count_spins, exists_mol_res_spin_data, generate_spin_id, return_molecule, 
return_residue, return_spin, spin_id_to_data_list, spin_loop
+from generic_fns.mol_res_spin import count_molecules, count_residues, 
count_spins, create_spin, exists_mol_res_spin_data, generate_spin_id, 
return_molecule, return_residue, return_spin, spin_id_to_data_list, spin_loop
 import pipes
 from relax_errors import RelaxError, RelaxDiffMolNumError, 
RelaxDiffResNumError, RelaxDiffSeqError, RelaxDiffSpinNumError, 
RelaxFileEmptyError, RelaxInvalidSeqError, RelaxNoSequenceError, 
RelaxSequenceError
 from relax_io import open_write_file, read_spin_data, write_spin_data
 import sys
 
+
+
+def attach_protons():
+    """Attach a single proton to all heteronuclei."""
+
+    # Loop over all spins.
+    mol_names = []
+    res_nums = []
+    res_names = []
+    for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
+        # The spin is already a proton.
+        if hasattr(spin, 'element') and spin.element == 'H':
+            continue
+
+        # Store the sequence info.
+        mol_names.append(mol_name)
+        res_nums.append(res_num)
+        res_names.append(res_name)
+
+    # Create all protons (this must be done out of the spin loop, as it 
affects the looping!).
+    for i in range(len(mol_names)):
+        create_spin(spin_name='H', res_name=res_names[i], 
res_num=res_nums[i], mol_name=mol_names[i])
 
 
 def copy(pipe_from=None, pipe_to=None, preserve_select=False, verbose=True):

Modified: branches/interatomic/user_functions/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/interatomic/user_functions/sequence.py?rev=16986&r1=16985&r2=16986&view=diff
==============================================================================
--- branches/interatomic/user_functions/sequence.py (original)
+++ branches/interatomic/user_functions/sequence.py Wed Jun 20 00:32:25 2012
@@ -38,6 +38,24 @@
 uf_class.title = "Class for manipulating sequence data."
 uf_class.menu_text = "&sequence"
 uf_class.gui_icon = "relax.sequence"
+
+
+# The sequence.attach_protons user function.
+uf = uf_info.add_uf('sequence.attach_protons')
+uf.title = "Attach protons to all heteronuclei."
+uf.title_short = "Heteronuclei proton attachment."
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("This can be used to attach protons to all the 
heteronuclei in the current data pipe.  For each proton, a spin container 
will be created.")
+# Prompt examples.
+uf.desc.append(Desc_container("Prompt examples"))
+uf.desc[-1].add_paragraph("To attach protons, simply type:")
+uf.desc[-1].add_prompt("relax> sequence.attach_protons()")
+uf.backend = sequence.attach_protons
+uf.menu_text = "&attach_protons"
+uf.gui_icon = "oxygen.actions.list-add-relax-blue"
+uf.wizard_size = (700, 500)
+uf.wizard_image = WIZARD_IMAGE_PATH + 'sequence.png'
 
 
 # The sequence.copy user function.




Related Messages


Powered by MHonArc, Updated Wed Jun 20 01:00:02 2012