view tools/mira4_9/mirabait/mira4_9_mirabait.xml @ 0:c9269b5803d8 draft default tip

planemo upload for repository https://github.com/peterjc/galaxy_mira/tree/master/tools/mira4_9 commit 9a6640a7b7f516d028a9852f7bbf39083e50188f
author peterjc
date Wed, 07 Oct 2015 10:31:49 -0400
parents
children
line wrap: on
line source

<tool id="mira4_9_mirabait" name="MIRA v4.9 mirabait" version="0.0.1">
    <description>Filter reads using kmer matches</description>
    <requirements>
        <requirement type="binary">mirabait</requirement>
        <requirement type="package" version="4.9.5">MIRA</requirement>
    </requirements>
    <stdio>
        <!-- Assume anything other than zero is an error -->
        <exit_code range="1:" />
        <exit_code range=":-1" />
    </stdio>
    <version_command interpreter="python">mira_check_version.py ${MIRA4_9}mirabait</version_command>
    <command interpreter="python">./mira_check_version.py \${MIRA4_9}mirabait 4.9 &amp;&amp;
##First checked it is mirabait v4.9 on the path... now actually run it
##-----------------------------------------------------------------------
\${MIRA4_9}mirabait -k "$kmer_length" -n "$min_occurence" -b "$bait_file"
##-----------------------------------------------------------------------
##Must now map Galaxy datatypes to MIRA file types...
##exploiting the polymorphic naming of the input read parameter!
#if $reads.filename.ext.startswith("fastq")
##MIRA doesn't like fastqsanger etc, just plain old fastq
 -f fastq -t fastq
#elif $reads.filename.ext == "mira"
##We're calling *.maf the "mira" format in Galaxy (name space collision)
 -f maf -t maf
#else
##MIRA is happy with fasta as name,
 -f "$reads.filename.ext" -t "$reads.filename.ext"
#end if
##-----------------------------------------------------------------------
#if str($output_choice_cond.output_choice)=="both"
-o "$output_pos" -O "$output_neg"
#elif str($output_choice_cond.output_choice)=="pos"
-o "$output_pos"
#elif str($output_choice_cond.output_choice)=="neg"
-i -O "$output_neg"
#end if
##-----------------------------------------------------------------------
##Do we need to ignore the reverse strand?
#if str($strand_choice) == "fwd"
-r
#end if
##-----------------------------------------------------------------------
##Default is to mark k-mers with upper case...
#if str($output_case) == "original"
-c
#end if
##-----------------------------------------------------------------------
#if str($reads.type) == "paired"
#if $reads.filename.ext != $reads.filename2.ext
##TODO: Is there a better way to signal an error to Galaxy here?
; echo "ERROR: Paired read datatype mis-match!" ; false
#end if
-p "$reads.filename" "$reads.filename2"
#elif str($reads.type) == "interleaved"
-P "$reads.filename"
#elif str($reads.type) == "none"
"$reads.filename"
#end if
    </command>
    <inputs>
        <!-- TODO: mirabait now allows multiple input files, and can do multiple outputs - or merge into one? -->
        <!-- TODO: define a new Galaxy datatype for the bait hash file? -->
        <param name="bait_file" type="data" format="fasta,fastq,mira" required="true" label="Bait file (what to look for)" />
        <conditional name="reads">
            <param name="type" type="select" label="Are these paired reads?">
                <option value="paired">Paired reads (as two files)</option>
                <option value="interleaved">Paired reads (as one interleaved file)</option>
                <option value="none">Unpaired reads (single or orphan reads as one file)</option>
            </param>
            <when value="paired">
                <param name="filename" type="data" format="fastq,fasta" required="true" label="Read file one"/>
                <param name="filename2" type="data" format="fastq,fasta" required="true" label="Read file two"/>
            </when>
            <when value="interleaved">
                <param name="filename" type="data" format="fasta,fastq" required="true" label="Interleaved paired reads to search" />
            </when>
            <when value="none">
                <param name="filename" type="data" format="fasta,fastq,mira" required="true" label="Reads to search" />
            </when>
        </conditional>
        <conditional name="output_choice_cond">
            <param name="output_choice" type="select" label="Output positive matches, negative matches, or both?">
                <option value="both">Both positive matches and negative matches, as two files</option>
                <option value="pos" selected="true">Just positive matches, as a single file</option>
                <option value="neg">Just negative matches, as a single file</option>
            </param>
            <!-- Seems need these dummy entries here, compare this to indels/indel_sam2interval.xml -->
            <when value="both" />
            <when value="pos" />
            <when value="neg" />
        </conditional>
        <param name="output_case" type="select" label="How to use sequence case in output?">
            <option value="original">Preserve case from input</option>
            <option value="bait">Mark k-mer matches in upper case</option>
        </param>
        <param name="strand_choice" type="select" label="Check for matches on both strands?">
            <option value="both">Check both strands</option>
            <option value="fwd">Just forward strand</option>
        </param>
        <param name="kmer_length" type="integer" value="31" min="1" max="256"
               label="k-mer length" help="Maximum 256" />
        <param name="min_occurence" type="integer" value="1" min="1"
               label="Minimum k-mer occurence"
               help="How many k-mer matches do you want per read? Minimum one" />
    </inputs>
    <outputs>
        <data name="output_pos" format_source="filename" metadata_source="filename"
             label="$reads.filename.name #if str($reads.type)=='paired' then 'and $reads.filename2.name' else ''# matching $bait_file.name">
            <filter>output_choice_cond["output_choice"] != "neg"</filter>
        </data>
        <data name="output_neg" format_source="filename" metadata_source="filename"
             label="$reads.filename.name #if str($reads.type)=='paired' then 'and $reads.filename2.name' else ''# not matching $bait_file.name">
            <filter>output_choice_cond["output_choice"] != "pos"</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="bait_file" value="tvc_bait.fasta" ftype="fasta" />
            <param name="reads|type" value="none" />
            <param name="reads|filename" value="tvc_mini.fastq" ftype="fastqsanger" />
            <param name="output_choice" value="pos" />
            <param name="output_case" value="original" />
            <output name="output_pos" file="tvc_mini_bait_pos.fastq" ftype="fastqsanger" />
        </test>
        <test>
            <param name="bait_file" value="tvc_bait.fasta" ftype="fasta" />
            <param name="reads|type" value="none" />
            <param name="reads|filename" value="tvc_mini.fastq" ftype="fastqsanger" />
            <param name="output_case" value="bait" />
            <output name="output_pos" file="tvc_mini_bait_pos_case.fastq" ftype="fastqsanger" />
        </test>
        <test>
            <param name="bait_file" value="tvc_bait.fasta" ftype="fasta" />
            <param name="reads|type" value="none" />
            <param name="reads|filename" value="tvc_mini.fastq" ftype="fastqsanger" />
            <param name="output_case" value="bait" />
            <output name="output_pos" file="tvc_mini_bait_pos_case.fastq" ftype="fastqsanger" />
        </test>
        <test>
            <param name="bait_file" value="tvc_bait.fasta" ftype="fasta" />
            <param name="reads|type" value="none" />
            <param name="reads|filename" value="tvc_mini.fastq" ftype="fastqsanger" />
            <param name="output_case" value="bait" />
            <param name="kmer_length" value="32" />
            <param name="min_occurence" value="50" />
            <output name="output_pos" file="tvc_mini_bait_strict_case.fastq" ftype="fastqsanger" />
        </test>
        <test>
            <param name="bait_file" value="tvc_bait.fasta" ftype="fasta" />
            <param name="reads|type" value="none" />
            <param name="reads|filename" value="tvc_mini.fastq" ftype="fastqsanger" />
            <param name="output_choice" value="neg" />
            <param name="output_case" value="original" />
            <output name="output_neg" file="tvc_mini_bait_neg.fastq" ftype="fastqsanger" />
        </test>
        <test>
            <param name="bait_file" value="tvc_bait.fasta" ftype="fasta" />
            <param name="reads|type" value="none" />
            <param name="reads|filename" value="tvc_mini.fastq" ftype="fastqsanger" />
            <param name="output_choice" value="neg" />
            <param name="output_case" value="bait" />
            <output name="output_neg" file="tvc_mini_bait_neg_case.fastq" ftype="fastqsanger" />
        </test>
        <test>
            <param name="bait_file" value="tvc_bait.fasta" ftype="fasta" />
            <param name="reads|type" value="none" />
            <param name="reads|filename" value="tvc_mini.fastq" ftype="fastqsanger" />
            <param name="output_choice" value="both" />
            <param name="output_case" value="original" />
            <output name="output_pos" file="tvc_mini_bait_pos.fastq" ftype="fastqsanger" />
            <output name="output_neg" file="tvc_mini_bait_neg.fastq" ftype="fastqsanger" />
        </test>
    </tests>
    <help>
