diff ob_filter.xml @ 10:da03b00048b1 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit c4274133a07c323627e3ac5374502da9ecf669fe-dirty"
author bgruening
date Sat, 21 Mar 2020 10:26:39 -0400
parents 0e382252d23d
children 340f8d63c1f4
line wrap: on
line diff
--- a/ob_filter.xml	Thu Aug 22 10:29:17 2019 -0400
+++ b/ob_filter.xml	Sat Mar 21 10:26:39 2020 -0400
@@ -1,4 +1,4 @@
-<tool id="openbabel_filter" name="Filter" version="@VERSION@.0">
+<tool id="openbabel_filter" name="Filter" version="@VERSION@.1">
     <description> a set of molecules from a file</description>
     <!--parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism-->
     <macros>
@@ -10,37 +10,42 @@
     python '$__tool_directory__/ob_filter.py'
       -i '${infile}'
       -o '${outfile}'
-      -iformat "${infile.ext}"
-      -oformat "${infile.ext}"
-      --filters '{
-        #if $filter_methods.filter_methods_opts == "ruleof5":
-          "hbd" : [0, 5],
-          "hba" : [0, 10],
-          "molwt" : [0, 500],
-          "logp" : [-5, 5],
-        #elif $filter_methods.filter_methods_opts == "LeadLike":
-          "rotbonds" : [0, 7],
-          "molwt" : [0, 350],
-          "logp" : [-5, 3.5],
-        #elif $filter_methods.filter_methods_opts == "DrugLike":
-          "hba" : [0, 10],
-          "rotbonds" : [0, 8],
-          "molwt" : [150, 500],
-          "logp" : [-5, 5],
-          "psa" : [0, 150],
-        #elif $filter_methods.filter_methods_opts == "FragmentLike":
-          "rotbonds" : [0, 5],
-          "molwt" : [0, 250],
-          "logp" : [-5, 2.5],
-        #else:
-          #for $filter in $filter_methods.filter_set:
-            #set $filter_selected = $filter.filter_sel.filter_sel_opts
-            #set $filter_min = $filter_selected + "_min"
-            #set $filter_max = $filter_selected + "_max"
-            "$filter_selected" : [$filter.filter_sel[$filter_min], $filter.filter_sel[$filter_max] ],
-          #end for
+      -iformat '${infile.ext}'
+      -oformat '${infile.ext}'
+      #if $filter_methods.filter_methods_opts == "__filter_by_name__":
+          --list_of_names '$name_file'
+          --filters '__filter_by_name__'
+      #else
+          --filters '{
+            #if $filter_methods.filter_methods_opts == "ruleof5":
+              "hbd" : [0, 5],
+              "hba" : [0, 10],
+              "molwt" : [0, 500],
+              "logp" : [-5, 5],
+            #elif $filter_methods.filter_methods_opts == "LeadLike":
+              "rotbonds" : [0, 7],
+              "molwt" : [0, 350],
+              "logp" : [-5, 3.5],
+            #elif $filter_methods.filter_methods_opts == "DrugLike":
+              "hba" : [0, 10],
+              "rotbonds" : [0, 8],
+              "molwt" : [150, 500],
+              "logp" : [-5, 5],
+              "psa" : [0, 150],
+            #elif $filter_methods.filter_methods_opts == "FragmentLike":
+              "rotbonds" : [0, 5],
+              "molwt" : [0, 250],
+              "logp" : [-5, 2.5],
+            #else:
+              #for $filter in $filter_methods.filter_set:
+                #set $filter_selected = $filter.filter_sel.filter_sel_opts
+                #set $filter_min = $filter_selected + "_min"
+                #set $filter_max = $filter_selected + "_max"
+                "$filter_selected" : [$filter.filter_sel[$filter_min], $filter.filter_sel[$filter_max] ],
+              #end for
+            #end if
+          }'
         #end if
-      }'
 ]]>
   </command>
   <inputs>
@@ -53,7 +58,12 @@
         <option value="LeadLike">Lead-like properties</option>
         <option value="DrugLike">Drug-like properties</option>
         <option value="FragmentLike">Fragment-like properties</option>
+        <option value="__filter_by_name__">Filter by molecule name</option>
       </param>
+      <when value="__filter_by_name__">
+            <param name="name_file" type="data" format="txt,tabular"
+                label="File with molecule names that match the names in the SDF file" help="Every name one line."/>
+      </when>
       <when value="ruleof5" />
       <when value="LeadLike" />
       <when value="DrugLike" />
@@ -121,6 +131,12 @@
   </outputs>
   <tests>
     <test>
+        <param name="infile" value="ligands_with_title.sdf" ftype="sdf" />
+        <param name="filter_methods_opts" value="__filter_by_name__" />
+        <param name="name_file" value="name_file.txt" />
+        <output name="outfile" file="filterd_by_name.sdf" ftype="sdf" lines_diff="4" />
+    </test>
+    <test>
         <param name="infile" ftype="smi" value="CID_2244.smi"/>
         <param name="filter_methods_opts" value="ruleof5" />
         <output name="outfile" ftype="smi" file="ob_filter_on_CID2244.smi" />