mailr11298 - /1.3/auto_analyses/noe.py


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

Header


Content

Posted by edward on July 13, 2010 - 13:28:
Author: bugman
Date: Tue Jul 13 13:28:44 2010
New Revision: 11298

URL: http://svn.gna.org/viewcvs/relax?rev=11298&view=rev
Log:
Major patch for integrating the GUI into the noe calculation.

This patch is from Michael Bieri (https://gna.org/users/michaelbieri) and is 
from file #9490
(https://gna.org/support/download.php?file_id=9490) attached to task #6847
(https://gna.org/task/?6847).

Changes include:
- output filename can be specified
- folder, where results files will be placed, can be specified
- label of hetero nucleus and proton of peak lists and pdb file can be 
selected
- sequence is read either by sequence file or pdb file
- removed white spaces and progress output.


Modified:
    1.3/auto_analyses/noe.py

Modified: 1.3/auto_analyses/noe.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/auto_analyses/noe.py?rev=11298&r1=11297&r2=11298&view=diff
==============================================================================
--- 1.3/auto_analyses/noe.py (original)
+++ 1.3/auto_analyses/noe.py Tue Jul 13 13:28:44 2010
@@ -35,9 +35,13 @@
 
 
 class NOE_calc:
-    def __init__(self, pipe_name='noe', noe_ref = None, noe_ref_rmsd = None, 
noe_sat = None, noe_sat_rmsd = None, freq = '', unresolved = None, pdb_file = 
None, results_folder = None, int_method='height', mc_num=500):
+    def __init__(self, output_file='noe.out', seq_args=None, 
pipe_name='noe', noe_ref=None, noe_ref_rmsd=None, noe_sat=None, 
noe_sat_rmsd=None, unresolved=None, pdb_file=None, results_folder=None, 
int_method='height', heteronuc='N', proton='H', heteronuc_pdb='N'):
         """Perform relaxation curve fitting.
 
+        @keyword output_file:   Name of the output file.
+        @type output_file:      str
+        @keyword seq_args:      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.
+        @type seq_args:         list of lists of [str, None or str, None or 
int, None or int, None or int, None or int, None or int, None or int, None or 
int, None or str]
         @keyword pipe_name:     The name of the data pipe to create.
         @type pipe_name:        str
         @keyword noe_ref:       The NOE reference peak file.
@@ -48,8 +52,6 @@
         @type sat_ref:          file
         @keyword noe_sat_rmsd:  Background RMSD of saturated NOE spectrum.
         @type noe_sat_rmsd:     int
-        @keyword frq:           Frequency of current set up.
-        @type frq:              int
         @keyword unresolved:    Residues to exclude.
         @type unresolved:       str
         @keyword pdb_file:      Structure file in pdb format.
@@ -58,23 +60,29 @@
         @type results_folder:   str
         @keyword int_method:    The integration method, one of 'height', 
'point sum' or 'other'.
         @type int_method:       str
-        @keyword mc_num:        The number of Monte Carlo simulations to be 
used for error analysis at the end of the analysis.
-        @type mc_num:           int
+        @keyword heteronuc:     Name of heteronucleus of peak list.
+        @type heteronuc:        str
+        @keyword proton:        Name of proton of peak list.
+        @type proton:           str
+        @keyword heteronuc_pdb: Name of heteronucleus of PDB file.
+        @type heteronuc_pdb:    str
         """
 
         # Store the args.
-        self.pipe_name = pipe_name + ' ' + 
str(time.asctime(time.localtime())) # add date and time to allow multiple 
executions of relax_fit
+        self.pipe_name = pipe_name
+        self.output_file = output_file
         self.noe_sat = noe_sat
         self.noe_sat_rmsd = noe_sat_rmsd
         self.noe_ref = noe_ref
         self.noe_ref_rmsd =noe_ref_rmsd
-        self.frq = freq
         self.unresolved = unresolved
         self.pdb_file = pdb_file
         self.results_folder = results_folder
-        self.grace_dir = results_folder + sep + 'grace'
+        self.grace_dir = results_folder+sep+'grace'
         self.int_method = int_method
-        self.mc_num = mc_num
+        self.heteronuc = heteronuc
+        self.proton = proton
+        self.heteronuc_pdb = heteronuc_pdb
 
         # User variable checks.
         self.check_vars()
@@ -95,66 +103,47 @@
         self.interpreter.pipe.create(self.pipe_name, 'noe')
 
         # Load the sequence.
-        if self.pdb_file == '!!! Sequence file selected !!!': # load 
sequence of file
-            print 'Sequence file'  # FIXME
-            #self.interpreter.sequence.read(file=self.seq_args[0], 
dir=self.seq_args[1], mol_name_col=self.seq_args[2], 
res_num_col=self.seq_args[3], res_name_col=self.seq_args[4], 
spin_num_col=self.seq_args[5], spin_name_col=self.seq_args[6], 
sep=self.seq_args[7])
-            
-        else:   # load PDB File
+        if self.pdb_file:   # load PDB File
             self.interpreter.structure.read_pdb(self.pdb_file)
-            generic_fns.structure.main.load_spins(spin_id='@N')
-        
-        # Update Progress bar
-        print 'Progress: 20%'
-        
+            generic_fns.structure.main.load_spins(spin_id=heteronuc_pdb)
+
+        else:
+            self.interpreter.sequence.read(file=self.seq_args[0], 
dir=self.seq_args[1], mol_name_col=self.seq_args[2], 
res_num_col=self.seq_args[3], res_name_col=self.seq_args[4], 
spin_num_col=self.seq_args[5], spin_name_col=self.seq_args[6], 
sep=self.seq_args[7])
+
         # Load the reference spectrum and saturated spectrum peak 
intensities.
-        self.interpreter.spectrum.read_intensities(file=self.noe_ref, 
spectrum_id='ref', int_method=self.int_method, heteronuc='N', proton='H')
-        self.interpreter.spectrum.read_intensities(file=self.noe_sat, 
spectrum_id='sat', int_method=self.int_method, heteronuc='N', proton='H')
+        self.interpreter.spectrum.read_intensities(file=self.noe_ref, 
spectrum_id='ref', int_method=self.int_method, heteronuc=self.heteronuc, 
proton=self.proton)
+        self.interpreter.spectrum.read_intensities(file=self.noe_sat, 
spectrum_id='sat', int_method=self.int_method, heteronuc=self.heteronuc, 
proton=self.proton)
 
         # Set the spectrum types.
         self.interpreter.noe.spectrum_type('ref', 'ref')
         self.interpreter.noe.spectrum_type('sat', 'sat')
-        
+
         # Set the errors.
         self.interpreter.spectrum.baseplane_rmsd(error=self.noe_ref_rmsd, 
spectrum_id='ref')
         self.interpreter.spectrum.baseplane_rmsd(error=self.noe_sat_rmsd, 
spectrum_id='sat')
-        
-        # Update Progress bar
-        print 'Progress: 40%'
-        
+
         # Peak intensity error analysis.
         self.interpreter.spectrum.error_analysis()
-        
+
         # Deselect unresolved spins.
-        if self.unresolved == '':
-            print ''
-        else:
-            self.interpreter.deselect.read(file='unresolved') # FIXME. relax 
should read the list without creating a file
+        self.interpreter.deselect.read(file=self.unresolved)
 
         # Calculate the NOEs.
         self.interpreter.calc()
 
-        # Update Progress bar
-        print 'Progress: 60%'
-        
         # Save the NOEs.
-        self.interpreter.value.write(param='noe', 
file='noe_'+str(self.frq)+'.out', dir = self.results_folder, force=True)
+        self.interpreter.value.write(param='noe', file=self.output_file, dir 
= self.results_folder, force=True)
 
         # Create grace files.
-        self.interpreter.grace.write(y_data_type='ref', file='ref.agr', dir 
= self.grace_dir, force=True)
-        self.interpreter.grace.write(y_data_type='sat', file='sat.agr', dir 
= self.grace_dir, force=True)
-        self.interpreter.grace.write(y_data_type='noe', file='noe.agr', dir 
= self.grace_dir, force=True)
-
-        # Update Progress bar
-        print 'Progress: 80%'
+        self.interpreter.grace.write(y_data_type='ref', file='ref.agr', 
dir=self.grace_dir, force=True)
+        self.interpreter.grace.write(y_data_type='sat', file='sat.agr', 
dir=self.grace_dir, force=True)
+        self.interpreter.grace.write(y_data_type='noe', file='noe.agr', 
dir=self.grace_dir, force=True)
 
         # Write the results.
         self.interpreter.results.write(file='results', 
dir=self.results_folder, force=True)
 
         # Save the program state.
         self.interpreter.state.save(state = 'save', dir=self.results_folder, 
force=True)
-
-        # Update Progress bar
-        print 'Progress: 100%'
 
 
     def check_vars(self):




Related Messages


Powered by MHonArc, Updated Thu Jul 15 13:20:02 2010