**What it does**

Runs the ``mirabait`` utility from MIRA v4.9 to filter your input reads
according to whether or not they contain perfect kmer matches to your
bait file. By default this looks for 31-mers (kmers or *k*-mers where
the fragment length *k* is 31), and only requires a single matching kmer.

The ``mirabait`` utility is useful in many applications and pipelines
outside of using the main MIRA tool for assembly or mapping.

.. class:: warningmark

Note ``mirabait`` cannot be used on protein (amino acid) sequences.

**Example Usage**

To remove over abundant entries like rRNA sequences, run ``mirabait`` with
known rRNA sequences as the bait and select the *negative* matches.

To do targeted assembly by fishing out reads belonging to a gene and just
assemble these, run ``mirabait`` with the gene of interest as the bait and
select the *positive* matches.

To iteratively reconstruct mitochondria you could start by fishing out reads
matching any known mitochondrial sequence, assembly those, and repeat.


**Notes on paired read**

.. class:: warningmark

Unlike ``mirabait`` from MIRA v4.0, this version is aware of paired reads
and will preserve the pairing (if either the forward or the reverse read
has enough *k*-mer matches, the pair is accepted).


**Citation**

If you use this Galaxy tool in work leading to a scientific publication please
cite the following papers:

Peter J.A. Cock, Björn A. Grüning, Konrad Paszkiewicz and Leighton Pritchard (2013).
Galaxy tools and workflows for sequence analysis with applications
in molecular plant pathology. PeerJ 1:e167
http://dx.doi.org/10.7717/peerj.167

Bastien Chevreux, Thomas Wetter and Sándor Suhai (1999).
Genome Sequence Assembly Using Trace Signals and Additional Sequence Information.
Computer Science and Biology: Proceedings of the German Conference on Bioinformatics (GCB) 99, pp. 45-56.
http://www.bioinfo.de/isb/gcb99/talks/chevreux/main.html

This wrapper is available to install into other Galaxy Instances via the Galaxy
Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/mira_assembler_4_9
    </help>
    <citations>
        <citation type="doi">10.7717/peerj.167</citation>
        <citation type="bibtex">@ARTICLE{Chevreux1999-mira3,
        author = {B. Chevreux and T. Wetter and S. Suhai},
        year = {1999},
        title = {Genome Sequence Assembly Using Trace Signals and Additional Sequence Information},
        journal = {Computer Science and Biology: Proceedings of the German Conference on Bioinformatics (GCB)}
        volume = {99},
        pages = {45-56},
        url = {http://www.bioinfo.de/isb/gcb99/talks/chevreux/main.html}
        }</citation>
    </citations>
</tool>