mailr9782 - in /branches/bmrb: bmrblib/experimental_details/software.py generic_fns/exp_info.py specific_fns/model_free/bmrb.py


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

Header


Content

Posted by edward on October 25, 2009 - 22:22:
Author: bugman
Date: Sun Oct 25 22:22:09 2009
New Revision: 9782

URL: http://svn.gna.org/viewcvs/relax?rev=9782&view=rev
Log:
The software citation IDs are now handled, and all the new model-free info 
supplied.


Modified:
    branches/bmrb/bmrblib/experimental_details/software.py
    branches/bmrb/generic_fns/exp_info.py
    branches/bmrb/specific_fns/model_free/bmrb.py

Modified: branches/bmrb/bmrblib/experimental_details/software.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/experimental_details/software.py?rev=9782&r1=9781&r2=9782&view=diff
==============================================================================
--- branches/bmrb/bmrblib/experimental_details/software.py (original)
+++ branches/bmrb/bmrblib/experimental_details/software.py Sun Oct 25 
22:22:09 2009
@@ -70,6 +70,8 @@
         @type task:                 str
         @keyword cite_ids:          The citation ID numbers.
         @type cite_ids:             None or list of int
+        @return:                    The software ID number.
+        @rtype:                     int
         """
 
         # Check.
@@ -104,6 +106,9 @@
         # Add the saveframe to the data nodes.
         self.datanodes.append(self.frame)
 
+        # Return the software ID number.
+        return self.software_num
+
 
     def add_tag_categories(self):
         """Create the tag categories."""

Modified: branches/bmrb/generic_fns/exp_info.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/exp_info.py?rev=9782&r1=9781&r2=9782&view=diff
==============================================================================
--- branches/bmrb/generic_fns/exp_info.py (original)
+++ branches/bmrb/generic_fns/exp_info.py Sun Oct 25 22:22:09 2009
@@ -116,9 +116,13 @@
 
     @param star:        The NMR-STAR dictionary object.
     @type star:         NMR_STAR instance
+    @return:            A list BMRB software IDs and a list of software 
labels.
+    @rtype:             tuple of list of int and list of str
     """
 
     # Loop over the software.
+    software_ids = []
+    software_labels = []
     if hasattr(cdp, 'exp_info') and hasattr(cdp.exp_info, 'software'):
         for software in cdp.exp_info.software:
             # Get the citation ID numbers.
@@ -127,11 +131,18 @@
                 cite_id_nums.append(cdp.exp_info.get_cite_id_num(cite))
 
             # The program info.
