changeset 51:1ebae91eb6e9 draft

"planemo upload for repository https://github.com/peterjc/galaxy_blast/tree/master/tools/ncbi_blast_plus commit 0c82b9ef284c686cbffd30582d2586e4fb52881e-dirty"
author peterjc
date Wed, 09 Sep 2020 14:32:53 +0000
parents 8146c9884047
children fa7f92b81db1
files tools/ncbi_blast_plus/README.rst tools/ncbi_blast_plus/ncbi_blastdbcmd_info.xml tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml tools/ncbi_blast_plus/ncbi_macros.xml
diffstat 4 files changed, 74 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/tools/ncbi_blast_plus/README.rst	Wed Sep 09 13:12:55 2020 +0000
+++ b/tools/ncbi_blast_plus/README.rst	Wed Sep 09 14:32:53 2020 +0000
@@ -141,7 +141,9 @@
                  ``tool_dependencies.xml`` files. Instead assumes conda for
                  dependency resolution and requires at least Galaxy v16.10
                  which includes the BLAST datatypes.
-               - ``blastdbcmd`` wrapper supports multiple databases
+               - ``blastdbcmd`` wrapper supports multiple locally installed
+                 databases (contribution from Frederic Sapet), or a database
+                 from your Galaxy history.
 ============== ===============================================================
 
 Prior releases used a self-contained version number (deliberately kept low to
--- a/tools/ncbi_blast_plus/ncbi_blastdbcmd_info.xml	Wed Sep 09 13:12:55 2020 +0000
+++ b/tools/ncbi_blast_plus/ncbi_blastdbcmd_info.xml	Wed Sep 09 14:32:53 2020 +0000
@@ -6,33 +6,35 @@
     </macros>
     <expand macro="preamble" />
     <command detect_errors="aggressive">
-blastdbcmd -dbtype $db_opts.db_type -db "${db_opts.database.fields.path.replace(',',' ')}" -info -out "$info"
+blastdbcmd
+@DBCMD_OPTS@
+-info -out "$info"
     </command>
     <inputs>
         <expand macro="input_conditional_choose_db_type" />
     </inputs>
     <outputs>
-        <data name="info" format="txt" label="${db_opts.database.fields.name} info" />
+        <data name="info" format="txt" label="@ON_DBCMD_OPTS@ info" />
     </outputs>
     <tests>
         <test>
             <param name="db_opts|db_type" value="prot" />
-            <param name="db_opts|database" value="four_human_proteins" />
+            <param name="db_opts|db_origin|database" value="four_human_proteins" />
             <output name="info" file="four_human_proteins.dbinfo.txt" ftype="txt" compare="contains" />
         </test>
         <test>
             <param name="db_opts|db_type" value="nucl" />
-            <param name="db_opts|database" value="three_human_mRNA" />
+            <param name="db_opts|db_origin|database" value="three_human_mRNA" />
             <output name="info" file="three_human_mRNA.dbinfo.txt" ftype="txt" compare="contains" />
         </test>
         <test>
             <param name="db_opts|db_type" value="nucl" />
-            <param name="db_opts|database" value="rhodopsin_nucs" />
+            <param name="db_opts|db_origin|database" value="rhodopsin_nucs" />
             <output name="info" file="rhodopsin_nucs.dbinfo.txt" ftype="txt" compare="contains" />
         </test>
         <test>
             <param name="db_opts|db_type" value="nucl" />
-            <param name="db_opts|database" value="three_human_mRNA,rhodopsin_nucs" />
+            <param name="db_opts|db_origin|database" value="three_human_mRNA,rhodopsin_nucs" />
             <output name="info" file="three_human_mRNA_and_rhodopsin_nucs.dbinfo.txt" ftype="txt" compare="contains" />
         </test>
     </tests>
--- a/tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml	Wed Sep 09 13:12:55 2020 +0000
+++ b/tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml	Wed Sep 09 14:32:53 2020 +0000
@@ -8,7 +8,8 @@
     <command detect_errors="aggressive" strict="true">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
-blastdbcmd -dbtype $db_opts.db_type -db "${db_opts.database.fields.path.replace(',',' ')}"
+blastdbcmd
+@DBCMD_OPTS@
 
 ##TODO: What about -ctrl_a and -target_only as advanced options?
 
@@ -67,12 +68,15 @@
         </param>
     </inputs>
     <outputs>
-        <data name="seq" format="fasta" label="Sequences from ${db_opts.database.fields.name}" />
+
+        <data name="seq" format="fasta" label="Sequences from blastdbcmd @ON_DBCMD_OPTS@">
+        </data>
     </outputs>
     <tests>
         <test>
             <param name="db_opts|db_type" value="prot" />
-            <param name="db_opts|database" value="four_human_proteins" />
+            <param name="db_opts|db_origin|database" value="four_human_proteins" />
+            <param name="db_opts|db_origin|db_origin_selector" value="db" />
             <param name="id_opts|id_type" value="prompt" />
             <param name="id_opts|entries" value="all" />
             <param name="outfmt" value="original" />
@@ -81,7 +85,7 @@
         <test>
             <!-- This used to recover the original FASTA file, but had GI numbers -->
             <param name="db_opts|db_type" value="nucl" />
-            <param name="db_opts|database" value="rhodopsin_nucs" />
+            <param name="db_opts|db_origin|database" value="rhodopsin_nucs" />
             <param name="id_opts|id_type" value="prompt" />
             <param name="id_opts|entries" value="all" />
             <param name="outfmt" value="original" />
@@ -90,7 +94,7 @@
         <test>
             <!-- This uses various start end frame combinations but all recover full sequence -->
             <param name="db_opts|db_type" value="nucl" />
-            <param name="db_opts|database" value="rhodopsin_nucs" />
+            <param name="db_opts|db_origin|database" value="rhodopsin_nucs" />
             <param name="id_opts|id_type" value="file" />
             <param name="id_opts|entries" value="rhodopsin_nucs.blastdbcmd.txt" ftype="txt" />
             <param name="outfmt" value="original" />
@@ -98,7 +102,7 @@
         </test>
         <test>
             <param name="db_opts|db_type" value="nucl" />
-            <param name="db_opts|database" value="rhodopsin_nucs" />
+            <param name="db_opts|db_origin|database" value="rhodopsin_nucs" />
             <param name="id_opts|id_type" value="prompt" />
             <param name="id_opts|entries" value="U59921.1" />
             <param name="outfmt" value="original" />
@@ -107,7 +111,7 @@
         <test>
             <param name="db_opts|db_type" value="nucl" />
             <!-- look in two databases for this entry -->
-            <param name="db_opts|database" value="rhodopsin_nucs,three_human_mRNA" />
+            <param name="db_opts|db_origin|database" value="rhodopsin_nucs,three_human_mRNA" />
             <param name="id_opts|id_type" value="prompt" />
             <param name="id_opts|entries" value="gi|2734705|gb|U59921.1|BBU59921" />
             <param name="outfmt" value="original" />
--- a/tools/ncbi_blast_plus/ncbi_macros.xml	Wed Sep 09 13:12:55 2020 +0000
+++ b/tools/ncbi_blast_plus/ncbi_macros.xml	Wed Sep 09 14:32:53 2020 +0000
@@ -428,14 +428,40 @@
               <option value="prot">Protein</option>
             </param>
             <when value="nucl">
-                <param name="database" argument="-db" type="select" multiple="true" label="Nucleotide BLAST database">
-                    <options from_data_table="blastdb" />
-                </param>
+                <conditional name="db_origin">
+                    <param name="db_origin_selector" type="select" label="Subject database/sequences">
+                          <option value="db" selected="true">Locally installed BLAST database</option>
+                          <option value="histdb">BLAST database from your history</option>
+                    </param>
+                    <when value="db">
+                        <param name="database" argument="-db" type="select" multiple="true" label="Nucleotide BLAST database">
+                            <options from_data_table="blastdb" />
+                        </param>
+                        <param name="histdb" type="hidden" value="" />
+                    </when>
+                    <when value="histdb">
+                        <param name="database" type="hidden" value="" />
+                        <param name="histdb" type="data" format="blastdbn" label="Nucleotide BLAST database" />
+                    </when>
+                </conditional>
             </when>
             <when value="prot">
-                <param name="database" argument="-db" type="select" multiple="true" label="Protein BLAST database">
-                    <options from_data_table="blastdb_p" />
-                </param>
+                <conditional name="db_origin">
+                    <param name="db_origin_selector" type="select" label="Subject database/sequences">
+                          <option value="db" selected="true">Locally installed BLAST database</option>
+                          <option value="histdb">BLAST database from your history</option>
+                      </param>
+                      <when value="db">
+                          <param name="database" argument="-db" type="select" multiple="true" label="Protein BLAST database">
+                            <options from_data_table="blastdb_p" />
+                        </param>
+                        <param name="histdb" type="hidden" value="" />
+                      </when>
+                      <when value="histdb">
+                        <param name="database" type="hidden" value="" />
+                        <param name="histdb" type="data" format="blastdbp" label="Protein BLAST database" />
+                      </when>
+                </conditional>
             </when>
         </conditional>
     </xml>
@@ -576,6 +602,17 @@
 #end if
     ]]></token>
 
