changeset 29:82e833f02332 draft

planemo upload for repository https://github.com/peterjc/galaxy_blast/tree/master/tools/ncbi_blast_plus commit 100608715d0e98f250057fa362b99759bd750a31-dirty
author peterjc
date Wed, 11 Oct 2017 07:43:09 -0400
parents ce0b2cad3626
children d724d9af93ee
files tools/ncbi_blast_plus/README.rst 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_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_tblastn_wrapper.xml tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
diffstat 12 files changed, 419 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/tools/ncbi_blast_plus/README.rst	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/README.rst	Wed Oct 11 07:43:09 2017 -0400
@@ -3,7 +3,7 @@
 
 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.
+Nicola Soranzo, Jim Johnson, Bjoern Gruening, and Caleb Easterly.
 
 See the licence text below.
 
@@ -250,6 +250,11 @@
         - Add ``-use_sw_tback`` option for BLASTP (Nicola Soranzo).
 v0.2.02 - Document the BLAST+ 2.5.0 change in the standard 12 column output
           from ``qseqid,sseqid,...`` to ``qacc,sacc,...`` instead.
+        - Support for per-matrix recommended gaps settings (``-gapopen`` and
+          ``-gapextend``, contribution from Caleb Easterly and Jim Johnson).
+        - Support for ``-window_size``, ``-threshold``, ``-comp_based_stats``
+          and revising ``-word_size`` to avoid using zero to mean  default
+          (contribution from Caleb Easterly).
 ======= ======================================================================
 
 
--- a/tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastdbcmd_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -131,6 +131,10 @@
 
 -------
 
+@CLI_OPTIONS
+
+-------
+
 **References**
 
 If you use this Galaxy tool in work leading to a scientific publication please
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -27,6 +27,12 @@
 $adv_opts.ungapped
 @ADV_ID_LIST_FILTER@
 @ADV_QCOV_HSP_PERC@
+## only use window size if dc-megablast mode is used
+#if ($blast_type == "dc-megablast"):
+-window_size @ADV_WINDOW_SIZE@
+#end if
+@ADV_GAPOPEN@
+@ADV_GAPEXTEND@
 ## End of advanced options:
 #end if
     </command>
@@ -53,13 +59,18 @@
             <expand macro="input_strand" />
             <expand macro="input_max_hits" />
             <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 argument="-word_size" type="integer" min="0" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 4" />
+            <expand macro="input_word_size" />
             <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" />
+            <!-- the help text here is unique to the blastx application, so macro not used -->
+            <param name="window_size" type="integer" optional="true" min="0"
+                label="Multiple hits window size: use 0 to specify 1-hit algorithm, leave blank for default"
+                help="Only relevant for dc-megablast, and otherwise ignored. Default window size changes with substitution matrix and BLAST type.
+                    Entering a non-negative integer will override the default."/>
+            <expand macro="input_gapopen"/>
+            <expand macro="input_gapextend"/>
         </expand>
     </inputs>
     <outputs>
@@ -168,6 +179,10 @@
 
 -------
 
+@CLI_OPTIONS@
+
+-------
+
 **References**
 
 If you use this Galaxy tool in work leading to a scientific publication please
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -17,7 +17,7 @@
 @BLAST_OUTPUT@
 @THREADS@
 #if $adv_opts.adv_opts_selector=="advanced":
-    -matrix $adv_opts.matrix
+    @ADV_MATRIX_GAPCOSTS@
     @ADV_FILTER_QUERY@
     @ADV_MAX_HITS@
     @ADV_WORD_SIZE@
@@ -26,6 +26,10 @@
     @ADV_ID_LIST_FILTER@
     @ADV_QCOV_HSP_PERC@
     $adv_opts.use_sw_tback
+    @ADV_WINDOW_SIZE@
+    @ADV_THRESHOLD@
+    @ADV_COMP_BASED_STATS@
+## End of advanced options:
 #end if
     </command>
     <inputs>
@@ -33,19 +37,24 @@
 
         <expand macro="input_conditional_protein_db" />
 
-        <param name="blast_type" argument="-task" type="select" display="radio" label="Type of BLAST">
+        <param name="blast_type" argument="-task" type="select" display="radio"
+            label="Type of BLAST"
+            help="See help text for default parameter values for each BLAST type.">
             <option value="blastp">blastp - Traditional BLASTP to compare a protein query to a protein database</option>
