view bamCoverage.xml @ 20:827fe3df85c3 draft

planemo upload for repository https://github.com/deeptools/deepTools/tree/master/galaxy/wrapper/ commit 38cfe39e3b3c82bbc0c2013e3068bd71adc3a9cb
author bgruening
date Mon, 09 Jul 2018 19:06:38 -0400
parents f024daeffbed
children
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 or CRAM file</description>
    <macros>
        <token name="@BINARY@">bamCoverage</token>
        <import>deepTools_macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command>
<![CDATA[
        ln -s '$bamInput' one.bam &&
        #if $bamInput.ext == 'bam':
            ln -s '${bamInput.metadata.bam_index}' one.bam.bai &&
        #else:
            ln -s '${bamInput.metadata.cram_index}' one.bam.crai &&
        #end if

        @BINARY@
            @THREADS@

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

            --binSize $binSize

            #if $scaling.type=='rpkm':
                --normalizeUsing RPKM
            #elif $scaling.type=='cpm':
                --normalizeUsing CPM
            #elif $scaling.type=='bpm':
                --normalizeUsing BPM
            #elif $scaling.type=='1x':
                --normalizeUsing RPGC
                #if $scaling.effectiveGenomeSize.effectiveGenomeSize_opt == "specific":
                    --effectiveGenomeSize $scaling.effectiveGenomeSize.effectiveGenomeSize
                #else:
                    --effectiveGenomeSize $scaling.effectiveGenomeSize.effectiveGenomeSize_opt
                #end if
            #end if

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

            #if $advancedOpt.showAdvancedOpt == "yes":
                #if str($advancedOpt.scaleFactor).strip() != '':
                    --scaleFactor $advancedOpt.scaleFactor
                #end if

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

                @ADVANCED_OPTS_READ_PROCESSING@
                $advancedOpt.skipNAs

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

                #if str($advancedOpt.filterRNAstrand) != 'no':
                    --filterRNAstrand '$advancedOpt.filterRNAstrand'
                #end if

                #if $advancedOpt.Offset:
                    --Offset $advancedOpt.Offset
                #end if

                @blacklist@
            #end if
]]>
    </command>

    <inputs>
        <param name="bamInput" format="bam,cram" type="data" label="BAM/CRAM file"
            help=""/>

        <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 reads per kilobase per million (RPKM)</option>
                <option value="cpm">Normalize to counts per million (CPM), same as CPM in RNA-seq</option>
                <option value="bpm">Normalize to bins per million (BPM), same as TPM in RNA-seq</option>
                <option value="no">Do not normalize or scale</option>
            </param>
            <when value="rpkm"/>
            <when value="cpm"/>
            <when value="bpm"/>
            <when value="no"/>
            <when value="1x">
                <expand macro="effectiveGenomeSize" />
            </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="exactScaling" />
        <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="scaleFactor" />
                <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. By default, only fragments between 130 and 200 bases will be used, though this can be changed with the --minFragmentLength and --maxFragmentLength options." />

                <param argument="--Offset" type="text"  value="" optional="True"
                    label="Offset inside each alignment to use for the signal location."
                    help="Uses this offset inside of each read as the signal. This is useful in
                        cases like RiboSeq or GROseq, where only the 12th, 15th or 1st base aligned
                        should be used to denote where the signal is (rather than the span of the
                        whole alignment). This can be paired with the --filterRNAstrand option. Note
                        that negative values indicate offsets from the end of each read. A value of
                        1 indicates the first base of the alignment (taking alignment orientation
                        into account). Likewise, a value of -1 is the last base of the alignment. An
                        offset of 0 is not permitted. If two values (separated by spaces) are specified, then they will be
                        used to specify a range of positions. Note that specifying something like
                        --Offset 5 -1 will result in the 5th through last position being used, which
                        is equivalent to trimming 4 bases from the 5-prime end of alignments." />

                <param argument="filterRNAstrand" type="select" label="Only include reads originating from fragments from the forward or reverse strand."
                    help="By default (the no option), all reads are processed, regardless of the strand they originated from. For RNAseq, it can be useful to separately create bigWig files for the forward or reverse strands.
                          Note that this tools assumes that a dUTP-based method was used, so fragments will be assigned to the reverse strand if the second read in a pair is reverse complemented.">
                    <option value="no" selected="true">no</option>
                    <option value="forward">forward</option>
                    <option value="reverse">reverse</option>
                </param>
                <expand macro="blacklist" />

            </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="effectiveGenomeSize_opt" value="specific" />
            <param name="effectiveGenomeSize" value="2451960000" />
            <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="effectiveGenomeSize_opt" value="specific" />
            <param name="effectiveGenomeSize" value="2451960000" />
            <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="effectiveGenomeSize_opt" value="specific" />
            <param name="effectiveGenomeSize" value="2451960000" />
            <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="effectiveGenomeSize_opt" value="specific" />
            <param name="effectiveGenomeSize" value="2451960000" />
            <param name="binSize" value="10" />
            <output name="outFileName" file="bamCoverage_result4.bg" ftype="bedgraph" />
        </test>
        <test>
            <param name="bamInput" value="phiX.bam" ftype="bam" />
            <param name="outFileFormat" value="bigwig" />
            <param name="showAdvancedOpt" value="yes" />
            <param name="filterRNAstrand" value="reverse" />
            <param name="effectiveGenomeSize_opt" value="specific" />
            <param name="effectiveGenomeSize" value="2451960000" />
            <param name="binSize" value="10" />
            <output name="outFileName" file="bamCoverage_result5.bw" ftype="bigwig" />
        </test>
        <test>
            <param name="bamInput" value="bowtie2 test1.bam" ftype="bam" />
            <param name="outFileFormat" value="bigwig" />
            <param name="showAdvancedOpt" value="yes" />
            <param name="binSize" value="10" />
            <param name="Offset" value="-4 -1" />
            <param name="doExtend" value="yes" />
            <param name="minMappingQuality" value="0" />
            <param name="type" value="no" />
            <output name="outFileName" file="bamCoverage_result6.bw" ftype="bigwig" />
        </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. Various options are available to normalize the reads:
1) using a given scaling factor
2) RPKM (reads per kilobase per million) : RPKM (per bin) =  number of reads per bin / ( number of mapped reads (in millions) * bin length (kb) ).
3) CPM (counts per million) : CPM (per bin) =  number of reads per bin / number of mapped reads (in millions).
4) BPM (bins per million) :  BPM (per bin) =  number of reads per bin / sum of all reads per bin (in millions).
5) RPGC (1x sequencing depth ) : number of reads per bin /(total number of mapped reads * fragment length / effective genome size)

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>