mailr12037 - in /branches/bieri_gui: data/ gui_bieri/ gui_bieri/analyses/ gui_bieri/execution/ gui_bieri/user_functions/


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

Header


Content

Posted by edward on December 30, 2010 - 15:15:
Author: bugman
Date: Thu Dec 30 15:15:01 2010
New Revision: 12037

URL: http://svn.gna.org/viewcvs/relax?rev=12037&view=rev
Log:
Changed the ds.relax_gui.file_setting data structure to be a container class.

The structure is now called ds.relax_gui.free_file_format and it is a 
container with variables for
each column type and the column separator.


Modified:
    branches/bieri_gui/data/gui.py
    branches/bieri_gui/gui_bieri/analyses/auto_model_free.py
    branches/bieri_gui/gui_bieri/execution/calc_noe.py
    branches/bieri_gui/gui_bieri/execution/calc_rx.py
    branches/bieri_gui/gui_bieri/relax_gui.py
    branches/bieri_gui/gui_bieri/settings.py
    branches/bieri_gui/gui_bieri/user_functions/base.py

Modified: branches/bieri_gui/data/gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/data/gui.py?rev=12037&r1=12036&r2=12037&view=diff
==============================================================================
--- branches/bieri_gui/data/gui.py (original)
+++ branches/bieri_gui/data/gui.py Thu Dec 30 15:15:01 2010
@@ -40,6 +40,9 @@
         # Add the analysis list object.
         self.analyses = Analyses()
 
+        # The free format file settings.
+        self.free_file_format = Free_file_format()
+
         # Set the name and description.
         self.name = 'relax_gui'
         self.desc = 'The relax GUI information store.'
