view bamCorrelate.xml @ 2:b5da81864541 draft

Uploaded
author bgruening
date Fri, 15 Nov 2013 11:02:32 -0500
parents a22ccc261bb3
children 9441b4e5d2d6
line wrap: on
line source

<tool id="deeptools_bamCorrelate" name="bamCorrelate" version="1.0.1">
    <description>correlates pairs of BAM files</description>
    <expand macro="requirements" />
    <macros>
        <import>deepTools_macros.xml</import>
    </macros>
    <command>
        #import tempfile
        #set $temp_dir = os.path.abspath(tempfile.mkdtemp())

        #set files=[]
        #set labels=[]

        @multiple_input_bams@

        bamCorrelate

        @THREADS@

        --bamfiles #echo " ".join($files)
        --labels #echo " ".join($labels)

        --fragmentLength $fragmentLength
        --corMethod $corMethod

        #set newoutFileName=str($outFileName)+".png"
        --plotFile $newoutFileName

        #if $outputOpt.showOutputOpt == "yes"
            --outRawCounts '$outFileRawCounts' 
            --outFileCorMatrix '$outFileCorMatrix'
        #end if

        #if $mode.modeOpt == "bins":
            --binSize '$mode.binSize'
            --numberOfSamples '$mode.numberOfSamples'
        #else:
            --BED $mode.region_file
        #end if

        ## options available in both modes
        #if $mode.advancedOpt.showAdvancedOpt == "yes":

            #if str($mode.advancedOpt.region.value) != '':
            --region '$mode.advancedOpt.region'
            #end if

            $mode.advancedOpt.doNotExtendPairedEnds
            $mode.advancedOpt.ignoreDuplicates
            $mode.advancedOpt.includeZeros

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

            #if $mode.advancedOpt.zMin:
                --zMin $mode.advancedOpt.zMin
            #end if
            #if $mode.advancedOpt.zMax:
                --zMax $mode.advancedOpt.zMax
            #end if
            --colorMap '$mode.advancedOpt.colorMap'

        #end if

        ; mv $newoutFileName $outFileName
        ; rm $temp_dir -rf
    </command>

    <inputs>
        <expand macro="multiple_input_bams" />

        <param name="fragmentLength" type="integer" value="300" 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. *NOTE*: If the BAM files contain mated and unmated paired-end reads, unmated reads will be extended to match the fragment length."/>

        <param name="corMethod" type="select" label="Correlation method">
            <option value="pearson">Pearson</option>
            <option value="spearman">Spearman</option>
        </param>

        <conditional name="mode">
            <param name="modeOpt" type="select" label="Choose computation mode" 
                help="In the bins mode, the correlation is computed based on equal length bins. In the BED file mode, as list of genomic regions in BED format has to be given. For each region in the BED file the number of overlapping reads is counted in each of the BAM files. Then the correlation is computed.">
                <option value="bins" selected="true">Bins</option>
                <option value="BED-file">Limit correlation to certain regions (BED file)</option>
            </param>
            <when value="bins">
                <param name="binSize" type="integer" value="10000" min="1" 
                    label="Bin size in bp"
                    help="Length in base pairs for a window used to sample the genome."/>

                <param name="numberOfSamples" type="integer" value="100000" min="1" 
                    label="Number of samples"
                    help="Number of samples taken from the genome to compute the scaling factors"/>
                <expand macro="bamCorrelate_mode_actions" />
            </when>
            <when value="BED-file">
                <param name="region_file" type="data" format="bed" label="Region file in BED format" help="Correlation is computed for the number of reads that overlap such regions."/>
                <expand macro="bamCorrelate_mode_actions" />
            </when>

        </conditional>

        <conditional name="outputOpt">
            <param name="showOutputOpt" type="select" label="Show additional output options" >
                <option value="no" selected="true">no</option>
                <option value="yes">yes</option>
            </param>
            <when value="no" />
            <when value="yes">
                <param name="saveRawCounts" type="boolean" label="Save the bin counts"/>
                <param name="saveCorMatrix" type="boolean" label="Save the correlation matrix"/>
            </when>
        </conditional>

    </inputs>
    <outputs>
        <data format="png" name="outFileName" />
        <data format="tabular" name="outFileRawCounts" label="${tool.name} on ${on_string}: bin counts">
            <filter>(outputOpt['showOutputOpt'] == 'yes' and outputOpt['saveRawCounts'] == True)</filter>
        </data>
        <data format="tabular" name="outFileCorMatrix" label="${tool.name} on ${on_string}: correlation matrix">
            <filter>(outputOpt['showOutputOpt'] == 'yes' and outputOpt['saveCorMatrix'] == True)</filter>
        </data>
    </outputs>
    <help>

**What it does**

This tool is useful to assess the overall similarity of different BAM files. A typical application
is to check the correlation between replicates or published data sets.

The tool splits the genomes into bins of given length. For each bin, the number of reads
found in each BAM file is counted and a correlation is computed for all
pairs of BAM files.


.. image:: $PATH_TO_IMAGES/QC_bamCorrelate_humanSamples.png
   :alt: Heatmap of RNA Polymerase II ChIP-seq


**Output files**:

- diagnostic plot produced by bamCorrelate is a clustered heatmap displaying the values for each pair-wise correlation, see below for an example
- data matrix (optional) in case you want to plot the correlation values using a different program, e.g. R, this matrix can be used




-----

.. class:: infomark

@REFERENCES@

    </help>
</tool>