comparison bamCompare.xml @ 10:a68a771625d2 draft

Uploaded
author bgruening
date Tue, 29 Oct 2013 17:26:28 -0400
parents 73761f33f198
children 8436c195dd6c
comparison
equal deleted inserted replaced
9:73761f33f198 10:a68a771625d2
1 <tool id="deeptools_bamCompare" name="bamCompare" version="1.0"> 1 <tool id="deeptools_bamCompare" name="bamCompare" version="1.0">
2 <description>normalizes and compares two BAM files to obtain the ratio, log2ratio or difference.</description> 2 <description>normalizes and compares two BAM files to obtain the ratio, log2ratio or difference. (bam2bigwig)</description>
3 <requirements> 3 <expand macro="requirements" />
4 <requirement type="package" version="1.5.1_3e13687c89e951476776b15afb4bbbc3b906f761">deepTools</requirement> 4 <macros>
5 <requirement type="package" version="1.7.1">numpy</requirement> 5 <import>deepTools_macros.xml</import>
6 <requirement type="package" version="0.1">ucsc_tools</requirement> 6 </macros>
7 <requirement type="package" >deepTools</requirement> 7 <command>
8 </requirements> 8 bamCompare
9 <command> 9
10 bamCompare 10 @THREADS@
11 11
12 ##ToDo 12 --bamfile1 '$bamFile1'
13 --numberOfProcessors 4 13 -bai1 '${bamFile1.metadata.bam_index}'
14 14 --bamfile2 '$bamFile2'
15 --bamfile1 '$bamFile1' 15 -bai2 '${bamFile2.metadata.bam_index}'
16 -bai1 '${bamFile1.metadata.bam_index}' 16
17 --bamfile2 '$bamFile2' 17 --outFileName '$outFileName'
18 -bai2 '${bamFile2.metadata.bam_index}' 18 --outFileFormat '$outFileFormat'
19 19
20 --outFileName '$outFileName' 20 --fragmentLength $fragmentLength
21 --outFileFormat '$outFileFormat' 21 --binSize $binSize
22 22
23 --fragmentLength $fragmentLength 23 #if $scaling.method == 'SES':
24 --binSize $binSize 24 --scaleFactorsMethod SES
25 25 --sampleLength $scaling.sampleLength
26 #if $scaling.method == 'SES': 26 #elif $scaling.method == 'readCount':
27 --scaleFactorsMethod SES 27 --scaleFactorsMethod readCount
28 --sampleLength $scaling.sampleLength 28 #elif $scaling.method == 'own':
29 #elif $scaling.method == 'readCount': 29 --scaleFactors '$scaling.scaleFactor1:$scaling.scaleFactor2'
30 --scaleFactorsMethod readCount
31 #elif $scaling.method == 'own':
32 --scaleFactors '$scaling.scaleFactor1:$scaling.scaleFactor2'
33 #end if
34
35 --ratio $comparison.type
36
37 #if $comparison.type=='subtract':
38 #if $comparison.normalization.type=='rpkm':
39 --normalizeUsingRPKM
40 #elif $comparison.normalization.type=='1x':
41 --normalizeTo1x $comparison.normalization.normalizeTo1x
42 #end if 30 #end if
43 31
44 #if str($comparison.ignoreForNormalization).strip() != '': 32 --ratio $comparison.type
45 --ignoreForNormalization $comparison.ignoreForNormalization 33
34 #if $comparison.type=='subtract':
35 #if $comparison.normalization.type=='rpkm':
36 --normalizeUsingRPKM
37 #elif $comparison.normalization.type=='1x':
38 --normalizeTo1x $comparison.normalization.normalizeTo1x
39 #end if
40
41 #if str($comparison.ignoreForNormalization).strip() != '':
42 --ignoreForNormalization $comparison.ignoreForNormalization
43 #end if
44
46 #end if 45 #end if
47 46
48 #end if 47 #if $advancedOpt.showAdvancedOpt == "yes":
49 48 #if $advancedOpt.smoothLength:
50 #if $advancedOpt.showAdvancedOpt == "yes": 49 --smoothLength '$advancedOpt.smoothLength'
51 #if $advancedOpt.smoothLength: 50 #end if
52 --smoothLength '$advancedOpt.smoothLength' 51
53 #end if 52 #if str($advancedOpt.region.value) != '':
54 53 --region '$advancedOpt.region'
55 #if str($advancedOpt.region.value) != '': 54 #end if
56 --region '$advancedOpt.region' 55
57 #end if 56 $advancedOpt.doNotExtendPairedEnds
58 57 $advancedOpt.ignoreDuplicates
59 $advancedOpt.doNotExtendPairedEnds 58
60 $advancedOpt.ignoreDuplicates 59 #if $advancedOpt.minMappingQuality:
61 60 --minMappingQuality '$advancedOpt.minMappingQuality'
62 #if $advancedOpt.minMappingQuality: 61 #end if
63 --minMappingQuality '$advancedOpt.minMappingQuality' 62
64 #end if 63 --missingDataAsZero $advancedOpt.missingDataAsZero
65 64
66 --missingDataAsZero $advancedOpt.missingDataAsZero 65 #end if
67 66
68 #end if 67 </command>
69 68
70 </command> 69 <inputs>
71 70 <param name="bamFile1" format="bam" type="data" label="Treatment BAM file"
72 <inputs> 71 help="The BAM file must be sorted."/>
73 <param name="bamFile1" format="bam" type="data" label="Treatment BAM file" 72
74 help="The BAM file must be sorted."/> 73 <param name="bamFile2" format="bam" type="data" label="Input BAM file"
75 74 help="The BAM file must be sorted."/>
76 <param name="bamFile2" format="bam" type="data" label="Input BAM file" 75
77 help="The BAM file must be sorted."/> 76 <param name="fragmentLength" type="integer" value="300" min="1"
78 77 label="Length of the average fragment size"
79 <param name="fragmentLength" type="integer" value="300" min="1" 78 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."/>
80 label="Length of the average fragment size" 79
81 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."/> 80 <param name="binSize" type="integer" value="50" min="1"
82 81 label="Bin size in bp"
83 <param name="binSize" type="integer" value="50" min="1" 82 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. "/>
84 label="Bin size in bp" 83
85 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. "/> 84 <conditional name="scaling">
86 85 <param name="method" type="select"
87 <conditional name="scaling"> 86 label="Method to use for scaling the largest sample to the smallest">
88 <param name="method" type="select" 87 <option value="readCount" selected="true">read count</option>
89 label="Method to use for scaling the largest sample to the smallest"> 88 <option value="SES">signal extraction scaling (SES)</option>
90 <option value="readCount" selected="true">read count</option> 89 <option value="own">enter own scaling factors</option>
91 <option value="SES">signal extraction scaling (SES)</option> 90 </param>
92 <option value="own">enter own scaling factors</option> 91 <when value="SES">
93 </param> 92 <param name="sampleLength" type="integer" value="1000" min="10"
94 <when value="SES"> 93 label="Length in base pairs used to sample the genome and compute the size or scaling factors to compare the two BAM files "
95 <param name="sampleLength" type="integer" value="1000" min="10" 94 help="The default is fine. Only change it if you know what you are doing" />
96 label="Length in base pairs used to sample the genome and compute the size or scaling factors to compare the two BAM files " 95 </when>
97 help="The default is fine. Only change it if you know what you are doing" /> 96 <when value="readCount" />
98 </when> 97 <when value="own">
99 <when value="readCount" /> 98 <param name="scaleFactor1" type="float" value="1"
100 <when value="own"> 99 label="Scale factor for treatment"/>
101 <param name="scaleFactor1" type="float" value="1" 100
102 label="Scale factor for treatment"/> 101 <param name="scaleFactor2" type="float" value="1"
103 102 label="Scale factor for input"/>
104 <param name="scaleFactor2" type="float" value="1" 103 </when>
105 label="Scale factor for input"/>
106 </when>
107 </conditional>
108
109 <conditional name="comparison">
110 <param name="type" type="select"
111 label="How to compare the two files">
112 <option value="log2" selected="true">compute log2 of the number of reads ratio</option>
113 <option value="ratio">compute the ratio of the number of reads</option>
114 <option value="subtract">compute difference (subtract input from treatment) of the number of reads</option>
115 </param>
116 <when value="log2" />
117 <when value="ratio" />
118 <when value="subtract">
119 <conditional name="normalization">
120 <param name="type" type="select" label="Normalization method" >
121 <option value="1x">Normalize coverage to 1x</option>
122 <option value="rpkm">Normalize to fragments (reads) per kilobase per million (RPKM)</option>
123 <option value="no">Do not normalize or scale</option>
124 </param>
125 <when value="rpkm" />
126 <when value="no" />
127 <when value="1x">
128 <param name="normalizeTo1x" type="integer" value="2150570000"
129 label="Report normalized coverage to 1x sequenceing depth"
130 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."/>
131 </when>
132 </conditional> 104 </conditional>
133 <param name="ignoreForNormalization" type="text" value="" size="50" 105
134 label="regions that should be excluded for calculating the scaling factor" 106 <conditional name="comparison">
135 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" /> 107 <param name="type" type="select"
136 </when> 108 label="How to compare the two files">
137 </conditional> 109 <option value="log2" selected="true">compute log2 of the number of reads ratio</option>
138 110 <option value="ratio">compute the ratio of the number of reads</option>
139 <param name="outFileFormat" type="select" label="Coverage file format"> 111 <option value="subtract">compute difference (subtract input from treatment) of the number of reads</option>
140 <option value="bigwig" selected="true">bigwig</option> 112 </param>
141 <option value="bedgraph">bedgraph</option> 113 <when value="log2" />
142 </param> 114 <when value="ratio" />
143 115 <when value="subtract">
144 <conditional name="advancedOpt"> 116 <conditional name="normalization">
145 <param name="showAdvancedOpt" type="select" label="Show advanced options" > 117 <param name="type" type="select" label="Normalization method" >
146 <option value="no" selected="true">no</option> 118 <option value="1x">Normalize coverage to 1x</option>
147 <option value="yes">yes</option> 119 <option value="rpkm">Normalize to fragments (reads) per kilobase per million (RPKM)</option>
120 <option value="no">Do not normalize or scale</option>
121 </param>
122 <when value="rpkm" />
123 <when value="no" />
124 <when value="1x">
125 <param name="normalizeTo1x" type="integer" value="2150570000"
126 label="Report normalized coverage to 1x sequenceing depth"
127 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."/>
128 </when>
129 </conditional>
130 <param name="ignoreForNormalization" type="text" value="" size="50"
131 label="regions that should be excluded for calculating the scaling factor"
132 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" />
133 </when>
134 </conditional>
135
136 <param name="outFileFormat" type="select" label="Coverage file format">
137 <option value="bigwig" selected="true">bigwig</option>
138 <option value="bedgraph">bedgraph</option>
148 </param> 139 </param>
149 <when value="no" /> 140
150 <when value="yes"> 141 <conditional name="advancedOpt">
151 142 <param name="showAdvancedOpt" type="select" label="Show advanced options" >
152 <param name="smoothLength" type="integer" value="1" optional="true" min="1" 143 <option value="no" selected="true">no</option>
153 label="Smooth values using the following length (in bp)" 144 <option value="yes">yes</option>
154 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."/> 145 </param>
155 146 <when value="no" />
156 <param name="region" type="text" value="" 147 <when value="yes">
157 label="Region of the genome to limit the operation to" 148
158 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;" /> 149 <param name="smoothLength" type="integer" value="1" optional="true" min="1"
159 150 label="Smooth values using the following length (in bp)"
160 <param name="doNotExtendPairedEnds" type="boolean" truevalue="--doNotExtendPairedEnds" falsevalue="" 151 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."/>
161 label="Do not extend paired ends" 152
162 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."/> 153 <param name="region" type="text" value=""
163 154 label="Region of the genome to limit the operation to"
164 <param name="ignoreDuplicates" type="boolean" truevalue="--ignoreDuplicates" falsevalue="" 155 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;" />
165 label="Ignore duplicates" 156
166 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." /> 157 <param name="doNotExtendPairedEnds" type="boolean" truevalue="--doNotExtendPairedEnds" falsevalue=""
167 158 label="Do not extend paired ends"
168 <param name="minMappingQuality" type="integer" optional="true" value="1" min="1" 159 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."/>
169 label="Minimum mapping quality (e.g. BOWTIE2 measures)" 160
170 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."/> 161 <param name="ignoreDuplicates" type="boolean" truevalue="--ignoreDuplicates" falsevalue=""
171 162 label="Ignore duplicates"
172 <param name="missingDataAsZero" type="boolean" truevalue="yes" falsevalue="no" checked="True" 163 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." />
173 label ="Treat missing data as zero" 164
174 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." /> 165 <param name="minMappingQuality" type="integer" optional="true" value="1" min="1"
175 </when> 166 label="Minimum mapping quality (e.g. BOWTIE2 measures)"
176 </conditional> 167 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."/>
177 168
178 </inputs> 169 <param name="missingDataAsZero" type="boolean" truevalue="yes" falsevalue="no" checked="True"
179 <outputs> 170 label ="Treat missing data as zero"
180 <data format="bigwig" name="outFileName"> 171 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." />
181 <change_format> 172 </when>
182 <when input="outFileFormat" value="bigwig" format="bigwig" /> 173 </conditional>
183 <when input="outFileFormat" value="bedgraph" format="bedgraph" /> 174
184 </change_format> 175 </inputs>
185 </data> 176 <outputs>
186 </outputs> 177 <data format="bigwig" name="outFileName">
187 <help> 178 <change_format>
179 <when input="outFileFormat" value="bigwig" format="bigwig" />
180 <when input="outFileFormat" value="bedgraph" format="bedgraph" />
181 </change_format>
182 </data>
183 </outputs>
184 <help>
188 185
189 **What it does** 186 **What it does**
190 187
191 This tool compares two BAM files based on the number of mapped reads. To 188 This tool compares two BAM files based on the number of mapped reads. To
192 compare the BAM files, the genome is partitioned into bins of equal size, 189 compare the BAM files, the genome is partitioned into bins of equal size,
197 output is either a bedGraph or a bigWig file containing the bin location and 194 output is either a bedGraph or a bigWig file containing the bin location and
198 the resulting comparison values. 195 the resulting comparison values.
199 If paired-end reads are present, the fragment 196 If paired-end reads are present, the fragment
200 length reported in the BAM file is used by default. 197 length reported in the BAM file is used by default.
201 198
199
200 .. image:: $PATH_TO_IMAGES/norm_IGVsnapshot_indFiles.png
201
202
203 **Output files**:
204
205 - same as for bamCoverage, except that you now obtain 1 coverage file that is based on 2 BAM files.
206
202 ----- 207 -----
203 208
204 .. class:: infomark 209 .. class:: infomark
205 210
206 If you would like to give us feedback or you run into any trouble, please send an email to deeptools@googlegroups.com 211 </help>
207
208 This tool is developed by the `Bioinformatics and Deep-Sequencing Unit`_ at the `Max Planck Institute for Immunobiology and Epigenetics`_.
209
210
211 .. _Bioinformatics and Deep-Sequencing Unit: http://www3.ie-freiburg.mpg.de/facilities/research-facilities/bioinformatics-and-deep-sequencing-unit/
212 .. _Max Planck Institute for Immunobiology and Epigenetics: http://www3.ie-freiburg.mpg.de
213
214
215 </help>
216
217 </tool> 212 </tool>