view tools/ncbi_blast_plus/ncbi_makeblastdb.xml @ 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 3034ce97dd33
children 31e517610e1f
line wrap: on
line source

<tool id="ncbi_makeblastdb" name="NCBI BLAST+ makeblastdb" version="@WRAPPER_VERSION@">
    <description>Make BLAST database</description>
    <macros>
        <token name="@BINARY@">makeblastdb</token>
        <import>ncbi_macros.xml</import>
    </macros>
    <expand macro="preamble" />
    <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#
&amp;&amp;
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#'
#if $title:
-title '$title'
#else:
##Would default to being based on the cryptic Galaxy filenames, which is unhelpful
-title 'BLAST Database'
#end if
-dbtype $dbtype
## --------------------------------------------------------------------
## Masking
## --------------------------------------------------------------------
## HACK: If no mask files, evaluates as a list with just None in it:
## 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}'
#end for
#end if
## --------------------------------------------------------------------
## Taxonomy
## --------------------------------------------------------------------
#if $tax.taxselect == 'id':
-taxid $tax.taxid
## TODO - Can we use a tabular file for the taxonomy mapping?
## #else if $tax.taxselect == 'map':
## -taxid_map $tax.taxmap
#end if
## --------------------------------------------------------------------
## Capture the stdout log information to the primary file (plain text):
&gt; "$outfile"
    </command>
    <inputs>
        <param argument="-dbtype" type="select" display="radio" label="Molecule type of input">
            <option value="prot">protein</option>
            <option value="nucl">nucleotide</option>
        </param>
        <!-- TODO Allow merging of existing BLAST databases (conditional on the database type)?
             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" 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" 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">
            <param name="taxselect" type="select" label="Taxonomy options">
                <option value="">Do not assign a Taxonomy ID to the sequences</option>
                <option value="id">Assign the same Taxonomy ID to all the sequences</option>
                <!--
                <option value="map">Supply text file mapping sequence IDs to taxnomy IDs</option>
                -->
            </param>
            <when value="">
            </when>
            <when value="id">
                <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" argument="-taxid_map" type="data" format="txt" label="Seq ID : Tax ID mapping file" help="Format: SequenceId TaxonomyId" />
            </when>
            -->
        </conditional>
    </inputs>
    <outputs>
        <!-- If we only accepted one FASTA file, we could use its human name here... -->
        <data name="outfile" format="data" label="${dbtype.value_label} BLAST database from ${on_string}">
            <change_format>
                <when input="dbtype" value="nucl" format="blastdbn" />
                <when input="dbtype" value="prot" format="blastdbp" />
            </change_format>
        </data>
    </outputs>
    <tests>
        <!-- Note the (two line) PIN file is not reproducible run to run.
             The same applies to the NIN file for nucleotide database.
             Likewise there is a datestamp in the log file as well, so use contains comparison
             With and without the masking makes no difference.
             With and without the taxid the only real difference is in the *.phr file.
        -->
        <test>
            <param name="dbtype" value="prot" />
            <param name="input_file" value="four_human_proteins.fasta" ftype="fasta" />
            <param name="title" value="Just 4 human proteins" />
            <param name="parse_seqids" value="" />
            <param name="hash_index" value="true" />
            <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" />
                <extra_files type="file" value="four_human_proteins.fasta.pog" name="blastdb.pog" />
                <extra_files type="file" value="four_human_proteins.fasta.phd" name="blastdb.phd" />
                <extra_files type="file" value="four_human_proteins.fasta.phi" name="blastdb.phi" />
                <extra_files type="file" value="four_human_proteins.fasta.psd" name="blastdb.psd" />
                <extra_files type="file" value="four_human_proteins.fasta.psi" name="blastdb.psi" />
            </output>
        </test>
        <test>
            <param name="dbtype" value="prot" />
            <param name="input_file" value="four_human_proteins.fasta" ftype="fasta" />
            <param name="title" value="Just 4 human proteins" />
            <param name="parse_seqids" value="" />
            <param name="hash_index" value="true" />
            <param name="taxselect" value="id" />
            <param name="taxid" value="9606" />
            <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" />
                <extra_files type="file" value="four_human_proteins_taxid.fasta.pog" name="blastdb.pog" />
                <extra_files type="file" value="four_human_proteins_taxid.fasta.phd" name="blastdb.phd" />
                <extra_files type="file" value="four_human_proteins_taxid.fasta.phi" name="blastdb.phi" />
                <extra_files type="file" value="four_human_proteins_taxid.fasta.psd" name="blastdb.psd" />
                <extra_files type="file" value="four_human_proteins_taxid.fasta.psi" name="blastdb.psi" />
            </output>
        </test>
        <test>
            <param name="dbtype" value="prot" />
            <param name="input_file" value="four_human_proteins.fasta" ftype="fasta" />
            <param name="title" value="Just 4 human proteins" />
            <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="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" />
                <extra_files type="file" value="four_human_proteins.fasta.pog" name="blastdb.pog" />
                <extra_files type="file" value="four_human_proteins.fasta.phd" name="blastdb.phd" />
                <extra_files type="file" value="four_human_proteins.fasta.phi" name="blastdb.phi" />
                <extra_files type="file" value="four_human_proteins.fasta.psd" name="blastdb.psd" />
                <extra_files type="file" value="four_human_proteins.fasta.psi" name="blastdb.psi" />
            </output>
        </test>
        <test>
            <param name="dbtype" value="nucl" />
            <param name="input_file" value="three_human_mRNA.fasta" ftype="fasta" />
            <param name="title" value="Just 3 human mRNA sequences" />
            <param name="parse_seqids" value="" />
            <param name="hash_index" value="true" />
            <param name="taxselect" value="id" />
            <param name="taxid" value="9606" />
            <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" />
                <extra_files type="file" value="three_human_mRNA.fasta.nog" name="blastdb.nog" />
                <extra_files type="file" value="three_human_mRNA.fasta.nhd" name="blastdb.nhd" />
                <extra_files type="file" value="three_human_mRNA.fasta.nhi" name="blastdb.nhi" />
                <extra_files type="file" value="three_human_mRNA.fasta.nsd" name="blastdb.nsd" />
                <extra_files type="file" value="three_human_mRNA.fasta.nsi" name="blastdb.nsi" />
            </output>
        </test>
    </tests>
    <help>
**What it does**

Make BLAST database from one or more FASTA files and/or BLAST databases.

This is a wrapper for the NCBI BLAST+ tool 'makeblastdb', which is the
replacement for the 'formatdb' tool in the NCBI 'legacy' BLAST suite.

<!--
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
cite the following papers:

@REFERENCES@
    </help>
    <expand macro="blast_citations" />
</tool>