changeset 10:a68a771625d2 draft

Uploaded
author bgruening
date Tue, 29 Oct 2013 17:26:28 -0400
parents 73761f33f198
children e7cc2a55ff94
files bamCompare.xml bamCorrelate.xml bamCoverage.xml bamFingerprint.xml bigwigCompare.xml computeGCBias.xml computeMatrix.xml correctGCBias.xml deepTools_macros.xml heatmapper.xml profiler.xml readme.rst static/images/QC_GCplots_input.png static/images/QC_bamCorrelate_humanSamples.png static/images/QC_fingerprint.png static/images/flowChart_computeMatrixetc.png static/images/norm_IGVsnapshot_indFiles.png static/images/visual_hm_DmelPolII.png static/images/visual_profiler_DmelPolII.png tool-data/deepTools_seqs.loc.sample tool_dependencies.xml
diffstat 21 files changed, 1165 insertions(+), 1019 deletions(-) [+]
line wrap: on
line diff
--- a/bamCompare.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/bamCompare.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,190 +1,187 @@
 <tool id="deeptools_bamCompare" name="bamCompare" version="1.0">
-  <description>normalizes and compares two BAM files to obtain the ratio, log2ratio or difference.</description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" version="1.7.1">numpy</requirement>
-    <requirement type="package" version="0.1">ucsc_tools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <command>
-  bamCompare
+    <description>normalizes and compares two BAM files to obtain the ratio, log2ratio or difference. (bam2bigwig)</description>
+    <expand macro="requirements" />
+    <macros>
+        <import>deepTools_macros.xml</import>
+    </macros>
+    <command>
+        bamCompare
 
-  ##ToDo
-  --numberOfProcessors 4
-
-  --bamfile1 '$bamFile1'
-  -bai1 '${bamFile1.metadata.bam_index}'
-  --bamfile2 '$bamFile2'
-  -bai2 '${bamFile2.metadata.bam_index}'
+        @THREADS@
 
-  --outFileName '$outFileName'
-  --outFileFormat '$outFileFormat'
+      --bamfile1 '$bamFile1'
+      -bai1 '${bamFile1.metadata.bam_index}'
+      --bamfile2 '$bamFile2'
+      -bai2 '${bamFile2.metadata.bam_index}'
 
-  --fragmentLength $fragmentLength
-  --binSize $binSize
+      --outFileName '$outFileName'
+      --outFileFormat '$outFileFormat'
 
-  #if $scaling.method == 'SES':
-    --scaleFactorsMethod SES
-    --sampleLength $scaling.sampleLength
-  #elif $scaling.method == 'readCount':
-    --scaleFactorsMethod readCount
-  #elif $scaling.method == 'own':
-    --scaleFactors '$scaling.scaleFactor1:$scaling.scaleFactor2'
-  #end if
+      --fragmentLength $fragmentLength
+      --binSize $binSize
 
-  --ratio $comparison.type
-
-  #if $comparison.type=='subtract':
-      #if $comparison.normalization.type=='rpkm':
-        --normalizeUsingRPKM
-      #elif $comparison.normalization.type=='1x':
-        --normalizeTo1x $comparison.normalization.normalizeTo1x
+      #if $scaling.method == 'SES':
+        --scaleFactorsMethod SES
+        --sampleLength $scaling.sampleLength
+      #elif $scaling.method == 'readCount':
+        --scaleFactorsMethod readCount
+      #elif $scaling.method == 'own':
+        --scaleFactors '$scaling.scaleFactor1:$scaling.scaleFactor2'
       #end if
 
-      #if str($comparison.ignoreForNormalization).strip() != '':
-        --ignoreForNormalization $comparison.ignoreForNormalization
+      --ratio $comparison.type
+
+      #if $comparison.type=='subtract':
+          #if $comparison.normalization.type=='rpkm':
+            --normalizeUsingRPKM
+          #elif $comparison.normalization.type=='1x':
+            --normalizeTo1x $comparison.normalization.normalizeTo1x
+          #end if
+
+          #if str($comparison.ignoreForNormalization).strip() != '':
+            --ignoreForNormalization $comparison.ignoreForNormalization
+          #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
+
+        $advancedOpt.doNotExtendPairedEnds
+        $advancedOpt.ignoreDuplicates
+
+        #if $advancedOpt.minMappingQuality:
+          --minMappingQuality '$advancedOpt.minMappingQuality'
+        #end if
+
+        --missingDataAsZero $advancedOpt.missingDataAsZero
+
       #end if
 
-  #end if
-
-  #if $advancedOpt.showAdvancedOpt == "yes":
-    #if $advancedOpt.smoothLength:
-      --smoothLength '$advancedOpt.smoothLength'
-    #end if
+    </command>
 
-    #if str($advancedOpt.region.value) != '':
-      --region '$advancedOpt.region'
-    #end if
-
-    $advancedOpt.doNotExtendPairedEnds
-    $advancedOpt.ignoreDuplicates
+    <inputs>
+        <param name="bamFile1" format="bam" type="data" label="Treatment BAM file"
+            help="The BAM file must be sorted."/>
 
-    #if $advancedOpt.minMappingQuality:
-      --minMappingQuality '$advancedOpt.minMappingQuality'
-    #end if
-
-    --missingDataAsZero $advancedOpt.missingDataAsZero
+        <param name="bamFile2" format="bam" type="data" label="Input BAM file"
+            help="The BAM file must be sorted."/>
 
-  #end if
-
-  </command>
+        <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."/>
 
-  <inputs>
-    <param name="bamFile1" format="bam" type="data" label="Treatment BAM file"
-       help="The BAM file must be sorted."/>
+        <param name="binSize" type="integer" value="50" min="1" 
+            label="Bin size in bp"
+            help="The genome will be divided in bins (also called tiles) of the specified length. For each bin the overlaping number of fragments (or reads)  will be reported. If only half a fragment overlaps, this fraction will be reported. "/>
 
-    <param name="bamFile2" format="bam" type="data" label="Input BAM file"
-       help="The BAM file must be sorted."/>
-
-    <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="binSize" type="integer" value="50" min="1" 
-       label="Bin size in bp"
-       help="The genome will be divided in bins (also called tiles) of the specified length. 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="method" type="select" 
+                label="Method to use for scaling the largest sample to the smallest">
+                <option value="readCount" selected="true">read count</option>
+                <option value="SES">signal extraction scaling (SES)</option>
+                <option value="own">enter own scaling factors</option>
+            </param>
+            <when value="SES">
+                <param name="sampleLength" type="integer" value="1000" min="10"
+                    label="Length in base pairs used to sample the genome and compute the size or scaling factors to compare the two  BAM files "
+                    help="The default is fine. Only change it if you know what you are doing" />
+            </when>
+            <when value="readCount" />
+            <when value="own">
+                <param name="scaleFactor1" type="float" value="1"
+                    label="Scale factor for treatment"/>
 
-    <conditional name="scaling">
-      <param name="method" type="select" 
-         label="Method to use for scaling the largest sample to the smallest">
-        <option value="readCount" selected="true">read count</option>
-        <option value="SES">signal extraction scaling (SES)</option>
-        <option value="own">enter own scaling factors</option>
-      </param>
-      <when value="SES">
-        <param name="sampleLength" type="integer" value="1000" min="10"
-               label="Length in base pairs used to sample the genome and compute the size or scaling factors to compare the two  BAM files "
-               help="The default is fine. Only change it if you know what you are doing" />
-      </when>
-      <when value="readCount" />
-      <when value="own">
-        <param name="scaleFactor1" type="float" value="1"
-               label="Scale factor for treatment"/>
-
-        <param name="scaleFactor2" type="float" value="1"
-               label="Scale factor for input"/>
-      </when>
-    </conditional>
+                <param name="scaleFactor2" type="float" value="1"
+                    label="Scale factor for input"/>
+            </when>
+        </conditional>
 
-    <conditional name="comparison">
-      <param name="type" type="select" 
-         label="How to compare the two files">
-        <option value="log2" selected="true">compute log2 of the number of reads ratio</option>
-        <option value="ratio">compute the ratio of the number of reads</option>
-        <option value="subtract">compute difference (subtract input from treatment) of the number of reads</option>
-      </param>
-      <when value="log2" />
-      <when value="ratio" />
-      <when value="subtract">
-        <conditional name="normalization">
-          <param name="type" type="select" label="Normalization method" >
-                <option value="1x">Normalize coverage to 1x</option>
-                <option value="rpkm">Normalize to fragments (reads) per kilobase per million (RPKM)</option>
-                <option value="no">Do not normalize or scale</option>
-          </param>
-          <when value="rpkm" />
-          <when value="no" />
-          <when value="1x">
-            <param name="normalizeTo1x" type="integer" value="2150570000"
-               label="Report normalized coverage to 1x sequenceing depth"
-               help ="Sequencing depth is defined as the total number of mapped reads * fragment length / effective genome size. To use this option, the effective genome size has to be given. Common values are: mm9: 2150570000, hg19:2451960000, dm3:121400000 and ce10:93260000."/>
-          </when>
+        <conditional name="comparison">
+            <param name="type" type="select" 
+                label="How to compare the two files">
+                <option value="log2" selected="true">compute log2 of the number of reads ratio</option>
+                <option value="ratio">compute the ratio of the number of reads</option>
+                <option value="subtract">compute difference (subtract input from treatment) of the number of reads</option>
+            </param>
+            <when value="log2" />
+            <when value="ratio" />
+            <when value="subtract">
+                <conditional name="normalization">
+                    <param name="type" type="select" label="Normalization method" >
+                        <option value="1x">Normalize coverage to 1x</option>
+                        <option value="rpkm">Normalize to fragments (reads) per kilobase per million (RPKM)</option>
+                        <option value="no">Do not normalize or scale</option>
+                    </param>
+                    <when value="rpkm" />
+                    <when value="no" />
+                    <when value="1x">
+                        <param name="normalizeTo1x" type="integer" value="2150570000"
+                            label="Report normalized coverage to 1x sequenceing depth"
+                            help ="Sequencing depth is defined as the total number of mapped reads * fragment length / effective genome size. To use this option, the effective genome size has to be given. Common values are: mm9: 2150570000, hg19:2451960000, dm3:121400000 and ce10:93260000."/>
+                    </when>
+                </conditional>
+                <param name="ignoreForNormalization" type="text" value="" size="50"
+                    label="regions that should be excluded for calculating the scaling factor"
+                    help="Sometimes it makes sense to exclude certain regions when calculating the scaling factor. For example, if you know some regions that you suspect to be present more often in your sample's genome than in the reference genome that will therefore accumulate reads (CNV). Another typical example is the single X chromosome in male samples that should be scaled separately from the diploid autosomes. For example chrX,chrY,chr3. or chr10:12220-128932" />
+            </when>
         </conditional>