+            <option value="blastp-short">blastp-short - BLASTP optimized for queries shorter than 30 residues</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>
         </param>
         <expand macro="input_evalue" />
         <expand macro="input_out_format" />
         <expand macro="advanced_options">
             <!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
             <expand macro="input_filter_query_default_false" />
-            <expand macro="input_scoring_matrix" />
+            <expand macro="input_matrix_gapcosts" />
             <expand macro="input_max_hits" />
             <expand macro="input_word_size" />
+            <expand macro="input_window_size" />
+            <expand macro="input_threshold" />
+            <expand macro="input_comp_based_stats" />
             <!--
             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
@@ -76,7 +85,8 @@
             <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="word_size" value="" />
+            <param name="window_size" value="40" />
             <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" />
@@ -93,7 +103,8 @@
             <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="word_size" value="" />
+            <param name="window_size" value="40" />
             <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" />
@@ -110,7 +121,7 @@
             <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="word_size" value="" />
             <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" />
@@ -126,6 +137,32 @@
             <param name="adv_opts_selector" value="basic" />
             <output name="output1" file="blastp_rhodopsin_vs_four_human.tabular" ftype="tabular" />
         </test>
+        <test>
+            <param name="query" value="rhodopsin_peptides.fasta" ftype="fasta" />
+            <param name="db_opts_selector" value="file" />
+            <param name="subject" value="four_human_proteins.fasta" ftype="fasta" />
+            <param name="database" value="" />
+            <param name="evalue_cutoff" value="200000" />
+            <param name="blast_type" value="blastp-short" />
+            <param name="out_format" value="6" />
+            <param name="adv_opts_selector" value="basic" />
+            <output name="output1" file="blastp_rhodopsin_peptides_vs_four_human.tabular" ftype="tabular" />
+        </test>
+        <test>
+            <param name="query" value="rhodopsin_proteins.fasta" ftype="fasta" />
+            <param name="db_opts_selector" value="file" />
+            <param name="subject" value="four_human_proteins.fasta" ftype="fasta" />
+            <param name="database value=" />
+            <param name="evalue_cutoff" value="1e-8"/>
+            <param name="blast_type" value="blastp" />
+            <param name="out_format" value="6"/>
+            <param name="adv_opts_selector" value="advanced"/>
+            <param name="window_size" value="35" />
+            <param name="matrix" value="BLOSUM62" />
+            <param name="gap_costs" value="-gapopen 11 -gapextend 1"/>
+            <param name="comp_based_stats" value="3" />
+            <output name="output1" file="blastp_rhodopsin_adv_vs_four_human.tabular" ftype="tabular" />
+        </test>
     </tests>
     <help>
 
@@ -138,10 +175,14 @@
 
 @FASTA_WARNING@
 
------
+-------
 
 @OUTPUT_FORMAT@
 
+------
+
+@CLI_OPTIONS@
+
 -------
 
 **References**
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -19,13 +19,16 @@
 @THREADS@
 #if $adv_opts.adv_opts_selector=="advanced":
 $adv_opts.strand
--matrix $adv_opts.matrix
+@ADV_MATRIX_GAPCOSTS@
 @ADV_FILTER_QUERY@
 @ADV_MAX_HITS@
 @ADV_WORD_SIZE@
 $adv_opts.ungapped
 @ADV_ID_LIST_FILTER@
 @ADV_QCOV_HSP_PERC@
+@ADV_WINDOW_SIZE@
+@ADV_THRESHOLD@
+@ADV_COMP_BASED_STATS@
 ## End of advanced options:
 #end if
     </command>
@@ -45,13 +48,16 @@
             <!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
             <expand macro="input_filter_query_default_true" />
             <expand macro="input_strand" />
-            <expand macro="input_scoring_matrix" />
+            <expand macro="input_matrix_gapcosts" />
             <expand macro="input_max_hits" />
             <expand macro="input_word_size" />
             <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" />
+            <expand macro="input_window_size" />
+            <expand macro="input_threshold" />
+            <expand macro="input_comp_based_stats" />
         </expand>
     </inputs>
     <outputs>
@@ -105,6 +111,17 @@
             <param name="adv_opts_selector" value="basic" />
             <output name="output1" file="blastx_rhodopsin_vs_four_human_all.tabular" ftype="tabular" />
         </test>
