changeset 3:908880455b2d draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/autodock_vina commit deb7ad38cefd13df312431b1138054a68381efdf"
author bgruening
date Fri, 18 Oct 2019 04:57:34 -0400
parents 73c2c9774c2d
children ad35eaa204ea
files calc_vina_box_params.py prepare_box.xml test-data/NUDT5A-x0114_2.mol2 test-data/NUDT5A-x0114_2.pdb test-data/NUDT5A-x0114_2.sdf
diffstat 5 files changed, 147 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/calc_vina_box_params.py	Wed Oct 02 12:49:11 2019 -0400
+++ b/calc_vina_box_params.py	Fri Oct 18 04:57:34 2019 -0400
@@ -4,12 +4,21 @@
 import argparse
 from random import randint
 
+def get_mol_from_file(fname, ftype):
+    if ftype in ['mol', 'sdf']:
+        mol = Chem.MolFromMolFile(options.ligand_path)
+    elif ftype == 'pdb':
+        mol = Chem.MolFromPDBFile(options.ligand_path)
+    elif ftype == 'mol2':
+        mol = Chem.MolFromMol2File(options.ligand_path)
+    else:
+        raise IOError
+    if not mol:
+        raise IOError
+    return mol
 
 def get_params(options):
-    # make sure we have a mol file by initiating rdkit mol object from input
-    mol = Chem.MolFromMolFile(options.ligand_path)
-    if not mol:
-        raise IOError
+    mol = get_mol_from_file(options.ligand_path, options.ftype)
 
     # get rdkit conformer and compute x,y,z of top and bottom corner of confounding cuboid
     conf = mol.GetConformer()