-        <param name="ignoreForNormalization" type="text" value="" size="50"
-            label="regions that should be excluded for calculating the scaling factor"
-            help="Sometimes it makes sense to exclude certain regions when calculating the scaling factor. For example, if you know some regions that you suspect to be present more often in your sample's genome than in the reference genome that will therefore accumulate reads (CNV). Another typical example is the single X chromosome in male samples that should be scaled separately from the diploid autosomes. For example chrX,chrY,chr3. or chr10:12220-128932" />
-      </when>
-    </conditional>
 
-    <param name="outFileFormat" type="select" label="Coverage file format">
-        <option value="bigwig" selected="true">bigwig</option>
-    <option value="bedgraph">bedgraph</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 name="outFileFormat" type="select" label="Coverage file format">
+            <option value="bigwig" selected="true">bigwig</option>
+            <option value="bedgraph">bedgraph</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."/>
+        <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="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="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="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="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="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="minMappingQuality" type="integer" optional="true" value="1" min="1"
-            label="Minimum mapping quality (e.g. BOWTIE2 measures)"
-            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="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="missingDataAsZero" type="boolean" truevalue="yes" falsevalue="no" checked="True"
-            label ="Treat missing data as zero"
-            help  ="This parameter determines if missing data should be treated as zeros. If unchecked, missing data will be ignored and not included in the output file. Missing data is defined as those regions for which both BAM files have 0 reads." />
-        </when>
-    </conditional>
+            <param name="minMappingQuality" type="integer" optional="true" value="1" min="1"
+                label="Minimum mapping quality (e.g. BOWTIE2 measures)"
+                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."/>
 
-  </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>
-  <help>
+            <param name="missingDataAsZero" type="boolean" truevalue="yes" falsevalue="no" checked="True"
+                label ="Treat missing data as zero"
+                help  ="This parameter determines if missing data should be treated as zeros. If unchecked, missing data will be ignored and not included in the output file. Missing data is defined as those regions for which both BAM files have 0 reads." />
+            </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>
+    <help>
 
 **What it does**
 
@@ -199,19 +196,17 @@
 If paired-end reads are present, the fragment
 length reported in the BAM file is used by default.
 
+
+.. image:: $PATH_TO_IMAGES/norm_IGVsnapshot_indFiles.png
+
+
+**Output files**:
+
+- same as for bamCoverage, except that you now obtain 1 coverage file that is based on 2 BAM files.
+
 -----
 
 .. class:: infomark
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-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
-
-
-  </help>
-  
+    </help>
 </tool>
--- a/bamCorrelate.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/bamCorrelate.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,154 +1,144 @@
 <tool id="deeptools_bamCorrelate" name="bamCorrelate" version="1.0.1">
-  <description>correlates pairs of BAM files</description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <command>
-    #import tempfile
-    #set $temp_dir = os.path.abspath(tempfile.mkdtemp())
+    <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=[]
-    #for $i in $inputs
+        #set files=[]
+        #set labels=[]
+        #for $i in $inputs
 
-        #set $temp_input_handle = tempfile.NamedTemporaryFile( dir=$temp_dir )
-        #set $temp_input_path = $temp_input_handle.name
-        #silent $temp_input_handle.close()
-        #silent os.system("ln -s %s %s.bam" % (str($i.bamfile), $temp_input_path))
-        #silent os.system("ln -s %s %s.bam.bai" % (str($i.bamfile.metadata.bam_index), $temp_input_path))
-        #silent $files.append('%s.bam' % $temp_input_path)
-
+            #set $temp_input_handle = tempfile.NamedTemporaryFile( dir=$temp_dir )
+            #set $temp_input_path = $temp_input_handle.name
+            #silent $temp_input_handle.close()
+            #silent os.system("ln -s %s %s.bam" % (str($i.bamfile), $temp_input_path))
+            #silent os.system("ln -s %s %s.bam.bai" % (str($i.bamfile.metadata.bam_index), $temp_input_path))
+            #silent $files.append('%s.bam' % $temp_input_path)
 
-        ##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
+            ##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
 
-  ##ToDo
-  --numberOfProcessors 4
+        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 $advancedOpt.showAdvancedOpt == "yes":
-        
-    #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
-  ; mv $newoutFileName $outFileName
-  ; rm $temp_dir -rf
-  </command>
+        --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 '$modenumberOfSamples'
+        #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
 
-  <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."/>
-    <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>
+            #if $mode.advancedOpt.zMin:
+                --zMin $mode.advancedOpt.zMin
+            #end if
+            #if $mode.advancedOpt.zMax:
+                --zMax $mode.advancedOpt.zMax
+            #end if
+            --colorMap '$mode.advancedOpt.colorMap'
 
-  <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>
+        #end if
 
-  <conditional name="advancedOpt">
-    <param name="showAdvancedOpt" type="select" label="Show advanced options" >
-      <option value="no" selected="true">no</option>
-      <option value="yes">yes</option>
+        ; 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>
-    <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."/>
+    <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="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="includeZeros" type="boolean" truevalue="--includeZeros" falsevalue=""
-       label ="Include zeros"
-       help  ="If set, then regions with zero counts for *all* BAM files given are included. The default behavior is to ignore those cases." />
+            <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>
 
-    </when>
-  </conditional>
+    </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>
+    <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>
+    </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**
 
@@ -159,19 +149,24 @@
 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
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
-
+@REFERENCES@
 
-.. _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
-
-
-  </help>
-  
+    </help>
 </tool>
--- a/bamCoverage.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/bamCoverage.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,16 +1,13 @@
 <tool id="deeptools_bamCoverage" name="bamCoverage" version="1.0">
-  <description> generates a coverage bigWig file from a given BAM file.  Multiple options are available to count reads and normalize coverage.</description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" version="0.1">ucsc_tools</requirement>
-    <requirement type="package" version="1.7.1">numpy</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <command>
-  bamCoverage
+    <description> generates a coverage bigWig file from a given BAM file.  Multiple options are available to count reads and normalize coverage. (bam2bigwig)</description>
+    <expand macro="requirements" />
+    <macros>
+        <import>deepTools_macros.xml</import>
+    </macros>
+    <command>
+        bamCoverage
 
-  ##ToDo
-  --numberOfProcessors 4
+    @THREADS@
 
   --bam '$bamInput'
   --bamIndex ${bamInput.metadata.bam_index}
@@ -135,19 +132,24 @@
 
 **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. Bins with zero counts are skipped, i.e. not added to the output file. The resulting read counts can be normalized using either a given scaling factor, the RPKM formula or to get a 1x depth of coverage (RPGC).
+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. Bins with zero counts are skipped, i.e. not added to the output file. 
+The resulting read counts can be normalized using either a given scaling factor, the RPKM formula or to get a 1x depth of coverage (RPGC).
+
+
+.. image:: $PATH_TO_IMAGES/norm_IGVsnapshot_indFiles.png
+
+
+**Output files**:
+
+- coverage file either in bigWig or bedGraph format
 
 -----
 
 .. class:: infomark
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
-
+@REFERENCES@
 
-.. _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
-
-</help>
+    </help>
 </tool>
--- a/bamFingerprint.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/bamFingerprint.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,138 +1,131 @@
 <tool id="deeptools_bamFingerprint" name="bamFingerprint" version="1.0">
-  <description>plots profiles of BAM files; useful for assesing ChIP signal strength</description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <command>
-    #import tempfile
-    #set $temp_dir = os.path.abspath(tempfile.mkdtemp())
+    <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=[]
-    #for $i in $inputs
-        #set $temp_input_handle = tempfile.NamedTemporaryFile( dir=$temp_dir )
-        #set $temp_input_path = $temp_input_handle.name
-        #silent $temp_input_handle.close()
-        #silent os.system("ln -s %s %s.bam" % (str($i.bamfile), $temp_input_path))
-        #silent os.system("ln -s %s %s.bam.bai" % (str($i.bamfile.metadata.bam_index), $temp_input_path))
-        #silent $files.append('%s.bam' % $temp_input_path)
+        #set files=[]
+        #set labels=[]
+        #for $i in $inputs
+            #set $temp_input_handle = tempfile.NamedTemporaryFile( dir=$temp_dir )
+            #set $temp_input_path = $temp_input_handle.name
+            #silent $temp_input_handle.close()
+            #silent os.system("ln -s %s %s.bam" % (str($i.bamfile), $temp_input_path))
+            #silent os.system("ln -s %s %s.bam.bai" % (str($i.bamfile.metadata.bam_index), $temp_input_path))
+            #silent $files.append('%s.bam' % $temp_input_path)
 
-        ##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
-
-  bamFingerprint
-
-  ##ToDo
-  --numberOfProcessors 4
+            ##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
 
-  --bamfiles #echo " ".join($files)
-  --labels #echo " ".join($labels)
+    bamFingerprint
 
-  --fragmentLength $fragmentLength
+        @THREADS@
 
-  #set newoutFileName=str($outFileName)+".png"
-  --plotFile $newoutFileName
+      --bamfiles #echo " ".join($files)
+      --labels #echo " ".join($labels)
 
-  #if $outputOpt.showOutputOpt == "yes"
-      #if $outputOpt.saveRawCounts:
-        --outRawCounts '$outFileRawCounts' 
-      #end if
-  #end if
+      --fragmentLength $fragmentLength
+
+      #set newoutFileName=str($outFileName)+".png"
+      --plotFile $newoutFileName
 
-  #if $advancedOpt.showAdvancedOpt == "yes":
-    
-    #if str($advancedOpt.region.value) != '':
-      --region '$advancedOpt.region'
-    #end if
-
-    --binSize '$advancedOpt.binSize'
-    --numberOfSamples '$advancedOpt.numberOfSamples'
+      #if $outputOpt.showOutputOpt == "yes"
+          #if $outputOpt.saveRawCounts:
+            --outRawCounts '$outFileRawCounts' 
+          #end if
+      #end if
 
-    $advancedOpt.doNotExtendPairedEnds
-    $advancedOpt.ignoreDuplicates
-    $advancedOpt.skipZeros
+      #if $advancedOpt.showAdvancedOpt == "yes":
+        
+        #if str($advancedOpt.region.value) != '':
+          --region '$advancedOpt.region'
+        #end if
 
