view bamFingerprint.xml @ 1:a22ccc261bb3 draft

Uploaded
author bgruening
date Fri, 15 Nov 2013 07:57:48 -0500
parents d957e25e18a3
children 135f3bae5c56
line wrap: on
line source

<tool id="deeptools_bamFingerprint" name="bamFingerprint" version="1.0">
    <description>plots profiles of BAM files; useful for assesing ChIP signal strength</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@

    bamFingerprint

        @THREADS@

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

      --fragmentLength $fragmentLength

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

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

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

        --binSize '$advancedOpt.binSize'
        --numberOfSamples '$advancedOpt.numberOfSamples'

        $advancedOpt.doNotExtendPairedEnds
        $advancedOpt.ignoreDuplicates
        $advancedOpt.skipZeros

        #if $advancedOpt.minMappingQuality:
          --minMappingQuality '$advancedOpt.minMappingQuality'
        #end if
      #end if
      ; mv $newoutFileName $outFileName
      ; rm $temp_dir -rf
    </command>

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

        <param name="fragmentLength" type="integer" value="200" min="1"
           label="Length of the average fragment size"/>
        <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="region" type="text" value=""
                   label="Region of the genome to limit the operation to"
                   help="This is useful when testing parameters to reduce the computing time. The format is chr:start:end, for example &quot;chr10&quot; or &quot;chr10:456700:891000&quot;" />
                
                <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"/>
                
                <param name="doNotExtendPairedEnds" type="boolean" truevalue="--doNotExtendPairedEnds" falsevalue=""
                    label="Do not extend paired ends"
                    help="If set, reads are not extended to match the fragment length reported in the BAM file, instead they will be extended to match the fragment length. Default is to extend the reads if paired end information is available."/>
                  
                <param name="ignoreDuplicates" type="boolean" truevalue="--ignoreDuplicates" falsevalue=""
                    label="Ignore duplicates"
                    help="If set, reads that have the same orientation and start position will be considered only once. If reads are paired, the mate position also has to coincide to ignore a read." /> 
                  
                <param name="minMappingQuality" type="integer" optional="true" value="1" min="1"
                    label="Minimum mapping quality"
                    help= "If set, only reads that have a mapping quality score higher than the given value are considered. *Note* Bowtie's Mapping quality is related to uniqueness: the higher the score, the more unique is a read. A mapping quality defined by Bowtie of 10 or less indicates that there is at least a 1 in 10 chance that the read truly originated elsewhere."/>
                    
                <param name="skipZeros" type="boolean" truevalue="--skipZeros" falsevalue=""
                   label ="Include zeros"
                   help  ="If set, then zero counts that happen for *all* BAM files given are ignored. This might have the effect that fewer regions are considered than indicated in the option where the number of samples is defined." />
            </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"/>
            </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>
    </outputs>
    <help>

**What it does**

This tool is based on a method developed by Diaz et al. (2012). Stat Appl Genet Mol Biol 11(3).
The resulting plot can be used to assess the strength of a ChIP (for factors that bind to narrow regions).
The tool first samples indexed BAM files and counts all reads overlapping a window (bin) of specified length.
These counts are then sorted according to their rank and the cumulative sum of read counts are plotted. An ideal input
with perfect uniform distribution of reads along the genome (i.e. without enrichments in open chromatin etc.) should
generate a straight diagonal line. A very specific and strong ChIP enrichment will be indicated by a prominent and steep
rise of the cumulative sum towards the highest rank. This means that a big chunk of reads from the ChIP sample is located in
few bins which corresponds to high, narrow enrichments seen for transcription factors.


.. image:: $PATH_TO_IMAGES/QC_fingerprint.png


**Output files**:

- Diagnostic plot
- Data matrix of raw counts

-----

.. class:: infomark

@REFERENCES@

    </help>
</tool>