mailr22892 - in /trunk: specific_analyses/relax_disp/sherekhan.py user_functions/relax_disp.py


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

Header


Content

Posted by tlinnet on April 30, 2014 - 15:05:
Author: tlinnet
Date: Wed Apr 30 15:05:50 2014
New Revision: 22892

URL: http://svn.gna.org/viewcvs/relax?rev=22892&view=rev
Log:
Modified the relax_disp.sherekhan_input to accept dir as input.

bug #21995: (https://gna.org/bugs/index.php?21995) Creating sherekhan input 
files, with data for several fields and different time_T2

Modified:
    trunk/specific_analyses/relax_disp/sherekhan.py
    trunk/user_functions/relax_disp.py

Modified: trunk/specific_analyses/relax_disp/sherekhan.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/sherekhan.py?rev=22892&r1=22891&r2=22892&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/sherekhan.py     (original)
+++ trunk/specific_analyses/relax_disp/sherekhan.py     Wed Apr 30 15:05:50 
2014
@@ -26,26 +26,29 @@
 import dep_check
 
 # Python module imports.
+from os import sep
 PIPE, Popen = None, None
 if dep_check.subprocess_module:
     from subprocess import PIPE, Popen
 
 # relax module imports.
 from lib.errors import RelaxError, RelaxNoSequenceError
-from lib.io import open_write_file
+from lib.io import mkdir_nofail, open_write_file
 from lib.physical_constants import g1H, g15N
 from pipe_control import pipes
 from pipe_control.mol_res_spin import exists_mol_res_spin_data, 
return_residue
 from specific_analyses.relax_disp.data import loop_cluster, loop_exp_frq, 
loop_offset_point, return_param_key_from_data, spin_ids_to_containers
 
 
-def sherekhan_input(spin_id=None, force=False):
+def sherekhan_input(spin_id=None, force=False, dir='ShereKhan'):
     """Create the ShereKhan input files.
 
     @keyword spin_id:           The spin ID string to restrict the file 
creation to.
     @type spin_id:              str
     @keyword force:             A flag which if True will cause all 
pre-existing files to be overwritten.
     @type force:                bool
+    @keyword dir:               The optional directory to place the files 
into.  If None, then the files will be placed into the current directory.
+    @type dir:                  str or None
     """
 
     # Test if the current pipe exists.
@@ -63,6 +66,10 @@
     if not hasattr(cdp, 'model_type'):
         raise RelaxError("The relaxation dispersion model has not been 
specified.")
 
+    # Directory creation.
+    if dir != None:
+        mkdir_nofail(dir, verbosity=0)
+
     # Loop over the spin blocks.
     cluster_index = 0
     for spin_ids in loop_cluster():
@@ -73,7 +80,10 @@
         for exp_type, frq, ei, mi in loop_exp_frq(return_indices=True):
             # The ShereKhan input file for the spin cluster.
             file_name = 'sherekhan_frq%s.in' % (mi+1)
-            dir_name = 'cluster%s' % (cluster_index+1)
+            if dir != None:
+                dir_name = dir + sep + 'cluster%s' % (cluster_index+1)
+            else:
+                dir_name = 'cluster%s' % (cluster_index+1)
             file = open_write_file(file_name=file_name, dir=dir_name, 
force=force)
 
             # The B0 field for the nuclei of interest in MHz (must be 
positive to be accepted by the server).

Modified: trunk/user_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/user_functions/relax_disp.py?rev=22892&r1=22891&r2=22892&view=diff
==============================================================================
--- trunk/user_functions/relax_disp.py  (original)
+++ trunk/user_functions/relax_disp.py  Wed Apr 30 15:05:50 2014
@@ -949,6 +949,14 @@
     desc = "The spin identification string.",
     can_be_none = True
 )
+uf.add_keyarg(
+    name = "dir",
+    py_type = "str",
+    arg_type = "dir sel",
+    desc_short = "directory name",
+    desc = "The directory name to place ShereKhan cluster folders into.",
+    can_be_none = True
+)
 # Description.
 uf.desc.append(Desc_container())
 uf.desc[-1].add_paragraph("This creates the files required for the ShereKhan 
server located at http://sherekhan.bionmr.org/.  One file per spin cluster 
per field strength will be created.  These will be placed in the directory 
'clusterx' and named 'sherekhan_frqy.in', where x is the cluster index 
starting from 1 and y is the magnetic field strength index starting from 1.")




Related Messages


Powered by MHonArc, Updated Wed Apr 30 15:20:03 2014