-    #if $advancedOpt.minMappingQuality:
-      --minMappingQuality '$advancedOpt.minMappingQuality'
-    #end if
-  #end if
-  ; mv $newoutFileName $outFileName
-  ; rm $temp_dir -rf
-  </command>
+        --binSize '$advancedOpt.binSize'
+        --numberOfSamples '$advancedOpt.numberOfSamples'
+
+        $advancedOpt.doNotExtendPairedEnds
+        $advancedOpt.ignoreDuplicates
+        $advancedOpt.skipZeros
 
-  <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."/>
-    <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="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>
+        #if $advancedOpt.minMappingQuality:
+          --minMappingQuality '$advancedOpt.minMappingQuality'
+        #end if
+      #end if
+      ; mv $newoutFileName $outFileName
+      ; rm $temp_dir -rf
+    </command>
+
+    <inputs>
+        <expand macro="multiple_input_bams" />
 
-  <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>
+        <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**
 
@@ -145,18 +138,20 @@
 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
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
-
+@REFERENCES@
 
-.. _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
-
-  </help>
-  
+    </help>
 </tool>
--- a/bigwigCompare.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/bigwigCompare.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,90 +1,86 @@
 <tool id="deeptools_bigwigCompare" name="bigwigCompare" version="1.0">
-  <description>normalizes and compares two bigWig files to obtain the ratio, log2ratio or difference</description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" version="0.1">ucsc_tools</requirement>
-    <requirement type="package" version="1.7.1">numpy</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <command>
-  bigwigCompare
+    <description>normalizes and compares two bigWig files to obtain the ratio, log2ratio or difference</description>
+    <expand macro="requirements"/>
+    <macros>
+        <import>deepTools_macros.xml</import>
+    </macros>
+    <command>
+        bigwigCompare
 
-  ##ToDo
-  --numberOfProcessors 4
+        @THREADS@
 
-  --bigwig1 '$bigwigFile1'
-  --bigwig2 '$bigwigFile2'
+        --bigwig1 '$bigwigFile1'
+        --bigwig2 '$bigwigFile2'
+
+        --outFileName '$outFileName'
+        --outFileFormat '$outFileFormat'
 
-  --outFileName '$outFileName'
-  --outFileFormat '$outFileFormat'
-
-  --ratio $comparison_type
+        --ratio $comparison_type
 
-    #if $advancedOpt.showAdvancedOpt == "yes":
-      #if str($advancedOpt.region.value) != '':
-        --region '$advancedOpt.region'
-      #end if
+        #if $advancedOpt.showAdvancedOpt == "yes":
+          #if str($advancedOpt.region.value) != '':
+            --region '$advancedOpt.region'
+          #end if
 
-      --missingDataAsZero $advancedOpt.missingDataAsZero
-      --scaleFactors '$advancedOpt.scaleFactor1:$advancedOpt.scaleFactor2'
-      --pseudocount '$advancedOpt.pseudocount'
-      --binSize $advancedOpt.binSize
+          --missingDataAsZero $advancedOpt.missingDataAsZero
+          --scaleFactors '$advancedOpt.scaleFactor1:$advancedOpt.scaleFactor2'
+          --pseudocount '$advancedOpt.pseudocount'
+          --binSize $advancedOpt.binSize
 
-    #end if
-
-  </command>
-  <inputs>
-    <param name="bigwigFile1" format="bigwig" type="data" label="Treatment bigwig file" />
-    <param name="bigwigFile2" format="bigwig" type="data" label="Input bigwig file" />
+        #end if
+    </command>
+    <inputs>
+        <param name="bigwigFile1" format="bigwig" type="data" label="Treatment bigwig file" />
+        <param name="bigwigFile2" format="bigwig" type="data" label="Input bigwig file" />
 
-      <param name="comparison_type" type="select" 
-         label="How to compare the two files"
-         help="The reciprocal ratio returns the negative of the inverse of the ratio if the ratio is less than 0. The resulting values are interpreted as negative fold changes." >
-        <option value="log2" selected="true">log2 ratio</option>
-        <option value="ratio">simple ratio</option>
-        <option value="subtract">difference (subtract input from treatment)</option>
-        <option value="add">sum</option>
-        <option value="reciprocal_ratio">reciprocal ratio</option>
-      </param>
+        <param name="comparison_type" type="select" 
+                label="How to compare the two files"
+                help="The reciprocal ratio returns the negative of the inverse of the ratio if the ratio is less than 0. The resulting values are interpreted as negative fold changes." >
+            <option value="log2" selected="true">log2 ratio</option>
+            <option value="ratio">simple ratio</option>
+            <option value="subtract">difference (subtract input from treatment)</option>
+            <option value="add">sum</option>
+            <option value="reciprocal_ratio">reciprocal ratio</option>
+        </param>
 
-    <param name="outFileFormat" type="select" label="Coverage file format">
-        <option value="bigwig" selected="true">bigwig</option>
-        <option value="bedgraph">bedgraph</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 name="outFileFormat" type="select" label="Coverage file format">
+            <option value="bigwig" selected="true">bigwig</option>
+            <option value="bedgraph">bedgraph</option>
         </param>
-        <when value="no" />
-        <when value="yes">
-            <param name="binSize" type="integer" value="50" min="1" 
-                label="Bin size in bp"
-                help="Size of the bins in bp for the ouput of the bigwig/bedgraph file "/>
 
-            <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;" />
+        <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="binSize" type="integer" value="50" min="1" 
+                    label="Bin size in bp"
+                    help="Size of the bins in bp for the ouput of the bigwig/bedgraph file "/>
 
-            <param name="missingDataAsZero" type="boolean" truevalue="yes" falsevalue="no" checked="True"
-                label ="Treat missing data as zero"
-                help  ="This parameter determines if missing data should be replaced with a zero. If set to &quot;no&quot;, missing data will be ignored and will not be included in the output file at all. Missing data is defined as those regions for which no value exists in *any* of the bigwig files. The decision to include or exclude missing data depends on the interpretation of the data. Missing data in a bigwig file may mean that there is no information available for certain regions, for example a repetitive region that is not being considered. In the same file regions with low coverage may get zero read counts. If missing data is replaced by zero, this would convert the excluded repetitive regions into regions of low coverage." />
+                <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="scaleFactor1" type="float" value="1" label="Scale factor for treatment"/>
-            <param name="scaleFactor2" type="float" value="1" label="Scale factor for input"/>
-            <param name="pseudocount" type="float" value="1" label="Pseudocount" help="Small number to avoid dividing by zero."/>
-        </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>
+                <param name="missingDataAsZero" type="boolean" truevalue="yes" falsevalue="no" checked="True"
+                    label ="Treat missing data as zero"
+                    help  ="This parameter determines if missing data should be replaced with a zero. If set to &quot;no&quot;, missing data will be ignored and will not be included in the output file at all. Missing data is defined as those regions for which no value exists in *any* of the bigwig files. The decision to include or exclude missing data depends on the interpretation of the data. Missing data in a bigwig file may mean that there is no information available for certain regions, for example a repetitive region that is not being considered. In the same file regions with low coverage may get zero read counts. If missing data is replaced by zero, this would convert the excluded repetitive regions into regions of low coverage." />
+
+                <param name="scaleFactor1" type="float" value="1" label="Scale factor for treatment"/>
+                <param name="scaleFactor2" type="float" value="1" label="Scale factor for input"/>
+                <param name="pseudocount" type="float" value="1" label="Pseudocount" help="Small number to avoid dividing by zero."/>
+            </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>
 
   <help>
 
@@ -100,14 +96,7 @@
 
 .. class:: infomark
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
-
+@REFERENCES@
 
-.. _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
-
-  </help>
-  
+    </help>
 </tool>
--- a/computeGCBias.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/computeGCBias.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,16 +1,15 @@
 <tool id="deeptools_computeGCBias" name="computeGCBias" version="1.0.1">
-  <description>to see whether your samples should be normalized for GC bias</description>
-  
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <stdio>
-    <exit_code range="0" level="warning" description="Warning" />
-  </stdio>
-  <command>
-    #import tempfile
-    #set $temp_dir = os.path.abspath(tempfile.mkdtemp())
+    <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'
@@ -20,26 +19,27 @@
 
   computeGCBias
 
-  ##ToDo
-  --numberOfProcessors 4
+    @THREADS@
 
   --bamfile '$temp_bam_path'
-  --species '$species'
   --GCbiasFrequenciesFile $outFileName
   --fragmentLength $fragmentLength
 
-  #if $source.ref_source=="history":
-    --genome $source.input1
+    @reference_genome_source@
+
+
+  #if $effectiveGenomeSize.effectiveGenomeSize_opt == "specific":
+    --effectiveGenomeSize $effectiveGenomeSize.effectiveGenomeSize
   #else:
-    --genome "${source.input1_2bit.fields.path}"
+    --effectiveGenomeSize $effectiveGenomeSize.effectiveGenomeSize_opt
   #end if
 
+
   #if $advancedOpt.showAdvancedOpt == "yes":
     #if str($advancedOpt.region.value) != '':
       --region '$advancedOpt.region'
     #end if
     
-    --binSize '$advancedOpt.binSize'
     --sampleSize '$advancedOpt.sampleSize'
     --regionSize '$advancedOpt.regionSize'
 
@@ -66,34 +66,15 @@
 
   ; rm $temp_dir -rf
 
-  </command>
-  <inputs>
-
-      <param name="bamInput" format="bam" type="data" label="Input BAM file"
-        help="The BAM file must be sorted."/>
-      <!--<param name="species" type="text" value="" label="Species name abbreviation" />-->
-
-        <param name="species" type="select" label="Species name abbreviation">
-            <option value="hg19">hg19</option>
-            <option value="ce10">ce10</option>
-            <option value="dm3">dm3</option>
-            <option value="mm9">mm9</option>
-        </param>
+    </command>
+    <inputs>
 
-      <conditional name="source">
-        <param name="ref_source" type="select" label="Reference genome">
-            <option value="cached">locally cached</option>
-            <option value="history">in your history</option>
-        </param>
-        <when value="cached">
-            <param name="input1_2bit" type="select" label="Using reference genome" help="If your genome of interest is not listed, contact the Galaxy team">
-                <options from_data_table="deepTools_seqs" />
-            </param>
-        </when>
-        <when value="history">
-            <param name="input1" type="data" format="twobit" label="Select a reference dataset in 2bit format" />
-        </when>
-      </conditional>
+        <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."/>
@@ -108,10 +89,6 @@
           <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="50" min="1" 