+    <!-- Implement -dbtype and -db command line options (in blastdbcmd) -->
+    <token name="@DBCMD_OPTS@"><![CDATA[
+-dbtype "$db_opts.db_type"
+#if $db_opts.db_origin.db_origin_selector=="db":
+  -db "${db_opts.db_origin.database.fields.path.replace(',',' ')}"
+#else if $db_opts.db_origin.db_origin_selector=="histdb":
+  -db '${os.path.join($db_opts.db_origin.histdb.extra_files_path, "blastdb")}'
+#end if
+    ]]></token>
+
+    <!-- Implement -db ... / -subject ... command line options -->
     <token name="@BLAST_DB_SUBJECT@"><![CDATA[
 #if $db_opts.db_opts_selector == "db":
   -db '${" ".join(str($db_opts.database.fields.path).split(","))}'
@@ -701,6 +738,15 @@
 #end if
 ]]></token>
 
+    <!-- @ON_DBCMD_OPTS@ is for use with @DBCMD_OPTS@ -->
+    <token name="@ON_DBCMD_OPTS@"><![CDATA[
+#if str($db_opts.db_origin.db_origin_selector)=="db"
+'${db_opts.db_origin.database}'
+#else
+'${db_opts.db_origin.histdb.name}'
+#end if
+]]></token>
+
     <token name="@REFERENCES@"><![CDATA[
 Peter J. A. Cock, John M. Chilton, Björn Grüning, James E. Johnson, Nicola Soranzo (2015).
 NCBI BLAST+ integrated into Galaxy. *GigaScience* 4:39