mailr7258 - /1.3/generic_fns/grace.py


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

Header


Content

Posted by edward on September 24, 2008 - 18:43:
Author: bugman
Date: Wed Sep 24 18:43:16 2008
New Revision: 7258

URL: http://svn.gna.org/viewcvs/relax?rev=7258&view=rev
Log:
Wrote the determine_seq_type() function.


Modified:
    1.3/generic_fns/grace.py

Modified: 1.3/generic_fns/grace.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/grace.py?rev=7258&r1=7257&r2=7258&view=diff
==============================================================================
--- 1.3/generic_fns/grace.py (original)
+++ 1.3/generic_fns/grace.py Wed Sep 24 18:43:16 2008
@@ -31,7 +31,7 @@
 # relax module imports.
 from data import Relax_data_store; ds = Relax_data_store()
 import generic_fns
-from generic_fns.mol_res_spin import exists_mol_res_spin_data, spin_loop
+from generic_fns.mol_res_spin import count_molecules, count_residues, 
count_spins, exists_mol_res_spin_data, spin_loop
 from relax_errors import RelaxError, RelaxNoPipeError, RelaxNoSequenceError, 
RelaxNoSimError, RelaxRegExpError
 from relax_io import get_file_path, open_write_file, test_binary
 from specific_fns.setup import get_specific_fn
@@ -103,6 +103,36 @@
 
     # Return the graph type.
     return graph_type
+
+
+def determine_seq_type(data, spin_id=None):
+    """Determine the spin sequence data type.
+
+    The purpose is to identify systems whereby only spins or only residues 
exist.
+
+    @param data:        The graph numerical data.
+    @type data:         list of lists of float
+    @keyword spin_id:   The spin identification string.
+    @type spin_id:      str
+    @return:            The spin sequence data type.  This can be one of 
'spin', 'res,' or 'mixed'.
+    @rtype:             str
+    """
+
+    # Count the molecules, residues, and spins.
+    num_mol = count_molecules(spin_id)
+    num_res = count_residues(spin_id)
+    num_spin = count_spins(spin_id)
+
+    # Only residues.
+    if num_mol == 1 and num_spin == 1:
+        return 'res'
+
+    # Only spins.
+    if num_mol == 1 and num_res == 1:
+        return 'spin'
+
+    # Mixed.
+    return 'mixed'
 
 
 def get_data(spin_id=None, x_data_type=None, y_data_type=None, 
plot_data=None):




Related Messages


Powered by MHonArc, Updated Wed Sep 24 19:00:04 2008