view bamCorrelate.xml @ 50:f9390e176b8f

Uploaded
author bgruening
date Fri, 02 Aug 2013 12:54:19 -0400
parents c6f1a059bc7d
children 6a2a7374450b
line wrap: on
line source

<tool id="bamCorrelate" name="bamCorrelate" version="1.0">
  <description>corrlates pairs of bam files</description>

  <command>
  #set files=[]
  #set labels=[]
  #for $i in $inputs
    #set $files += [str($i.bamfile)]
    #if str($i.label.value) != "":
        #set $labels += ["\"%s\"" % ($i.label.value)]
    #else
        #set $labels += ["\"%s\"" % ($i.bamfile.name)]
    #end if
  #end for
  bamCorrelate
  --bamfiles #echo " ".join($files)
  --labels #echo " ".join($labels)
  
  --fragmentLength $fragmentLength
  --corMethod $corMethod
  
  #set newoutFileName=str($outFileName)+".png"
  --plotFile $newoutFileName
  
  #if $outputOpt.showOutputOpt == "yes"
      #if $outputOpt.outFileRawCounts:
        --outRawCounts '$outputOpt.outFileRawCounts' 
      #end if
      #if $outputOpt.outFileCorMatrix:
        --outFileCorMatrix '$outputOpt.outFileCorMatrix'
      #end if
  #end if
  
  #if $advancedOpt.showAdvancedOpt == "yes":
    #if $advancedOpt.smoothLength:
      --smoothLength '$advancedOpt.smoothLength'
    #end if
    
    #if str($advancedOpt.region.value) != '':
      --region '$advancedOpt.region'
    #end if
    
    --binSize '$advancedOpt.binSize'
    --numberOfSamples '$advancedOpt.numberOfSamples'
    
    $advancedOpt.doNotExtendPairedEnds
    $advancedOpt.ignoreDuplicates
    $advancedOpt.includeZeros
    
    #if $advancedOpt.minMappingQuality:
      --minMappingQuality '$advancedOpt.minMappingQuality'
    #end if
  #end if
  
  --numberOfProcessors 4; mv $newoutFileName $outFileName
  </command>

  <inputs>
  
  <repeat name="inputs" title="Input files" min="2">
    <param name="bamfile" type="data" format="bam" 
        label="Bam file" 
        help="The BAM file must be sorted and indexed."/>
    <param name="label" type="text" size="30" optional="true" value=""
        label="Label"
        help="Label to use in the output. If not given the dataset name will be used instead."/>
  </repeat>
  
  <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. If this value is set to the read length or smaller, the read will not be extended. *Warning* the fragment length affects the normalization to 1x (see &quot;normalize coverage to 1x&quot;). The formula to normalize using the sequencing depth is genomeSize/(number of mapped reads * 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="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="smoothLength" type="integer" value="1" optional="true" min="1"
	   label="Smooth values using the following length (in bp)"
	   help ="The smooth length defines a window, larger than the bin size, to average the number of reads. For example, if the bin size is set to 20 bp and the smooth length is set to 60 bp, then, for each bin size the average of it and its left and right neighbors is considered. Any value smaller than the bin size will be ignored and no smoothing will be applied."/>
	   
    <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"/>
	    
	<param name="includeZeros" type="boolean" truevalue="--includeZeros" falsevalue=""
	   label ="Include zeros"
	   help  ="If set, then zero counts that happen for *all* bam files given are included. The default behavior is to ignore those cases" />
  
    </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**

Genomes are split into bins of given length. For each bin the number of reads
found for each of the bam files is counted. A correlation is computed for all
pairs of bam files.

-----

.. class:: infomark

Please acknowledge that this tool **is still in development** and we will be very happy to receive feedback from the users. If you run into any trouble please sent an email to `Fidel Ramirez`_.

This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.


.. _Bioinformatics and Deep-Sequencing Unit: http://www3.ie-freiburg.mpg.de/facilities/research-facilities/bioinformatics-and-deep-sequencing-unit/
.. _Max Planck Institute for Immunobiology and Epigenetics: http://www3.ie-freiburg.mpg.de
.. _Fidel Ramirez: ramirez@ie-freiburg.mpg.de

  </help>
  
</tool>