-            star.software.add(name=software.name, version=software.version, 
vendor_name=software.vendor_name, vendor_eaddress=software.url, 
task=software.tasks, cite_ids=cite_id_nums)
+            id = star.software.add(name=software.name, 
version=software.version, vendor_name=software.vendor_name, 
vendor_eaddress=software.url, task=software.tasks, cite_ids=cite_id_nums)
+
+            # Append the software info.
+            software_ids.append(id)
+            software_labels.append(software.name)
 
     # relax cannot be the only program used!
     else:
         raise RelaxError("relax cannot be the only program used in the 
analysis - spectral analysis programs, etc. must also have been used.  Please 
use the relevant BMRB user functions to specify these.")
+
+    # Return the software info.
+    return software_ids, software_labels
 
 
 def citation(cite_id=None, authors=None, doi=None, pubmed_id=None, 
full_citation=None, title=None, status=None, type=None, journal_abbrev=None, 
journal_full=None, volume=None, issue=None, page_first=None, page_last=None, 
year=None):

Modified: branches/bmrb/specific_fns/model_free/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/specific_fns/model_free/bmrb.py?rev=9782&r1=9781&r2=9782&view=diff
==============================================================================
--- branches/bmrb/specific_fns/model_free/bmrb.py (original)
+++ branches/bmrb/specific_fns/model_free/bmrb.py Sun Oct 25 22:22:09 2009
@@ -80,8 +80,36 @@
         else:
             star = NMR_STAR('relax_model_free_results', file_path)
 
+        # Global minimisation stats.
+        global_chi2 = None
+        if hasattr(cdp, 'chi2'):
+            global_chi2 = cdp.chi2
+
         # Rex frq.
         rex_frq = cdp.frq[0]
+
+        # The relax to BMRB model-free model name map.
+        model_map = {'m0':  '',
+                     'm1':  'S2',
+                     'm2':  'S2, te',
+                     'm3':  'S2, Rex',
+                     'm4':  'S2, te, Rex',
+                     'm5':  'S2f, S2, ts',
+                     'm6':  'S2f, tf, S2, ts',
+                     'm7':  'S2f, S2, ts, Rex',
+                     'm8':  'S2f, tf, S2, ts, Rex',
+                     'm9':  'Rex',
+                     'tm0': 'tm',
+                     'tm1': 'tm, S2',
+                     'tm2': 'tm, S2, te',
+                     'tm3': 'tm, S2, Rex',
+                     'tm4': 'tm, S2, te, Rex',
+                     'tm5': 'tm, S2f, S2, ts',
+                     'tm6': 'tm, S2f, tf, S2, ts',
+                     'tm7': 'tm, S2f, S2, ts, Rex',
+                     'tm8': 'tm, S2f, tf, S2, ts, Rex',
+                     'tm9': 'tm, Rex'
+        }
 
         # Initialise the spin specific data lists.
         res_num_list = []
@@ -93,6 +121,7 @@
         isotope_list = []
         element_list = []
 
+        local_tm_list = []
         s2_list = []
         s2f_list = []
         s2s_list = []
@@ -101,6 +130,7 @@
         ts_list = []
         rex_list = []
 
+        local_tm_err_list = []
         s2_err_list = []
         s2f_err_list = []
         s2s_err_list = []
@@ -110,6 +140,7 @@
         rex_err_list = []
 
         chi2_list = []
+        model_list = []
 
         # Store the spin specific data in lists for later use.
         for spin, mol_name, res_num, res_name, spin_id in 
spin_loop(full_info=True, return_id=True):
@@ -140,6 +171,10 @@
                 element_list.append(spin.element)
             else:
                 element_list.append(None)
+
+            # Diffusion tensor.
+            local_tm_list.append(spin.local_tm)
+            local_tm_err_list.append(spin.local_tm_err)
 
             # Model-free data.
             s2_list.append(spin.s2)
@@ -167,6 +202,9 @@
             # Opt stats.
             chi2_list.append(spin.chi2)
 
+            # Model-free model.
+            model_list.append(model_map[spin.model])
+
 
         # Create Supergroup 2 : The citations.
         ######################################
@@ -186,7 +224,7 @@
         #################################################################
 
         # Generate the software saveframe.
-        exp_info.bmrb_write_software(star)
+        software_ids, software_labels = exp_info.bmrb_write_software(star)
 
 
         # Create Supergroup 5 : The NMR parameters saveframes.
@@ -206,8 +244,13 @@
         # Create Supergroup 7 : The thermodynamics saveframes.
         ######################################################
 
+        # Get the relax software id.
+        for i in range(len(software_ids)):
+            if software_labels[i] == 'relax':
+                software_id = software_ids[i]
+
         # Generate the model-free data saveframe.
-        star.model_free.add(res_nums=res_num_list, res_names=res_name_list, 
atom_names=atom_name_list, atom_types=element_list, s2=s2_list, s2f=s2f_list, 
s2s=s2s_list, te=te_list, tf=tf_list, ts=ts_list, rex=rex_list, 
s2_err=s2_err_list, s2f_err=s2f_err_list, s2s_err=s2s_err_list, 
te_err=te_err_list, tf_err=tf_err_list, ts_err=ts_err_list, 
rex_err=rex_err_list, rex_frq=rex_frq, chi2=chi2_list)
+        star.model_free.add(global_chi2=global_chi2, 
software_ids=[software_id], software_labels=['relax'], res_nums=res_num_list, 
res_names=res_name_list, atom_names=atom_name_list, atom_types=element_list, 
local_tc=local_tm_list, s2=s2_list, s2f=s2f_list, s2s=s2s_list, te=te_list, 
tf=tf_list, ts=ts_list, rex=rex_list, local_tc_err=local_tm_err_list, 
s2_err=s2_err_list, s2f_err=s2f_err_list, s2s_err=s2s_err_list, 
te_err=te_err_list, tf_err=tf_err_list, ts_err=ts_err_list, 
rex_err=rex_err_list, rex_frq=rex_frq, chi2=chi2_list, model_fit=model_list)
 
 
         # Write the contents to the STAR formatted file.




Related Messages


Powered by MHonArc, Updated Mon Oct 26 15:40:03 2009