+        <test>
+            <param name="query" value="rhodopsin_nucs.fasta" ftype="fasta" />
+            <param name="db_opts_selector" value="file" />
+            <param name="subject" value="four_human_proteins.fasta" ftype="fasta" />
+            <param name="database" value="" />
+            <param name="evalue_cutoff" value="1e-10" />
+            <param name="out_format" value="6" />
+            <param name="adv_opts_selector" value="advanced" />
+            <param name="matrix" value="BLOSUM62" />
+            <output name="output1" file="blastx_rhodopsin_adv_vs_four_human.tabular" ftype="tabular" />
+        </test>
     </tests>
     <help>
 
@@ -117,12 +134,16 @@
 
 @FASTA_WARNING@
 
------
+-------
 
 @OUTPUT_FORMAT@
 
 -------
 
+@CLI_OPTIONS@
+
+-------
+
 **References**
 
 If you use this Galaxy tool in work leading to a scientific publication please
--- a/tools/ncbi_blast_plus/ncbi_macros.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_macros.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -4,12 +4,14 @@
         <!-- 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" />
     </xml>
+
     <xml name="preamble">
         <requirements>
             <requirement type="package" version="2.5.0">blast</requirement>
         </requirements>
         <version_command>@BINARY@ -version</version_command>
     </xml>
+
     <xml name="output_change_format">
         <change_format>
             <when input="output.out_format" value="0" format="txt"/>
@@ -21,6 +23,7 @@
             <when input="output.out_format" value="5" format="blastxml"/>
         </change_format>
     </xml>
+
     <xml name="input_out_format">
         <conditional name="output">
             <param name="out_format" argument="-outfmt" type="select" label="Output format">
@@ -108,6 +111,168 @@
             <when value="4 -html"/>
         </conditional>
     </xml>
