mailr7518 - in /1.3: generic_fns/sequence.py specific_fns/model_free/main.py


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

Header


Content

Posted by edward on October 05, 2008 - 17:36:
Author: bugman
Date: Sun Oct  5 17:36:49 2008
New Revision: 7518

URL: http://svn.gna.org/viewcvs/relax?rev=7518&view=rev
Log:
Bug fix for the duplication of sequence data during model selection.

The sequence.copy() function was not preserving the selection flag so that 
new option is sent into
the copy() and generate() functions, originating from the duplicate_data() 
model-free method.


Modified:
    1.3/generic_fns/sequence.py
    1.3/specific_fns/model_free/main.py

Modified: 1.3/generic_fns/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/sequence.py?rev=7518&r1=7517&r2=7518&view=diff
==============================================================================
--- 1.3/generic_fns/sequence.py (original)
+++ 1.3/generic_fns/sequence.py Sun Oct  5 17:36:49 2008
@@ -35,18 +35,20 @@
 
 
 
-def copy(pipe_from=None, pipe_to=None, verbose=True):
+def copy(pipe_from=None, pipe_to=None, preserve_select=False, verbose=True):
     """Copy the molecule, residue, and spin sequence data from one data pipe 
to another.
 
-    @keyword pipe_from: The data pipe to copy the sequence data from.  This 
defaults to the current
-                        data pipe.
-    @type pipe_from:    str
-    @keyword pipe_to:   The data pipe to copy the sequence data to.  This 
defaults to the current
-                        data pipe.
-    @type pipe_to:      str
-    @keyword verbose:   A flag which if True will cause info about each spin 
to be printed out as
-                        the sequence is generated.
-    @type verbose:      bool
+    @keyword pipe_from:         The data pipe to copy the sequence data 
from.  This defaults to the
+                                current data pipe.
+    @type pipe_from:            str
+    @keyword pipe_to:           The data pipe to copy the sequence data to.  
This defaults to the
+                                current data pipe.
+    @type pipe_to:              str
+    @keyword preserve_select:   A flag which if True will cause spin 
selections to be preserved.
+    @type preserve_select:      bool
+    @keyword verbose:           A flag which if True will cause info about 
each spin to be printed
+                                out as the sequence is generated.
+    @type verbose:              bool
     """
 
     # Defaults.
@@ -71,8 +73,14 @@
 
     # Loop over the spins of the pipe_from data pipe.
     for spin, mol_name, res_num, res_name in spin_loop(pipe=pipe_from, 
full_info=True):
+        # Preserve selection.
+        if preserve_select:
+            select = spin.select
+        else:
+            select = True
+
         # Generate the new sequence.
-        generate(mol_name, res_num, res_name, spin.num, spin.name, pipe_to, 
verbose)
+        generate(mol_name, res_num, res_name, spin.num, spin.name, pipe_to, 
select=select, verbose=verbose)
 
 
 def display(sep=None, mol_name_flag=False, res_num_flag=False, 
res_name_flag=False, spin_num_flag=False, spin_name_flag=False):
@@ -108,7 +116,7 @@
     write_body(file=sys.stdout, sep=sep, mol_name_flag=mol_name_flag, 
res_num_flag=res_num_flag, res_name_flag=res_name_flag, 
spin_num_flag=spin_num_flag, spin_name_flag=spin_name_flag)
 
 
-def generate(mol_name=None, res_num=None, res_name=None, spin_num=None, 
spin_name=None, pipe=None, verbose=True):
+def generate(mol_name=None, res_num=None, res_name=None, spin_num=None, 
spin_name=None, pipe=None, select=True, verbose=True):
     """Generate the sequence item-by-item by adding a single 
molecule/residue/spin container as necessary.
 
     @keyword mol_name:  The molecule name.
@@ -124,6 +132,8 @@
     @keyword pipe:      The data pipe in which to generate the sequence.  
This defaults to the
                         current data pipe.
     @type pipe:         str
+    @keyword select:    The spin selection flag.
+    @type select:       bool
     @keyword verbose:   A flag which if True will cause info about each spin 
to be printed out as
                         the sequence is generated.
     @type verbose:      bool
@@ -161,6 +171,12 @@
     if not curr_spin:
         # Add the spin.
         curr_res.spin.add_item(spin_name=spin_name, spin_num=spin_num)
+
+        # Get the spin.
+        curr_spin = return_spin(generate_spin_id(mol_name=mol_name, 
res_num=res_num, res_name=res_name, spin_num=spin_num, spin_name=spin_name), 
pipe=pipe)
+
+    # Set the selection flag.
+    curr_spin.select = select
 
     # Print out of all the spins.
     if verbose:

Modified: 1.3/specific_fns/model_free/main.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/main.py?rev=7518&r1=7517&r2=7518&view=diff
==============================================================================
--- 1.3/specific_fns/model_free/main.py (original)
+++ 1.3/specific_fns/model_free/main.py Sun Oct  5 17:36:49 2008
@@ -1121,7 +1121,7 @@
         if model_type == 'mf' or (model_type == 'local_tm' and not 
global_stats):
             # Duplicate the sequence data if it doesn't exist.
             if dp_to.mol.is_empty():
-                sequence.copy(pipe_from=pipe_from, pipe_to=pipe_to, 
verbose=verbose)
+                sequence.copy(pipe_from=pipe_from, pipe_to=pipe_to, 
preserve_select=True, verbose=verbose)
 
             # Get the spin container indices.
             mol_index, res_index, spin_index = 
convert_from_global_index(global_index=model_index, pipe=pipe_from)




Related Messages


Powered by MHonArc, Updated Sun Oct 05 20:00:03 2008