mailr19152 - /trunk/lib/selection.py


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

Header


Content

Posted by edward on March 24, 2013 - 22:17:
Author: bugman
Date: Sun Mar 24 22:17:25 2013
New Revision: 19152

URL: http://svn.gna.org/viewcvs/relax?rev=19152&view=rev
Log:
Restored the selection object __contains_spin_id() method as 
contains_spin_id().

This will allow for faster checks for matches to spin ID strings.


Modified:
    trunk/lib/selection.py

Modified: trunk/lib/selection.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/selection.py?rev=19152&r1=19151&r2=19152&view=diff
==============================================================================
--- trunk/lib/selection.py (original)
+++ trunk/lib/selection.py Sun Mar 24 22:17:25 2013
@@ -440,6 +440,30 @@
         return select_spin and select_res and select_mol
 
 
+    def contains_spin_id(self, spin_id):
+        """Is the molecule, residue, and/or spin of the spin_id string 
located in the selection.
+
+        Only the simple selections allowed by the tokenise function are 
currently supported.
+
+
+        @param spin_id: The spin identification string.
+        @type spin_id:  str
+        @return:        The answer of whether the molecule, residue, and/or 
spin corresponding to the spin_id string found within the selection object.
+        @rtype:         bool
+        """
+
+        # No ID string.
+        if spin_id == '':
+            warn(RelaxWarning("The spin ID string '' is empty."))
+            return False
+
+        # Parse the spin_id string.
+        mol_name, res_num, res_name, spin_num, spin_name = 
spin_id_to_data_list(spin_id)
+
+        # Check if the spin is in the selection object.
+        return self.contains_spin(spin_num=spin_num, spin_name=spin_name, 
res_num=res_num, res_name=res_name, mol=mol_name)
+
+
     def has_molecules(self):
         """Determine if the selection object contains molecules.
 




Related Messages


Powered by MHonArc, Updated Sun Mar 24 22:40:04 2013