view bamCoverage.xml @ 30:5231f398d784 draft

planemo upload for repository https://github.com/fidelram/deepTools/tree/master/galaxy/wrapper/ commit 3bc1d1c6f4e28ac7ff8df79fe4e3f00a195938e6-dirty
author bgruening
date Tue, 20 Oct 2015 14:43:12 -0400
parents 3a2aab18a217
children
line wrap: on
line source

<tool id="deeptools_bamCoverage" name="bamCoverage" version="@WRAPPER_VERSION@.0">
    <description> generates a coverage bigWig file from a given BAM file.  Multiple options are available to count reads and normalize coverage. (bam2bigwig)</description>
    <macros>
        <token name="@BINARY@">bamCoverage</token>
        <import>deepTools_macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command>
<![CDATA[
        bamCoverage

            @THREADS@

            --bam '$bamInput'
            --bamIndex ${bamInput.metadata.bam_index}
            --outFileName '$outFileName'
            --outFileFormat '$outFileFormat'

            --fragmentLength $fragmentLength
            --binSize $binSize

            #if $scaling.type=='rpkm':
                --normalizeUsingRPKM
            #elif $scaling.type=='1x':
                #if $scaling.effectiveGenomeSize.effectiveGenomeSize_opt == "specific":
                    --normalizeTo1x $scaling.effectiveGenomeSize.effectiveGenomeSize
                #else:
                    --normalizeTo1x $scaling.effectiveGenomeSize.effectiveGenomeSize_opt
                #end if
            #elif $scaling.type=='own':
                --scaleFactor $scaling.scaleFactor
            #end if

            #if str($region).strip() != '':
                --region '$region'
            #end if

            #if $advancedOpt.showAdvancedOpt == "yes":
                #if $advancedOpt.smoothLength:
                    --smoothLength '$advancedOpt.smoothLength'
                #end if

                $advancedOpt.doNotExtendPairedEnds
                $advancedOpt.ignoreDuplicates

                #if $advancedOpt.minMappingQuality:
                    --minMappingQuality '$advancedOpt.minMappingQuality'
                #end if

                --missingDataAsZero $advancedOpt.missingDataAsZero

                ##if str($advancedOpt.ignoreForNormalization).strip() != '':
                ##    --ignoreForNormalization $advancedOpt.ignoreForNormalization
                ##end if
                #if $samFlag:
                    --samFlag $samFlag
                #end if
            #end if
]]>
    </command>

    <inputs>
        <param name="bamInput" format="bam" type="data" label="BAM file"
            help="The BAM file must be sorted."/>

        <param name="fragmentLength" type="integer" value="200" min="1"
            label="Length of the average fragment size"
            help ="Reads will be extended to match this length unless they are paired-end, in which case they will be extended to match the fragment length. If this value is set to the read length or smaller, the read will not be extended. *Warning* the fragment length affects the normalization to 1x (see &quot;normalize coverage to 1x&quot;). Sequencing depth is defined as: (total number of mapped reads * fragment length) / effective genome size. *NOTE*: If the BAM files contain mated and unmated paired-end reads, unmated reads will be extended to match the fragment length. (--fragmentLength)"/>

        <param name="binSize" type="integer" value="50" min="1" 
            label="Bin size in bp"
            help="The genome will be divided in bins (also called tiles) of the specified length. For each bin the overlaping number of fragments (or reads)  will be reported. If only half a fragment overlaps, this fraction will be reported. "/>

        <conditional name="scaling">
            <param name="type" type="select" label="Scaling/Normalization method" >
                <option value="1x">Normalize coverage to 1x</option>
                <option value="rpkm">Normalize to fragments (reads) per kilobase per million (RPKM)</option>
                <option value="own">Set your own scaling factor</option>
                <option value="no">Do not normalize or scale</option>
            </param>
            <when value="rpkm"/>
            <when value="no"/>
            <when value="1x">
                <expand macro="effectiveGenomeSize" />
            </when>
            <when value="own">
                <param name="scaleFactor" type="float" value="1" size="3" 
                    label="Scale factor to multiply all values" />
            </when>
        </conditional>

        <param name="outFileFormat" type="select" label="Coverage file format">
            <option value="bigwig" selected="true">bigwig</option>
            <option value="bedgraph">bedgraph</option>
        </param>

        <expand macro="region_limit_operation" />

        <conditional name="advancedOpt">
            <param name="showAdvancedOpt" type="select" label="Show advanced options" >
                <option value="no" selected="true">no</option>
                <option value="yes">yes</option>
            </param>
            <when value="no" />
            <when value="yes">
                <param name="smoothLength" type="integer" value="1" optional="true" min="1"
                    label="Smooth values using the following length (in bp)"
                    help ="The smooth length defines a window, larger than the bin size, to average the number of reads. For example, if the bin size is set to 20 bp and the smooth length is set to 60 bp, then, for each bin size the average of it and its left and right neighbors is considered. Any value smaller than the bin size will be ignored and no smoothing will be applied. (--smoothLength)"/>

                <expand macro="doNotExtendPairedEnds" />
                <expand macro="ignoreDuplicates" />
                <expand macro="minMappingQuality" />
                <expand macro="missingDataAsZero" />
                <expand macro="samFlag" />
             <!--   <param name="ignoreForNormalization" type="text" value="" size="50"
                    label="regions that should be excluded for calculating the scaling factor"
                    help="Sometimes it makes sense to exclude certain regions when calculating the scaling factor. For example, if you know some regions that you suspect to be present more often in your sample's genome than in the reference genome that will therefore accumulate reads (CNV). Another typical example is the single X chromosome in male samples that should be scaled separately from the diploid autosomes. For example chrX,chrY,chr3. or chr10:12220-128932" />
            -->
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data format="bigwig" name="outFileName">
            <change_format>
                <when input="outFileFormat" value="bigwig" format="bigwig" />
                <when input="outFileFormat" value="bedgraph" format="bedgraph" />
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="bamInput" value="bowtie2-test1.bam" ftype="bam" />
            <param name="outFileFormat" value="bigwig" />
            <param name="showAdvancedOpt" value="no" />
            <param name="binSize" value="10" />
            <param name="type" value="no" />
            <output name="outFileName" file="bamCoverage_result1.bw" ftype="bigwig" />
        </test>
        <test>
            <param name="bamInput" value="bowtie2-test1.bam" ftype="bam" />
            <param name="outFileFormat" value="bigwig" />
            <param name="showAdvancedOpt" value="no" />
            <param name="binSize" value="10" />
            <output name="outFileName" file="bamCoverage_result2.bw" ftype="bigwig" />
        </test>
        <test>
            <param name="bamInput" value="bowtie2-test1.bam" ftype="bam" />
            <param name="outFileFormat" value="bedgraph" />
            <param name="showAdvancedOpt" value="no" />
            <param name="binSize" value="10" />
            <output name="outFileName" file="bamCoverage_result3.bg" ftype="bedgraph" />
        </test>
        <test>
            <param name="bamInput" value="phiX.bam" ftype="bam" />
            <param name="outFileFormat" value="bigwig" />
            <param name="showAdvancedOpt" value="no" />
            <param name="binSize" value="10" />
            <output name="outFileName" file="bamCoverage_result4.bw" ftype="bigwig" />
        </test>
        <test>
            <param name="bamInput" value="phiX.bam" ftype="bam" />
            <param name="outFileFormat" value="bedgraph" />
            <param name="showAdvancedOpt" value="no" />
            <param name="binSize" value="10" />
            <output name="outFileName" file="bamCoverage_result4.bg" ftype="bedgraph" />
        </test>
    </tests>
    <help>
<![CDATA[
**What it does**

Given a BAM file, this tool generates a bigWig or bedGraph file of fragment or
read coverages. The way the method works is by first calculating all the
number of reads (either extended to match the fragment length or not) that
overlap each bin in the genome. The resulting read counts can be normalized
using either a given scaling factor, the RPKM formula or to get a 1x depth of
coverage (RPGC). In the case of paired-end mapping each read mate is treated
independently to avoid a bias when a mixture of concordant and discordant
pairs is present. This means that *each end* will be extended to match the
fragment length.

.. image:: $PATH_TO_IMAGES/norm_IGVsnapshot_indFiles.png


You can find more details on the bamCoverage wiki page: https://github.com/fidelram/deepTools/wiki/Normalizations#wiki-bamCoverage


**Output files**:

- coverage file either in bigWig or bedGraph format

-----

@REFERENCES@
]]>
    </help>
    <expand macro="citations" />
</tool>