view bam_readtagger.xml @ 60:01acf62d5012 draft

"planemo upload for repository https://github.com/bardin-lab/readtagger/tree/master/galaxy commit f8a3ec15a4b0f73bfab3510858bc21c264c0e79f"
author mvdbeek
date Thu, 29 Aug 2019 11:08:57 -0400
parents 13c5f2e30a13
children 210427d5c65a
line wrap: on
line source

<tool id="bam_readtagger" name="Tag alignment files" version="0.5.7">
    <description>from multiple bam files</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <requirements>
        <requirement type="package" version="0.5.7">readtagger</requirement>
    </requirements>
    <command detect_errors="aggressive"><![CDATA[
        readtagger -t '$tag_file' -s
        #for $element in $alignment_series
            '$element.annotate_with':$element.r_tag:$element.m_tag
        #end for
        #if $reference_fasta:
            --reference_fasta '$reference_fasta'
        #end if
        $allow_dovetailing
        $discard_suboptimal
        $discarded
        $verified
        $discard_proper_pairs
        --cores "\${GALAXY_SLOTS:-2}"
        -o '$tagged_file'
    ]]></command>
    <inputs>
        <param name="tag_file" argument="--tag_file" type="data" format="bam,qname_sorted.bam"/>
        <repeat name="alignment_series" title="Alignments">
            <param name="annotate_with" argument="--annotate_with" type="data" format="bam,qname_sorted.bam"/>
            <param type="select" name="r_tag" label="First letter to use for read tag" value="A">
                <expand macro="tag_options"/>
            </param>
            <param type="select" name="m_tag" label="First letter to use for mate tag" value="B">
                <expand macro="tag_options"/>
            </param>
        </repeat>
        <param argument="--reference_fasta" type="data" format="fasta" label="Reference fasta for realigning clipped reads" optional="True" help="This file is optional. If you provide it, clipped sequences are extracted and aligned against this fasta file."/>
        <param argument="--allow_dovetailing" type="boolean" truevalue="--allow_dovetailing" falsevalue="--no_allow_dovetailing" checked="True" label="Allow dovetailing" help="Check this to label reads as proper_pair even if the mates of a pair overlap each other"/>
        <param argument="--discard_suboptimal_alternate_tags" name="discard_suboptimal" type="boolean" checked="True" truevalue="--discard_suboptimal_alternate_tags" falsevalue="--no_discard_suboptimal" label="Discard suboptimal alternative tags" help="Check this to discard alternative tags that cannot explain the current read cigar"/>
        <param argument="--discard_if_proper_pair" name="discard_proper_pairs" type="boolean" truevalue="--discard_if_proper_pair" falsevalue="--no_discard_if_proper_pair" label="Discard alternative tags for proper pairs" checked="True" help="Check this to discard alternative tags for reads in proper pairs"/>
        <param argument="--discarded_path" name="discarded" type="boolean" truevalue="--discarded_path discarded.bam" falsevalue="" label="Check this to produce an output file containing only the reads with tags that failed validation"/>
        <param argument="--verified_path" name="verified" type="boolean" truevalue="--verified_path verified.bam" falsevalue="" label="Check this to produce an output file containing only the reads with tags that pass validation"/>
    </inputs>
    <outputs>
        <data name="tagged_file" format="bam" label="Tagged reads on $on_string"/>
        <data name="verified_file" format="bam" from_work_dir="verified.bam" label="Verified reads/tags on $on_string">
            <filter>verified is True</filter>
        </data>
        <data name="discarded_file" format="bam" from_work_dir="discarded.bam" label="Discarded reads/tags $on_string">
            <filter>verified is True</filter>
        </data>
    </outputs>
    <tests>
        <test> <!-- test that a single read originating from a pasteurianus is properly annotated in a dm6 alignment (should end in verified bam file) -->
            <param name="tag_file" value="dm6.bam" ftype="bam"/>
            <repeat name="alignment_series">
                <param name="annotate_with" value="pasteurianus.bam" ftype="bam"/>
                <param name="r_tag" value="A"/>
                <param name="m_tag" value="B"/>
            </repeat>
            <param name="discarded" value="True"/>
            <param name="verified" value="True"/>
            <output name="tagged_file" file="dm6_tagged_with_a_pasteurianus.bam" ftype="bam" lines_diff="7"/>
            <output name="verified_file" file="dm6_tagged_with_a_pasteurianus_verified.bam" ftype="bam" lines_diff="7"/>
            <output name="discarded_file" file="dm6_tagged_with_a_pasteurianus_discarded.bam" ftype="bam" lines_diff="7"/>
        </test>
        <test> <!-- test that a single read originating from a pasteurianus is annotated in pasteurianus.bam as having homology with dm6, but marked as discarded (should end in discarded bam file) -->
            <param name="tag_file" value="pasteurianus.bam" ftype="bam"/>
            <repeat name="alignment_series">
                <param name="annotate_with" value="dm6.bam" ftype="bam"/>
                <param name="r_tag" value="A"/>
                <param name="m_tag" value="B"/>
            </repeat>
            <param name="discarded" value="True"/>
            <param name="verified" value="True"/>
            <output name="tagged_file" file="a_pasteurianus_tagged_with_dm6.bam" ftype="bam" lines_diff="7" />
            <output name="verified_file" file="a_pasteurianus_tagged_with_dm6_verified.bam" ftype="bam" lines_diff="7"/>
            <output name="discarded_file" file="a_pasteurianus_tagged_with_dm6_discarded.bam" ftype="bam" lines_diff="7"/>
        </test>
        <test> <!-- test that a pair with homology to a TE insertion is discarded, because it is a proper pair -->
            <param name="tag_file" value="proper_pair_discard.bam" ftype="bam"/>
            <repeat name="alignment_series">
                <param name="annotate_with" value="proper_pair_discard_fbti.bam" ftype="bam"/>
                <param name="r_tag" value="A"/>
                <param name="m_tag" value="B"/>
            </repeat>
            <param name="discarded" value="True"/>
            <param name="keep_suboptimal" value="True"/>
            <param name="discard_proper_pairs" value="True"/>
            <param name="verified" value="True"/>
            <output name="tagged_file" file="proper_pair_out_suboptimal_tags.bam" ftype="bam" lines_diff="7" />
            <output name="verified_file" file="proper_pair_discard_verified_empty.bam" ftype="bam" lines_diff="7"/>
            <output name="discarded_file" file="proper_pair_discard_out.bam" ftype="bam" lines_diff="7"/>
        </test>
    </tests>
    <help><![CDATA[
.. code-block::

    usage: readtagger [-h] -t TAG_FILE -a ANNOTATE_WITH [ANNOTATE_WITH ...] -o
                      OUTPUT_FILE [-d] [-dp] [-k] [-wd WRITE_DISCARDED]
                      [-wv WRITE_VERIFIED] [--version]

    Tag reads in an alignment file based on other alignment files

    optional arguments:
      -h, --help            show this help message and exit
      -t TAG_FILE, --tag_file TAG_FILE
                            Tag reads in this file. (default: None)
      -a ANNOTATE_WITH [ANNOTATE_WITH ...], --annotate_with ANNOTATE_WITH [ANNOTATE_WITH ...]
                            Tag reads in readfile if reads are aligned in these
                            files.Append `:A:B` to tag first letter of tag
                            describing read as A, and first letter of tag
                            describing the mate as B (default: None)
      -o OUTPUT_FILE, --output_file OUTPUT_FILE
                            Write bam file to this path (default: None)
      -d, --allow_dovetailing
                            Sets the proper pair flag (0x0002) to true if reads
                            dovetail [reads reach into or surpass the mate
                            sequence]. (default: False)
      -dp, --discard_if_proper_pair
                            Discard an alternative flag if the current read is in
                            a proper pair. (default: False)
      -k, --keep_suboptimal_alternate_tags
                            By default cigarstrings of the alternative tags are
                            compared and alternates that are not explaining the
                            current cigar strings are discarded. Use this option
                            to keep the alternative tags (effectively restoring
                            the behaviour of readtagger < 0.1.4) (default: False)
      -wd WRITE_DISCARDED, --write_discarded WRITE_DISCARDED
                            Write discarded reads into separate file (default:
                            False)
      -wv WRITE_VERIFIED, --write_verified WRITE_VERIFIED
                            Write verified reads into separate file (default:
                            False)
      --version             show program's version number and exit

    ]]></help>
</tool>