+
+    <xml name="input_matrix_gapcosts">
+        <conditional name="matrix_gapcosts">
+            <param argument="-matrix" type="select" label="Scoring matrix and gap costs">
+                <option value="" selected="true">Use Defaults</option>
+                <option value="BLOSUM90">BLOSUM90</option>
+                <option value="BLOSUM80">BLOSUM80</option>
+                <option value="BLOSUM62">BLOSUM62</option>
+                <option value="BLOSUM50">BLOSUM50</option>
+                <option value="BLOSUM45">BLOSUM45</option>
+                <option value="PAM250">PAM250</option>
+                <option value="PAM70">PAM70</option>
+                <option value="PAM30">PAM30</option>
+            </param>
+            <when value="">
+            <!-- do nothing -->
+            </when>
+            <when value="BLOSUM90">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 9 -gapextend 2">Existence: 9  Extension: 2</option>
+                    <option value="-gapopen 8 -gapextend 2">Existence: 8  Extension: 2</option>
+                    <option value="-gapopen 7 -gapextend 2">Existence: 7  Extension: 2</option>
+                    <option value="-gapopen 6 -gapextend 2">Existence: 6  Extension: 2</option>
+                    <option value="-gapopen 11 -gapextend 1">Existence: 11  Extension: 1</option>
+                    <option value="-gapopen 10 -gapextend 1">Existence: 10  Extension: 1</option>
+                    <option value="-gapopen 9 -gapextend 1">Existence: 9  Extension: 1</option>
+                </param>
+
+            </when>
+            <when value="BLOSUM80">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 8 -gapextend 2">Existence: 8  Extension: 2</option>
+                    <option value="-gapopen 7 -gapextend 2">Existence: 7  Extension: 2</option>
+                    <option value="-gapopen 6 -gapextend 2">Existence: 6  Extension: 2</option>
+                    <option value="-gapopen 11 -gapextend 1">Existence: 11  Extension: 1</option>
+                    <option value="-gapopen 10 -gapextend 1">Existence: 10  Extension: 1</option>
+                    <option value="-gapopen 9 -gapextend 1">Existence: 9  Extension: 1</option>
+                </param>
+            </when>
+            <when value="BLOSUM62">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 11 -gapextend 2">Existence: 11  Extension: 2</option>
+                    <option value="-gapopen 10 -gapextend 2">Existence: 10  Extension: 2</option>
+                    <option value="-gapopen 9 -gapextend 2">Existence: 9  Extension: 2</option>
+                    <option value="-gapopen 8 -gapextend 2">Existence: 8  Extension: 2</option>
+                    <option value="-gapopen 7 -gapextend 2">Existence: 7  Extension: 2</option>
+                    <option value="-gapopen 6 -gapextend 2">Existence: 6  Extension: 2</option>
+                    <option value="-gapopen 13 -gapextend 1">Existence: 13  Extension: 1</option>
+                    <option value="-gapopen 12 -gapextend 1">Existence: 12  Extension: 1</option>
+                    <option value="-gapopen 11 -gapextend 1">Existence: 11  Extension: 1</option>
+                    <option value="-gapopen 10 -gapextend 1">Existence: 10  Extension: 1</option>
+                    <option value="-gapopen 9 -gapextend 1">Existence: 9  Extension: 1</option>
+                </param>
+
+            </when>
+            <when value="BLOSUM50">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 13 -gapextend 3">Existence: 13  Extension: 3</option>
+                    <option value="-gapopen 12 -gapextend 3">Existence: 12  Extension: 3</option>
+                    <option value="-gapopen 11 -gapextend 3">Existence: 11  Extension: 3</option>
+                    <option value="-gapopen 10 -gapextend 3">Existence: 10  Extension: 3</option>
+                    <option value="-gapopen 9 -gapextend 3">Existence: 9  Extension: 3</option>
+                    <option value="-gapopen 16 -gapextend 2">Existence: 16  Extension: 2</option>
+                    <option value="-gapopen 15 -gapextend 2">Existence: 15  Extension: 2</option>
+                    <option value="-gapopen 14 -gapextend 2">Existence: 14  Extension: 2</option>
+                    <option value="-gapopen 13 -gapextend 2">Existence: 13  Extension: 2</option>
+                    <option value="-gapopen 12 -gapextend 2">Existence: 12  Extension: 2</option>
+                    <option value="-gapopen 19 -gapextend 1">Existence: 19  Extension: 1</option>
+                    <option value="-gapopen 18 -gapextend 1">Existence: 18  Extension: 1</option>
+                    <option value="-gapopen 17 -gapextend 1">Existence: 17  Extension: 1</option>
+                    <option value="-gapopen 16 -gapextend 1">Existence: 16  Extension: 1</option>
+                    <option value="-gapopen 15 -gapextend 1">Existence: 15  Extension: 1</option>
+                </param>
+
+            </when>
+            <when value="BLOSUM45">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 13 -gapextend 3">Existence: 13  Extension: 3</option>
+                    <option value="-gapopen 12 -gapextend 3">Existence: 12  Extension: 3</option>
+                    <option value="-gapopen 11 -gapextend 3">Existence: 11  Extension: 3</option>
+                    <option value="-gapopen 10 -gapextend 3">Existence: 10  Extension: 3</option>
+                    <option value="-gapopen 15 -gapextend 2">Existence: 15  Extension: 2</option>
+                    <option value="-gapopen 14 -gapextend 2">Existence: 14  Extension: 2</option>
+                    <option value="-gapopen 13 -gapextend 2">Existence: 13  Extension: 2</option>
+                    <option value="-gapopen 12 -gapextend 2">Existence: 12  Extension: 2</option>
+                    <option value="-gapopen 19 -gapextend 1">Existence: 19  Extension: 1</option>
+                    <option value="-gapopen 18 -gapextend 1">Existence: 18  Extension: 1</option>
+                    <option value="-gapopen 17 -gapextend 1">Existence: 17  Extension: 1</option>
+                    <option value="-gapopen 16 -gapextend 1">Existence: 16  Extension: 1</option>
+                </param>
+            </when>
+            <when value="PAM250">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 15 -gapextend 3">Existence: 15  Extension: 3</option>
+                    <option value="-gapopen 14 -gapextend 3">Existence: 14  Extension: 3</option>
+                    <option value="-gapopen 13 -gapextend 3">Existence: 13  Extension: 3</option>
+                    <option value="-gapopen 12 -gapextend 3">Existence: 12  Extension: 3</option>
+                    <option value="-gapopen 17 -gapextend 2">Existence: 17  Extension: 2</option>
+                    <option value="-gapopen 16 -gapextend 2">Existence: 16  Extension: 2</option>
+                    <option value="-gapopen 15 -gapextend 2">Existence: 15  Extension: 2</option>
+                    <option value="-gapopen 14 -gapextend 2">Existence: 14  Extension: 2</option>
+                    <option value="-gapopen 13 -gapextend 2">Existence: 13  Extension: 2</option>
+                    <option value="-gapopen 21 -gapextend 1">Existence: 21  Extension: 1</option>
+                    <option value="-gapopen 20 -gapextend 1">Existence: 20  Extension: 1</option>
+                    <option value="-gapopen 19 -gapextend 1">Existence: 19  Extension: 1</option>
+                    <option value="-gapopen 18 -gapextend 1">Existence: 18  Extension: 1</option>
+                    <option value="-gapopen 17 -gapextend 1">Existence: 17  Extension: 1</option>
+                </param>
+
+            </when>
+            <when value="PAM70">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 12 -gapextend 3">Existence: 12 Extension: 3</option>
+                    <option value="-gapopen 11 -gapextend 2">Existence: 11 Extension: 2</option>
+                    <option value="-gapopen 8 -gapextend 2">Existence: 8  Extension: 2</option>
+                    <option value="-gapopen 7 -gapextend 2">Existence: 7  Extension: 2</option>
+                    <option value="-gapopen 6 -gapextend 2">Existence: 6  Extension: 2</option>
+                    <option value="-gapopen 11 -gapextend 1">Existence: 11  Extension: 1</option>
+                    <option value="-gapopen 10 -gapextend 1">Existence: 10  Extension: 1</option>
+                    <option value="-gapopen 9 -gapextend 1">Existence: 9  Extension: 1</option>
+                </param>
+
+            </when>
+            <when value="PAM30">
+                <param name="gap_costs" type="select" label="Gap Costs">
+                    <option value="" selected="true">Use defaults</option>
+                    <option value="-gapopen 15 -gapextend 3">Existence: 15 Extension: 3</option>
+                    <option value="-gapopen 13 -gapextend 3">Existence: 13 Extension: 3</option>
+                    <option value="-gapopen 14 -gapextend 2">Existence: 14 Extension: 2</option>
+                    <option value="-gapopen 7 -gapextend 2">Existence: 7  Extension: 2</option>
+                    <option value="-gapopen 6 -gapextend 2">Existence: 6  Extension: 2</option>
+                    <option value="-gapopen 5 -gapextend 2">Existence: 5  Extension: 2</option>
+                    <option value="-gapopen 14 -gapextend 1">Existence: 14 Extension: 1</option>
+                    <option value="-gapopen 10 -gapextend 1">Existence: 10  Extension: 1</option>
+                    <option value="-gapopen 9 -gapextend 1">Existence: 9  Extension: 1</option>
+                    <option value="-gapopen 8 -gapextend 1">Existence: 8  Extension: 1</option>
+                </param>
+            </when>
+        </conditional>
+    </xml>
+    <!-- these gapopen and gapextend macros are only used in blastn.
+        otherwise, the combined matrix/gapcosts macro is used -->
+    <xml name="input_gapopen">
+        <param argument="-gapopen" type="integer" optional="true" min="0"
+            label="Cost to open a gap"
+            help="Leave blank for default. See tool help for defaults."/>
+    </xml>
+
+    <xml name="input_gapextend">
+        <param argument="-gapextend" type="integer" optional="true" min="1"
+            label="Cost to extend a gap"
+            help="Leave blank for default. See tool help for defaults."/>
+    </xml>
+
+    <!-- this matrix macro is used in deltablast, makeprofiledb, psiblast, and tblastx -->
     <xml name="input_scoring_matrix">
         <param argument="-matrix" type="select" label="Scoring matrix">
             <option value="BLOSUM90">BLOSUM90</option>
