Mercurial > repos > bgruening > autodock_vina
changeset 6:0ae768a0e5c0 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/autodock_vina commit a2f6034a691af458e3df662e36d7f05617982bdc
| author | bgruening |
|---|---|
| date | Wed, 19 Jun 2019 06:43:41 -0400 |
| parents | c410ffcabf9d |
| children | 7b2f205b3f68 |
| files | convert_pdbqt_to_sdf.py docking.xml test-data/NuBBE_1_obabel_3D_-_3u1i_for_DM.sdf |
| diffstat | 3 files changed, 1801 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/convert_pdbqt_to_sdf.py Wed Jun 19 06:43:41 2019 -0400 @@ -0,0 +1,40 @@ +import pybel, openbabel +import sys + + +def main(): + if len(sys.argv) == 3: + process(sys.argv[1], sys.argv[2]) + else: + print("Usage: convert_pdbqt_to_sdf.py <input-pdbqt-file> <output-sdf-file>") + exit(1) + +def add_property(mol, prop_name, prop_value): + newData = openbabel.OBPairData() + newData.SetAttribute(prop_name) + newData.SetValue(prop_value) + mol.OBMol.CloneData(newData) + +def process(input, output): + docked = pybel.readfile('pdbqt', input) + sdf = pybel.Outputfile("sdf", output, overwrite=True) + for mol in docked: + if mol.OBMol.HasData('REMARK'): + remark = mol.OBMol.GetData('REMARK').GetValue() + lines = remark.splitlines() + tokens = lines[0].split() + + # add the score property + add_property(mol, "SCORE", tokens[2]) + # add the first RMSD property + add_property(mol, "RMSD_LB", tokens[3]) + # add the second RMSD property + add_property(mol, "RMSD_UB", tokens[4]) + + sdf.write(mol) + + sdf.close() + +if __name__ == "__main__": + main() +
--- a/docking.xml Tue May 07 13:31:43 2019 -0400 +++ b/docking.xml Wed Jun 19 06:43:41 2019 -0400 @@ -1,7 +1,8 @@ -<tool id="docking" name="Docking" version="0.2.0"> +<tool id="docking" name="Docking" version="0.2.1"> <description>tool to perform protein-ligand docking with Autodock Vina</description> <requirements> <requirement type="package" version="1.1.2">autodock-vina</requirement> + <requirement type="package" version="2.4.1">openbabel</requirement> </requirements> <stdio> <exit_code range="1" /> @@ -20,8 +21,8 @@ --energy_range 9999 --receptor '$receptor' --ligand '$ligand' - --out '$file_output1' - --log '$file_output2' + --out './output1.dat' + --log './output2.dat' --cpu \${GALAXY_SLOTS:-1} #if $config_params.seed.seed == 'true': --seed '$config_params.seed.seed_value' @@ -32,10 +33,18 @@ --config '$config_params.box' --receptor '$receptor' --ligand '$ligand' - --out '$file_output1' - --log '$file_output2' + --out './output1.dat' + --log './output2.dat' --cpu \${GALAXY_SLOTS:-1} - + #if $config_params.exh != "": + --exhaustiveness $config_params.exh + #end if + #end if + #if $output_format == 'sdf': + && python '$__tool_directory__/convert_pdbqt_to_sdf.py' './output1.dat' '$sdf_output' + #else + && mv ./output1.dat '$file_output1' + && mv ./output2.dat '$file_output2' #end if ]]></command> @@ -65,15 +74,27 @@ </when> <when value="file"> <param type="data" name="box" format="txt" label="Box configuration" help="Text file with the box configurations" /> + <param type="integer" name="exh" label="Exhaustiveness" help="The number of poses to return from the docking job (optional, will override any value specified in the config file)" optional="true"/> </when> </conditional> + <param type="select" name="output_format" label="Output format" help="Select a format for the output files"> + <option value="pdbqt" selected="true">PDBQT (and separate log file with binding scores)</option> + <option value="sdf">SDF</option> + </param> </inputs> <outputs> - <data name="file_output1" format="pdbqt" /> - <data name="file_output2" format="txt" /> + <data name="file_output1" format="pdbqt"> + <filter>output_format == 'pdbqt'</filter> + </data> + <data name="file_output2" format="txt"> + <filter>output_format == 'pdbqt'</filter> + </data> + <data name="sdf_output" format="sdf"> + <filter>output_format == 'sdf'</filter> + </data> </outputs> <tests> - <test> + <test expect_num_outputs="2"> <param name="receptor" value="3u1i_for_DM.pdbqt"/> <param name="ligand" value="NuBBE_1_obabel_3D.pdbqt"/> <param name="config_params" value="vals"/> @@ -85,32 +106,140 @@ <param name="size_z" value="23.60" /> <param name="seed" value="true" /> <param name="seed_value" value="1" /> - <param name="exhaustivenesss" value="10" /> + <param name="exhaustiveness" value="10" /> + <param name="output_format" value="pdbqt" /> <output name="file_output1" file="NuBBE_1_obabel_3D_-_3u1i_for_DM.pdbqt"/> <output name="file_output2" file="NuBBE_1_obabel_3D_-_3u1i_for_DM.log"/> </test> - <test> + <test expect_num_outputs="2"> <param name="receptor" value="3u1i_for_DM.pdbqt"/> <param name="ligand" value="NuBBE_1_obabel_3D.pdbqt"/> <param name="config_params" value="file"/> <param name="box" value="config_complexo_dm.txt"/> + <param name="output_format" value="pdbqt" /> <output name="file_output1" file="NuBBE_1_obabel_3D_-_3u1i_for_DM.pdbqt"/> <output name="file_output2" file="NuBBE_1_obabel_3D_-_3u1i_for_DM.log"/> </test> + <test expect_num_outputs="1"> + <param name="receptor" value="3u1i_for_DM.pdbqt"/> + <param name="ligand" value="NuBBE_1_obabel_3D.pdbqt"/> + <param name="config_params" value="file"/> + <param name="box" value="config_complexo_dm.txt"/> + <param name="output_format" value="sdf" /> + <output name="sdf_output" file="NuBBE_1_obabel_3D_-_3u1i_for_DM.sdf" lines_diff="40"/> + </test> </tests> <help><