-             label="Bin size in bp"
-             help="Size of the bins in bp for the ouput of the bigwig/bedgraph file."/>
              
            <param name="sampleSize" type="integer" value="50000000" min="1"
              label="Number of sampling points to be considered" />
@@ -171,16 +148,26 @@
 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
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
+@REFERENCES@
 
-.. _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
-
-  </help>
+    </help>
 </tool>
--- a/computeMatrix.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/computeMatrix.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,11 +1,11 @@
 <tool id="deeptools_computeMatrix" name="computeMatrix" version="1.0">
-  <description>summarizes and prepares an intermediary file containing scores associated with genomic regions that can be used afterwards to plot a heatmap or a profile</description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <command>
-    #import tempfile
+    <description>summarizes and prepares an intermediary file containing scores associated with genomic regions that can be used afterwards to plot a heatmap or a profile</description>
+    <expand macro="requirements" />
+    <macros>
+        <import>deepTools_macros.xml</import>
+    </macros>
+    <command>
+        #import tempfile
 
     #set $temp_input_handle = tempfile.NamedTemporaryFile()
     #set $temp_input_path = $temp_input_handle.name
@@ -28,7 +28,7 @@
   --scoreFileName '$scoreFile'
   --outFileName '$outFileName'
 
-  --numberOfProcessors 4
+    @THREADS@
 
   #if $output.showOutputSettings == "yes"
       #if $output.saveData:
@@ -208,19 +208,28 @@
         </test>
     </tests>
   <help>
+
 **What it does**
 
-This tool summarizes and prepares an intermediary file containing scores associated with genomic regions that can be used afterwards to plot a heatmap or a profile. Typically, these genomic regions are genes, but any other regions defined in a BED or INTERVAL format can be used. This tool can also be used to filter and sort regions according to their score.
+This tool summarizes and prepares an intermediary file
+containing scores associated with genomic regions that can be used
+afterwards to plot a heatmap or a profile.
+
+Genomic regions can really be anything - genes, parts of genes, ChIP-seq
+peaks, favorite genome regions... as long as you provide a proper file
+in BED or INTERVAL format. This tool can also be used to filter and sort
+regions according to their score.
+
+
+.. image:: $PATH_TO_IMAGES/flowChart_computeMatrixetc.png
+   :alt: Relationship between computeMatrix, heatmapper and profiler
+
 
 -----
 
 .. class:: infomark
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
+@REFERENCES@
 
-.. _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
-  </help>
+    </help>
 </tool>
--- a/correctGCBias.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/correctGCBias.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,10 +1,9 @@
 <tool id="deeptools_correctGCBias" name="correctGCBias" version="1.0.1">
-  <description>uses the output from computeGCBias to generate corrected BAM files</description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" version="0.1">ucsc_tools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
+    <description>uses the output from computeGCBias to generate corrected BAM files</description>
+    <expand macro="requirements" />
+    <macros>
+        <import>deepTools_macros.xml</import>
+    </macros>
   <command>
     #import tempfile
     #set $temp_dir = os.path.abspath(tempfile.mkdtemp())
@@ -18,15 +17,18 @@
 
   correctGCBias
   --bamfile '$temp_bam_path'
-  --species '$species'
   --GCbiasFrequenciesFile $GCbiasFrequenciesFile
-  
-  #if $source.ref_source=="history":
-    --genome $source.input1
+
+    @reference_genome_source@
+
+
+  #if $effectiveGenomeSize.effectiveGenomeSize_opt == "specific":
+    --effectiveGenomeSize $effectiveGenomeSize.effectiveGenomeSize
   #else:
-    --genome "${source.input1_2bit.fields.path}"
+    --effectiveGenomeSize $effectiveGenomeSize.effectiveGenomeSize_opt
   #end if
-  
+
+
   #if $advancedOpt.showAdvancedOpt == "yes":
     #if str($advancedOpt.region.value) != '':
       --region '$advancedOpt.region'
@@ -47,28 +49,9 @@
 
   <param name="bamInput" format="bam" type="data" label="Input BAM file" help="This should be same file that was used for computeGCbias. The BAM file must be sorted."/>
 
-  <param name="species" type="select" label="Species name abbreviation">
-    <option value="hg19">hg19</option>
-    <option value="ce10">ce10</option>
-    <option value="dm3">dm3</option>
-    <option value="mm9">mm9</option>
-  </param>
+        <expand macro="reference_genome_source" />
+        <expand macro="effectiveGenomeSize" />
 
-  <conditional name="source">
-    <param name="ref_source" type="select" label="Reference genome">
-        <option value="cached">locally cached</option>
-        <option value="history">in your history</option>
-    </param>
-    <when value="cached">
-        <param name="input1_2bit" type="select" label="Using reference genome" help="If your genome of interest is not listed, contact your Galaxy team">
-            <options from_data_table="deepTools_seqs" />
-        </param>
-    </when>
-    <when value="history">
-        <param name="input1" type="data" format="twobit" label="Select a reference dataset in 2bit format" />
-    </when>
-  </conditional>
-     
   <param name="outFileFormat" type="select" label="File format of the output">
     <option value="bam">bam</option>
     <option value="bw">bigwig</option>
@@ -108,19 +91,16 @@
 
 This tool requires the output from computeGCBias to correct the given BAM files according to the method proposed by Benjamini and Speed (2012). Nucleic Acids Res.
 The resulting BAM files can be used in any downstream analyses, but be aware that you should not filter out duplicates from here on.
+
+**Output files**:
+
+- GC-normalized BAM file
+
 -----
 
 .. class:: infomark
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
-
+@REFERENCES@
 
