mailr6100 - /branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py


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

Header


Content

Posted by edward on May 04, 2008 - 15:53:
Author: bugman
Date: Sun May  4 15:53:46 2008
New Revision: 6100

URL: http://svn.gna.org/viewcvs/relax?rev=6100&view=rev
Log:
Added the has_molecules(), has_residues(), and has_spins() methods to the 
Selection object.


Modified:
    branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py

Modified: branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py?rev=6100&r1=6099&r2=6100&view=diff
==============================================================================
--- branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py (original)
+++ branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py Sun May  
4 15:53:46 2008
@@ -396,6 +396,66 @@
         return select_spin and select_res and select_mol
 
 
+    def has_molecules(self):
+        """Determine if the selection object contains molecules.
+
+        @return:            The answer of whether the selection contains 
molecules.
+        @rtype:             bool
+        """
+
+        # The selection object is a union.
+        if self._union:
+            return self._union[0].has_molecules() or 
self._union[1].has_molecules()
+
+        # The selection object is an intersection.
+        elif self._intersect:
+            return self._intersect[0].has_molecules() and 
self._intersect[1].has_molecules()
+
+        # Molecules are present.
+        if self.molecules:
+            return True
+
+
+    def has_residues(self):
+        """Determine if the selection object contains residues.
+
+        @return:            The answer of whether the selection contains 
residues.
+        @rtype:             bool
+        """
+
+        # The selection object is a union.
+        if self._union:
+            return self._union[0].has_residues() or 
self._union[1].has_residues()
+
+        # The selection object is an intersection.
+        elif self._intersect:
+            return self._intersect[0].has_residues() and 
self._intersect[1].has_residues()
+
+        # Residues are present.
+        if self.residues:
+            return True
+
+
+    def has_spins(self):
+        """Determine if the selection object contains spins.
+
+        @return:            The answer of whether the selection contains 
spins.
+        @rtype:             bool
+        """
+
+        # The selection object is a union.
+        if self._union:
+            return self._union[0].has_spins() or self._union[1].has_spins()
+
+        # The selection object is an intersection.
+        elif self._intersect:
+            return self._intersect[0].has_spins() and 
self._intersect[1].has_spins()
+
+        # Spins are present.
+        if self.spins:
+            return True
+
+
     def intersection(self, select_obj0, select_obj1):
         """Make this Selection object the intersection of two other 
Selection objects.
 




Related Messages


Powered by MHonArc, Updated Sun May 04 16:00:25 2008