mailr6066 - /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 - 11:54:
Author: bugman
Date: Sun May  4 11:54:18 2008
New Revision: 6066

URL: http://svn.gna.org/viewcvs/relax?rev=6066&view=rev
Log:
Big simplifications to the molecule and residue naming functions.


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=6066&r1=6065&r2=6066&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 11:54:18 2008
@@ -1120,64 +1120,35 @@
         yield mol
 
 
-def name_molecule(mol_id, new_name=None):
-    """Function for renaming molecules.
-
-    @param mol_id:      The identifier string for the molecule to rename.
+def name_molecule(mol_id, name=None):
+    """Name the molecules.
+
+    @param mol_id:      The molecule identification string.
     @type mol_id:       str
-    @param new_name:    The new molecule name.
-    @type new_name:     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
-
-    # Alias the current data pipe.
-    cdp = relax_data_store[relax_data_store.current_pipe]
-
-    # Parse the tokens.
-    molecules = parse_token(mol_token)
+    @param name:        The new molecule name.
+    @type name:         str
+    """
 
     # Get the single molecule data container.
     mol = return_molecule(mol_id)
 
-    # Rename the molecule is there is a match.
+    # Name the molecule is there is a single match.
     if mol:
-        mol.name = new_name
+        mol.name = name
         
 
-def name_residue(res_id, new_name=None):
-    """Function for renaming residues.
-
-    @param res_id:      The identifier string for the residue(s) to rename.
+def name_residue(res_id, name=None):
+    """Name the residues.
+
+    @param res_id:      The residue identification string.
     @type res_id:       str
-    @param new_name:    The new residue name.
-    @type new_name:     str
-    """
-
-    # Split up the selection string.
-    mol_token, res_token, spin_token = tokenise(res_id)
-
-    # Disallow spin selections.
-    if spin_token != None:
-        raise RelaxSpinSelectDisallowError
-
-    # Parse the tokens.
-    residues = parse_token(res_token)
-
-    # Residue loop.
+    @param name:        The new residue name.
+    @type name:         str
+    """
+
+    # Rename the matching residues.
     for res in residue_loop(res_id):
-        # Rename the residue is there is a match.
-        if res.num in residues or res.name in residues:
-            res.name = new_name
+        res.name = name
 
 
 def name_spin(spin_id=None, name=None):
@@ -1189,7 +1160,7 @@
     @type name:         str
     """
 
-    # Rename the spin.
+    # Rename the matching spins.
     for spin in spin_loop(spin_id):
         spin.name = name
 




Related Messages


Powered by MHonArc, Updated Sun May 04 12:00:15 2008