-.. _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
-
-
-  </help>
-  
+    </help>
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deepTools_macros.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -0,0 +1,288 @@
+<macros>
+    <macro name="bamCorrelate_mode_actions">
+        <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="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="includeZeros" type="boolean" truevalue="--includeZeros" falsevalue=""
+                    label ="Include zeros"
+                    help  ="If set, then regions with zero counts for *all* BAM files given are included. The default behavior is to ignore those cases." />
+
+                <param name="zMin" type="integer" value="" label="Minimum value for the heatmap intensities"
+                    help="If not specified the value is set automatically."/>
+
+                <param name="zMax" type="integer" value="" label="Maximum value for the heatmap intensities"
+                    help="If not specified the value is set automatically."/>
+
+                <expand macro="colormap" />
+            </when>
+        </conditional>
+    </macro>
+    <token name="@THREADS@">--numberOfProcessors "\${GALAXY_SLOTS:-4}"</token>
+    <macro name="requirements">
+        <requirements>
+            <requirement type="package" version="1.5.1_91b873c095bb4ca44da99e57d8b49784508aa98b">deepTools</requirement>
+            <requirement type="package" version="0.1">ucsc_tools</requirement>
+            <requirement type="package" version="1.7.1">numpy</requirement>
+            <requirement type="package" >deepTools</requirement>
+            <requirement type="package" >ucsc_tools</requirement>
+            <yield />
+        </requirements>
+        </macro>
+
+    <token name="@REFERENCES@">
+
+For more informations, please visit our `project site`_.
+
+If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
+
+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
+.. _project site: https://github.com/fidelram/deepTools
+
+    </token>
+
+    <macro name="multiple_input_bams">
+        <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."/>
+            <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>
+    </macro>
+
+    <macro name="reference_genome_source">
+        <conditional name="source">
+            <param name="ref_source" type="select" label="Reference genome">
+                <option value="cached">locally cached</option>
+                <option value="history">in your history</option>
+            </param>
+            <when value="cached">
+                <param name="input1_2bit" type="select" label="Using reference genome" help="If your genome of interest is not listed, contact the Galaxy team">
+                    <options from_data_table="deepTools_seqs" />
+                </param>
+            </when>
+            <when value="history">
+                <param name="input1" type="data" format="twobit" label="Select a reference dataset in 2bit format" />
+            </when>
+        </conditional>
+    </macro>
+
+    <token name="@reference_genome_source@">
+    #if $source.ref_source=="history":
+        --genome $source.input1
+    #else:
+        --genome "${source.input1_2bit.fields.path}"
+    #end if
+    </token>
+
+    <macro name="effectiveGenomeSize">
+        <conditional name="effectiveGenomeSize">
+            <param name="effectiveGenomeSize_opt" type="select" label="Effective genome size"
+                help="The effective genome size is the portion of the genome that is mappable. Large fractions of the genome are stretches of NNNN that should be discarded. 
+                    Also, if repetitive regions were not included in the mapping of reads, the effective genome size needs to be adjusted accordingly. 
+                    See Table 2 of http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0030377 or http://www.nature.com/nbt/journal/v27/n1/fig_tab/nbt.1518_T1.html for several effective genome sizes.">
+                <option value="2150570000">mm9</option>
+                <option value="2451960000">hg19</option>
+                <option value="121400000">dm3</option>
+                <option value="93260000">ce10</option>
+                <option value="specific">user specified</option>
+            </param>
+            <when value="specific">
+                <param name="effectiveGenomeSize" type="integer" value="" label="Effective genome size" />
+            </when>
+        </conditional>
+    </macro>
+
+    <macro name="graphic_output_settings">
+        <conditional name="output" >
+            <param name="showOutputSettings" type="select" label="Show advanced output settings" >
+                <option value="no" selected="true">no</option>
+                <option value="yes">yes</option>
+            </param>
+            <when value="no" />
+            <when value="yes">
+                <param name="outFileFormat" type="select" label="Image file format">
+                    <option value="png" selected="true">png</option>
+                    <option value="pdf">pdf</option>
+                    <option value="svg">svg</option>
+                    <option value="eps">eps</option>
+                    <option value="emf">emf</option>
+                </param>
+                <param name="saveData" type="boolean" label="Save the data underlying data for the average profile"/>
+                <param name="saveMatrix" type="boolean" label="Save the the matrix of values underlying the heatmap"/>
+                <param name="saveSortedRegions" type="boolean" label="Save the regions after skipping zeros or min/max threshold values" help="The order of the regions in the file follows the sorting order selected. This is useful, for example, to generate other heatmaps keeping the sorting of the first heatmap."/>
+            </when>
+        </conditional>
+    </macro>
+
+    <macro name="colormap">
+
+        <param name="colorMap" type="select" label="Color map to use for the heatmap" help=" Available color map names can be found here: http://www.astro.lsa.umich.edu/~msshin/science/code/matplotlib_cm/">
+            <option value="RdYlBu" selected="true">RdYlBu</option>
+            <option value="Accent">Accent</option>
+            <option value="Spectral">Spectral</option>
+            <option value="Set1">Set1</option>
+            <option value="Set2">Set2</option>
+            <option value="Set3">Set3</option>
+            <option value="Dark2">Dark2</option>
+            <option value="Reds">Reds</option>
+            <option value="Oranges">Oranges</option>
+            <option value="Greens">Greens</option>
+            <option value="Blues">Blues</option>
+            <option value="Greys">Greys</option>
+            <option value="Purples">Purples</option>
+            <option value="Paired">Paired</option>
+            <option value="Pastel1">Pastel1</option>
+            <option value="Pastel2">Pastel2</option>
+            <option value="spring">spring</option>
+            <option value="summer">summer</option>
+            <option value="autumn">autumn</option>
+            <option value="winter">winter</option>
+            <option value="hot">hot</option>
+            <option value="coolwarm">coolwarm</option>
+            <option value="cool">cool</option>
+            <option value="seismic">seismic</option>
+            <option value="terrain">terrain</option>
+            <option value="ocean">ocean</option>
+            <option value="rainbow">rainbow</option>
+            <option value="bone">bone</option>
+            <option value="flag">flag</option>
+            <option value="prism">prism</option>
+            <option value="cubehelix">cubehelix</option>
+            <option value="binary">binary</option>
+            <option value="pink">pink</option>
+            <option value="gray">gray</option>
+            <option value="copper">copper</option>
+            <option value="BrBG">BrBG</option>
+            <option value="BuGn">BuGn</option>
+            <option value="BuPu">BuPu</option>
+            <option value="GnBu">GnBu</option>
+            <option value="OrRd">OrRd</option>
+            <option value="PiYG">PiYG</option>
+            <option value="PRGn">PRGn</option>
+            <option value="PuOr">PuOr</option>
+            <option value="PuRd">PuRd</option>
+            <option value="PuBu">PuBu</option>
+            <option value="RdBu">RdBu</option>
+            <option value="RdGy">RdGy</option>
+            <option value="RdPu">RdPu</option>
+            <option value="YlGn">YlGn</option>
+            <option value="PuBuGn">PuBuGn</option>
+            <option value="RdYlGn">RdYlGn</option>
+            <option value="YlGnBu">YlGnBu</option>
+            <option value="YlOrBr">YlOrBr</option>
+            <option value="YlOrRd">YlOrRd</option>
+            <option value="gist_gray">gist_gray</option>
+            <option value="gist_stern">gist_stern</option>
+            <option value="gist_earth">gist_earth</option>
+            <option value="gist_yarg">gist_yarg</option>
+            <option value="gist_ncar">gist_ncar</option>
+            <option value="gist_rainbow">gist_rainbow</option>
+            <option value="gist_heat">gist_heat</option>
+            <option value="gnuplot">gnuplot</option>
+            <option value="gnuplot2">gnuplot2</option>
+            <option value="CMRmap">CMRmap</option>
+            <option value="bwr">bwr</option>
+            <option value="hsv">hsv</option>
+            <option value="brg">brg</option>
+            <option value="jet">jet</option>
+            <option value="afmhot">afmhot</option>
+            <option value="Accent_r">Accent reversed</option>
+            <option value="Spectral_r">Spectral reversed</option>
+            <option value="Set1_r">Set1 reversed</option>
+            <option value="Set2_r">Set2 reversed</option>
+            <option value="Set3_r">Set3 reversed</option>
+            <option value="Dark2_r">Dark2 reversed</option>
+            <option value="Reds_r">Reds reversed</option>
+            <option value="Oranges_r">Oranges reversed</option>
+            <option value="Greens_r">Greens reversed</option>
+            <option value="Blues_r">Blues reversed</option>
+            <option value="Greys_r">Greys reversed</option>
+            <option value="Purples_r">Purples reversed</option>
+            <option value="Paired_r">Paired reversed</option>
+            <option value="Pastel1_r">Pastel1 reversed</option>
+            <option value="Pastel2_r">Pastel2 reversed</option>
+            <option value="spring_r">spring reversed</option>
+            <option value="summer_r">summer reversed</option>
+            <option value="autumn_r">autumn reversed</option>
+            <option value="winter_r">winter reversed</option>
+            <option value="hot_r">hot reversed</option>
+            <option value="coolwarm_r">coolwarm reversed</option>
+            <option value="cool_r">cool reversed</option>
+            <option value="seismic_r">seismic reversed</option>
+            <option value="terrain_r">terrain reversed</option>
+            <option value="ocean_r">ocean reversed</option>
+            <option value="rainbow_r">rainbow reversed</option>
+            <option value="bone_r">bone reversed</option>
+            <option value="flag_r">flag reversed</option>
+            <option value="prism_r">prism reversed</option>
+            <option value="cubehelix_r">cubehelix reversed</option>
+            <option value="binary_r">binary reversed</option>
+            <option value="pink_r">pink reversed</option>
+            <option value="gray_r">gray reversed</option>
+            <option value="copper_r">copper reversed</option>
+            <option value="BrBG_r">BrBG reversed</option>
+            <option value="BuGn_r">BuGn reversed</option>
+            <option value="BuPu_r">BuPu reversed</option>
+            <option value="GnBu_r">GnBu reversed</option>
+            <option value="OrRd_r">OrRd reversed</option>
+            <option value="PiYG_r">PiYG reversed</option>
+            <option value="PRGn_r">PRGn reversed</option>
+            <option value="PuOr_r">PuOr reversed</option>
+            <option value="PuRd_r">PuRd reversed</option>
+            <option value="PuBu_r">PuBu reversed</option>
+            <option value="RdBu_r">RdBu reversed</option>
+            <option value="RdGy_r">RdGy reversed</option>
+            <option value="RdPu_r">RdPu reversed</option>
+            <option value="YlGn_r">YlGn reversed</option>
+            <option value="PuBuGn_r">PuBuGn reversed</option>
+            <option value="RdYlBu_r">RdYlBu reversed</option>
+            <option value="RdYlGn_r">RdYlGn reversed</option>
+            <option value="YlGnBu_r">YlGnBu reversed</option>
+            <option value="YlOrBr_r">YlOrBr reversed</option>
+            <option value="YlOrRd_r">YlOrRd reversed</option>
+            <option value="gist_gray_r">gist_gray reversed</option>
+            <option value="gist_stern_r">gist_stern reversed</option>
+            <option value="gist_earth_r">gist_earth reversed</option>
+            <option value="gist_yarg_r">gist_yarg reversed</option>
+            <option value="gist_ncar_r">gist_ncar reversed</option>
+            <option value="gist_rainbow_r">gist_rainbow reversed</option>
+            <option value="gist_heat_r">gist_heat reversed</option>
+            <option value="gnuplot_r">gnuplot reversed</option>
+            <option value="gnuplot2_r">gnuplot2 reversed</option>
+            <option value="CMRmap_r">CMRmap reversed</option>
+            <option value="bwr_r">bwr reversed</option>
+            <option value="hsv_r">hsv reversed</option>
+            <option value="brg_r">brg reversed</option>
+            <option value="jet_r">jet reversed</option>
+            <option value="afmhot_r">afmhot reversed</option>
+        </param>
+
+    </macro>
+
+</macros>
--- a/heatmapper.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/heatmapper.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,16 +1,14 @@
 <tool id="deeptools_heatmapper" name="heatmapper" version="1.0">
-  <description>creates a heatmap for a score associated to genomic regions</description>
-
-  <requirements>
-    <requirement type="package" version="0.1.18">samtools</requirement>
-    <requirement type="package" version="1.7.1">numpy</requirement>
-    <requirement type="package" version="1.2.1">matplotlib</requirement>
-    <requirement type="package" version="0.12.0">scipy</requirement>
-    <requirement type="package" version="0.1">ucsc_tools</requirement>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-
+    <description>creates a heatmap for a score associated to genomic regions</description>
+    <expand macro="requirements">
+        <requirement type="package" version="0.1.18">samtools</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+        <requirement type="package" version="1.2.1">matplotlib</requirement>
+        <requirement type="package" version="0.12.0">scipy</requirement>
+    </expand>
+    <macros>
+        <import>deepTools_macros.xml</import>
+    </macros>
   <command>
   heatmapper
 
@@ -91,25 +89,8 @@
   </command>
   <inputs>
     <param name="matrixFile" format="bgzip" type="data" label="Matrix file from the computeMatrix tool"/>
-    <conditional name="output" >
-        <param name="showOutputSettings" type="select" label="Show advanced output settings" >
-        <option value="no" selected="true">no</option>
-        <option value="yes">yes</option>
-      </param>
-      <when value="no" />
-      <when value="yes">
-        <param name="outFileFormat" type="select" label="Image file format">
-            <option value="png" selected="true">png</option>
-            <option value="pdf">pdf</option>
-            <option value="svg">svg</option>
-            <option value="eps">eps</option>
-            <option value="emf">emf</option>
-        </param>
-        <param name="saveData" type="boolean" label="Save the data underlying data for the average profile"/>
-        <param name="saveMatrix" type="boolean" label="Save the the matrix of values underlying the heatmap"/>
-        <param name="saveSortedRegions" type="boolean" label="Save the regions after skipping zeros or min/max threshold values" help="The order of the regions in the file follows the sorting order selected. This is useful, for example, to generate other heatmaps keeping the sorting of the first heatmap."/>
-    </when>
-    </conditional>
+
+    <expand macro="graphic_output_settings" />
 
     <conditional name="advancedOpt" >
       <param name="showAdvancedOpt" type="select" label="Show advanced options" >
@@ -145,146 +126,7 @@
 
         <param name="missingDataColor" type="text" label="Missing data color" value="black" optional="true" help="If 'Represent missing data as zero' is not set, such cases will be colored in black by default. By using this parameter a different color can be set. A value between 0 and 1 will be used for a gray scale (black is 0). Also color names can be used, see a list here: http://packages.python.org/ete2/reference/reference_svgcolors.html. Alternatively colors can be specified using the #rrggbb notation." />
 
