mailr8453 - /branches/multi_structure/generic_fns/structure/api_base.py


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

Header


Content

Posted by edward on January 15, 2009 - 10:19:
Author: bugman
Date: Thu Jan 15 10:19:11 2009
New Revision: 8453

URL: http://svn.gna.org/viewcvs/relax?rev=8453&view=rev
Log:
Created the API base method target_mol_name() for generating the list of 
molecule names.


Modified:
    branches/multi_structure/generic_fns/structure/api_base.py

Modified: branches/multi_structure/generic_fns/structure/api_base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_structure/generic_fns/structure/api_base.py?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- branches/multi_structure/generic_fns/structure/api_base.py (original)
+++ branches/multi_structure/generic_fns/structure/api_base.py Thu Jan 15 
10:19:11 2009
@@ -36,6 +36,7 @@
 # relax module import.
 from data.relax_xml import fill_object_contents, xml_to_object
 from relax_errors import RelaxError, RelaxFileError, RelaxImplementError
+from relax_io import file_root
 from relax_warnings import RelaxWarning
 
 
@@ -347,6 +348,31 @@
                 model.mol.add_item(mol_name=set_mol_name[j], 
mol_cont=data_matrix[i][j])
 
 
+    def target_mol_name(self, set=None, target=None, index=None, 
mol_num=None, file=None):
+        """Add the new molecule name to the target data structure.
+
+        @keyword set:       The list of new molecule names.  If not 
supplied, the names will be
+                            generated from the file name.
+        @type set:          None or list of str
+        @keyword target:    The target molecule name data structure to which 
the new name will be
+                            appended.
+        @type target:       list
+        @keyword index:     The molecule index, matching the set argument.
+        @type index:        int
+        @keyword mol_num:   The molecule number.
+        @type mol_num:      int
+        @keyword file:      The name of the file, excluding all directories.
+        @type file:         str
+        """
+
+        # Set the target molecule name.
+        if set:
+            target.append(set[index])
+        else:
+            # Set the name to the file name plus the structure number.
+            target.append(file_root(file) + '_mol' + `mol_num`)
+
+
     def to_xml(self, doc, element):
         """Prototype method for converting the structural object to an XML 
representation.
 




Related Messages


Powered by MHonArc, Updated Thu Jan 15 10:40:03 2009