changeset 22:6f386c5dc4fb draft

v0.2.01 add -max_hsps, -use_sw_tback; lists args; internal updates
author peterjc
date Mon, 18 Sep 2017 06:21:27 -0400
parents 7538e2bfcd41
children 31e517610e1f
files tools/ncbi_blast_plus/README.rst tools/ncbi_blast_plus/blastxml_to_tabular.py tools/ncbi_blast_plus/blastxml_to_tabular.xml tools/ncbi_blast_plus/ncbi_blastdbcmd_info.xml tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml tools/ncbi_blast_plus/ncbi_convert2blastmask_wrapper.xml tools/ncbi_blast_plus/ncbi_dustmasker_wrapper.xml tools/ncbi_blast_plus/ncbi_macros.xml tools/ncbi_blast_plus/ncbi_makeblastdb.xml tools/ncbi_blast_plus/ncbi_makeprofiledb.xml tools/ncbi_blast_plus/ncbi_rpsblast_wrapper.xml tools/ncbi_blast_plus/ncbi_rpstblastn_wrapper.xml tools/ncbi_blast_plus/ncbi_segmasker_wrapper.xml tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
diffstat 18 files changed, 238 insertions(+), 234 deletions(-) [+]
line wrap: on
line diff
--- a/tools/ncbi_blast_plus/README.rst	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/README.rst	Mon Sep 18 06:21:27 2017 -0400
@@ -1,7 +1,7 @@
 Galaxy wrappers for NCBI BLAST+ suite
 =====================================
 
-These wrappers are copyright 2010-2016 by Peter Cock (The James Hutton Institute,
+These wrappers are copyright 2010-2017 by Peter Cock (The James Hutton Institute,
 UK) and additional contributors including Edward Kirton, John Chilton,
 Nicola Soranzo, Jim Johnson, and Bjoern Gruening.
 
@@ -213,7 +213,7 @@
           table definitions in Galaxy's ``tool_data_table_conf.xml`` file,
           setup via ``tool-data/tool_data_table_conf.xml.sample``
         - Replace ``.extra_files_path`` with ``.files_path`` (internal change,
-	  thanks to Bjoern Gruening and John Chilton).
+          thanks to Bjoern Gruening and John Chilton).
         - Added "NCBI BLAST+ integrated into Galaxy" preprint citation.
 v0.1.03 - Reorder XML elements (internal change only).
         - Planemo for Tool Shed upload (``.shed.yml``, internal change only).
@@ -233,15 +233,21 @@
           (contribution from Gildas Le Corguillé and Emma Prudent).
         - Minor XML and Python style changes (internal change only).
         - Set ``allow_duplicate_entries="False"`` in sample configuration file
-	  ``tool_data_table_conf.xml``.
+          ``tool_data_table_conf.xml``.
         - Fix identifers with pipes in ``blastdbcmd`` wrapper (Devon Ryan).
 v0.2.00 - Updated for NCBI BLAST+ 2.5.0, where GI numbers are less visible,
           tabular output changes with `-parse_deflines`, and percentage
-	  identifies are now given to 3dp rather than 2dp.
+          identifies are now given to 3dp rather than 2dp.
         - Depends on ``package_blast_plus_2_5_0`` in ToolShed, or BioConda.
         - ``blastxml_to_tabular`` now also gives percentage idenity to 3dp.
         - Removed never-used binary and Python module dependency declarations
           (internal change only).
+v0.2.01 - Use ``<command detect_errors="aggressive">`` (internal change only).
+        - Single quote command line arguments (internal change only).
+        - Show BLAST command line argument corresponding to each tool
+          parameter (contribution from Nicola Soranzo).
+        - Add ``-max_hsps`` option (contribution from Nicola Soranzo).
+        - Add ``-use_sw_tback`` option for BLASTP (Nicola Soranzo).
 ======= ======================================================================
 
 
@@ -278,7 +284,7 @@
 
     $ planemo shed_upload --tar_only tools/ncbi_blast_plus/
     ...
-    $ tar -tzf shed_upload.tar.gz 
+    $ tar -tzf shed_upload.tar.gz
     test-data/blastdb.loc
     ...
     tools/ncbi_blast_plus/tool_dependencies.xml