-        <param name="colorMap" type="select" label="Color map to use for the heatmap" help=" Available color map names can be found here: http://www.astro.lsa.umich.edu/~msshin/science/code/matplotlib_cm/">
-            <option value="RdYlBu" selected="true">RdYlBu</option>
-            <option value="Accent">Accent</option>
-            <option value="Spectral">Spectral</option>
-            <option value="Set1">Set1</option>
-            <option value="Set2">Set2</option>
-            <option value="Set3">Set3</option>
-            <option value="Dark2">Dark2</option>
-            <option value="Reds">Reds</option>
-            <option value="Oranges">Oranges</option>
-            <option value="Greens">Greens</option>
-            <option value="Blues">Blues</option>
-            <option value="Greys">Greys</option>
-            <option value="Purples">Purples</option>
-            <option value="Paired">Paired</option>
-            <option value="Pastel1">Pastel1</option>
-            <option value="Pastel2">Pastel2</option>
-            <option value="spring">spring</option>
-            <option value="summer">summer</option>
-            <option value="autumn">autumn</option>
-            <option value="winter">winter</option>
-            <option value="hot">hot</option>
-            <option value="coolwarm">coolwarm</option>
-            <option value="cool">cool</option>
-            <option value="seismic">seismic</option>
-            <option value="terrain">terrain</option>
-            <option value="ocean">ocean</option>
-            <option value="rainbow">rainbow</option>
-            <option value="bone">bone</option>
-            <option value="flag">flag</option>
-            <option value="prism">prism</option>
-            <option value="cubehelix">cubehelix</option>
-            <option value="binary">binary</option>
-            <option value="pink">pink</option>
-            <option value="gray">gray</option>
-            <option value="copper">copper</option>
-            <option value="BrBG">BrBG</option>
-            <option value="BuGn">BuGn</option>
-            <option value="BuPu">BuPu</option>
-            <option value="GnBu">GnBu</option>
-            <option value="OrRd">OrRd</option>
-            <option value="PiYG">PiYG</option>
-            <option value="PRGn">PRGn</option>
-            <option value="PuOr">PuOr</option>
-            <option value="PuRd">PuRd</option>
-            <option value="PuBu">PuBu</option>
-            <option value="RdBu">RdBu</option>
-            <option value="RdGy">RdGy</option>
-            <option value="RdPu">RdPu</option>
-            <option value="YlGn">YlGn</option>
-            <option value="PuBuGn">PuBuGn</option>
-            <option value="RdYlGn">RdYlGn</option>
-            <option value="YlGnBu">YlGnBu</option>
-            <option value="YlOrBr">YlOrBr</option>
-            <option value="YlOrRd">YlOrRd</option>
-            <option value="gist_gray">gist_gray</option>
-            <option value="gist_stern">gist_stern</option>
-            <option value="gist_earth">gist_earth</option>
-            <option value="gist_yarg">gist_yarg</option>
-            <option value="gist_ncar">gist_ncar</option>
-            <option value="gist_rainbow">gist_rainbow</option>
-            <option value="gist_heat">gist_heat</option>
-            <option value="gnuplot">gnuplot</option>
-            <option value="gnuplot2">gnuplot2</option>
-            <option value="CMRmap">CMRmap</option>
-            <option value="bwr">bwr</option>
-            <option value="hsv">hsv</option>
-            <option value="brg">brg</option>
-            <option value="jet">jet</option>
-            <option value="afmhot">afmhot</option>
-            <option value="Accent_r">Accent reversed</option>
-            <option value="Spectral_r">Spectral reversed</option>
-            <option value="Set1_r">Set1 reversed</option>
-            <option value="Set2_r">Set2 reversed</option>
-            <option value="Set3_r">Set3 reversed</option>
-            <option value="Dark2_r">Dark2 reversed</option>
-            <option value="Reds_r">Reds reversed</option>
-            <option value="Oranges_r">Oranges reversed</option>
-            <option value="Greens_r">Greens reversed</option>
-            <option value="Blues_r">Blues reversed</option>
-            <option value="Greys_r">Greys reversed</option>
-            <option value="Purples_r">Purples reversed</option>
-            <option value="Paired_r">Paired reversed</option>
-            <option value="Pastel1_r">Pastel1 reversed</option>
-            <option value="Pastel2_r">Pastel2 reversed</option>
-            <option value="spring_r">spring reversed</option>
-            <option value="summer_r">summer reversed</option>
-            <option value="autumn_r">autumn reversed</option>
-            <option value="winter_r">winter reversed</option>
-            <option value="hot_r">hot reversed</option>
-            <option value="coolwarm_r">coolwarm reversed</option>
-            <option value="cool_r">cool reversed</option>
-            <option value="seismic_r">seismic reversed</option>
-            <option value="terrain_r">terrain reversed</option>
-            <option value="ocean_r">ocean reversed</option>
-            <option value="rainbow_r">rainbow reversed</option>
-            <option value="bone_r">bone reversed</option>
-            <option value="flag_r">flag reversed</option>
-            <option value="prism_r">prism reversed</option>
-            <option value="cubehelix_r">cubehelix reversed</option>
-            <option value="binary_r">binary reversed</option>
-            <option value="pink_r">pink reversed</option>
-            <option value="gray_r">gray reversed</option>
-            <option value="copper_r">copper reversed</option>
-            <option value="BrBG_r">BrBG reversed</option>
-            <option value="BuGn_r">BuGn reversed</option>
-            <option value="BuPu_r">BuPu reversed</option>
-            <option value="GnBu_r">GnBu reversed</option>
-            <option value="OrRd_r">OrRd reversed</option>
-            <option value="PiYG_r">PiYG reversed</option>
-            <option value="PRGn_r">PRGn reversed</option>
-            <option value="PuOr_r">PuOr reversed</option>
-            <option value="PuRd_r">PuRd reversed</option>
-            <option value="PuBu_r">PuBu reversed</option>
-            <option value="RdBu_r">RdBu reversed</option>
-            <option value="RdGy_r">RdGy reversed</option>
-            <option value="RdPu_r">RdPu reversed</option>
-            <option value="YlGn_r">YlGn reversed</option>
-            <option value="PuBuGn_r">PuBuGn reversed</option>
-            <option value="RdYlBu_r">RdYlBu reversed</option>
-            <option value="RdYlGn_r">RdYlGn reversed</option>
-            <option value="YlGnBu_r">YlGnBu reversed</option>
-            <option value="YlOrBr_r">YlOrBr reversed</option>
-            <option value="YlOrRd_r">YlOrRd reversed</option>
-            <option value="gist_gray_r">gist_gray reversed</option>
-            <option value="gist_stern_r">gist_stern reversed</option>
-            <option value="gist_earth_r">gist_earth reversed</option>
-            <option value="gist_yarg_r">gist_yarg reversed</option>
-            <option value="gist_ncar_r">gist_ncar reversed</option>
-            <option value="gist_rainbow_r">gist_rainbow reversed</option>
-            <option value="gist_heat_r">gist_heat reversed</option>
-            <option value="gnuplot_r">gnuplot reversed</option>
-            <option value="gnuplot2_r">gnuplot2 reversed</option>
-            <option value="CMRmap_r">CMRmap reversed</option>
-            <option value="bwr_r">bwr reversed</option>
-            <option value="hsv_r">hsv reversed</option>
-            <option value="brg_r">brg reversed</option>
-            <option value="jet_r">jet reversed</option>
-            <option value="afmhot_r">afmhot reversed</option>
-        </param>
+        <expand macro="colormap" />
 
         <param name="zMin" type="float" value="" size="3" label="Minimum value for the heatmap intensities. Leave empty for automatic values" optional="true"/>
         <param name="zMax" type="float" value="" size="3" label="Maximum value for the heatmap intensities. Leave empty for automatic values" optional="true"/>
@@ -348,19 +190,24 @@
 
 **What it does**
 
-The heatmapper visualizes scores associated with genomic regions, for example ChIP enrichment values around the TSS of genes. Those values can be visualized individually along each of the regions provided by the user in INTERVAL or BED format. In addition to the heatmap, an average profile plot is plotted on top of the heatmap (can be turned off by the user; it can also be generated separately by the tool profiler). We implemented vast optional parameters and we encourage you to play around with the min/max values displayed in the heatmap as well as with the different coloring options. If you would like to plot heatmaps for different groups of genomic regions individually, e.g. one plot per chromosome, simply supply each group as an individual BED file.
+The heatmapper visualizes scores associated with genomic regions, for example ChIP enrichment values around the TSS of genes. 
+Those values can be visualized individually along each of the regions provided by the user in INTERVAL or BED format. 
+In addition to the heatmap, an average profile plot is plotted on top of the heatmap (can be turned off by the user; 
+it can also be generated separately by the tool profiler). 
+We implemented vast optional parameters and we encourage you to play around with the min/max values displayed in the heatmap as well as 
+with the different coloring options. If you would like to plot heatmaps for different groups of genomic regions individually, 
+e.g. one plot per chromosome, simply supply each group as an individual BED file.
+
+
+.. image:: $PATH_TO_IMAGES/visual_hm_DmelPolII.png
+   :alt: Heatmap of RNA Polymerase II ChIP-seq
+
 
 -----
 
 .. class:: infomark
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
-
+@REFERENCES@
 
-.. _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
-
-  </help>
+    </help>
 </tool>
--- a/profiler.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/profiler.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,182 +1,166 @@
 <tool id="deeptools_profiler" name="profiler" version="1.0">
-  <description>
-    creates a profile plot for a score associated to genomic regions
-  </description>
-  <requirements>
-    <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement>
-    <requirement type="package" >deepTools</requirement>
-  </requirements>
-  <command>
-  profiler
+    <description>
+        creates a profile plot for a score associated to genomic regions
+    </description>
+    <expand macro="requirements" />
+    <macros>
+        <import>deepTools_macros.xml</import>
+    </macros>
+    <command>
+        profiler
 
-  --matrixFile $matrixFile
+        --matrixFile $matrixFile
+
+        #if $output.showOutputSettings == "yes"
+            #set newoutFileName = str($outFileName)+"."+str($output.outFileFormat)
+            --outFileName $newoutFileName
 
-  #if $output.showOutputSettings == "yes"
-      #set newoutFileName = str($outFileName)+"."+str($output.outFileFormat)
-      --outFileName $newoutFileName
-      #if $output.saveData:
-        --outFileNameData '$outFileNameData' 
-      #end if
+            #if $output.saveData:
+                --outFileNameData '$outFileNameData' 
+            #end if
 
-      #if $output.saveMatrix:
-      --outFileNameMatrix '$outFileNameMatrix'
-      #end if
+            #if $output.saveMatrix:
+                --outFileNameMatrix '$outFileNameMatrix'
+            #end if
 
