mailr3436 - /1.3/generic_fns/molecule.py


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

Header


Content

Posted by edward on November 04, 2007 - 19:26:
Author: bugman
Date: Sun Nov  4 19:26:42 2007
New Revision: 3436

URL: http://svn.gna.org/viewcvs/relax?rev=3436&view=rev
Log:
Wrote the generic_fns.molecule.display() function.


Modified:
    1.3/generic_fns/molecule.py

Modified: 1.3/generic_fns/molecule.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/molecule.py?rev=3436&r1=3435&r2=3436&view=diff
==============================================================================
--- 1.3/generic_fns/molecule.py (original)
+++ 1.3/generic_fns/molecule.py Sun Nov  4 19:26:42 2007
@@ -169,19 +169,23 @@
         cdp.mol.add_item()
 
 
-def display(res_id=None):
-    """Function for displaying the information associated with the residue.
-
-    @param res_id:  The molecule and residue identifier string.
-    @type res_id:   str
-    """
-
-    # Split up the selection string.
-    mol_token, res_token, spin_token = tokenise(res_id)
-
-    # Disallow spin selections.
-    if spin_token != None:
-        raise RelaxSpinSelectDisallowError
+def display(mol_id=None):
+    """Function for displaying the information associated with the molecule.
+
+    @param mol_id:  The molecule identifier string.
+    @type mol_id:   str
+    """
+
+    # Split up the selection string.
+    mol_token, res_token, spin_token = tokenise(mol_id)
+
+    # Disallow spin selections.
+    if spin_token != None:
+        raise RelaxSpinSelectDisallowError
+
+    # Disallow residue selections.
+    if res_token != None:
+        raise RelaxResSelectDisallowError
 
     # The molecule selection string.
     if mol_token:
@@ -189,21 +193,14 @@
     else:
         mol_sel = None
 
+    # Print a header.
+    print "\nMolecule information:"
+    print "%-8s%-10s" % ("Name", "Number of residues")
+
     # Molecule loop.
     for mol in molecule_loop(mol_sel):
-        # Print a header.
-        print "\n\nMolecule: " + `mol.name`
-        print "%-8s%-8s%-10s" % ("Number", "Name", "Number of spins")
-
-        # The residue identifier for this molecule.
-        res_sel = '#' + mol.name
-        if res_token:
-            res_sel = res_sel + ':' + res_token
-
-        # Loop over the residues of this molecule.
-        for res in residue_loop(res_sel):
-            # Print the residue data.
-            print "%-8i%-8s%-10i" % (res.num, res.name, len(res.spin))
+        # Print the molecule data.
+        print "%-8i%-8s%-10i" % (mol.name, len(mol.res))
 
 
 def rename(res_id, new_name=None):




Related Messages


Powered by MHonArc, Updated Sun Nov 04 19:40:23 2007