--- a/tools/ncbi_blast_plus/blastxml_to_tabular.py	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/blastxml_to_tabular.py	Mon Sep 18 06:21:27 2017 -0400
@@ -61,6 +61,7 @@
 space character (probably a bug).
 """
 
+from __future__ import print_function
 
 import os
 import re
@@ -69,7 +70,7 @@
 from optparse import OptionParser
 
 if "-v" in sys.argv or "--version" in sys.argv:
-    print "v0.2.00"
+    print("v0.2.01")
     sys.exit(0)
 
 if sys.version_info[:2] >= (2, 5):
@@ -295,7 +296,7 @@
                             salltitles = "<>".join(name.split(None, 1)[1] for name in hit_def.split(" >"))
                         except IndexError as e:
                             sys.exit("Problem splitting multuple hits?\n%r\n--> %s" % (hit_def, e))
-                        # print hit_def, "-->", sallseqid
+                        # print(hit_def, "-->", sallseqid)
                         positive = hsp.findtext("Hsp_positive")
                         ppos = "%0.2f" % (100 * float(positive) / float(length))
                         qframe = hsp.findtext("Hsp_query-frame")
@@ -325,7 +326,7 @@
                     if cols:
                         # Only a subset of the columns are needed
                         values = [values[colnames.index(c)] for c in cols]
-                    # print "\t".join(values)
+                    # print("\t".join(values))
                     output_handle.write("\t".join(values) + "\n")
             # prevents ElementTree from growing large datastructure
             root.clear()
--- a/tools/ncbi_blast_plus/blastxml_to_tabular.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/blastxml_to_tabular.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -3,27 +3,22 @@
     <macros>
         <import>ncbi_macros.xml</import>
     </macros>
-    <stdio>
-        <!-- Anything other than zero is an error -->
-        <exit_code range="1:" />
-        <exit_code range=":-1" />
-    </stdio>
-    <version_command interpreter="python">blastxml_to_tabular.py --version</version_command>
-    <command interpreter="python">
-blastxml_to_tabular.py -o "$tabular_file"
+    <version_command>python $__tool_directory__/blastxml_to_tabular.py --version</version_command>
+    <command detect_errors="aggressive">
+python $__tool_directory__/blastxml_to_tabular.py -o '$tabular_file'
 #if $output.out_format == "cols":
 #set cols = (str($output.std_cols)+","+str($output.ext_cols)).replace("None", " ").replace(",,", ",").replace(",", " ")
--c "$cols"
+-c '$cols'
 #else
--c "$output.out_format"
+-c '$output.out_format'
 #end if
-#for i in $blastxml_file#"${i}" #end for#
+#for i in $blastxml_file#'${i}' #end for#
     </command>
     <inputs>
         <param name="blastxml_file" type="data" format="blastxml" multiple="true" label="BLAST results as XML"/>
         <conditional name="output">
           <param name="out_format" type="select" label="Output format">
-            <option value="std" selected="True">Tabular (standard 12 columns)</option>
+            <option value="std" selected="true">Tabular (standard 12 columns)</option>
             <option value="ext">Tabular (extended 25 columns)</option>
             <option value="cols">Tabular (select columns to output)</option>
           </param>
@@ -139,7 +134,7 @@
         </test>
     </tests>
     <help>
-    
+
 **What it does**
 
 NCBI BLAST+ (and the older NCBI 'legacy' BLAST) can output in a range of
--- a/tools/ncbi_blast_plus/ncbi_blastdbcmd_info.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastdbcmd_info.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -5,7 +5,7 @@
         <import>ncbi_macros.xml</import>
     </macros>
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 blastdbcmd -dbtype $db_opts.db_type -db "${db_opts.database.fields.path}" -info -out "$info"
     </command>
     <inputs>
@@ -32,7 +32,7 @@
         </test>
     </tests>
     <help>
-    
+
 **What it does**
 
 Calls the NCBI BLAST+ blastdbcmd command line tool with the -info
--- a/tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -5,7 +5,7 @@
         <import>ncbi_macros.xml</import>
     </macros>
     <expand macro="preamble" />
-    <command>
+    <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}"
@@ -13,7 +13,7 @@
 ##TODO: What about -ctrl_a and -target_only as advanced options?
 
 #if $id_opts.id_type=="file":
--entry_batch "$id_opts.entries"
+-entry_batch '$id_opts.entries'
 #else:
 ##Perform some simple search/replaces to remove whitespace
 ##and make it comma separated. Quoted so don't escape pipes.
@@ -40,11 +40,11 @@
 ##using sed, however the exact syntax differs for Mac OS X's sed
 
 #if str($outfmt)=="blastid":
--out "$seq"
+-out '$seq'
 #else if sys.platform == "darwin":
-| sed -E 's/^>(lcl\||gnl\|BL_ORD_ID\|[0-9]* )/>/1' > "$seq"
+| sed -E 's/^&gt;(lcl\||gnl\|BL_ORD_ID\|[0-9]* )/&gt;/1' &gt; "$seq"
 #else:
-| sed 's/>\(lcl|\|gnl|BL_ORD_ID|[0-9]* \)/>/1' > "$seq"
+| sed 's/&gt;\(lcl|\|gnl|BL_ORD_ID|[0-9]* \)/&gt;/1' &gt; "$seq"
 #end if
     </command>
     <inputs>
@@ -55,10 +55,10 @@
               <option value="prompt">User entered</option>
             </param>
             <when value="file">
-                <param name="entries" type="data" format="txt,tabular" label="Sequence identifier(s)" help="Plain text file with one ID per line (i.e. single column tabular file)"/>
+                <param name="entries" argument="-entry_batch" type="data" format="txt,tabular" label="Sequence identifier(s)" help="Plain text file with one ID per line (i.e. single column tabular file)"/>
             </when>
             <when value="prompt">
-                <param name="entries" type="text" label="Sequence identifier(s)" help="Comma or new line separated list." optional="False" area="True" size="10x30"/>
+                <param name="entries" argument="-entry" type="text" optional="false" area="true" size="10x30" label="Sequence identifier(s)" help="Comma or new line separated list"/>
             </when>
         </conditional>
         <param name="outfmt" type="select" label="Output format">
@@ -105,7 +105,7 @@
         </test>
     </tests>
     <help>
-    
+
 **What it does**
 
 Extracts FASTA formatted sequences from a BLAST database
@@ -138,5 +138,5 @@
 
 @REFERENCES@
     </help>
-    <expand macro="blast_citations" />    
+    <expand macro="blast_citations" />
 </tool>
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,11 +6,11 @@
     </macros>
     <expand macro="parallelism" />
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 blastn
--query "$query"
+-query '$query'
 @BLAST_DB_SUBJECT@
 -task $blast_type
 -evalue $evalue_cutoff
@@ -31,9 +31,9 @@
 #end if
     </command>
     <inputs>
-        <param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/> 
+        <param argument="-query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
         <expand macro="input_conditional_nucleotide_db" />
-        <param name="blast_type" type="select" display="radio" label="Type of BLAST">
+        <param name="blast_type" argument="-task" type="select" display="radio" label="Type of BLAST">
             <option value="megablast">megablast - Traditional megablast used to find very similar (e.g., intraspecies or closely related species) sequences</option>
             <option value="blastn">blastn - Traditional BLASTN requiring an exact match of 11, for somewhat similar sequences</option>
             <option value="blastn-short">blastn-short - BLASTN program optimized for sequences shorter than 50 bases</option>
@@ -49,16 +49,14 @@
         <expand macro="input_out_format" />
         <expand macro="advanced_options">
             <!-- Could use a select (yes, no, other) where other allows setting 'level window linker' -->
-            <param name="filter_query" type="boolean" label="Filter out low complexity regions (with DUST)" truevalue="-dust yes" falsevalue="-dust no" checked="true" />
+            <param name="filter_query" argument="-dust" type="boolean" label="Filter out low complexity regions (with DUST)" truevalue="-dust yes" falsevalue="-dust no" checked="true" />
             <expand macro="input_strand" />
             <expand macro="input_max_hits" />
-            <param name="identity_cutoff" type="float" min="0" max="100" value="0" label="Percent identity cutoff (-perc_identity)" help="Use zero for no cutoff" />
-            
+            <param name="identity_cutoff" argument="-perc_identity" type="float" min="0" max="100" value="0" label="Percent identity cutoff" help="Use zero for no cutoff" />
+
             <!-- I'd like word_size to be optional, with minimum 4 for blastn -->
-            <param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 4.">
-                <validator type="in_range" min="0" />
-            </param>
-            <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped" falsevalue="" checked="false" />
+            <param argument="-word_size" type="integer" min="0" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 4" />
+            <param argument="-ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped" falsevalue="" checked="false" />
             <expand macro="input_parse_deflines" />
             <expand macro="advanced_optional_id_files" />
             <expand macro="input_qcov_hsp_perc" />
@@ -134,6 +132,15 @@
             <param name="out_format" value="6" />
             <output name="output1" file="blastn_chimera_vs_rhodopsin_db.tabular" ftype="tabular" />
         </test>
+        <test>
+            <param name="query" value="chimera.fasta" ftype="fasta" />
+            <param name="db_opts_selector" value="db" />
+            <param name="database" value="rhodopsin_nucs" />
+            <param name="out_format" value="6" />
+            <param name="adv_opts_selector" value="advanced" />
+            <param name="max_hsps" value="1" />
+            <output name="output1" file="blastn_chimera_vs_rhodopsin_db_max_hsps1.tabular" ftype="tabular" />
+        </test>
         <!-- next test is passing in two blast databases -->
         <test>
             <param name="query" value="chimera.fasta" ftype="fasta" />
@@ -144,7 +151,7 @@
         </test>
     </tests>
     <help>
-    
+
 @SEARCH_TIME_WARNING@
 
 **What it does**
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,34 +6,34 @@
     </macros>
     <expand macro="parallelism" />
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 blastp
--query "$query"
+-query '$query'
 @BLAST_DB_SUBJECT@
 -task $blast_type
 -evalue $evalue_cutoff
 @BLAST_OUTPUT@
 @THREADS@
 #if $adv_opts.adv_opts_selector=="advanced":
--matrix $adv_opts.matrix
-@ADV_FILTER_QUERY@
-@ADV_MAX_HITS@
-@ADV_WORD_SIZE@
-##Ungapped disabled for now - see comments below
-##$adv_opts.ungapped
-@ADV_ID_LIST_FILTER@
-@ADV_QCOV_HSP_PERC@
-## End of advanced options:
+    -matrix $adv_opts.matrix
+    @ADV_FILTER_QUERY@
+    @ADV_MAX_HITS@
+    @ADV_WORD_SIZE@
+    ##Ungapped disabled for now - see comments below
+    ##$adv_opts.ungapped
+    @ADV_ID_LIST_FILTER@
+    @ADV_QCOV_HSP_PERC@
+    $adv_opts.use_sw_tback
 #end if
     </command>
     <inputs>
-        <param name="query" type="data" format="fasta" label="Protein query sequence(s)"/> 
+        <param argument="-query" type="data" format="fasta" label="Protein query sequence(s)"/>
 
         <expand macro="input_conditional_protein_db" />
 
-        <param name="blast_type" type="select" display="radio" label="Type of BLAST">
+        <param name="blast_type" argument="-task" type="select" display="radio" label="Type of BLAST">
             <option value="blastp">blastp - Traditional BLASTP to compare a protein query to a protein database</option>
             <option value="blastp-fast">blastp-fast - Use longer words for seeding, faster but less accurate</option>
             <option value="blastp-short">blastp-short - BLASTP optimized for queries shorter than 30 residues</option>
@@ -50,11 +50,12 @@
             Can't use '-ungapped' on its own, error back is:
             Composition-adjusted searched are not supported with an ungapped search, please add -comp_based_stats F or do a gapped search
             Tried using '-ungapped -comp_based_stats F' and blastp crashed with 'Attempt to access NULL pointer.'
-            <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped -comp_based_stats F" falsevalue="" checked="false" />
+            <param argument="-ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped -comp_based_stats F" falsevalue="" checked="false" />
             -->
             <expand macro="input_parse_deflines" />
             <expand macro="advanced_optional_id_files" />
             <expand macro="input_qcov_hsp_perc" />
+            <param argument="-use_sw_tback" type="boolean" truevalue="-use_sw_tback" falsevalue="" label="Compute locally optimal Smith-Waterman alignments" />
         </expand>
     </inputs>
     <outputs>
@@ -72,11 +73,11 @@
             <param name="blast_type" value="blastp" />
             <param name="out_format" value="5" />
             <param name="adv_opts_selector" value="advanced" />
-            <param name="filter_query" value="False" />
+            <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM62" />
             <param name="max_hits" value="0" />
             <param name="word_size" value="0" />
-            <param name="parse_deflines" value="True" />
+            <param name="parse_deflines" value="true" />
             <param name="qcov_hsp_perc" value="25" />
             <output name="output1" file="blastp_four_human_vs_rhodopsin.xml" ftype="blastxml" />
         </test>
@@ -89,11 +90,11 @@
             <param name="blast_type" value="blastp" />
             <param name="out_format" value="6" />
             <param name="adv_opts_selector" value="advanced" />
-            <param name="filter_query" value="False" />
+            <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM62" />
             <param name="max_hits" value="0" />
             <param name="word_size" value="0" />
-            <param name="parse_deflines" value="True" />
+            <param name="parse_deflines" value="true" />
             <param name="qcov_hsp_perc" value="25" />
             <output name="output1" file="blastp_four_human_vs_rhodopsin.tabular" ftype="tabular" />
         </test>
@@ -106,11 +107,11 @@
             <param name="blast_type" value="blastp" />
             <param name="out_format" value="ext" />
             <param name="adv_opts_selector" value="advanced" />
-            <param name="filter_query" value="False" />
+            <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM62" />
             <param name="max_hits" value="0" />
             <param name="word_size" value="0" />
-            <param name="parse_deflines" value="True" />
+            <param name="parse_deflines" value="true" />
             <param name="qcov_hsp_perc" value="25" />
             <output name="output1" file="blastp_four_human_vs_rhodopsin_ext.tabular" ftype="tabular" />
         </test>
@@ -127,7 +128,7 @@
         </test>
     </tests>
     <help>
-    
+
 @SEARCH_TIME_WARNING@
 
 **What it does**
@@ -150,5 +151,5 @@
 
 @REFERENCES@
     </help>
-    <expand macro="blast_citations" />    
+    <expand macro="blast_citations" />
 </tool>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,11 +6,11 @@
     </macros>
     <expand macro="parallelism" />
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 blastx
--query "$query"
+-query '$query'
 @BLAST_DB_SUBJECT@
 -query_gencode $query_gencode
 -task $blast_type
@@ -30,11 +30,11 @@
 #end if
     </command>
     <inputs>
-        <param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/> 
+        <param argument="-query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
 
         <expand macro="input_conditional_protein_db" />
         <expand macro="input_query_gencode" />
-        <param name="blast_type" type="select" display="radio" label="Type of BLAST">
+        <param name="blast_type" argument="-task" type="select" display="radio" label="Type of BLAST">
             <option value="blastx">blastx - Traditional BLASTX to compare translated nucleotide query to protein database</option>
             <option value="blastx-fast">blastx-fast - Use longer words for seeding, faster but less accurate</option>
         </param>
@@ -48,7 +48,7 @@
             <expand macro="input_scoring_matrix" />
             <expand macro="input_max_hits" />
             <expand macro="input_word_size" />
-            <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped" falsevalue="" checked="false" />
+            <param argument="-ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped" falsevalue="" checked="false" />
             <expand macro="input_parse_deflines" />
             <expand macro="advanced_optional_id_files" />
             <expand macro="input_qcov_hsp_perc" />
@@ -107,7 +107,7 @@
         </test>
     </tests>
     <help>
-    
+
 @SEARCH_TIME_WARNING@
 
 **What it does**
--- a/tools/ncbi_blast_plus/ncbi_convert2blastmask_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_convert2blastmask_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -5,36 +5,36 @@
         <import>ncbi_macros.xml</import>
     </macros>
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 convert2blastmask
--in $infile
--masking_algorithm "$masking_algorithm"
--masking_options "$masking_options"
+-in '$infile'
+-masking_algorithm '$masking_algorithm'
+-masking_options '$masking_options'
 $parse_seqids
--out "$outfile"
+-out '$outfile'
 -outfmt $outformat
     </command>
     <inputs>
-        <param name="infile" type="data" format="fasta" label="masked FASTA file"/> 
-        <param name="masking_algorithm" type="select" label="Used masking algorithm">
+        <param name="infile" argument="-in" type="data" format="fasta" label="Masked FASTA file"/>
+        <param argument="-masking_algorithm" type="select" label="Used masking algorithm">
             <option value="dust">DUST</option>
             <option value="seg" selected="true">SEG</option>
             <option value="windowmasker">windowmasker</option>
             <option value="repeat">repeat</option>
             <option value="other">other</option>
         </param>
-        <param name="masking_options" type="text" value="" size="20" label="Masking algorithm options to create the masked input" 
-            help ="free text to describe the options used to create the masking files. (-masking_options)">
+        <param argument="-masking_options" type="text" value="" size="20" label="Masking algorithm options to create the masked input"
+            help ="Free text to describe the options used to create the masking files">
             <sanitizer invalid_char="">
                 <valid initial="string.printable" />
             </sanitizer>
         </param>
-        <param name="parse_seqids" type="boolean" truevalue="-parse_seqids" falsevalue="" checked="true" label="Parse Seq-ids in FASTA input" help="(-parse_seqids)" />
-        <param name="outformat" type="select" label="Output format">
+        <param argument="-parse_seqids" type="boolean" truevalue="-parse_seqids" falsevalue="" checked="true" label="Parse Seq-ids in FASTA input" help="(-parse_seqids)" />
+        <param name="outformat" argument="-outfmt" type="select" label="Output format">
             <option value="maskinfo_asn1_bin">maskinfo ASN.1 binary</option>
-            <option value="maskinfo_asn1_text" selected="True">maskinfo ASN.1 text</option>
+            <option value="maskinfo_asn1_text" selected="true">maskinfo ASN.1 text</option>
             <option value="maskinfo_xml">maskinfo_xml</option>
         </param>
     </inputs>
@@ -42,9 +42,9 @@
         <data name="outfile" format="maskinfo-asn1" label="SEG Masked File">
             <change_format>
                 <when input="outformat" value="maskinfo_asn1_bin" format="maskinfo-asn1-binary" />
-		<!--
+                <!--
                 <when input="outformat" value="maskinfo_asn1_text" format="maskinfo-asn1" />
-		-->
+                -->
                 <when input="outformat" value="maskinfo_xml" format="xml" />
             </change_format>
         </data>
@@ -54,7 +54,7 @@
             <param name="infile" value="four_human_proteins_masked.fasta" ftype="fasta" />
             <param name="masking_algorithm" value="seg" />
             <param name="masking_options" value="window=12; locut=2.2; hicut=2.5" />
-            <param name="parse_seqids" value="True" />
+            <param name="parse_seqids" value="true" />
             <param name="outformat" value="maskinfo_asn1_bin" />
             <output name="outfile" file="convert2blastmask_four_human_masked.maskinfo-asn1-binary" />
         </test>
@@ -62,7 +62,7 @@
             <param name="infile" value="four_human_proteins_masked.fasta" ftype="fasta" />
             <param name="masking_algorithm" value="seg" />
             <param name="masking_options" value="window=12; locut=2.2; hicut=2.5" />
-            <param name="parse_seqids" value="True" />
+            <param name="parse_seqids" value="true" />
             <param name="outformat" value="maskinfo_asn1_text" />
             <output name="outfile" file="convert2blastmask_four_human_masked.maskinfo-asn1" />
         </test>
--- a/tools/ncbi_blast_plus/ncbi_dustmasker_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_dustmasker_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,26 +6,26 @@
         <import>ncbi_macros.xml</import>
     </macros>
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 dustmasker
 #if $db_opts.db_opts_selector == "db":
-  -in "${db_opts.database.fields.path}" -infmt blastdb
+  -in '${db_opts.database.fields.path}' -infmt blastdb
 #elif $db_opts.db_opts_selector == "histdb":
-  -in "${os.path.join($db_opts.histdb.files_path, 'blastdb')}" -infmt blastdb
+  -in '${os.path.join($db_opts.histdb.files_path, "blastdb")}' -infmt blastdb
 #else:
-  -in "$subject" -infmt fasta
+  -in '$subject' -infmt fasta
 #end if
--out "$outfile"
+-out '$outfile'
 -window $window -level $level -linker $linker -outfmt $outformat
     </command>
     <inputs>
         <expand macro="input_conditional_nucleotide_db" />
-        <param name="window" type="integer" value="64" label="DUST window length" />
-        <param name="level" type="integer" value="20" label="DUST level" help="Score threshold for subwindows" />
-        <param name="linker" type="integer" value="1" label="DUST linker" help="How close masked intervals should be to get merged together" />
-        <param name="outformat" type="select" label="Output format">
+        <param argument="-window" type="integer" value="64" label="DUST window length" />
+        <param argument="-level" type="integer" value="20" label="DUST level" help="Score threshold for subwindows" />
+        <param argument="-linker" type="integer" value="1" label="DUST linker" help="How close masked intervals should be to get merged together" />
+        <param name="outformat" argument="-outfmt" type="select" label="Output format">
             <!-- seqloc_* formats are not very useful
                  and what BLAST+ calls 'interval' is not what Galaxy calls interval format
             -->
@@ -40,9 +40,9 @@
             <change_format>
                 <when input="outformat" value="fasta" format="fasta" />
                 <when input="outformat" value="maskinfo_asn1_bin" format="maskinfo-asn1-binary" />
-		<!--
+                <!--
                 <when input="outformat" value="maskinfo_asn1_text" format="maskinfo-asn1" />
-		-->
+                -->
                 <when input="outformat" value="maskinfo_xml" format="xml" />
             </change_format>
         </data>
--- a/tools/ncbi_blast_plus/ncbi_macros.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_macros.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -1,5 +1,5 @@
 <macros>
-    <token name="@WRAPPER_VERSION@">0.2.00</token>
+    <token name="@WRAPPER_VERSION@">0.2.01</token>
     <xml name="parallelism">
         <!-- If job splitting is enabled, break up the query file into parts -->
         <parallelism method="multi" split_inputs="query" split_mode="to_size" split_size="1000" merge_outputs="output1" />
@@ -8,15 +8,6 @@
         <requirements>
             <requirement type="package" version="2.5.0">blast</requirement>
         </requirements>
-        <stdio>
-            <!-- Anything other than zero is an error -->
-            <exit_code range="1:" />
-            <!-- Might see negative return codes for Unix signals via Python subprocess -->
-            <exit_code range=":-1" />
-            <!-- In case the return code has not been set properly check stderr too -->
-            <regex match="Error:" />
-            <regex match="Exception:" />
-        </stdio>
         <version_command>@BINARY@ -version</version_command>
     </xml>
     <xml name="output_change_format">
@@ -32,9 +23,9 @@
     </xml>
     <xml name="input_out_format">
         <conditional name="output">
-            <param name="out_format" type="select" label="Output format">
+            <param name="out_format" argument="-outfmt" type="select" label="Output format">
                 <option value="6">Tabular (standard 12 columns)</option>
-                <option value="ext" selected="True">Tabular (extended 25 columns)</option>
+                <option value="ext" selected="true">Tabular (extended 25 columns)</option>
                 <option value="cols">Tabular (select which columns)</option>
                 <option value="5">BLAST XML</option>
                 <option value="0">Pairwise text</option>
@@ -118,11 +109,11 @@
         </conditional>
     </xml>
     <xml name="input_scoring_matrix">
-        <param name="matrix" type="select" label="Scoring matrix">
+        <param argument="-matrix" type="select" label="Scoring matrix">
             <option value="BLOSUM90">BLOSUM90</option>
             <option value="BLOSUM80">BLOSUM80</option>
             <option value="BLOSUM62" selected="true">BLOSUM62 (default)</option>
-            <option value="BLOSUM50">BLOSUM50</option> 
+            <option value="BLOSUM50">BLOSUM50</option>
             <option value="BLOSUM45">BLOSUM45</option>
             <option value="PAM250">PAM250</option>
             <option value="PAM70">PAM70</option>
@@ -130,9 +121,9 @@
         </param>
     </xml>
     <xml name="input_query_gencode">
-        <param name="query_gencode" type="select" label="Query genetic code">
+        <param argument="-query_gencode" type="select" label="Query genetic code">
             <!-- See http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi for details -->
-            <option value="1" selected="True">1. Standard</option>
+            <option value="1" selected="true">1. Standard</option>
             <option value="2">2. Vertebrate Mitochondrial</option>
             <option value="3">3. Yeast Mitochondrial</option>
             <option value="4">4. Mold, Protozoan, and Coelenterate Mitochondrial Code and the Mycoplasma/Spiroplasma Code</option>
@@ -153,9 +144,9 @@
         </param>
     </xml>
     <xml name="input_db_gencode">
-        <param name="db_gencode" type="select" label="Database/subject genetic code">
+        <param argument="-db_gencode" type="select" label="Database/subject genetic code">
             <!-- See http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi for details -->
-            <option value="1" selected="True">1. Standard</option>
+            <option value="1" selected="true">1. Standard</option>
             <option value="2">2. Vertebrate Mitochondrial</option>
             <option value="3">3. Yeast Mitochondrial</option>
             <option value="4">4. Mold, Protozoan, and Coelenterate Mitochondrial Code and the Mycoplasma/Spiroplasma Code</option>
@@ -176,9 +167,10 @@
         </param>
     </xml>
     <xml name="input_conditional_nucleotide_db">
+        <!-- Usually database argument mapped to -db, but -in in dustmasker -->
         <conditional name="db_opts">
             <param name="db_opts_selector" type="select" label="Subject database/sequences">
-              <option value="db" selected="True">Locally installed BLAST database</option>
+              <option value="db" selected="true">Locally installed BLAST database</option>
               <option value="histdb">BLAST database from your history</option>
               <option value="file">FASTA file from your history (see warning note below)</option>
             </param>
@@ -187,7 +179,7 @@
                     <options from_data_table="blastdb" />
                 </param>
                 <param name="histdb" type="hidden" value="" />
-                <param name="subject" type="hidden" value="" /> 
+                <param name="subject" type="hidden" value="" />
             </when>
             <when value="histdb">
                 <param name="database" type="hidden" value="" />
@@ -197,14 +189,15 @@
             <when value="file">
                 <param name="database" type="hidden" value="" />
                 <param name="histdb" type="hidden" value="" />
-                <param name="subject" type="data" format="fasta" label="Nucleotide FASTA file to use as database"/> 
+                <param argument="-subject" type="data" format="fasta" label="Nucleotide FASTA subject file to use instead of a database"/>
             </when>
         </conditional>
     </xml>
     <xml name="input_conditional_protein_db">
+        <!-- Usually database argument mapped to -db, but -in in segmasker -->
         <conditional name="db_opts">
             <param name="db_opts_selector" type="select" label="Subject database/sequences">
-              <option value="db" selected="True">Locally installed BLAST database</option>
+              <option value="db" selected="true">Locally installed BLAST database</option>
               <option value="histdb">BLAST database from your history</option>
               <option value="file">FASTA file from your history (see warning note below)</option>
             </param>
@@ -223,18 +216,18 @@
             <when value="file">
                 <param name="database" type="hidden" value="" />
                 <param name="histdb" type="hidden" value="" />
-                <param name="subject" type="data" format="fasta" label="Protein FASTA file to use as database"/> 
+                <param argument="-subject" type="data" format="fasta" label="Protein FASTA subject file to use instead of a database"/>
             </when>
         </conditional>
     </xml>
     <xml name="input_conditional_pssm">
         <conditional name="db_opts">
             <param name="db_opts_selector" type="select" label="Protein domain database (PSSM)">
-              <option value="db" selected="True">Locally installed BLAST protein domain database</option>
+              <option value="db" selected="true">Locally installed BLAST protein domain database</option>
               <option value="histdb">BLAST protein domain database from your history</option>
             </param>
             <when value="db">
-                <param name="database" type="select" label="Protein domain database">
+                <param name="database" argument="-db" type="select" label="Protein domain database">
                     <options from_data_table="blastdb_d" />
                 </param>
                 <param name="histdb" type="hidden" value="" />
@@ -242,65 +235,62 @@
             </when>
             <when value="histdb">
                 <param name="database" type="hidden" value="" />
-                <param name="histdb" type="data" format="blastdbd" label="Protein domain database" />
+                <param name="histdb" argument="-db" type="data" format="blastdbd" label="Protein domain database" />
                 <param name="subject" type="hidden" value="" />
             </when>
         </conditional>
     </xml>
     <xml name="input_conditional_choose_db_type">
         <conditional name="db_opts">
-            <param name="db_type" type="select" label="Type of BLAST database">
-              <option value="nucl" selected="True">Nucleotide</option>
+            <param argument="-db_type" type="select" label="Type of BLAST database">
+              <option value="nucl" selected="true">Nucleotide</option>
               <option value="prot">Protein</option>
             </param>
             <when value="nucl">
-                <param name="database" type="select" multiple="true" label="Nucleotide BLAST database">
+                <param name="database" argument="-db" type="select" multiple="true" label="Nucleotide BLAST database">
                     <options from_data_table="blastdb" />
                 </param>
             </when>
             <when value="prot">
-                <param name="database" type="select" multiple="true" label="Protein BLAST database">
+                <param name="database" argument="-db" type="select" multiple="true" label="Protein BLAST database">
                     <options from_data_table="blastdb_p" />
                 </param>
             </when>
         </conditional>
     </xml>
     <xml name="input_parse_deflines">
-        <param name="parse_deflines" type="boolean" label="Should the query and subject defline(s) be parsed?" truevalue="-parse_deflines" falsevalue="" checked="false" help="This affects the formatting of the query/subject ID strings"/>
+        <param argument="-parse_deflines" type="boolean" label="Should the query and subject defline(s) be parsed?" truevalue="-parse_deflines" falsevalue="" checked="false" help="This affects the formatting of the query/subject ID strings"/>
     </xml>
     <xml name="input_filter_query_default_false">
-        <param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="false" />
+        <param name="filter_query" argument="-seg" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="false" />
     </xml>
     <xml name="input_filter_query_default_true">
-        <param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
+        <param name="filter_query" argument="-seg" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
     </xml>
     <xml name="input_max_hits">
-        <param name="max_hits" type="integer" value="0" label="Maximum hits to show" help="Use zero for default limits">
-            <validator type="in_range" min="0" />
-        </param>        
+        <param name="max_hits" type="integer" min="0" value="0" label="Maximum hits to show" help="Use zero for default limits" />
+        <param argument="-max_hsps" type="integer" min="1" optional="true" value="" label="Maximum number of HSPs (alignments) to keep for any single query-subject pair" help="The HSPs shown will be the best as judged by expect value. If this option is not set, BLAST shows all HSPs meeting the expect value criteria" />
     </xml>
     <xml name="input_evalue">
-        <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" />
+        <param name="evalue_cutoff" argument="-evalue" type="float" size="15" value="0.001" label="Set expectation value cutoff" />
     </xml>
     <xml name="input_word_size">
-        <param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2.">
-            <validator type="in_range" min="0" />
-        </param>        
+        <param argument="-word_size" type="integer" min="0" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2" />
     </xml>
     <xml name="input_strand">
-        <param name="strand" type="select" label="Query strand(s) to search against database/subject">
+        <param argument="-strand" type="select" label="Query strand(s) to search against database/subject">
             <option value="-strand both">Both</option>
             <option value="-strand plus">Plus (forward)</option>
             <option value="-strand minus">Minus (reverse complement)</option>
         </param>
     </xml>
     <xml name="input_qcov_hsp_perc">
-        <param name="qcov_hsp_perc" type="float" value="0" min="0" max="100" label="Minimum query coverage per hsp (percentage, 0 to 100)" help="See also the output column qcovhsp"/>
+        <param argument="-qcov_hsp_perc" type="float" value="0" min="0" max="100" label="Minimum query coverage per hsp (percentage, 0 to 100)" help="See also the output column qcovhsp"/>
     </xml>
     <xml name="advanced_options">
         <conditional name="adv_opts">
             <param name="adv_opts_selector" type="select" label="Advanced Options">
-              <option value="basic" selected="True">Hide Advanced Options</option>
+              <option value="basic" selected="true">Hide Advanced Options</option>
               <option value="advanced">Show Advanced Options</option>
             </param>
             <when value="basic" />
@@ -313,23 +303,23 @@
         <conditional name="adv_optional_id_files_opts">
             <param name="adv_optional_id_files_opts_selector" type="select"
                    label="Restrict search of database to a given set of ID's"
-		   help="This feature provides a means to exclude ID's from a BLAST database search. The expectation values in the BLAST results are based upon the sequences actually searched, and not on the underlying database. Note this cannot be used when comparing against a FASTA file.">
-                <option value="none" selected="True">No restriction, search the entire database</option>
+                   help="This feature provides a means to exclude ID's from a BLAST database search. The expectation values in the BLAST results are based upon the sequences actually searched, and not on the underlying database. Note this cannot be used when comparing against a FASTA file.">
+                <option value="none" selected="true">No restriction, search the entire database</option>
                 <option value="gilist">GI identifiers</option>
                 <option value="negative_gilist">Negative GI identifiers</option>
                 <option value="seqidlist">Sequence identifiers (SeqId's)</option>
             </param>
             <when value="none" />
             <when value="gilist">
-                <param name="gilist" type="data" format="txt" label="Restrict search of database to GI's listed in this file"
+                <param argument="-gilist" type="data" format="txt" label="Restrict search of database to GI's listed in this file"
                        help="This option is only available for database searches."/>
             </when>
             <when value="negative_gilist">
-                <param name="negative_gilist" type="data" format="txt" label="Restrict search of database to everything except the GI's listed in this file"
+                <param argument="-negative_gilist" type="data" format="txt" label="Restrict search of database to everything except the GI's listed in this file"
                        help="This option is only available for database searches."/>
             </when>
             <when value="seqidlist">
-                <param name="seqidlist" type="data" format="txt" label=" Restrict search of database to list of SeqId's"
+                <param argument="-seqidlist" type="data" format="txt" label=" Restrict search of database to list of SeqId's"
                        help="This option is only available for database searches."/>
             </when>
         </conditional>
@@ -351,23 +341,24 @@
     <token name="@THREADS@">-num_threads "\${GALAXY_SLOTS:-8}"</token>
     <token name="@BLAST_DB_SUBJECT@">
 #if $db_opts.db_opts_selector == "db":
-  -db "${' '.join(str( $db_opts.database.fields.path ).split( ',' ))}"
+  -db '${" ".join(str($db_opts.database.fields.path).split(","))}'
 #elif $db_opts.db_opts_selector == "histdb":
-  -db "${os.path.join($db_opts.histdb.extra_files_path,'blastdb')}"
+  -db '${os.path.join($db_opts.histdb.extra_files_path, "blastdb")}'
 #else:
-  -subject "$db_opts.subject"
+  -subject '$db_opts.subject'
 #end if
     </token>
-    <token name="@BLAST_OUTPUT@">-out "$output1"
+    <token name="@BLAST_OUTPUT@">-out '$output1'
 ##Set the extended list here so when we add things, saved workflows are not affected
 #if str($output.out_format)=="ext":
-    -outfmt "6 std sallseqid score nident positive gaps ppos qframe sframe qseq sseq qlen slen salltitles"
+    -outfmt '6 std sallseqid score nident positive gaps ppos qframe sframe qseq sseq qlen slen salltitles'
 #elif str($output.out_format)=="cols"
 ##Pick your own columns. Galaxy gives us it comma separated, BLAST+ wants space separated:
 ##TODO - Can we catch the user picking no columns and raise an error here?
 #set cols = (str($output.std_cols)+","+str($output.ext_cols)+","+str($output.ids_cols)+","+str($output.misc_cols)+","+str($output.tax_cols)).replace("None", "").replace(",,", ",").replace(",", " ").strip()
-    -outfmt "6 $cols"
+    -outfmt '6 $cols'
 #else:
+## Note do not quote this as can be '0 -html' which is really two arguments
     -outfmt $output.out_format
 #end if
     </token>
@@ -377,13 +368,16 @@
 ## Note -max_target_seqs used to simply override -num_descriptions and -num_alignments
 ## but this was changed in BLAST+ 2.2.27 onwards to force their use (raised with NCBI)
 #if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
-#if str($output.out_format) in ["6", "ext", "cols", "5"]:
-## Most output formats use this, including tabular and XML:
--max_target_seqs $adv_opts.max_hits
-#else
-## Text and HTML output formats 0-4 currently need this instead:
--num_descriptions $adv_opts.max_hits -num_alignments $adv_opts.max_hits
+    #if str($output.out_format) in ["6", "ext", "cols", "5"]:
+        ## Most output formats use this, including tabular and XML:
+        -max_target_seqs $adv_opts.max_hits
+    #else
+        ## Text and HTML output formats 0-4 currently need this instead:
+        -num_descriptions $adv_opts.max_hits -num_alignments $adv_opts.max_hits
+    #end if
 #end if
+#if str($adv_opts.max_hsps)
+    -max_hsps $adv_opts.max_hsps
 #end if
     </token>
     <token name="@ADV_WORD_SIZE@">
@@ -394,11 +388,11 @@
     </token>
     <!-- @ON_DB_SUBJECT@ is for use with @BLAST_DB_SUBJECT@ -->
     <token name="@ON_DB_SUBJECT@">#if str($db_opts.db_opts_selector)=='db'
-${db_opts.database}
+'${db_opts.database}'
 #elif str($db_opts.db_opts_selector)=='histdb'
-${db_opts.histdb.name}
+'${db_opts.histdb.name}'
 #else
-${db_opts.subject.name}
+'${db_opts.subject.name}'
 #end if</token>
     <token name="@REFERENCES@">
 Peter J. A. Cock, John M. Chilton, Björn Grüning, James E. Johnson, Nicola Soranzo (2015).
@@ -491,7 +485,7 @@
     <token name="@SEARCH_TIME_WARNING@">.. class:: warningmark
 
 **Note**. Database searches may take a substantial amount of time.
-For large input datasets it is advisable to allow overnight processing.  
+For large input datasets it is advisable to allow overnight processing.
 
 -----
     </token>
--- a/tools/ncbi_blast_plus/ncbi_makeblastdb.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_makeblastdb.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -5,23 +5,24 @@
         <import>ncbi_macros.xml</import>
     </macros>
     <expand macro="preamble" />
-    <command interpreter="python">check_no_duplicates.py
+    <command detect_errors="aggressive" strict="true">
+python $__tool_directory__/check_no_duplicates.py
 ##First check for duplicates (since BLAST+ 2.2.28 fails to do so)
 ##and abort (via the ampersand ampersand trick) if any are found.
-#for i in $input_file#"${i}" #end for#
+#for i in $input_file#'${i}' #end for#
 &amp;&amp;
-makeblastdb -out "${os.path.join($outfile.files_path,'blastdb')}"
+makeblastdb -out '${os.path.join($outfile.files_path, "blastdb")}'
 $parse_seqids
 $hash_index
 ## Single call to -in with multiple filenames space separated with outer quotes
 ## (presumably any filenames with spaces would be a problem). Note this gives
 ## some extra spaces, e.g. -in "file1 file2 file3 " but BLAST seems happy:
--in "#for i in $input_file#${i} #end for#"
+-in '#for i in $input_file#${i} #end for#'
 #if $title:
--title "$title"
+-title '$title'
 #else:
 ##Would default to being based on the cryptic Galaxy filenames, which is unhelpful
--title "BLAST Database"
+-title 'BLAST Database'
 #end if
 -dbtype $dbtype
 ## --------------------------------------------------------------------
@@ -31,7 +32,7 @@
 ## See Trello issue https://trello.com/c/lp5YmA1O
 #if ' '.join( map(str, $mask_data_file) ) != 'None':
 #for i in $mask_data_file:
--mask_data "${i}"
+-mask_data '${i}'
 #end for
 #end if
 ## --------------------------------------------------------------------
@@ -48,7 +49,7 @@
 &gt; "$outfile"
     </command>
     <inputs>
-        <param name="dbtype" type="select" display="radio" label="Molecule type of input">
+        <param argument="-dbtype" type="select" display="radio" label="Molecule type of input">
             <option value="prot">protein</option>
             <option value="nucl">nucleotide</option>
         </param>
@@ -56,13 +57,13 @@
              NOTE Double check the new database would be self contained first
         -->
         <!-- Note this is a mandatory parameter - default should be most recent FASTA file -->
-        <param name="input_file" type="data" multiple="true" optional="false" format="fasta" label="Input FASTA files(s)" help="One or more FASTA files" />
-        <param name="title" type="text" value="" label="Title for BLAST database" help="This is the database name shown in BLAST search output" />
-        <param name="parse_seqids" type="boolean" truevalue="-parse_seqids" falsevalue="" checked="False" label="Parse the sequence identifiers" help="This is only advised if your FASTA file follows the NCBI naming conventions using pipe '|' symbols" />
-        <param name="hash_index" type="boolean" truevalue="-hash_index" falsevalue="" checked="true" label="Enable the creation of sequence hash values" help="These hash values can then be used to quickly determine if a given sequence data exists in this BLAST database." />
+        <param name="input_file" argument="-in" type="data" multiple="true" optional="false" format="fasta" label="Input FASTA files(s)" help="One or more FASTA files" />
+        <param argument="-title" type="text" value="" label="Title for BLAST database" help="This is the database name shown in BLAST search output" />
+        <param argument="-parse_seqids" type="boolean" truevalue="-parse_seqids" falsevalue="" checked="false" label="Parse the sequence identifiers" help="This is only advised if your FASTA file follows the NCBI naming conventions using pipe '|' symbols" />
+        <param argument="-hash_index" type="boolean" truevalue="-hash_index" falsevalue="" checked="true" label="Enable the creation of sequence hash values" help="These hash values can then be used to quickly determine if a given sequence data exists in this BLAST database." />
         <!-- SEQUENCE MASKING OPTIONS -->
         <!-- Note this is an optional parameter - default should be NO files -->
-        <param name="mask_data_file" type="data" multiple="true" optional="true" value="" format="maskinfo-asn1,maskinfo-asn1-binary" label="Optional ASN.1 file(s) containing masking data" help="As produced by NCBI masking applications (e.g. dustmasker, segmasker, windowmasker)" />
+        <param name="mask_data_file" argument="-mask_data" type="data" multiple="true" optional="true" value="" format="maskinfo-asn1,maskinfo-asn1-binary" label="Optional ASN.1 file(s) containing masking data" help="As produced by NCBI masking applications (e.g. dustmasker, segmasker, windowmasker)" />
         <!-- TODO - Option to create GI indexed masking data? via -gi_mask and -gi_mask_name? -->
         <!-- TAXONOMY OPTIONS -->
         <conditional name="tax">
@@ -76,11 +77,11 @@
             <when value="">
             </when>
             <when value="id">
-                <param name="taxid" type="integer" value="" label="NCBI taxonomy ID" help="Integer &gt;=0, e.g. 9606 for Homo sapiens" min="0" />
+                <param argument="-taxid" type="integer" min="0" value="" label="NCBI taxonomy ID" help="Integer &gt;=0, e.g. 9606 for Homo sapiens" />
             </when>
             <!-- TODO: File format?
             <when value="map">
-                <param name="taxmap" type="data" format="txt" label="Seq ID : Tax ID mapping file" help="Format: SequenceId TaxonomyId" />
+                <param name="taxmap" argument="-taxid_map" type="data" format="txt" label="Seq ID : Tax ID mapping file" help="Format: SequenceId TaxonomyId" />
             </when>
             -->
         </conditional>
@@ -107,7 +108,7 @@
             <param name="title" value="Just 4 human proteins" />
             <param name="parse_seqids" value="" />
             <param name="hash_index" value="true" />
-            <output name="out_file" compare="contains" file="four_human_proteins.fasta.log.txt" ftype="blastdbp">
+            <output name="outfile" compare="contains" file="four_human_proteins.fasta.log.txt" ftype="blastdbp">
                 <extra_files type="file" value="four_human_proteins.fasta.phr" name="blastdb.phr" />
                 <extra_files type="file" value="four_human_proteins.fasta.pin" name="blastdb.pin" lines_diff="2" />
                 <extra_files type="file" value="four_human_proteins.fasta.psq" name="blastdb.psq" />
@@ -126,7 +127,7 @@
             <param name="hash_index" value="true" />
             <param name="taxselect" value="id" />
             <param name="taxid" value="9606" />
-            <output name="out_file" compare="contains" file="four_human_proteins_taxid.fasta.log.txt" ftype="blastdbp">
+            <output name="outfile" compare="contains" file="four_human_proteins_taxid.fasta.log.txt" ftype="blastdbp">
                 <extra_files type="file" value="four_human_proteins_taxid.fasta.phr" name="blastdb.phr" />
                 <extra_files type="file" value="four_human_proteins_taxid.fasta.pin" name="blastdb.pin" lines_diff="2" />
                 <extra_files type="file" value="four_human_proteins_taxid.fasta.psq" name="blastdb.psq" />
@@ -144,7 +145,7 @@
             <param name="parse_seqids" value="" />
             <param name="hash_index" value="true" />
             <param name="mask_data_file" value="segmasker_four_human.maskinfo-asn1" ftype="maskinfo-asn1" />
-            <output name="out_file" compare="contains" file="four_human_proteins.fasta.log.txt" ftype="blastdbp">
+            <output name="outfile" compare="contains" file="four_human_proteins.fasta.log.txt" ftype="blastdbp">
                 <extra_files type="file" value="four_human_proteins.fasta.phr" name="blastdb.phr" />
                 <extra_files type="file" value="four_human_proteins.fasta.pin" name="blastdb.pin" lines_diff="2" />
                 <extra_files type="file" value="four_human_proteins.fasta.psq" name="blastdb.psq" />
@@ -163,7 +164,7 @@
             <param name="hash_index" value="true" />
             <param name="taxselect" value="id" />
             <param name="taxid" value="9606" />
-            <output name="out_file" compare="contains" file="three_human_mRNA.fasta.log.txt" ftype="blastdbn">
+            <output name="outfile" compare="contains" file="three_human_mRNA.fasta.log.txt" ftype="blastdbn">
                 <extra_files type="file" value="three_human_mRNA.fasta.nhr" name="blastdb.nhr" />
                 <extra_files type="file" value="three_human_mRNA.fasta.nin" name="blastdb.nin" lines_diff="2" />
                 <extra_files type="file" value="three_human_mRNA.fasta.nsq" name="blastdb.nsq" />
--- a/tools/ncbi_blast_plus/ncbi_makeprofiledb.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_makeprofiledb.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -5,19 +5,19 @@
         <import>ncbi_macros.xml</import>
     </macros>
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive" strict="true">
 ##Unlike makeblastdb, makeprofiledb needs directory to exist already:
 mkdir -p $outfile.files_path &amp;&amp;
-makeprofiledb -out "${os.path.join($outfile.files_path,'blastdb')}"
+makeprofiledb -out '${os.path.join($outfile.files_path, "blastdb")}'
 
-##We turn $infile_list into $infiles with a configfile entry defined below
--in $infiles
+##We turn $input_file into $infiles with a configfile entry defined below
+-in '$infiles'
 
 #if $title:
--title "$title"
+-title '$title'
 #else:
 ##Would default to being based on the cryptic Galaxy filenames, which is unhelpful
--title "Profile Database"
+-title 'Profile Database'
 #end if
 
 -threshold $threshold
@@ -32,7 +32,7 @@
 -obsr_threshold $obsr_threshold
 -exclude_invalid $exclude_invalid
 
--logfile "$outfile"
+-logfile '$outfile'
     </command>
     <configfiles>
         <configfile name="infiles">
@@ -42,13 +42,12 @@
         </configfile>
     </configfiles>
     <inputs>
-        <param name="input_file" type="data" multiple="true" optional="false" format="pssm-asn1"
-	       label="Input PSSM files(s)"
-	       help="One or NCBI PSSM ASN.1 format scoremat files (often named *.smp)" />
-        <param name="infile_list" type="data" multiple="true" format="pssm-asn1" />
+        <param name="input_file" argument="-in" type="data" multiple="true" optional="false" format="pssm-asn1"
+               label="Input PSSM files(s)"
+               help="One or NCBI PSSM ASN.1 format scoremat files (often named *.smp)" />
 
-        <param name="title" type="text" value="" label="Title for the profile database" help="This is the database name shown in BLAST search output" />
-        <param name="threshold" type="float" size="5" value="9.82" label="Minimum word score to add a word to the lookup table" />
+        <param argument="-title" type="text" value="" label="Title for the profile database" help="This is the database name shown in BLAST search output" />
+        <param argument="-threshold" type="float" size="5" value="9.82" label="Minimum word score to add a word to the lookup table" />
 
         <!-- output options -->
         <!-- Initially we're only offering the default, RPS databases for use with rpsblast and rpstblastn
@@ -61,24 +60,24 @@
 
         <conditional name="contain_pssm_scores">
             <param name="contain_pssm_scores_type" type="select" label="Does your input file contain PSSM scores?">
-              <option value="yes" selected="True">Yes</option>
+              <option value="yes" selected="true">Yes</option>
               <option value="no">No</option>
             </param>
             <when value="yes" />
             <when value="no">
-                <param name="gapopen" type="integer" size="5" value="" label="Cost to open a gap" />
-                <param name="gapextend" type="integer" size="5" value="" label="Cost to extend a gap" />
-                <param name="scale" type="float" size="5" value="" label="PSSM scale factor" />
+                <param argument="-gapopen" type="integer" size="5" value="" label="Cost to open a gap" />
+                <param argument="-gapextend" type="integer" size="5" value="" label="Cost to extend a gap" />
+                <param argument="-scale" type="float" size="5" value="" label="PSSM scale factor" />
                 <expand macro="input_scoring_matrix" />
             </when>
         </conditional>
 
         <!--  Delta Blast Options -->
-        <param name="exclude_invalid" type="boolean" truevalue="true" falsevalue="false" checked="true" 
+        <param argument="-exclude_invalid" type="boolean" truevalue="true" falsevalue="false" checked="true"
             label="Exclude invalid domains?"
             help="Exclude domains that do not pass validation test" />
-        <param name="obsr_threshold" type="float" size="5" value="6.0"
-            label="Observation threshold"            
+        <param argument="-obsr_threshold" type="float" size="5" value="6.0"
+            label="Observation threshold"
             help="Exclude domains with with maximum number of independent observations below this threshold" />
     </inputs>
     <outputs>
@@ -89,7 +88,7 @@
             <param name="input_file" value="cd00003.smp,cd00008.smp" ftype="pssm-asn1" />
             <param name="title" value="Just 2 PSSM matrices" />
             <param name="contain_pssm_scores_type" value="yes" />
-            <output name="out_file" file="empty_file.dat" ftype="blastdbd" >
+            <output name="outfile" file="empty_file.dat" ftype="blastdbd" >
                 <extra_files type="file" value="cd00003_and_cd00008.phr" name="blastdb.phr" />
                 <extra_files type="file" value="cd00003_and_cd00008.pin" name="blastdb.pin" lines_diff="2" />
                 <extra_files type="file" value="cd00003_and_cd00008.psq" name="blastdb.psq" />
--- a/tools/ncbi_blast_plus/ncbi_rpsblast_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_rpsblast_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,15 +6,15 @@
     </macros>
     <expand macro="parallelism" />
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 rpsblast
--query "$query"
+-query '$query'
 #if $db_opts.db_opts_selector == "db":
-  -db "${db_opts.database.fields.path}"
+  -db '${db_opts.database.fields.path}'
 #elif $db_opts.db_opts_selector == "histdb":
-  -db "${os.path.join($db_opts.histdb.files_path,'blastdb')}"
+  -db '${os.path.join($db_opts.histdb.files_path, "blastdb")}'
 #end if
 -evalue $evalue_cutoff
 @BLAST_OUTPUT@
@@ -27,7 +27,7 @@
 #end if
     </command>
     <inputs>
-        <param name="query" type="data" format="fasta" label="Protein query sequence(s)"/> 
+        <param argument="-query" type="data" format="fasta" label="Protein query sequence(s)"/>
 
         <expand macro="input_conditional_pssm" />
 
@@ -61,7 +61,7 @@
         </test>
     </tests>
     <help>
-    
+
 @SEARCH_TIME_WARNING@
 
 **What it does**
@@ -76,7 +76,7 @@
 http://www.ncbi.nlm.nih.gov/Structure/cdd/cdd_help.shtml#NCBI_curated_domains
 
 *Kog* - PSSMs from automatically aligned sequences and sequence
-fragments classified in the KOGs resource, the eukaryotic 
+fragments classified in the KOGs resource, the eukaryotic
 counterpart to COGs, see http://www.ncbi.nlm.nih.gov/COG/
 
 *Cog* - PSSMs from automatically aligned sequences and sequence
--- a/tools/ncbi_blast_plus/ncbi_rpstblastn_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_rpstblastn_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,15 +6,15 @@
     </macros>
     <expand macro="parallelism" />
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 rpstblastn
--query "$query"
+-query '$query'
 #if $db_opts.db_opts_selector == "db":
-  -db "${db_opts.database.fields.path}"
+  -db '${db_opts.database.fields.path}'
 #elif $db_opts.db_opts_selector == "histdb":
-  -db "${os.path.join($db_opts.histdb.files_path,'blastdb')}"
+  -db '${os.path.join($db_opts.histdb.files_path, "blastdb")}'
 #end if
 -evalue $evalue_cutoff
 @BLAST_OUTPUT@
@@ -28,7 +28,7 @@
 #end if
     </command>
     <inputs>
-        <param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/> 
+        <param argument="-query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
 
         <expand macro="input_conditional_pssm" />
 
@@ -61,7 +61,7 @@
         </test>
     </tests>
     <help>
-    
+
 @SEARCH_TIME_WARNING@
 
 **What it does**
@@ -76,7 +76,7 @@
 http://www.ncbi.nlm.nih.gov/Structure/cdd/cdd_help.shtml#NCBI_curated_domains
 
 *Kog* - PSSMs from automatically aligned sequences and sequence
-fragments classified in the KOGs resource, the eukaryotic 
+fragments classified in the KOGs resource, the eukaryotic
 counterpart to COGs, see http://www.ncbi.nlm.nih.gov/COG/
 
 *Cog* - PSSMs from automatically aligned sequences and sequence
--- a/tools/ncbi_blast_plus/ncbi_segmasker_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_segmasker_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -5,18 +5,18 @@
         <import>ncbi_macros.xml</import>
     </macros>
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 segmasker
 #if $db_opts.db_opts_selector == "db":
-  -in "${db_opts.database.fields.path}" -infmt blastdb
+  -in '${db_opts.database.fields.path}' -infmt blastdb
 #elif $db_opts.db_opts_selector == "histdb":
-  -in "${os.path.join($db_opts.histdb.files_path, 'blastdb')}" -infmt blastdb
+  -in '${os.path.join($db_opts.histdb.files_path, "blastdb")}' -infmt blastdb
 #else:
-  -in "$subject" -infmt fasta
+  -in '$subject' -infmt fasta
 #end if
--out "$outfile"
+-out '$outfile'
 -window $window
 -locut $locut
 -hicut $hicut
@@ -42,9 +42,9 @@
             <change_format>
                 <when input="outformat" value="fasta" format="fasta" />
                 <when input="outformat" value="maskinfo_asn1_bin" format="maskinfo-asn1-binary" />
-		<!--
+                <!--
                 <when input="outformat" value="maskinfo_asn1_text" format="maskinfo-asn1" />
-		-->
+                -->
                 <when input="outformat" value="maskinfo_xml" format="xml" />
             </change_format>
         </data>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,11 +6,11 @@
     </macros>
     <expand macro="parallelism" />
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 tblastn
--query "$query"
+-query '$query'
 @BLAST_DB_SUBJECT@
 -task $blast_type
 -evalue $evalue_cutoff
@@ -30,10 +30,10 @@
 #end if
     </command>
     <inputs>
-        <param name="query" type="data" format="fasta" label="Protein query sequence(s)"/> 
+        <param argument="-query" type="data" format="fasta" label="Protein query sequence(s)"/>
 
         <expand macro="input_conditional_nucleotide_db" />
-        <param name="blast_type" type="select" display="radio" label="Type of BLAST">
+        <param name="blast_type" argument="-task" type="select" display="radio" label="Type of BLAST">
             <option value="tblastn">tblastn - Traditional TBLASTN to compare protein query to translated nucleotide database</option>
             <option value="tblastn-fast">tblastn-fast - Use longer words for seeding, faster but less accurate</option>
         </param>
@@ -51,7 +51,7 @@
             Can't use '-ungapped' on its own, error back is:
             Composition-adjusted searched are not supported with an ungapped search, please add -comp_based_stats F or do a gapped search
             Tried using '-ungapped -comp_based_stats F' and tblastn crashed with 'Attempt to access NULL pointer.'
-            <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped -comp_based_stats F" falsevalue="" checked="false" />
+            <param argument="-ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped -comp_based_stats F" falsevalue="" checked="false" />
             -->
             <expand macro="input_parse_deflines" />
             <expand macro="advanced_optional_id_files" />
@@ -144,7 +144,7 @@
         </test>
     </tests>
     <help>
-    
+
 @SEARCH_TIME_WARNING@
 
 **What it does**
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml	Wed Apr 19 05:27:19 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml	Mon Sep 18 06:21:27 2017 -0400
@@ -6,11 +6,11 @@
     </macros>
     <expand macro="parallelism" />
     <expand macro="preamble" />
-    <command>
+    <command detect_errors="aggressive">
 ## The command is a Cheetah template which allows some Python based syntax.
 ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
 tblastx
--query "$query"
+-query '$query'
 @BLAST_DB_SUBJECT@
 -query_gencode $query_gencode
 -evalue $evalue_cutoff
@@ -29,7 +29,7 @@
 #end if
     </command>
     <inputs>
-        <param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/> 
+        <param argument="-query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
 
         <expand macro="input_conditional_nucleotide_db" />
         <expand macro="input_query_gencode" />
@@ -69,7 +69,7 @@
         </test>
     </tests>
     <help>
-    
+
 @SEARCH_TIME_WARNING@
 
 **What it does**