diff esearch.xml @ 3:e267701c187b draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit dae34e5e182b4cceb808d7353080f14aa9a78ca9"
author iuc
date Wed, 23 Sep 2020 09:48:26 +0000
parents c6096cd97120
children
line wrap: on
line diff
--- a/esearch.xml	Wed Mar 11 04:03:14 2020 -0400
+++ b/esearch.xml	Wed Sep 23 09:48:26 2020 +0000
@@ -6,14 +6,21 @@
   </macros>
   <expand macro="requirements"/>
   <version_command>python esearch.py --version</version_command>
-  <command detect_errors="aggressive"><![CDATA[
-python '$__tool_directory__/esearch.py'
-$db_select
-"$term"
+  <command detect_errors="aggressive">
+    <![CDATA[
+
+      ##Doing replacement here so that dataset label doesn't have slashes
+      #set saniterm = $term.replace('"','\\"')
+
+      python '$__tool_directory__/esearch.py'
 
-#if $history_file and $history_file is not None:
-    --history_file '$history_file'
-#end if
+      $db_select
+
+      "$saniterm"
+
+      #if $history_file and $history_file is not None:
+        --history_file '$history_file'
+      #end if
 
 #if $date.enabled == 'True'
     --datetype $date.datetype
@@ -31,12 +38,34 @@
     #end if
 #end if
 
-#if $use_history:
-    --history_out $history
-#end if
+      #if $retstart is not None:
+        --retstart '$retstart'
+      #end if
+
+      #if $retmax is not None:
+        --retmax '$retmax'
+      #end if
 
-@EMAIL_ARGUMENTS@
-> $default]]></command>
+      #if $output_format == 'history_xml':
+        --history_out
+        --retmode xml
+      #elif $output_format == 'history_json':
+        --history_out
+        --retmode json
+      #elif $output_format == 'id_xml':
+        --retmode xml
+      #elif $output_format == 'id_json':
+        --retmode json
+      #elif $output_format == 'id_text':
+        --retmode text
+      #end if
+
+      @EMAIL_ARGUMENTS@
+
+      > $default
+
+    ]]>
+  </command>
   <inputs>
     <expand macro="dbselect"/>
     <param name="term" type="text" label="Search term">
@@ -45,11 +74,18 @@
           <add value="'"/>
           <add value="["/>
           <add value="]"/>
+          <add value='"'/>
         </valid>
       </sanitizer>
     </param>
     <param name="history_file" type="data" format="json" optional="true" label="Filter existing history" />
-    <param name="use_history" type="boolean" truevalue="--use_history" falsevalue="" checked="false" label="Store results to history server" />
+    <param name="output_format" type="select" label="Output Format">
+      <option value="history_json">History File (json)</option>
+      <option value="history_xml">History File (xml)</option>
+      <option value="id_xml">ID File (xml)</option>
+      <option value="id_json">ID File (json)</option>
+      <option value="id_text" selected="true">ID File (tabular)</option>
+    </param>
     <conditional name="date">
       <param name="enabled" type="select" label="Filter by date">
         <option value="False">No</option>
@@ -67,32 +103,73 @@
       </when>
       <when value="False"/>
     </conditional>
+    <param name="retstart" type="integer" value="0" min="0" max="99999" label="Starting record to return (--retstart)" />
+    <param name="retmax" type="integer" value="100000" min="1" max="100000" label="Maximum number of records to return (--retmax)" />
   </inputs>
   <outputs>
-    <data name="default" format="json" label="ESearch results for $term">
+    <data name="default" format="xml" label="ESearch results for $db_select database query: $term">
       <change_format>
-        <when input="use_history" value="" format="xml"/>
+        <when input="output_format" value="history_json" format="json" />
+        <when input="output_format" value="history_xml" format="xml" />
+        <when input="output_format" value="id_xml" format="xml" />
+        <when input="output_format" value="id_json" format="json" />
+        <when input="output_format" value="id_text" format="tabular" />
       </change_format>
     </data>
-    <expand macro="history_out">
-      <filter>use_history</filter>
-    </expand>
   </outputs>
   <tests>
     <test>
       <param name="db_select" value="pubmed"/>
       <param name="term" value="(PNAS[ta] AND 97[vi])"/>
+      <param name="retstart" value="0"/>
+      <param name="retmax" value="20"/>
+      <param name="output_format" value="id_xml"/>
       <output name="default" file="esearch.pubmed.xml" ftype="xml" lines_diff="2"/>
     </test>
     <test>
       <param name="db_select" value="pubmed"/>
       <param name="term" value="PNAS[ta]"/>
+      <param name="retstart" value="0"/>
+      <param name="retmax" value="20"/>
+      <param name="output_format" value="id_xml"/>
       <param name="enabled" value="True"/>
       <param name="datetype" value="PDAT"/>
       <param name="mindate" value="2014/01/01"/>
       <param name="maxdate" value="2014/02/01"/>
       <output name="default" file="esearch.pubmed.2014-01-pnas.xml" ftype="xml" lines_diff="2"/>
     </test>
+    <test>
+      <param name="db_select" value="gene"/>
+      <param name="term" value="&quot;genetype rrna&quot;[Properties] AND &quot;Homo sapiens&quot;[Organism] AND (&quot;srcdb refseq&quot;[Properties] AND alive[prop])"/>
+      <param name="retstart" value="2"/>
+      <param name="retmax" value="22"/>
+      <param name="output_format" value="id_text"/>
+      <output name="default" file="esearch.gene.tabular" ftype="tabular" lines_diff="2"/>
+    </test>
+    <test>
+      <param name="db_select" value="gene"/>
+      <param name="term" value="118502329"/>
+      <param name="retstart" value="0"/>
+      <param name="retmax" value="1"/>
+      <param name="output_format" value="id_json"/>
+      <output name="default" file="esearch.gene.json" ftype="json" lines_diff="2"/>
+    </test>
+    <test>
+      <param name="db_select" value="gene"/>
+      <param name="term" value="118502329"/>
+      <param name="retstart" value="0"/>
+      <param name="retmax" value="1"/>
+      <param name="output_format" value="history_json"/>
+      <output name="default" file="esearch.gene.hist.json" ftype="json" lines_diff="2"/>
+    </test>
+    <test>
+      <param name="db_select" value="gene"/>
+      <param name="term" value="118502329"/>
+      <param name="retstart" value="0"/>
+      <param name="retmax" value="1"/>
+      <param name="output_format" value="history_xml"/>
+      <output name="default" file="esearch.gene.hist.xml" ftype="xml" lines_diff="2"/>
+    </test>
   </tests>
   <help><![CDATA[
 NCBI Entrez ESearch