view computeGCBias.xml @ 2:b5da81864541 draft

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

<tool id="deeptools_computeGCBias" name="computeGCBias" version="1.0.1">
    <description>to see whether your samples should be normalized for GC bias</description>
    <expand macro="requirements" />
    <stdio>
        <exit_code range="0" level="warning" description="Warning" />
    </stdio>
    <macros>
        <import>deepTools_macros.xml</import>
    </macros>
    <command>
        #import tempfile
        #set $temp_dir = os.path.abspath(tempfile.mkdtemp())

    #set $temp_bam_handle = tempfile.NamedTemporaryFile( dir=$temp_dir )
    #set $temp_bam_path = $temp_bam_handle.name + '.bam'
    #silent $temp_bam_handle.close()
    #silent os.system("ln -s %s %s" % (str($bamInput), $temp_bam_path))
    #silent os.system("ln -s %s %s.bai" % (str($bamInput.metadata.bam_index), $temp_bam_path))

  computeGCBias

    @THREADS@

  --bamfile '$temp_bam_path'
  --GCbiasFrequenciesFile $outFileName
  --fragmentLength $fragmentLength

    @reference_genome_source@


  #if $effectiveGenomeSize.effectiveGenomeSize_opt == "specific":
    --effectiveGenomeSize $effectiveGenomeSize.effectiveGenomeSize
  #else:
    --effectiveGenomeSize $effectiveGenomeSize.effectiveGenomeSize_opt
  #end if


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

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

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

  #end if

  #if $saveBiasPlot:
    --biasPlot $biasPlot
  #end if

##  #if $output.showOutputSettings == "yes"
##      #if $output.saveBiasPlot:
##        --biasPlot biasPlot.png ;
##        mv biasPlot.png $biasPlot
##      #end if
##  #end if

  ; rm $temp_dir -rf

    </command>
    <inputs>

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

        <expand macro="reference_genome_source" />
        <expand macro="effectiveGenomeSize" />

      <param name="fragmentLength" type="integer" value="300" min="1"
        label="Fragment length used for the sequencing"
        help ="If paired-end reads are used, the fragment length is computed from the BAM file."/>

    <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="sampleSize" type="integer" value="50000000" min="1"
             label="Number of sampling points to be considered" />
           
           <param name="regionSize" type="integer" value="300" min="1"
             label="Region size"
             help ="To plot the reads per GC over a region, the size of the region is required (see below for more details of the mthod). By default, the bin size is set to 300 bp, which is close to the standard fragment size many sequencing applications. However, if the depth of sequencing is low, a larger bin size will be required, otherwise many bins will not overlap with any read."/>
           
           <param name="filterOut" type="data" format="bed" optional="true"
             label="BED file containing genomic regions to be excluded from the estimation of the correction"
             help="Such regions  usually contain repetitive regions and peaks that if included will bias the correction. It is recommended to filter out known repetitive regions if multi-reads (reads that map to more than one genomic position) were excluded. In the case of ChIP-seq data, it is recommended to first use a peak caller to identify and filter out the identified peaks." />
           <param name="extraSampling" type="data" format="bed" optional="true"
             label="BED file containing genomic regions for which extra sampling is required because they are underrepresented in the genome"
             help="" />
        </when>
    </conditional>

    <param name="saveBiasPlot" type="boolean" truevalue="--biasPlot" falsevalue="" checked="True" label="Save a diagnostic image summarizing the GC bias found on the sample"/>
    <!--
    <conditional name="output" >
        <param name="showOutputSettings" 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="saveBiasPlot" type="boolean" label="Save a diagnostic image summarizing the GC bias found on the sample"/>
      </when>
    </conditional>
    -->
  </inputs>
  <outputs>
    <data format="tabular" name="outFileName" />
    <data format="png" name="biasPlot" label="${tool.name} on ${on_string}: bias plot">
      <filter>saveBiasPlot is True</filter>      
      <!--<filter>(output['showOutputSettings'] == 'yes' and output['saveBiasPlot'] == True)</filter>-->
    </data>
  </outputs>
  <help>

**What it does**

This tool computes the GC bias using the method proposed by Benjamini and Speed (2012). Nucleic Acids Res. (see below for more explanations)
The output is used to plot the bias and can also be used later on to correct the bias with the tool correctGCbias.
There are two plots produced by the tool: a boxplot showing the absolute read numbers per genomic-GC bin and an x-y plot
depicting the ratio of observed/expected reads per genomic GC content bin.

-----

**Summary of the method used**

In order to estimate how many reads with what kind of GC content one should have sequenced, we first need to determine how many regions the specific
reference genome contains for each amount of GC content, i.e. how many regions in the genome have 50% GC (or 10% GC or 90% GC or...).
We then sample a large number of equally sized genome bins and count how many times we see a bin with 50% GC (or 10% GC or 90% or...). These EXPECTED values are independent of any 
sequencing as it only depends on the respective reference genome (i.e. it will most likely vary between mouse and fruit fly due to their genome's different GC contents).
The OBSERVED values are based on the reads from the sequenced sample. Instead of noting how many genomic regions there are per GC content, we now count the reads per GC content.
In an ideal sample without GC bias, the ratio of OBSERVED/EXPECTED values should be close to 1 regardless of the GC content. Due to PCR (over)amplifications, the majority of ChIP samples
usually shows a significant bias towards reads with high GC content (>50%)

.. image:: $PATH_TO_IMAGES/QC_GCplots_input.png


**Output files**:

- Diagnostic plot

  - box plot of absolute read numbers per genomic GC bin
  - x-y plot of observed/expected read ratios per genomic GC content bin

- Data matrix

  - to be used for GC correction with correctGCbias


-----

.. class:: infomark

@REFERENCES@

    </help>
</tool>