view ivar_consensus.xml @ 12:9c5754002592 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit fc9887dd2a1468b58a5da12a91fe3fbcd226e981
author iuc
date Fri, 10 Feb 2023 17:06:13 +0000
parents 3e4f434a69c6
children 1069f6db0a0e
line wrap: on
line source

<tool id="ivar_consensus" name="ivar consensus" version="@TOOL_VERSION@+galaxy2" profile="@PROFILE@">
    <description>Call consensus from aligned BAM file</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="version_command"/>
    <command detect_errors="exit_code"><![CDATA[
        #import re
        #set $clean_name = re.sub('[^\w\-]', '_', str($input_bam.element_identifier))
        ln -s '$input_bam' sorted.bam &&
        samtools mpileup -A -a -d 0 -Q 0 sorted.bam | ivar consensus
        -p consensus
        -q $min_qual
        -t $min_freq
        -m $min_depth
        $depth_action
        &&
        sed -i "s|consensus|$clean_name|" consensus.fa
    ]]></command>
    <inputs>
        <param name="input_bam" type="data" format="bam" label="Bam file" help="Aligned reads, to trim primers and quality"/>
        <!-- Warning: integer params in the following define a max of 255 intentionally
        because the underlying C++ code of ivar defines them as uint8 and does not check for overflow! -->
        <param name="min_qual" argument="-q" type="integer" min="0" max="255" value="20" label="Minimum quality score threshold to count base"/>
        <param name="min_freq" argument="-t" type="float" min="0" max="1" value="0.0" label="Minimum frequency threshold">
            <help>
                <![CDATA[
           0 - Majority or most common base <br/>
         0.2 - Bases that make up atleast 20% of the depth at a position <br/>
         0.5 - Strict or bases that make up atleast 50% of the depth at a position <br/>
         0.9 - Strict or bases that make up atleast 90% of the depth at a position <br/>
           1 - Identical or bases that make up 100% of the depth at a position. Will have highest ambiguities 
        ]]>
            </help>
        </param>
        <param name="min_depth" argument="-m" type="integer" min="1" max="255" value="10" label="Minimum depth to call consensus"/>
        <param name="depth_action" type="select" label="How to represent positions with coverage less than the minimum depth threshold">
            <option value="-k">Drop from output (-k)</option>
            <option value="-n N" selected="true">Represent as N (-n N)</option>
            <option value="-n -">Represent as - (-n -)</option>
        </param>
    </inputs>
    <outputs>
        <data name="consensus" format="fasta" label="${tool.name} on ${on_string} Consensus" from_work_dir="consensus.fa"/>
    </outputs>
    <tests>
        <test>
            <param name="input_bam" value="covid19/PC00101P_sub.trimmed.sorted.bam" />
            <output name="consensus" file="covid19/PC00101P_sub.fa" ftype="fasta" compare="contains" lines_diff="1"/>
        </test>
    </tests>
    <help><![CDATA[
    .. class:: infomark

    To generate a consensus sequence iVar uses the output of samtools mpileup
    command. The mpileup output must be piped into ivar consensus
    
    The command formed by this wrapper is :
    
    samtools mpileup -A -a -d 0 -Q 0 sorted.bam | ivar consensus [options]

    There are four parameters that can be set:

    - **Minimum quality**: the minimum quality of a base to be considered in calculations of variant frequencies at a given position

    - **Minimum frequency threshold**: the minimum frequency that the most likely base must surpass to be called as the consensus base at a position.
    
    - **Minimum depth to call consensus**: the minimum required depth to call a consensus base

    - **How to represent positions with coverage less than the minimum depth threshold**: for positions for which the above minimum depth to call a consensus base is not reached, you can choose one of three different actions:

      - Drop the position from the output entirely (-> the consensus sequence can become shorter than the reference used to produce the input BAM!)
      - Use an ``N``, or
      - Use a ``-`` to represent the position
    ]]>    </help>
    <expand macro="citations" />
</tool>