@@ -52,17 +55,20 @@
         @type gui_node:     xml.dom.minicompat.Element instance
         """
 
-        # Add the analysis list object.
+        # Init.
         self.analyses = Analyses()
+        self.free_file_format = Free_file_format()
 
-        # Get the analyses node.
+        # Get the analyses node and recreate the analyses structure.
         analyses_nodes = gui_node.getElementsByTagName('analyses')
-
-        # Recreate the analyses structure.
         self.analyses.from_xml(analyses_nodes[0])
 
+        # Get the file settings node and recreate the structure.
+        format_nodes = gui_node.getElementsByTagName('free_file_format')
+        self.free_file_format.from_xml(format_nodes[0])
+
         # Recreate all the other data structures.
-        xml_to_object(gui_node, self, blacklist=['analyses'])
+        xml_to_object(gui_node, self, blacklist=['analyses', 
'free_file_format'])
 
 
 
@@ -116,3 +122,33 @@
 
             # Recreate the analysis container.
             cont.from_xml(node)
+
+
+class Free_file_format(Element):
+    """Container for the free format file settings (column numbers, column 
separators, etc.)."""
+
+    def __init__(self):
+        """Set up the initial values."""
+
+        # Execute the base class __init__() method.
+        super(Free_file_format, self).__init__(name='free_file_format', 
desc='The column numbers and separator for the free format file.')
+
+        # Reset.
+        self.reset()
+
+
+    def reset(self):
+        """Reset all variables to the initial values."""
+
+        # The default column numbers.
+        self.spin_id_col =   None
+        self.mol_name_col =  1
+        self.res_num_col =   2
+        self.res_name_col =  3
+        self.spin_num_col =  4
+        self.spin_name_col = 5
+        self.data_col =      6
+        self.err_col =       7
+
+        # The column separator (set to None for white space).
+        self.sep = None

Modified: branches/bieri_gui/gui_bieri/analyses/auto_model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/analyses/auto_model_free.py?rev=12037&r1=12036&r2=12037&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/analyses/auto_model_free.py (original)
+++ branches/bieri_gui/gui_bieri/analyses/auto_model_free.py Thu Dec 30 
15:15:01 2010
@@ -673,19 +673,11 @@
         if not self.data.paramfiles1[2] == '':     # R2 file of frq 1
             sequence_file = self.data.paramfiles1[2]
 
-        # Import parameter file settings.
-        param = ds.relax_gui.file_setting
-
-        # Read parameter file parameters and convert them to integers if not 
None.
-        param_tmp = param
-        for i in range(0, len(param_tmp)):
-            if str(param_tmp[i]) in ['', '0', 'None']:
-                param_tmp[i] = None
-            else:
-                param_tmp[i] = int(param_tmp[i])
+        # Alias the free file format data structure.
+        format = ds.relax_gui.free_file_format
 
         # The sequence data (file name, dir, mol_name_col, res_num_col, 
res_name_col, spin_num_col, spin_name_col, sep).  These are the arguments to 
the  sequence.read() user function, for more information please see the 
documentation for that function.
-        data.seq_args = [sequence_file, None, None, param_tmp[1], 
param_tmp[2], param_tmp[3], param_tmp[4], None]
+        data.seq_args = [sequence_file, None, format.mol_name_col, 
format.res_num_col, format.res_name_col, format.spin_num_col, 
format.spin_name_col, format.sep]
 
         # Import golbal settings.
         global_settings = ds.relax_gui.global_setting
@@ -730,11 +722,11 @@
 
             # Append the relaxation data if present.
             if not files[1] == '':
-                data.relax_data.append(['R1', str(frq), float(frq)*1e6, 
files[1], None, None, param_tmp[1], param_tmp[2], param_tmp[3], param_tmp[4], 
param_tmp[5], param_tmp[6], None])
+                data.relax_data.append(['R1', str(frq), float(frq)*1e6, 
files[1], None, format.mol_name_col, format.res_num_col, format.res_name_col, 
format.spin_num_col, format.spin_name_col, format.data_col, format.err_col, 
format.sep])
             if not files[2] == '':
-                data.relax_data.append(['R2', str(frq), float(frq)*1e6, 
files[2], None, None, param_tmp[1], param_tmp[2], param_tmp[3], param_tmp[4], 
param_tmp[5], param_tmp[6], None])
+                data.relax_data.append(['R2', str(frq), float(frq)*1e6, 
files[2], None, format.mol_name_col, format.res_num_col, format.res_name_col, 
format.spin_num_col, format.spin_name_col, format.data_col, format.err_col, 
format.sep])
             if not files[0] == '':
-                data.relax_data.append(['NOE', str(frq), float(frq)*1e6, 
files[0], None, None, param_tmp[1], param_tmp[2], param_tmp[3], param_tmp[4], 
param_tmp[5], param_tmp[6], None])
+                data.relax_data.append(['NOE', str(frq), float(frq)*1e6, 
files[0], None, format.mol_name_col, format.res_num_col, format.res_name_col, 
format.spin_num_col, format.spin_name_col, format.data_col, format.err_col, 
format.sep])
 
         # Unresolved resiudes
         file = DummyFileObject()

Modified: branches/bieri_gui/gui_bieri/execution/calc_noe.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/execution/calc_noe.py?rev=12037&r1=12036&r2=12037&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/execution/calc_noe.py (original)
+++ branches/bieri_gui/gui_bieri/execution/calc_noe.py Thu Dec 30 15:15:01 
2010
@@ -52,12 +52,6 @@
 
     hetero = global_setting[2]
     prot = global_setting[3]
-    intcol = int(file_setting[5])
-    mol_name = int(file_setting[0])
-    res_num = int(file_setting[1])
-    res_name = int(file_setting[2])
-    spin_num = int(file_setting[3])
-    spin_name = int(file_setting[4])
     resultsdir = str(target_dir)
     gracedir = str(target_dir) + sep + 'grace'
     save_file = str(target_dir) + sep + 'noe.' + str(nmr_freq) + '.out'

Modified: branches/bieri_gui/gui_bieri/execution/calc_rx.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/execution/calc_rx.py?rev=12037&r1=12036&r2=12037&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/execution/calc_rx.py (original)
+++ branches/bieri_gui/gui_bieri/execution/calc_rx.py Thu Dec 30 15:15:01 2010
@@ -53,12 +53,6 @@
 
     hetero = global_setting[2]
     prot = global_setting[3]
-    intcol = int(file_setting[5])
-    mol_name = int(file_setting[0])
-    res_num = int(file_setting[1])
-    res_name = int(file_setting[2])
-    spin_num = int(file_setting[3])
-    spin_name = int(file_setting[4])
     resultsdir = str(target_dir)
     gracedir = str(target_dir) + sep + 'grace'
     savefile = str(target_dir) + sep + 'r' + str(r1_r2) + '.' + 
str(nmr_freq) + '.out'

Modified: branches/bieri_gui/gui_bieri/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/relax_gui.py?rev=12037&r1=12036&r2=12037&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/relax_gui.py (original)
+++ branches/bieri_gui/gui_bieri/relax_gui.py Thu Dec 30 15:15:01 2010
@@ -420,7 +420,6 @@
         ds.relax_gui.results_rx = []
         ds.relax_gui.results_model_free = []
         ds.relax_gui.global_setting = ['1.02 * 1e-10', '-172 * 1e-6', 'N', 
'H', '11', 'newton', '500']
-        ds.relax_gui.file_setting = [1, 2, 3, 4, 5, 6, 7]
 
         # Table of relax Results
         ds.relax_gui.table_residue = []
@@ -529,7 +528,7 @@
         global global_setting #import global variable
         if question('Do you realy want to change relax settings?'):
             ds.relax_gui.global_setting = ['1.02 * 1e-10', '-172 * 1e-6', 
'N', 'H', '11', 'newton', '500']
-            ds.relax_gui.file_setting = [1, 2, 3, 4, 5, 6, 7]
+            ds.relax_gui.free_file_format.reset()
 
 
     def settings(self, event): # set up for relax variables

Modified: branches/bieri_gui/gui_bieri/settings.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/settings.py?rev=12037&r1=12036&r2=12037&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/settings.py (original)
+++ branches/bieri_gui/gui_bieri/settings.py Thu Dec 30 15:15:01 2010
@@ -252,14 +252,13 @@
 
 
     def accept_settings(self, event): # change settings
-        ds.relax_gui.file_setting = []
-        ds.relax_gui.file_setting.append(gui_to_int(self.mol_nam.GetValue()))
-        
ds.relax_gui.file_setting.append(gui_to_int(self.res_num_col.GetValue()))
-        
ds.relax_gui.file_setting.append(gui_to_int(self.res_nam_col.GetValue()))
-        
ds.relax_gui.file_setting.append(gui_to_int(self.spin_num_col.GetValue()))
-        
ds.relax_gui.file_setting.append(gui_to_int(self.spin_nam_col.GetValue()))
-        
ds.relax_gui.file_setting.append(gui_to_int(self.value_col.GetValue()))
-        
ds.relax_gui.file_setting.append(gui_to_int(self.error_col.GetValue()))
+        ds.relax_gui.free_file_format.mol_name_col =  
gui_to_int(self.mol_nam.GetValue())
+        ds.relax_gui.free_file_format.res_num_col =   
gui_to_int(self.res_num_col.GetValue())
+        ds.relax_gui.free_file_format.res_name_col =  
gui_to_int(self.res_nam_col.GetValue())
+        ds.relax_gui.free_file_format.spin_num_col =  
gui_to_int(self.spin_num_col.GetValue())
+        ds.relax_gui.free_file_format.spin_name_col = 
gui_to_int(self.spin_nam_col.GetValue())
+        ds.relax_gui.free_file_format.data_col =      
gui_to_int(self.value_col.GetValue())
+        ds.relax_gui.free_file_format.err_col =       
gui_to_int(self.error_col.GetValue())
 
         # Update the fields.
         self.update()
@@ -274,10 +273,10 @@
     def update(self):
         """Update all the fields."""
 
-        self.mol_nam =      wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.file_setting[0]))
-        self.res_num_col =  wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.file_setting[1]))
-        self.res_nam_col =  wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.file_setting[2]))
-        self.spin_num_col = wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.file_setting[3]))
-        self.spin_nam_col = wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.file_setting[4]))
-        self.value_col =    wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.file_setting[5]))
-        self.error_col =    wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.file_setting[6]))
+        self.mol_nam =      wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.free_file_format.mol_name_col))
+        self.res_num_col =  wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.free_file_format.res_num_col))
+        self.res_nam_col =  wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.free_file_format.res_name_col))
+        self.spin_num_col = wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.free_file_format.spin_num_col))
+        self.spin_nam_col = wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.free_file_format.spin_name_col))
+        self.value_col =    wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.free_file_format.data_col))
+        self.error_col =    wx.TextCtrl(self, -1, 
int_to_gui(ds.relax_gui.free_file_format.err_col))

Modified: branches/bieri_gui/gui_bieri/user_functions/base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/base.py?rev=12037&r1=12036&r2=12037&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/user_functions/base.py (original)
+++ branches/bieri_gui/gui_bieri/user_functions/base.py Thu Dec 30 15:15:01 
2010
@@ -28,6 +28,7 @@
 from wx.lib import buttons
 
 # relax module imports.
+from data import Relax_data_store; ds = Relax_data_store()
 from relax_errors import AllRelaxErrors, RelaxImplementError
 
 # relax GUI module imports.




Related Messages


Powered by MHonArc, Updated Thu Dec 30 15:40:02 2010