-      #if $output.saveSortedRegions:
-        --outFileSortedRegions '$outFileSortedRegions'
-      #end if
-  #else
-    #set newoutFileName = str($outFileName)+".png"
-    --outFileName $newoutFileName
-  #end if
-  
-  #if $scaleRegions.showScaleRegionsOpt == "yes":
-    --startLabel $scaleRegions.startLabel
-    --endLabel $scaleRegions.endLabel
-  #end if
-  
-  #if $advancedOpt.showAdvancedOpt == "yes"
-    #if $advancedOpt.averageType:
-      --averageType '$advancedOpt.averageType'
-    #end if
-    --plotHeight $advancedOpt.plotHeight
-    --plotWidth $advancedOpt.plotWidth
-    --plotType $advancedOpt.plotType
-    
-    --regionsLabel '$advancedOpt.regionsLabel'
-      
-    #if str($advancedOpt.plotTitle.value) != "None":
-      --plotTitle '$advancedOpt.plotTitle'
-    #end if
+            #if $output.saveSortedRegions:
+                --outFileSortedRegions '$outFileSortedRegions'
+            #end if
+        #else
+            #set newoutFileName = str($outFileName)+".png"
+            --outFileName $newoutFileName
+        #end if
+
+        #if $scaleRegions.showScaleRegionsOpt == "yes":
+            --startLabel $scaleRegions.startLabel
+            --endLabel $scaleRegions.endLabel
+        #end if
 
-    $advancedOpt.onePlotPerGroup
+        #if $advancedOpt.showAdvancedOpt == "yes":
+            #if $advancedOpt.averageType:
+                --averageType '$advancedOpt.averageType'
+            #end if
+            --plotHeight $advancedOpt.plotHeight
+            --plotWidth $advancedOpt.plotWidth
+            --plotType $advancedOpt.plotType
+
+            --regionsLabel '$advancedOpt.regionsLabel'
 
-    #if $advancedOpt.yMin:
-      --yMin $advancedOpt.yMin
-    #end if
-    #if $advancedOpt.yMax:
-      --yMax $advancedOpt.yMax
-    #end if
+            #if str($advancedOpt.plotTitle.value) != "None":
+                --plotTitle '$advancedOpt.plotTitle'
+            #end if
+
+            $advancedOpt.onePlotPerGroup
+
+            #if $advancedOpt.yMin:
+                --yMin $advancedOpt.yMin
+            #end if
+            #if $advancedOpt.yMax:
+                --yMax $advancedOpt.yMax
+            #end if
 
-    --xAxisLabel '$advancedOpt.xAxisLabel'
-    #if str($advancedOpt.yAxisLabel.value) != "None":
-      --yAxisLabel '$advancedOpt.yAxisLabel'
-    #end if
-  #end if
-  ; mv $newoutFileName $outFileName
-  </command>
-  <inputs>
-    <param name="matrixFile" format="bgzip" type="data" label="Matrix file from the computeMatrix tool"/>
-    <conditional name="scaleRegions">
-      <param name="showScaleRegionsOpt" type="select" label="The input matrix was computed in scale-regions mode">
-        <option value="no" selected="true">no</option>
-        <option value="yes">yes</option>
-      </param>
-        <when value="no" />
-        <when value="yes">
-            <param name="startLabel" type="text" value="TSS" size="10" label="Label for the region start" help ="[only for scale-regions mode] Label shown in the plot for the start of the region. Default is TSS (transcription start site), but could be changed to anything, e.g. &quot;peak start&quot;." />
-            <param name="endLabel" type="text" value="TES" size="10" label="Label for the region end" help="[only for scale-regions mode] Label shown in the plot for the region end. Default is TES (transcription end site)."/>
-        </when>
-    </conditional>
+            --xAxisLabel '$advancedOpt.xAxisLabel'
+            #if str($advancedOpt.yAxisLabel.value) != "None":
+                --yAxisLabel '$advancedOpt.yAxisLabel'
+            #end if
+        #end if
+        ; mv $newoutFileName $outFileName
+    </command>
+    <inputs>
+        <param name="matrixFile" format="bgzip" type="data" label="Matrix file from the computeMatrix tool"/>
+        <conditional name="scaleRegions">
+            <param name="showScaleRegionsOpt" type="select" label="The input matrix was computed in scale-regions mode">
+                <option value="no" selected="true">no</option>
+                <option value="yes">yes</option>
+            </param>
+            <when value="no" />
+            <when value="yes">
+                <param name="startLabel" type="text" value="TSS" size="10" label="Label for the region start" help ="[only for scale-regions mode] Label shown in the plot for the start of the region. Default is TSS (transcription start site), but could be changed to anything, e.g. &quot;peak start&quot;." />
+                <param name="endLabel" type="text" value="TES" size="10" label="Label for the region end" help="[only for scale-regions mode] Label shown in the plot for the region end. Default is TES (transcription end site)."/>
+            </when>
+        </conditional>
 
-    <conditional name="output" >
-      <param name="showOutputSettings" type="select" label="Show advanced output settings" >
-        <option value="no" selected="true">no</option>
-        <option value="yes">yes</option>
-      </param>
-      <when value="no" />
-      <when value="yes">
-        <param name="outFileFormat" type="select" label="Image file format">
-            <option value="png" selected="true">png</option>
-            <option value="pdf">pdf</option>
-            <option value="svg">svg</option>
-            <option value="eps">eps</option>
-            <option value="emf">emf</option>
-        </param>
-        <param name="saveData" type="boolean" label="Save the data underlying data for the average profile"/>
-        <param name="saveMatrix" type="boolean" label="Save the the matrix of values underlying the heatmap"/>
-        <param name="saveSortedRegions" type="boolean" label="Save the regions after skipping zeros or min/max threshold values" help="This outputs the file of genomic intervals in the order that will be shown in the heatmap or summary profile. This is useful, for example, to generate other heatmaps keeping the sorting of the first heatmap."/>
-      </when>
-    </conditional>
+        <expand macro="graphic_output_settings" />
 
-    <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="averageType" type="select" label="Define the type of statistic that should be used for the profile.">
-          <option value="mean" selected="true">mean</option>
-          <option value="median">median</option>
-          <option value="min">min</option>
-          <option value="max">max</option>
-          <option value="sum">sum</option>
-          <option value="std">std</option>
-        </param>
-        <param name="plotHeight" type="integer" value="5" min="3" 
-          label="Plot height" 
-          help="Height in cm. The default for the plot height is 5 centimeters. The minimum value is 3 cm." />
-        <param name="plotWidth" type="integer" value="8" min="1" 
-          label="Plot width" 
-          help="Width in cm. The default value is 8 centimeters. The minimum value is 1 cm." />
-        <param name="plotType" type="select" label="Plot type"
-          help="For the summary plot (profile) only. The &quot;lines&quot; option will plot the profile line based on the average type selected. The &quot;fill&quot; option fills the region between zero and the profile curve. The fill in color is semi transparent to distinguish different profiles. The &quot;std&quot; option colors the region between the profile and the standard deviation of the data. As in the case of fill, a semi-transparent color is used. The option &quot;overlapped_lines&quot; plots each region values, one on top of the other; this option only works if &quot;one plot per proup&quot; is set.">
-          <option value="lines" selected="true">lines</option>
-          <option value="fill">fill</option>
-          <option value="std">std</option>
-          <option value="overlapped_lines">overlapped lines</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="averageType" type="select" label="Define the type of statistic that should be used for the profile.">
+                    <option value="mean" selected="true">mean</option>
+                    <option value="median">median</option>
+                    <option value="min">min</option>
+                    <option value="max">max</option>
+                    <option value="sum">sum</option>
+                    <option value="std">std</option>
+                </param>
+                <param name="plotHeight" type="integer" value="5" min="3" 
+                    label="Plot height" 
+                    help="Height in cm. The default for the plot height is 5 centimeters. The minimum value is 3 cm." />
+                <param name="plotWidth" type="integer" value="8" min="1" 
+                    label="Plot width" 
+                    help="Width in cm. The default value is 8 centimeters. The minimum value is 1 cm." />
+                <param name="plotType" type="select" label="Plot type"
+                    help="For the summary plot (profile) only. The &quot;lines&quot; option will plot the profile line based on the average type selected. The &quot;fill&quot; option fills the region between zero and the profile curve. The fill in color is semi transparent to distinguish different profiles. The &quot;std&quot; option colors the region between the profile and the standard deviation of the data. As in the case of fill, a semi-transparent color is used. The option &quot;overlapped_lines&quot; plots each region values, one on top of the other; this option only works if &quot;one plot per proup&quot; is set.">
+                    <option value="lines" selected="true">lines</option>
+                    <option value="fill">fill</option>
+                    <option value="std">std</option>
+                    <option value="overlapped_lines">overlapped lines</option>
+                </param>
 