@@ -51,14 +60,15 @@
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description="""
-    This tool calculates a confounding box around an input ligand (mol file), and uses it to
+    This tool calculates a confounding box around an input ligand, and uses it to
     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 Å),
     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)')
+    parser.add_argument('--ligand', dest='ligand_path', help='The input ligand filepath.')
+    parser.add_argument('--ftype', dest='ftype', help='Filetype of the input ligand (mol, sdf, pdb, mol2)')
     parser.add_argument('--config', dest='output', help='The output file containing calculated params (txt)')
     parser.add_argument('--exh', dest='exhaustiveness', type=int, help='Exhaustiveness of global search')
     parser.add_argument('--bufx', dest='bufx', default=0, type=float, help='the buffer in the x direction '
--- a/prepare_box.xml	Wed Oct 02 12:49:11 2019 -0400
+++ b/prepare_box.xml	Fri Oct 18 04:57:34 2019 -0400
@@ -1,12 +1,13 @@
-<tool id="prepare_box" name="Calculate the box parameters for an AutoDock Vina" version="0.1.0">
-    <description>job from an input mol file (confounding box)</description>
+<tool id="prepare_box" name="Calculate the box parameters for an AutoDock Vina" version="0.1.1">
+    <description>job from a ligand input file (confounding box)</description>
     <requirements>
-        <requirement type="package" version="2019.03.1.0">rdkit</requirement>
+        <requirement type="package" version="2019.03.1">rdkit</requirement>
         <requirement type="package" version="1.16.2">numpy</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
         python '$__tool_directory__/calc_vina_box_params.py'
         --ligand '$ligand'
+        --ftype '${ligand.ext}'
         --config '$output'
         --bufx '$bufx'
         --bufy '$bufy'
@@ -19,8 +20,8 @@
         #end if
     ]]></command>
     <inputs>
-        <param type="data" name="ligand" format="mol" label="Input ligand"
-            help="The input ligand (mol file)"/>
+        <param type="data" name="ligand" format="mol,sdf,pdb,mol2" label="Input ligand"
+            help="The input ligand with three-dimensional coordinates (MOL, SDF, PDB and MOL formats supported)."/>
         <param name="bufx" type="float" value="0" label="x-axis buffer"
             help="Buffer in the x direction (in angs.)"/>
         <param name="bufy" type="float" value="0" label="y-axis buffer"
@@ -37,14 +38,30 @@
     </outputs>
     <tests>
         <test>
-            <param name="ligand" value="NUDT5A-x0114_2.mol" />
+            <param name="ligand" value="NUDT5A-x0114_2.mol" ftype="mol"/>
             <param name="bufx" value="1" />
             <param name="bufy" value="2" />
             <param name="bufz" value="3" />
             <output name="output" file="box_params_1.txt" />
         </test>
         <test>
-            <param name="ligand" value="NUDT5A-x0114_2.mol" />
+            <param name="ligand" value="NUDT5A-x0114_2.sdf" ftype="sdf"/>
+            <param name="bufx" value="1" />
+            <param name="bufy" value="2" />
+            <param name="bufz" value="3" />
+            <param name="exh" value="10" />
+            <param name="seed_value" value="1" />
+            <output name="output" file="box_params_2.txt" />
+        </test>
+        <test>
+            <param name="ligand" value="NUDT5A-x0114_2.mol2"/>
+            <param name="bufx" value="1" />
+            <param name="bufy" value="2" />
+            <param name="bufz" value="3" />
+            <output name="output" file="box_params_1.txt" />
+        </test>
+        <test>
+            <param name="ligand" value="NUDT5A-x0114_2.pdb" ftype="pdb"/>
             <param name="bufx" value="1" />
             <param name="bufy" value="2" />
             <param name="bufz" value="3" />
@@ -60,10 +77,10 @@
 
 **Description**
 
-This tool calculates a confounding box around an input ligand (mol file), and
+This tool calculates a confounding box around an input ligand and
 uses it to 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
+The output file can be fed into the AutoDock Vina tool as an alternative to creating the
 parameter file manually.
 
 -----
@@ -74,7 +91,7 @@
 
 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 file (MOL, SDF, PDB or MOL2 format) representing the ligand you wish to dock.
 
 * (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.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/NUDT5A-x0114_2.mol2	Fri Oct 18 04:57:34 2019 -0400
@@ -0,0 +1,37 @@
+@<TRIPOS>MOLECULE
+*****
+ 14 15 0 0 0
+SMALL
+GASTEIGER
+
+@<TRIPOS>ATOM
+      1 N         -29.7210    5.1080  -63.9440 N.am    1  UNL1       -0.1674
+      2 C         -32.1200    1.4200  -65.7380 C.3     1  UNL1        0.0031
+      3 O         -32.3550    4.2720  -63.4470 O.3     1  UNL1       -0.3470
+      4 C         -32.1450    2.9190  -65.4240 C.3     1  UNL1        0.0388
+      5 C         -33.5610    3.5680  -65.3800 C.3     1  UNL1        0.0350
+      6 C         -33.4090    4.6780  -64.3250 C.3     1  UNL1        0.1428
+      7 C         -31.5300    3.2840  -64.0390 C.3     1  UNL1        0.1928
+      8 C         -30.0640    3.7560  -64.2700 C.2     1  UNL1        0.2733
+      9 C         -28.4710    5.7300  -64.0910 C.ar    1  UNL1        0.1429
+     10 C         -28.1090    7.0310  -63.7420 C.ar    1  UNL1        0.1474
+     11 N         -26.7490    7.3080  -64.0480 N.ar    1  UNL1       -0.1374
+     12 N         -26.1180    6.3750  -64.5730 N.ar    1  UNL1       -0.1080
+     13 O         -29.2560    2.9400  -64.7040 O.2     1  UNL1       -0.2703
+     14 S         -27.0620    4.9230  -64.8090 S.2     1  UNL1        0.0542
+@<TRIPOS>BOND
+     1     1     8   am
+     2     1     9    1
+     3     3     6    1
+     4     3     7    1
+     5     4     2    1
+     6     4     5    1
+     7     4     7    1
+     8     5     6    1
+     9     7     8    1
+    10     8    13    2
+    11     9    10   ar
+    12     9    14   ar
+    13    10    11   ar
+    14    11    12   ar
+    15    12    14   ar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/NUDT5A-x0114_2.pdb	Fri Oct 18 04:57:34 2019 -0400
@@ -0,0 +1,32 @@
+COMPND    UNNAMED
+AUTHOR    GENERATED BY OPEN BABEL 2.4.1
+HETATM    1  N   UNL     1     -29.721   5.108 -63.944  1.00  0.00           N  
+HETATM    2  C   UNL     1     -32.120   1.420 -65.738  1.00  0.00           C  
+HETATM    3  O   UNL     1     -32.355   4.272 -63.447  1.00  0.00           O  
+HETATM    4  C   UNL     1     -32.145   2.919 -65.424  1.00  0.00           C  
+HETATM    5  C   UNL     1     -33.561   3.568 -65.380  1.00  0.00           C  
+HETATM    6  C   UNL     1     -33.409   4.678 -64.325  1.00  0.00           C  
+HETATM    7  C   UNL     1     -31.530   3.284 -64.039  1.00  0.00           C  
+HETATM    8  C   UNL     1     -30.064   3.756 -64.270  1.00  0.00           C  
+HETATM    9  C   UNL     1     -28.471   5.730 -64.091  1.00  0.00           C  
+HETATM   10  C   UNL     1     -28.109   7.031 -63.742  1.00  0.00           C  
+HETATM   11  N   UNL     1     -26.749   7.308 -64.048  1.00  0.00           N  
+HETATM   12  N   UNL     1     -26.118   6.375 -64.573  1.00  0.00           N  
+HETATM   13  O   UNL     1     -29.256   2.940 -64.704  1.00  0.00           O  
+HETATM   14  S   UNL     1     -27.062   4.923 -64.809  1.00  0.00           S  
+CONECT    1    8    9                                                 
+CONECT    2    4                                                      
+CONECT    3    6    7                                                 
+CONECT    4    2    5    7                                            
+CONECT    5    4    6                                                 
+CONECT    6    3    5                                                 
+CONECT    7    3    4    8                                            
+CONECT    8    1    7   13                                            
+CONECT    9    1   10   14                                            
+CONECT   10    9   11                                                 
+CONECT   11   10   12                                                 
+CONECT   12   11   14                                                 
+CONECT   13    8                                                      
+CONECT   14    9   12                                                 
+MASTER        0    0    0    0    0    0    0    0   14    0   14    0
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/NUDT5A-x0114_2.sdf	Fri Oct 18 04:57:34 2019 -0400
@@ -0,0 +1,35 @@
+
+ OpenBabel10171911383D
+
+ 14 15  0  0  0  0  0  0  0  0999 V2000
+  -29.7210    5.1080  -63.9440 N   0  0  0  0  0  0  0  0  0  0  0  0
+  -32.1200    1.4200  -65.7380 C   0  0  0  0  0  0  0  0  0  0  0  0
+  -32.3550    4.2720  -63.4470 O   0  0  0  0  0  0  0  0  0  0  0  0
+  -32.1450    2.9190  -65.4240 C   0  0  1  0  0  0  0  0  0  0  0  0
+  -33.5610    3.5680  -65.3800 C   0  0  0  0  0  0  0  0  0  0  0  0
+  -33.4090    4.6780  -64.3250 C   0  0  0  0  0  0  0  0  0  0  0  0
+  -31.5300    3.2840  -64.0390 C   0  0  1  0  0  0  0  0  0  0  0  0
+  -30.0640    3.7560  -64.2700 C   0  0  0  0  0  0  0  0  0  0  0  0
+  -28.4710    5.7300  -64.0910 C   0  0  0  0  0  0  0  0  0  0  0  0
+  -28.1090    7.0310  -63.7420 C   0  0  0  0  0  0  0  0  0  0  0  0
+  -26.7490    7.3080  -64.0480 N   0  0  0  0  0  0  0  0  0  0  0  0
+  -26.1180    6.3750  -64.5730 N   0  0  0  0  0  0  0  0  0  0  0  0
+  -29.2560    2.9400  -64.7040 O   0  0  0  0  0  0  0  0  0  0  0  0
+  -27.0620    4.9230  -64.8090 S   0  0  0  0  0  0  0  0  0  0  0  0
+  1  8  1  0  0  0  0
+  1  9  1  0  0  0  0
+  3  6  1  0  0  0  0
+  3  7  1  0  0  0  0
+  4  2  1  1  0  0  0
+  4  5  1  0  0  0  0
+  4  7  1  0  0  0  0
+  5  6  1  0  0  0  0
+  7  8  1  6  0  0  0
+  8 13  2  0  0  0  0
+  9 10  2  0  0  0  0
+  9 14  1  0  0  0  0
+ 10 11  1  0  0  0  0
+ 11 12  2  0  0  0  0
+ 12 14  1  0  0  0  0
+M  END
+$$$$