mailr3506 - /1.3/generic_fns/spin.py


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

Header


Content

Posted by edward on November 11, 2007 - 22:12:
Author: bugman
Date: Sun Nov 11 22:12:12 2007
New Revision: 3506

URL: http://svn.gna.org/viewcvs/relax?rev=3506&view=rev
Log:
Implemented the generic_fns.spin.display() function.

The format of the output is quite different from the 
generic_fns.residue.display() function.  This
function will need to be updated.


Modified:
    1.3/generic_fns/spin.py

Modified: 1.3/generic_fns/spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/spin.py?rev=3506&r1=3505&r2=3506&view=diff
==============================================================================
--- 1.3/generic_fns/spin.py (original)
+++ 1.3/generic_fns/spin.py Sun Nov 11 22:12:12 2007
@@ -23,7 +23,7 @@
 # relax module imports.
 from data import Data as relax_data_store
 from relax_errors import RelaxError, RelaxNoPipeError, 
RelaxSpinSelectDisallowError
-from selection import molecule_loop, parse_token, residue_loop, 
return_molecule, return_residue, return_spin, return_single_residue_info, 
return_single_spin_info, tokenise
+from selection import molecule_loop, parse_token, residue_loop, 
return_molecule, return_residue, return_spin, return_single_residue_info, 
return_single_spin_info, spin_loop, tokenise
 
 
 # Module doc.
@@ -182,18 +182,14 @@
 
 
 def display(spin_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
+    """Function for displaying the information associated with the spin.
+
+    @param spin_id: The molecule and residue identifier string.
+    @type spin_id:  str
+    """
+
+    # Split up the selection string.
+    mol_token, res_token, spin_token = tokenise(spin_id)
 
     # The molecule selection string.
     if mol_token:
@@ -201,12 +197,11 @@
     else:
         mol_sel = None
 
+    # Print a header.
+    print "\n\n%-15s%-15s%-15s%-15s%-15s" % ("Molecule", "Res number", "Res 
name", "Spin number", "Spin name")
+
     # 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:
@@ -214,8 +209,16 @@
 
         # 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))
+            # The spin identifier for this residue.
+            spin_sel = res_sel
+            if spin_token:
+                spin_sel = spin_sel + '@' + spin_token
+
+            # Loop over the spins of this residue.
+            for spin in spin_loop(spin_sel):
+                # Print the residue data.
+                print "%-15s%-15s%-15s%-15s%-15s" % (mol.name, `res.num`, 
res.name, `spin.num`, spin.name)
+
 
 
 def rename(res_id, new_name=None):




Related Messages


Powered by MHonArc, Updated Sun Nov 11 22:40:15 2007