changeset 1:4f7c5cad3377 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/autodock_vina commit ed9b6859de648aa5f7cde483732f5df20aaff90e
author bgruening
date Tue, 07 May 2019 13:31:59 -0400
parents 761762031eee
children 73c2c9774c2d
files calc_vina_box_params.py prepare_box.xml
diffstat 2 files changed, 45 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/calc_vina_box_params.py	Wed Apr 17 09:11:01 2019 -0400
+++ b/calc_vina_box_params.py	Tue May 07 13:31:59 2019 -0400
@@ -2,6 +2,7 @@
 from rdkit import Chem
 from rdkit.Chem import rdShapeHelpers
 import argparse
+from random import randint
 
 
 def get_params(options):
@@ -27,6 +28,10 @@
     # optionally add buffers in each direction - expansion
     box_dims = [dims[0] + options.bufx, dims[1] + options.bufy, dims[2] + options.bufz]
 
+    # if no seed set, then randomly generate one between 0 and 2**31
+    if options.seed == None:
+        options.seed = randint(0, 2147483647)
+
     with open(options.output, 'w') as f:
         f.write(
             """
@@ -40,8 +45,8 @@
 energy_range = 9999
 exhaustiveness = {}
 cpu = 4
-seed = 1
-            """.format(box_dims[0], box_dims[1], box_dims[2], center[0], center[1], center[2], options.exhaustiveness)
+seed = {}
+            """.format(box_dims[0], box_dims[1], box_dims[2], center[0], center[1], center[2], options.exhaustiveness, options.seed)
         )
 
 
@@ -51,7 +56,7 @@
     generate the input parameters for an autodock vina job. The output file can be fed into
     the autodock vina tool as an alternative to creating the parameter file manually. 
     
-    Optionally, you can include a 'buffer' in each of the x,y and z directions (in angstroms),
+    Optionally, you can include a 'buffer' in each of the x,y and z directions (in Å),
     which will be added to the confounding box in the appropriate direction.
     """)
     parser.add_argument('--ligand', dest='ligand_path', help='The input ligand (mol file)')
@@ -64,6 +69,7 @@
                                                                            '(float - in angs.)')
     parser.add_argument('--bufz', dest='bufz', default=0, type=float, help='the buffer in the z direction '
                                                                            '(float - in angs.)')
+    parser.add_argument('--seed', dest='seed', default=None, type=int, help='Random seed for reproducibility')
 
     options = parser.parse_args()
     get_params(options)
--- a/prepare_box.xml	Wed Apr 17 09:11:01 2019 -0400
+++ b/prepare_box.xml	Tue May 07 13:31:59 2019 -0400
@@ -12,18 +12,24 @@
         --bufy '$bufy'
         --bufz '$bufz'
         --exh '$exh'
+        #if $seed_value:
+            --seed '$seed_value'
+        #end if
     ]]></command>
     <inputs>
-        <param type="data" name="input1" format="mol" label="input ligand mol file"
+        <param type="data" name="input1" format="mol" label="Input ligand"
             help="The input ligand (mol file)"/>
         <param name="bufx" type="float" value="0" label="x-axis buffer"
-            help="the buffer in the x direction (in angs.)"/>
+            help="Buffer in the x direction (in angs.)"/>
         <param name="bufy" type="float" value="0" label="y-axis buffer"
-            help="the buffer in the y direction (in angs.)"/>
+            help="Buffer in the y direction (in angs.)"/>
         <param name="bufz" type="float" value="0" label="z-axis buffer"
-            help="the buffer in the z direction (in angs.)"/>
-        <param name="exh" type="integer" value="0" label="exhaustiveness"
-            help="The number of poses to return from docking job"/>
+            help="Buffer in the z direction (in angs.)"/>
+        <param name="exh" type="integer" value="0" label="Exhaustiveness"
+            help="Number of poses to return from docking job"/>
+        <!-- <param name="seed" type="boolean" label="Specify random seed for simulation reproducibility?"/> -->
+        <param type="integer" name="seed_value" optional="true" label="Random seed (optional)" 
+            help="Choose a seed value; if none is selected, a seed will be chosen randomly"/>
     </inputs>
     <outputs>
         <data name="output1" format="txt" />
@@ -35,14 +41,16 @@
             <param name="bufy" value="2" />
             <param name="bufz" value="3" />
             <param name="exh" value="10" />
+            <param name="seed_value" value="1" />
             <output name="output1" file="box_params.txt" />
         </test>
     </tests>
-    <help><![CDATA[
+    <help>
+<![CDATA[
 
 .. class:: infomark
 
-**Description:**
+**Description**
 
 This tool calculates a confounding box around an input ligand (mol file), and
 uses it to generate the input parameters for an autodock vina job.
@@ -51,46 +59,45 @@
 parameter file manually.
 
 -----
+
 .. class:: infomark
 
 **Inputs:**
 
 This tool requires:
-* An input ligand - This should be a mol file representing the ligand you wish to dock.
-This should be derived from the file you use to prepare the ligand for the docking job
-(see prepare ligand tool).
+
+* An input ligand - This should be a mol file representing the ligand you wish to dock. This should be derived from the file you use to prepare the ligand for the docking job (see prepare ligand tool).
 
-* OPTIONAL Buffers for each direction (x,y,z), which defaults to 0 angstroms. This value
-will be added to the confounding box that the tool generates in each respective direction.
-We recommend that you visualise the calculated box from an initial run of this tool, and
-calculate the expansion needed in each direction to cover the area of the binding site
-you wish to explore.
+* (OPTIONAL) Buffers for each direction (x,y,z), which defaults to 0 Å. This value will be added to the confounding box that the tool generates in each respective direction. We recommend that you visualise the calculated box from an initial run of this tool, and calculate the expansion needed in each direction to cover the area of the binding site you wish to explore.
+
 
 -----
+
 .. class:: infomark
 
 **Output:**
 
 The output for this tool is a txt file containing the parameters needed to run an autodock
-vina docking calculation with the docking tool. For example:
+vina docking calculation with the docking tool. For example: ::
 
-size_x =  12.443000000000001
-size_y =  11.888
-size_z =  9.290999999999997
-center_x =  -29.8395
-center_y =  4.364
-center_z =  -64.5925
-num_modes = 9999
-energy_range = 9999
-exhaustiveness = 10
-cpu = 4
-seed = 1
+    size_x =  12.443000000000001
+    size_y =  11.888
+    size_z =  9.290999999999997
+    center_x =  -29.8395
+    center_y =  4.364
+    center_z =  -64.5925
+    num_modes = 9999
+    energy_range = 9999
+    exhaustiveness = 10
+    cpu = 4
+    seed = 1
 
 The values for num_modes, energy range, cpu and seed are set to default values here.
 
 This file can be used as the box parameter for the docking tool.
 
-    ]]></help>
+]]>
+    </help>
     <citations>
         <citation type="bibtex">
             @article{rdkit,