-        <param name="regionsLabel" type="text" value="genes" size="30" label="Labels for the regions plotted in the heatmap" help="If more than one region is being plotted a list of labels separated by comma and limited by quotes, is required. For example, &quot;label1, label2&quot;."/>
-        <param name="plotTitle" type="text" value="" size="30" label="Title of the plot" help="Title of the plot, to be printed on top of the generated image. Leave blank for no title." />
-        <param name="onePlotPerGroup" type="boolean" truevalue="--onePlotPerGroup" falsevalue="" label="Do one plot per group" help="When the region file contains groups separated by &quot;#&quot;, the default is to plot the averages for the distinct plots in one plot. If this option is set, each group will get its own plot, stacked on top of each other."/>
-        <param name="yMin" type="float" value="" size="3" label="Minimum value for the Y-axis of the summary plot. Leave empty for automatic values" optional="true"/>
-        <param name="yMax" type="float" value="" size="3" label="Maximum value for Y-axis of the summary plot. Leave empty for automatic values" optional="true"/>
-        <param name="xAxisLabel" type="text" value="gene distance (bp)" size="50" label="Description for the x-axis label" />
-        <param name="yAxisLabel" type="text" value="" size="50" label="Description for the y-axis label for the top panel" />
-      </when>
-    </conditional>
-  </inputs>
-  <outputs>
-    <data format="png" name="outFileName" label="${tool.name} image">
-        <change_format>
-            <when input="output.outFileFormat" value="pdf" format="pdf" />
-            <when input="output.outFileFormat" value="svg" format="svg" />
-            <when input="output.outFileFormat" value="eps" format="eps" />
-            <when input="output.outFileFormat" value="emf" format="emf" />
-        </change_format>
-    </data>
-    <data format="tabular" name="outFileNameData" label="${tool.name} raw plot data">
-      <filter>(output['showOutputSettings'] == 'yes' and output['saveData'] == True)</filter>
-    </data>
-    <data format="tabular" name="outFileNameMatrix" label="${tool.name} matrix of heatmap values">
-      <filter>(output['showOutputSettings'] == 'yes' and output['saveMatrix'] == True)</filter>
-    </data>
-    <data format="bed" name="outFileSortedRegions" label="${tool.name} sorted/filtered regions">
-      <filter>(output['showOutputSettings'] == 'yes' and output['saveSortedRegions'] == True)</filter>
-    </data>  
+                <param name="regionsLabel" type="text" value="genes" size="30" label="Labels for the regions plotted in the heatmap" help="If more than one region is being plotted a list of labels separated by comma and limited by quotes, is required. For example, &quot;label1, label2&quot;."/>
+                <param name="plotTitle" type="text" value="" size="30" label="Title of the plot" help="Title of the plot, to be printed on top of the generated image. Leave blank for no title." />
+                <param name="onePlotPerGroup" type="boolean" truevalue="--onePlotPerGroup" falsevalue="" label="Do one plot per group" help="When the region file contains groups separated by &quot;#&quot;, the default is to plot the averages for the distinct plots in one plot. If this option is set, each group will get its own plot, stacked on top of each other."/>
+                <param name="yMin" type="float" value="" size="3" label="Minimum value for the Y-axis of the summary plot. Leave empty for automatic values" optional="true"/>
+                <param name="yMax" type="float" value="" size="3" label="Maximum value for Y-axis of the summary plot. Leave empty for automatic values" optional="true"/>
+                <param name="xAxisLabel" type="text" value="gene distance (bp)" size="50" label="Description for the x-axis label" />
+                <param name="yAxisLabel" type="text" value="" size="50" label="Description for the y-axis label for the top panel" />
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        <data format="png" name="outFileName" label="${tool.name} image">
+            <change_format>
+                <when input="output.outFileFormat" value="pdf" format="pdf" />
+                <when input="output.outFileFormat" value="svg" format="svg" />
+                <when input="output.outFileFormat" value="eps" format="eps" />
+                <when input="output.outFileFormat" value="emf" format="emf" />
+            </change_format>
+        </data>
+        <data format="tabular" name="outFileNameData" label="${tool.name} raw plot data">
+            <filter>(output['showOutputSettings'] == 'yes' and output['saveData'] == True)</filter>
+        </data>
+        <data format="tabular" name="outFileNameMatrix" label="${tool.name} matrix of heatmap values">
+            <filter>(output['showOutputSettings'] == 'yes' and output['saveMatrix'] == True)</filter>
+        </data>
+        <data format="bed" name="outFileSortedRegions" label="${tool.name} sorted/filtered regions">
+            <filter>(output['showOutputSettings'] == 'yes' and output['saveSortedRegions'] == True)</filter>
+        </data>
   </outputs>
   <help>
 
 **What it does**
 
-This tool creates a profile plot for a score associated to genomic regions.
-Typically, these regions are genes, but any other regions defined in a BED or
-INTERVAL format will work. A preprocessed matrix generated by the tool
-computeMatrix is required.
+This tool plots the average enrichments over all genomic
+regions supplied to computeMarix. It is a very useful complement to the
+heatmapper, especially in cases when you want to compare the scores for
+many different groups. Like heatmapper, profiler does not change the
+values that were compute by computeMatrix, but you can choose between
+many different ways to color and display the plots.
+
+
+.. image:: $PATH_TO_IMAGES/visual_profiler_DmelPolII.png
+   :alt: Meta-gene profile of Rna Polymerase II
+
 
 -----
 
 .. class:: infomark
 
-If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com
-
-This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
-
+@REFERENCES@
 
-.. _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
-
-  </help>
+    </help>
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/readme.rst	Tue Oct 29 17:26:28 2013 -0400
@@ -0,0 +1,63 @@
+========================
+Galaxy deeptools wrapper
+========================
+
+deepTools are user-friendly tools for the normalization and visualization of 
+deep-sequencing data.
+They address the challenge of visualizing the large amounts of data that are now
+routinely generated from sequencing centers in a meaningful way. 
+To do so, deepTools contain useful routines to process the mapped reads data 
+through removal of duplicates and different filtering options to create coverage
+files in standard bedGraph and bigWig file formats. deepTools allow the creation
+of normalized coverage files or the comparison between two files 
+(for example, treatment and control). Finally, using such normalized and 
+standardized files, multiple visualizations can be created to identify 
+enrichments with functional annotations of the genome. 
+For a gallery of images that can be produced and a description 
+of the tools see our poster_.
+
+.. _poster: http://f1000.com/posters/browse/summary/1094053
+
+deeptools is developed under here:
+
+    https://github.com/fidelram/deepTools
+
+For support, questions, or feature requests contact: deeptools@googlegroups.com
+
+
+========
+Citation
+========
+
+deeptools are currently under review. In the meantime please refere to
+
+
+=======
+History
+=======
+
+- v1.0: Initial public release
+
+
+===============================
+Wrapper Licence (MIT/BSD style)
+===============================
+
+Permission to use, copy, modify, and distribute this software and its
+documentation with or without modifications and for any purpose and
+without fee is hereby granted, provided that any copyright notices
+appear in all copies and that both those copyright notices and this
+permission notice appear in supporting documentation, and that the
+names of the contributors or copyright holders not be used in
+advertising or publicity pertaining to distribution of the software
+without specific prior permission.
+
+THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
+OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+OR PERFORMANCE OF THIS SOFTWARE.
+
Binary file static/images/QC_GCplots_input.png has changed
Binary file static/images/QC_bamCorrelate_humanSamples.png has changed
Binary file static/images/QC_fingerprint.png has changed
Binary file static/images/flowChart_computeMatrixetc.png has changed
Binary file static/images/norm_IGVsnapshot_indFiles.png has changed
Binary file static/images/visual_hm_DmelPolII.png has changed
Binary file static/images/visual_profiler_DmelPolII.png has changed
--- a/tool-data/deepTools_seqs.loc.sample	Tue Sep 17 10:27:29 2013 -0400
+++ b/tool-data/deepTools_seqs.loc.sample	Tue Oct 29 17:26:28 2013 -0400
@@ -3,15 +3,15 @@
 #need to supply these files and then create a deepTools_seqs.loc file
 #similar to this one (store it in this directory) that points to
 #the directories in which those files are stored. The deepTools_seqs.loc
-#file has this format (white space characters are TAB characters):
+#file has this format:
 #
-#<unique_build_id><display_name><file_path>
+#<unique_build_id>	<display_name>	<file_path>
 #
 #So, for example, if your deepTools_seqs.loc began like this:
 #
-#hg18Human (Homo sapiens): hg18/depot/data2/galaxy/twobit/hg18.2bit
-#hg19Human (Homo sapiens): hg19/depot/data2/galaxy/twobit/hg19.2bit
-#mm9Mouse (Mus musculus): mm9/depot/data2/galaxy/twobit/mm9.2bit
+#hg18	Human (Homo sapiens): hg18	/depot/data2/galaxy/twobit/hg18.2bit
+#hg19	Human (Homo sapiens): hg19	/depot/data2/galaxy/twobit/hg19.2bit
+#mm9	Mouse (Mus musculus): mm9	/depot/data2/galaxy/twobit/mm9.2bit
 #
 #then your /depot/data2/galaxy/twobit/ directory
 #would need to contain the following 2bit files:
@@ -24,7 +24,4 @@
 #each file you have stored that you want to be available. Note that 
 #your files should all have the extension '2bit'.
 #
-#Note that for backwards compatibility with workflows, the unique ID of
-#an entry must be the path that was in the original loc file, because that
-#is the value stored in the workflow for that parameter. 
-#
+#Please note that the <unique_build_id> is also used as "Species name abbreviation".
--- a/tool_dependencies.xml	Tue Sep 17 10:27:29 2013 -0400
+++ b/tool_dependencies.xml	Tue Oct 29 17:26:28 2013 -0400
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
 <tool_dependency>
     <package name="samtools" version="0.1.19">
-        <repository changeset_revision="18ccfc4b9542" name="package_samtools_0_1_19" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
+        <repository changeset_revision="54195f1d4b0f" name="package_samtools_0_1_19" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
     </package>
     <package name="numpy" version="1.7.1">
-        <repository changeset_revision="b7ff4a8c58df" name="package_numpy_1_7" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
+        <repository changeset_revision="f0490401cfff" name="package_numpy_1_7" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
     </package>
     <package name="matplotlib" version="1.2.1">
         <repository changeset_revision="966f29c955b9" name="package_matplotlib_1_2" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
@@ -37,6 +37,15 @@
                 <action type="chmod">
                     <file mode="755">$INSTALL_DIR/bigWigInfo</file>
                 </action>
+                <action type="download_binary">
+                    <url_template architecture="x86_64" os="linux">http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bigWigToBedGraph</url_template>
+                    <url_template architecture="i686" os="darwin">http://hgdownload.cse.ucsc.edu/admin/exe/macOSX.i386/bigWigToBedGraph</url_template>
+                    <url_template architecture="i386" os="darwin">http://hgdownload.cse.ucsc.edu/admin/exe/macOSX.i386/bigWigToBedGraph</url_template>
+                    <url_template architecture="x86_64" os="darwin">http://hgdownload.cse.ucsc.edu/admin/exe/macOSX.x86_64/bigWigToBedGraph</url_template>
+                </action>
+                <action type="chmod">
+                    <file mode="755">$INSTALL_DIR/bigWigToBedGraph</file>
+                </action>
                 <action type="set_environment">
                     <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR</environment_variable>
                 </action>
@@ -45,11 +54,17 @@
          <readme>The tools downloaded by this dependency definition are free for academic use. TODO: UCSC tools are only available with their latest version. That is not good for reproducibility.</readme>
      </package>
 
-    <package name="deepTools" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">
+    <package name="deepTools" version="1.5.1_91b873c095bb4ca44da99e57d8b49784508aa98b">
         <install version="1.0">
             <actions>
+                <!-- populate the environment variables from the dependend repos -->
+                <action type="set_environment_for_install">
+                    <repository changeset_revision="a4e35f23093f" name="package_pysam_0_7_5" owner="fubar" toolshed="http://testtoolshed.g2.bx.psu.edu">
+                        <package name="pysam" version="0.7.5" />
+                    </repository>
+                </action>
                 <action type="shell_command">git clone --recursive https://github.com/fidelram/deepTools.git</action>
-                <action type="shell_command">git reset --hard 3e13687c89e951476776b15afb4bbbc3b906f761</action>
+                <action type="shell_command">git reset --hard 91b873c095bb4ca44da99e57d8b49784508aa98b</action>
                 <action type="make_directory">$INSTALL_DIR/lib/python</action>
                 <action type="shell_command">
                     export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp;