view bamCoverage.xml @ 2:8145727ba0f0 draft

planemo upload for repository https://github.com/fidelram/deepTools/tree/master/galaxy/wrapper/ commit 7150f0c106abd56920767518cc331ef6e4e7f439
author bgruening
date Thu, 18 Feb 2016 11:46:57 -0500
parents 36f655a04a57
children 10e697ec9bfb
line wrap: on
line source

<tool id="deeptools_bam_coverage" name="bamCoverage" version="@WRAPPER_VERSION@.0">
    <description>generates a coverage bigWig file from a given BAM file</description>
    <macros>
        <token name="@BINARY@">bamCoverage</token>
        <import>deepTools_macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command>
<![CDATA[
        ln -s '$bamInput' one.bam &&
        ln -s '${bamInput.metadata.bam_index}' one.bam.bai &&

        @BINARY@
            @THREADS@

            --bam one.bam
            --outFileName '$outFileName'
            --outFileFormat '$outFileFormat'

            --binSize $binSize

            #if $scaling.type=='rpkm':
                --normalizeUsingRPKM
                --scaleFactor $scaling.scaleFactor
            #elif $scaling.type=='1x':
                #if $scaling.effectiveGenomeSize.effectiveGenomeSize_opt == "specific":
                    --normalizeTo1x $scaling.effectiveGenomeSize.effectiveGenomeSize
                #else:
                    --normalizeTo1x $scaling.effectiveGenomeSize.effectiveGenomeSize_opt
                #end if
                --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

                @ADVANCED_OPTS_READ_PROCESSING@
                $advancedOpt.skipNAs

                #if str($advancedOpt.ignoreForNormalization).strip() != '':
                    --ignoreForNormalization $advancedOpt.ignoreForNormalization
                #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="binSize" type="integer" value="50" min="1"
            label="Bin size in bases"
            help="The genome will be divided into bins of the specified size. 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="no">Do not normalize or scale</option>
            </param>
            <when value="rpkm">
                <expand macro="scaleFactor" />
            </when>
            <when value="no"/>
            <when value="1x">
                <expand macro="effectiveGenomeSize" />
                <expand macro="scaleFactor" />
            </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">
                <expand macro="smoothLength" />

                <param argument="ignoreForNormalization" type="text" value=""
                    label="Regions that should be excluded for normalization"
                    help="A list of chromosome names separated by spaces
                        containing those chromosomes that should be excluded
                        during normalization. This is useful when
                        considering samples with unequal coverage across
                        chromosomes, like male and female samples. Example: chrX chrM" />

                <expand macro="skipNAs" />
                <expand macro="read_processing_options" />

                <param argument="--MNase" type="boolean" truevalue="--MNase" falsevalue=""
                    label="Determine nucleosome positions from MNase-seq data"
                    help="Only the 3 nucleotides at the center of each fragment are counted. The fragment ends are defined by the two mate reads. *NOTE*: Requires paired-end data." />

            </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="yes" />
            <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.

See the usage hints below.

.. image:: $PATH_TO_IMAGES/norm_IGVsnapshot_indFiles.png
   :width: 600
   :height: 336

Output
-------------

``bamCoverage`` produces a coverage file, either in bigWig or bedGraph format, where for each bin the number of overlapping reads (possibly normalized) is noted.

Like BAM files, bigWig files are compressed, binary files. If you would like to see the coverage values, choose the bedGraph output. For more information on typical NGS file formats, see our `Glossary <http://deeptools.readthedocs.org/en/latest/content/help_glossary.html#file-formats>`_

.. image:: $PATH_TO_IMAGES/bamCoverage_output.png
   :width: 600
   :height: 450

Usage hints
------------

* A smaller ``bin size`` value will result in a higher resolution of the coverage track but also in a larger file size.
* The ``1x normalization`` (RPGC) requires the input of a value for the **effective genome size**, which is the mappable part of the reference genome. Of course, this value is species-specific.
* It might be useful for some studies to exclude certain chromosomes in order to avoid biases, e.g. chromosome X for many mammals where the males contain a pair of each autosome, but often only a single X chromosome.
* By default, the read length is **NOT** extended! This is the preferred setting for **spliced-read** data like RNA-seq, where one usually wants to rely on the detected read locations only. A read extension would neglect potential splice sites in the unmapped part of the fragment.
  Other data, e.g. ChIP-seq, where fragments are known to map contiuously, should be processed with read extension (``--extendReads [INT]``).
* For paired-end data, the fragment length is generally defined by the two read mates. The user-provided fragment length is only used as a fallback for singletons or mate reads that map too far apart (with a distance greater than four times the fragment length or if the mates are located on different chromosomes).

WARNING: If you already normalized for GC bias using ``correctGCbias``, you should absolutely **NOT** set the parameter ``--ignoreDuplicates``!


-----

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