mailr25859 - /trunk/auto_analyses/relax_disp_repeat_cpmg.py


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

Header


Content

Posted by tlinnet on September 16, 2014 - 19:45:
Author: tlinnet
Date: Tue Sep 16 19:45:59 2014
New Revision: 25859

URL: http://svn.gna.org/viewcvs/relax?rev=25859&view=rev
Log:
Trying implementing flexibility, when data expected data is missing.

This can be due failing of processing data, where a whole run of data is 
randomly skipped.

Task #7826 (https://gna.org/task/index.php?7826): Write an python class for 
the repeated analysis of dispersion data.

Modified:
    trunk/auto_analyses/relax_disp_repeat_cpmg.py

Modified: trunk/auto_analyses/relax_disp_repeat_cpmg.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/auto_analyses/relax_disp_repeat_cpmg.py?rev=25859&r1=25858&r2=25859&view=diff
==============================================================================
--- trunk/auto_analyses/relax_disp_repeat_cpmg.py       (original)
+++ trunk/auto_analyses/relax_disp_repeat_cpmg.py       Tue Sep 16 19:45:59 
2014
@@ -238,6 +238,11 @@
             # Sort the file list Alphanumeric.
             peaks_file_list = sort_filenames(filenames=peaks_file_list)
 
+            # If there is no peak list, then continue.
+            if len(peaks_file_list) == 0:
+                finished = False
+                continue
+
             # There should only be one peak file.
             for peaks_file in peaks_file_list:
                 self.interpreter.spectrum.read_intensities(file=peaks_file, 
spectrum_id=spectrum_ids, int_method=self.int_method, 
int_col=range(len(spectrum_ids)))
@@ -264,6 +269,10 @@
                     rmsd = float(extract_data(file=rmsd_file)[0][0])
                     self.interpreter.spectrum.baseplane_rmsd(error=rmsd, 
spectrum_id=spectrum_id)
 
+                finished = True
+
+            return finished
+
 
     def do_spectrum_error_analysis(self, pipe_name, set_rep=None):
         """Do spectrum error analysis, where both replicates per 
spectrometer frequency and subset is taken into consideration."""
@@ -320,8 +329,10 @@
 
                 if not found:
                     calculate = True
+                    finished = False
                 elif found:
                     calculate = False
+                    finished = True
 
                 if calculate:
                     # Create the data pipe, by copying setup pipe.
@@ -329,14 +340,21 @@
                     self.interpreter.pipe.switch(pipe_name)
 
                     # Call set intensity.
-                    self.set_intensity_and_error(pipe_name=pipe_name, 
glob_ini=glob_ini, set_rmsd=set_rmsd)
-
-                    # Call error analysis.
-                    self.do_spectrum_error_analysis(pipe_name=pipe_name, 
set_rep=set_rep)
-
-                    # Save results, and store the current settings dic to 
pipe.
-                    cdp.settings = self.settings
-                    self.interpreter.results.write(file=resfile, dir=path, 
force=force)
+                    finished = 
self.set_intensity_and_error(pipe_name=pipe_name, glob_ini=glob_ini, 
set_rmsd=set_rmsd)
+
+                    if finished:
+                        # Call error analysis.
+                        self.do_spectrum_error_analysis(pipe_name=pipe_name, 
set_rep=set_rep)
+
+                        # Save results, and store the current settings dic 
to pipe.
+                        cdp.settings = self.settings
+                        self.interpreter.results.write(file=resfile, 
dir=path, force=force)
+
+                    else:
+                        pipe_name = pipes.cdp_name()
+                        self.interpreter.pipe.delete(pipe_name=pipe_name)
+
+                return finished
 
 
     def calc_r2eff(self, methods=None, list_glob_ini=None, force=False):
@@ -366,7 +384,9 @@
                     intensity_pipe_name = self.name_pipe(method=self.method, 
model='setup', analysis='int', glob_ini=glob_ini)
 
                     if not pipes.has_pipe(intensity_pipe_name):
-                        self.set_int(methods=[method], 
list_glob_ini=[glob_ini])
+                        finished = self.set_int(methods=[method], 
list_glob_ini=[glob_ini])
+                        if not finished:
+                            continue
 
                     
self.interpreter.pipe.copy(pipe_from=intensity_pipe_name, pipe_to=pipe_name, 
bundle_to=self.method)
                     self.interpreter.pipe.switch(pipe_name)
@@ -883,7 +903,7 @@
             if not pipes.has_pipe(pipe_name):
                 self.set_int(methods=[method], list_glob_ini=[glob_ini])
 
-            if pipes.get_pipe() != pipe_name:
+            if pipes.cdp_name() != pipe_name:
                 self.interpreter.pipe.switch(pipe_name)
 
             # Results dictionary.
@@ -1028,8 +1048,11 @@
             if not pipes.has_pipe(pipe_name):
                 self.calc_r2eff(methods=[method], list_glob_ini=[glob_ini])
 
-            if pipes.get_pipe() != pipe_name:
+            if pipes.cdp_name() != pipe_name and pipes.has_pipe(pipe_name):
                 self.interpreter.pipe.switch(pipe_name)
+
+            else:
+                continue
 
             # Results dictionary.
             res_dic[str(glob_ini)] = {}
@@ -1371,10 +1394,12 @@
         # Write png.
         png_file_name = file_name_ini + '.png'
         png_file_path = get_file_path(file_name=png_file_name, 
dir=self.results_dir)
-        plt.savefig(png_file_path, bbox_inches='tight')
 
         # Write to file.
         if write_stats:
+            # save figure
+            plt.savefig(png_file_path, bbox_inches='tight')
+
             file_name = file_name_ini + '.txt'
             path = self.results_dir
             file_obj, file_path = open_write_file(file_name=file_name, 
dir=path, force=True, compress_type=0, verbosity=1, return_path=True)




Related Messages


Powered by MHonArc, Updated Tue Sep 16 20:00:03 2014