@@ -120,6 +285,7 @@
             <option value="PAM30">PAM30</option>
         </param>
     </xml>
+
     <xml name="input_query_gencode">
         <param argument="-query_gencode" type="select" label="Query genetic code">
             <!-- See http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi for details -->
@@ -143,6 +309,7 @@
             <option value="24">24. Pterobranchia mitochondrial code</option>
         </param>
     </xml>
+
     <xml name="input_db_gencode">
         <param argument="-db_gencode" type="select" label="Database/subject genetic code">
             <!-- See http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi for details -->
@@ -166,6 +333,7 @@
             <option value="24">24. Pterobranchia mitochondrial code</option>
         </param>
     </xml>
+
     <xml name="input_conditional_nucleotide_db">
         <!-- Usually database argument mapped to -db, but -in in dustmasker -->
         <conditional name="db_opts">
@@ -193,6 +361,7 @@
             </when>
         </conditional>
     </xml>
+
     <xml name="input_conditional_protein_db">
         <!-- Usually database argument mapped to -db, but -in in segmasker -->
         <conditional name="db_opts">
@@ -220,6 +389,7 @@
             </when>
         </conditional>
     </xml>
+
     <xml name="input_conditional_pssm">
         <conditional name="db_opts">
             <param name="db_opts_selector" type="select" label="Protein domain database (PSSM)">
@@ -240,6 +410,7 @@
             </when>
         </conditional>
     </xml>
+
     <xml name="input_conditional_choose_db_type">
         <conditional name="db_opts">
             <param argument="-db_type" type="select" label="Type of BLAST database">
@@ -258,25 +429,34 @@
             </when>
         </conditional>
     </xml>
+
     <xml name="input_parse_deflines">
         <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" 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" 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" 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" argument="-evalue" type="float" size="15" value="0.001" label="Set expectation value cutoff" />
     </xml>
+
     <xml name="input_word_size">
-        <param argument="-word_size" type="integer" min="0" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2" />
+        <param argument="-word_size" type="integer" min="2" optional="true"
+        label="Word size for wordfinder algorithm"
+        help="Leave blank for default, otherwise minimum 2" />
     </xml>
+
     <xml name="input_strand">
         <param argument="-strand" type="select" label="Query strand(s) to search against database/subject">
             <option value="-strand both">Both</option>
@@ -284,9 +464,36 @@
             <option value="-strand minus">Minus (reverse complement)</option>
         </param>
     </xml>
+
     <xml name="input_qcov_hsp_perc">
         <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="input_window_size">
+        <param argument="-window_size" type="integer" optional="true" min="0"
+            label="Multiple hits window size: use 0 to specify 1-hit algorithm, leave blank for default"
+            help="Default window size varies with substitution matrix and BLAST type. Enter an integer to override the default."/>
+    </xml>
+
+    <xml name="input_threshold">
+        <param argument="-threshold" type="integer" optional="true" min="0"
+            label="Minimum score to add a word to the BLAST lookup table."
+            help="Leave blank for default, which varies based on application."/>
+    </xml>
+
+    <xml name="input_comp_based_stats">
+        <param argument="-comp_based_stats" type="select"
+            label="Composition-based statistics"
+            help="The default value varies based on application and task. Most common default is 2.">
+            <option value="">Use default</option>
+            <option value="0">0: No composition-based statistics</option>
+            <option value="1">1: Composition-based statistics as in NAR 29:2994-3005, 2001</option>
+            <option value="2">2: Composition-based score adjustment as in Bioinformatics
+                21:902-911, 2005, conditioned on sequence properties</option>
+            <option value="3">3: Composition-based score adjustment as in Bioinformatics 21:902-911, 2005, unconditionally</option>
+        </param>
+    </xml>
+
     <xml name="advanced_options">
         <conditional name="adv_opts">
             <param name="adv_opts_selector" type="select" label="Advanced Options">
@@ -299,6 +506,7 @@
             </when>
         </conditional>
     </xml>
+
     <xml name="advanced_optional_id_files">
         <conditional name="adv_optional_id_files_opts">
             <param name="adv_optional_id_files_opts_selector" type="select"
@@ -324,11 +532,20 @@
             </when>
         </conditional>
     </xml>
+<!--Tokens-->
+    <token name="@ADV_MATRIX_GAPCOSTS@">
+#if str($adv_opts.matrix_gapcosts.matrix):
+    -matrix $adv_opts.matrix_gapcosts.matrix
+    $adv_opts.matrix_gapcosts.gap_costs
+#end if
+    </token>
+
     <token name="@ADV_QCOV_HSP_PERC@">
 #if float(str($adv_opts.qcov_hsp_perc)) &gt; 0:
     -qcov_hsp_perc $adv_opts.qcov_hsp_perc
 #end if
     </token>
+
     <token name="@ADV_ID_LIST_FILTER@">
 #if $adv_opts.adv_optional_id_files_opts.adv_optional_id_files_opts_selector == 'negative_gilist':
     -negative_gilist $adv_opts.adv_optional_id_files_opts.negative_gilist
@@ -338,7 +555,9 @@
     -seqidlist $adv_opts.adv_optional_id_files_opts.seqidlist
 #end if
     </token>
+
     <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(","))}'
@@ -348,6 +567,7 @@
   -subject '$db_opts.subject'
 #end if
     </token>
+
     <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":
@@ -381,11 +601,47 @@
 #end if
     </token>
     <token name="@ADV_WORD_SIZE@">
-#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
+#if str($adv_opts.word_size):
 -word_size $adv_opts.word_size
 #end if
 $adv_opts.parse_deflines
     </token>
+    <token name="@ADV_WINDOW_SIZE@">
+#if str($adv_opts.window_size):
+-window_size $adv_opts.window_size
+#end if
+    </token>
+
+    <token name="@ADV_THRESHOLD@">
+#if str($adv_opts.threshold):
+-threshold $adv_opts.threshold
+#end if
+    </token>
+
+    <token name="@ADV_COMP_BASED_STATS@">
+#if str($adv_opts.comp_based_stats):
+-comp_based_stats $adv_opts.comp_based_stats
+#end if
+    </token>
+
+    <token name="@ADV_GAPOPEN@">
+#if str($adv_opts.gapopen):
+-gapopen $adv_opts.gapopen
+#end if
+    </token>
+
+    <token name="@ADV_GAPEXTEND@">
+#if str($adv_opts.gapextend):
+-gapextend $adv_opts.gapextend
+#end if
+    </token>
+
+    <token name="@ADV_MATRIX@">
+#if str($adv_opts.matrix):
+-matrix $adv_opts.matrix
+#end if
+    </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}'
@@ -394,6 +650,7 @@
 #else
 '${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).
 NCBI BLAST+ integrated into Galaxy. *GigaScience* 4:39
@@ -495,4 +752,11 @@
 
 -----
     </token>
+
+    <token name="@CLI_OPTIONS@">**Advanced Options**
+
+For help with advanced options and their default values, visit the `NCBI BLAST® Command Line Applications User Manual &lt;https://www.ncbi.nlm.nih.gov/books/NBK279675/&gt;`_.
+For amino acid substitution matrices, the NCBI User Manual page is `here &lt;https://www.ncbi.nlm.nih.gov/books/NBK379667/&gt;`_.
+
+    </token>
 </macros>
--- a/tools/ncbi_blast_plus/ncbi_makeblastdb.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_makeblastdb.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -184,15 +184,16 @@
 This is a wrapper for the NCBI BLAST+ tool 'makeblastdb', which is the
 replacement for the 'formatdb' tool in the NCBI 'legacy' BLAST suite.
 
+More information about makeblastdb can be found in the `BLAST Command Line Applications User Manual`_.
+
+.. _BLAST Command Line Applications User Manual: https://www.ncbi.nlm.nih.gov/books/NBK279690/
+
+
 <!--
 Applying masks to an existing BLAST database will not change the original database; a new database will be created.
 For this reason, it's best to apply all masks at once to minimize the number of unnecessary intermediate databases.
 -->
 
-**Documentation**
-
-https://www.ncbi.nlm.nih.gov/books/NBK279690/
-
 **References**
 
 If you use this Galaxy tool in work leading to a scientific publication please
--- a/tools/ncbi_blast_plus/ncbi_makeprofiledb.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_makeprofiledb.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -69,6 +69,10 @@
                 <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" />
+                <param argument="-gapopen" type="integer" min="0"
+                    label="Cost to open a gap" />
+                <param argument="-gapextend" type="integer" min="0"
+                    label="Cost to extend a gap" />
             </when>
         </conditional>
 
--- a/tools/ncbi_blast_plus/ncbi_rpsblast_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_rpsblast_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -23,6 +23,7 @@
 @ADV_FILTER_QUERY@
 @ADV_MAX_HITS@
 @ADV_QCOV_HSP_PERC@
+@ADV_WINDOW_SIZE@
 ## End of advanced options:
 #end if
     </command>
@@ -41,6 +42,7 @@
             <expand macro="input_max_hits" />
             <expand macro="input_parse_deflines" />
             <expand macro="input_qcov_hsp_perc" />
+            <expand macro="input_window_size" />
         </expand>
     </inputs>
     <outputs>
@@ -105,6 +107,10 @@
 
 -------
 
+@CLI_OPTIONS@
+
+-------
+
 **References**
 
 If you use this Galaxy tool in work leading to a scientific publication please
--- a/tools/ncbi_blast_plus/ncbi_rpstblastn_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_rpstblastn_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -105,6 +105,10 @@
 
 -------
 
+@CLI_OPTIONS@
+
+-------
+
 **References**
 
 If you use this Galaxy tool in work leading to a scientific publication please
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -18,14 +18,17 @@
 @THREADS@
 #if $adv_opts.adv_opts_selector=="advanced":
 -db_gencode $adv_opts.db_gencode
--matrix $adv_opts.matrix
 @ADV_FILTER_QUERY@
 @ADV_MAX_HITS@
 @ADV_WORD_SIZE@
+@ADV_MATRIX_GAPCOSTS@
 ##Ungapped disabled for now - see comments below
 ##$adv_opts.ungapped
 @ADV_ID_LIST_FILTER@
 @ADV_QCOV_HSP_PERC@
+@ADV_WINDOW_SIZE@
+@ADV_THRESHOLD@
+@ADV_COMP_BASED_STATS@
 ## End of advanced options:
 #end if
     </command>
@@ -44,7 +47,7 @@
 
             <!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
             <expand macro="input_filter_query_default_true" />
-            <expand macro="input_scoring_matrix" />
+            <expand macro="input_matrix_gapcosts" />
             <expand macro="input_max_hits" />
             <expand macro="input_word_size" />
             <!--
@@ -56,6 +59,9 @@
             <expand macro="input_parse_deflines" />
             <expand macro="advanced_optional_id_files" />
             <expand macro="input_qcov_hsp_perc" />
+            <expand macro="input_window_size" />
+            <expand macro="input_threshold" />
+            <expand macro="input_comp_based_stats" />
         </expand>
     </inputs>
     <outputs>
@@ -75,7 +81,7 @@
             <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM80" />
             <param name="max_hits" value="0" />
-            <param name="word_size" value="0" />
+            <param name="word_size" value="" />
             <param name="parse_deflines" value="false" />
             <output name="output1" file="tblastn_four_human_vs_rhodopsin.xml" ftype="blastxml" />
         </test>
@@ -90,7 +96,7 @@
             <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM80" />
             <param name="max_hits" value="0" />
-            <param name="word_size" value="0" />
+            <param name="word_size" value="" />
             <param name="parse_deflines" value="false" />
             <output name="output1" file="tblastn_four_human_vs_rhodopsin_ext.tabular" ftype="tabular" />
         </test>
@@ -105,7 +111,7 @@
             <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM80" />
             <param name="max_hits" value="0" />
-            <param name="word_size" value="0" />
+            <param name="word_size" value="" />
             <param name="parse_deflines" value="false" />
             <output name="output1" file="tblastn_four_human_vs_rhodopsin.tabular" ftype="tabular" />
         </test>
@@ -122,7 +128,7 @@
             <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM80" />
             <param name="max_hits" value="0" />
-            <param name="word_size" value="0" />
+            <param name="word_size" value="" />
             <param name="parse_deflines" value="true" />
             <output name="output1" file="tblastn_four_human_vs_rhodopsin_deflines.tabular" ftype="tabular" />
         </test>
@@ -138,7 +144,7 @@
             <param name="filter_query" value="false" />
             <param name="matrix" value="BLOSUM80" />
             <param name="max_hits" value="0" />
-            <param name="word_size" value="0" />
+            <param name="word_size" value="" />
             <param name="parse_deflines" value="false" />
             <output name="output1" file="tblastn_four_human_vs_rhodopsin.html" ftype="html" lines_diff="8" />
         </test>
@@ -154,11 +160,15 @@
 
 @FASTA_WARNING@
 
------
+------
 
 @OUTPUT_FORMAT@
 
--------
+------
+
+@CLI_OPTIONS
+
+------
 
 **References**
 
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml	Tue Sep 19 07:41:16 2017 -0400
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml	Wed Oct 11 07:43:09 2017 -0400
@@ -17,14 +17,15 @@
 @BLAST_OUTPUT@
 @THREADS@
 #if $adv_opts.adv_opts_selector=="advanced":
--db_gencode $adv_opts.db_gencode
-$adv_opts.strand
--matrix $adv_opts.matrix
-@ADV_FILTER_QUERY@
-@ADV_MAX_HITS@
-@ADV_WORD_SIZE@
-@ADV_ID_LIST_FILTER@
-@ADV_QCOV_HSP_PERC@
+    -db_gencode $adv_opts.db_gencode
+    $adv_opts.strand
+    @ADV_MATRIX@
+    @ADV_FILTER_QUERY@
+    @ADV_MAX_HITS@
+    @ADV_WORD_SIZE@
+    @ADV_ID_LIST_FILTER@
+    @ADV_QCOV_HSP_PERC@
+    @ADV_THRESHOLD@
 ## End of advanced options:
 #end if
     </command>
@@ -49,6 +50,7 @@
             <expand macro="input_parse_deflines" />
             <expand macro="advanced_optional_id_files" />
             <expand macro="input_qcov_hsp_perc" />
+            <expand macro="input_threshold" />
         </expand>
     </inputs>
     <outputs>
@@ -85,6 +87,10 @@
 
 -------
 
+@CLI_OPTIONS@
+
+-------
+
 **References**
 
 If you use this Galaxy tool in work leading to a scientific publication please