Mercurial > repos > bgruening > openbabel_obgrep
changeset 6:3004897342b2 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit ed9b6859de648aa5f7cde483732f5df20aaff90e
author | bgruening |
---|---|
date | Tue, 07 May 2019 13:20:39 -0400 |
parents | fda428d755d7 |
children | 4813887bb33d |
files | macros.xml ob_grep.xml test-data/2_mol.dat test-data/CO.smarts |
diffstat | 4 files changed, 60 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/macros.xml Mon Sep 03 16:32:50 2018 -0400 +++ b/macros.xml Tue May 07 13:20:39 2019 -0400 @@ -1,9 +1,10 @@ <macros> - <token name="@VERSION@">2.4.1</token> + <token name="@VERSION@">2.4.2</token> <xml name="requirements"> <requirements> <requirement type="package" version="2.4.1">openbabel</requirement> + <requirement type="package" version="3">python</requirement> <yield /> </requirements> </xml> @@ -37,6 +38,3 @@ </citations> </xml> </macros> - - -
--- a/ob_grep.xml Mon Sep 03 16:32:50 2018 -0400 +++ b/ob_grep.xml Tue May 07 13:20:39 2019 -0400 @@ -1,5 +1,5 @@ -<tool id="openbabel_obgrep" name="Compound Search" version="@VERSION@.0"> - <description>an advanced molecular grep program using SMARTS</description> +<tool id="openbabel_obgrep" name="Compound search" version="@VERSION@.0"> + <description>- an advanced molecular search program using SMARTS</description> <!--parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism--> <macros> <import>macros.xml</import> @@ -7,28 +7,55 @@ <expand macro="requirements"/> <command> <![CDATA[ - obgrep - $invert_matches - #if $n_times: - -t $n_times - #end if - $only_name - $full_match - $number_of_matches - -i '${infile.ext}' - '${smarts_pattern}' - '${infile}' - > '${outfile}' + + #if $input_type.inp == 'single': + obgrep + $invert_matches + #if $n_times: + -t $n_times + #end if + $only_name + $full_match + $number_of_matches + -i '${infile.ext}' + '${input_type.smarts_pattern}' + '${infile}' + > '${outfile}' + #else if $input_type.inp == 'multi': + python '$__tool_directory__/multi_obgrep.py' + -i $infile + --iformat ${infile.ext} + -q '${input_type.query}' + -o '${outfile}' + $invert_matches + --n-times $n_times + $only_name + $full_match + $number_of_matches + --processors "\${GALAXY_SLOTS:-12}" + #end if + ]]> </command> <inputs> <expand macro="infile_all_types"/> - <param name="smarts_pattern" type="text" format="text" label="SMARTS Pattern" help="Specify a SMARTS Pattern for your search."/> - <param name="invert_matches" type="boolean" label="Invert the matching, print non-matching molecules" truevalue="-v" falsevalue="" checked="false" /> - <param name="n_times" type="integer" value="" min="1" optional="True" - label="Print a molecule only if the pattern occurs # times inside the molecule" /> + <conditional name="input_type"> + <param name="inp" type="select" label="Input"> + <option value="single">Enter a single SMARTS pattern</option> + <option value="multi">Upload one or more SMARTS patterns in a text file</option> + </param> + <when value="single"> + <param name="smarts_pattern" type="text" format="text" label="SMARTS Pattern" help="Specify a SMARTS Pattern for your search."/> + </when> + <when value="multi"> + <param name="query" type='data' format="tabular,text" label="Query file" help="One SMARTS pattern in each line."/> + </when> + </conditional> + <param name="invert_matches" type="boolean" label="Perform an inverted search, i.e. print non-matching molecules" truevalue="-v" falsevalue="" checked="false" /> + <param name="n_times" type="integer" value="0" min="0" optional="True" + label="Print a molecule only if the pattern occurs this often inside the molecule" /> <param name="only_name" type="boolean" label="Only print the name of the molecules" truevalue="-n" falsevalue="" checked="false" /> - <param name="full_match" type="boolean" label="Full match, print matching-molecules only when the number of heavy atoms is also equal to the number of atoms in the SMARTS pattern" truevalue="-f" falsevalue="" checked="false" /> + <param name="full_match" type="boolean" label="Full match" help="Print matching molecules only when the number of heavy atoms equals the number of atoms in the SMARTS pattern" truevalue="-f" falsevalue="" checked="false" /> <param name="number_of_matches" type="boolean" label="Print the number of matches" truevalue="-c" falsevalue="" checked="false" /> </inputs> <options sanitize="False"/> @@ -38,6 +65,7 @@ <tests> <test> <param name="infile" ftype="smi" value="8_mol.smi"/> + <param name="inp" value="single"/> <param name="smarts_pattern" value="CO"/> <param name="invert_matches" value="False" /> <param name="only_name" value="False" /> @@ -45,6 +73,12 @@ <param name="number_of_matches" value="False" /> <output name="outfile" ftype="smi" file="obgrep_on_8_mol.smi"/> </test> + <test> + <param name="infile" ftype="smi" value="2_mol.smi"/> + <param name="inp" value="multi"/> + <param name="query" value="pattern.smarts" /> + <output name="outfile" ftype="smi" file="ob_multi_obgrep.smi" /> + </test> </tests> <help> <![CDATA[ @@ -53,9 +87,9 @@ **What this tool does** -Uses the Open Babel Obgrep_ to search for molecules inside multi-molecule files (e.g. SMI, SDF, etc.) or across multiple files. -It is known that not all SMARTS features from the Daylight Toolkit are supported, please have a look here_. +Uses the Open Babel Obgrep_ to search for molecules inside multi-molecule files (e.g. SMI, SDF, etc.) or across multiple files. Not all SMARTS features from the original implementation in the Daylight Toolkit are supported by OpenBabel; please have a look here_. +The search query can be submitted either as a single SMARTS pattern or as a file containing multiple SMARTS patterns. .. _Obgrep: http://openbabel.org/wiki/Obgrep .. _here: http://openbabel.org/wiki/SMARTS