61
|
1 <tool id="deeptools_bamCompare" name="bamCompare" version="@WRAPPER_VERSION@.0">
|
|
2 <description>normalizes and compares two BAM files to obtain the ratio, log2ratio or difference. (bam2bigwig)</description>
|
|
3 <expand macro="requirements" />
|
|
4 <expand macro="stdio" />
|
|
5 <macros>
|
|
6 <token name="@BINARY@">bamCompare</token>
|
|
7 <import>deepTools_macros.xml</import>
|
|
8 </macros>
|
|
9 <command>
|
|
10 <![CDATA[
|
|
11 bamCompare
|
|
12
|
|
13 @THREADS@
|
|
14
|
|
15 --bamfile1 '$bamFile1'
|
|
16 -bai1 '${bamFile1.metadata.bam_index}'
|
|
17 --bamfile2 '$bamFile2'
|
|
18 -bai2 '${bamFile2.metadata.bam_index}'
|
|
19
|
|
20 --outFileName '$outFileName'
|
|
21 --outFileFormat '$outFileFormat'
|
|
22
|
|
23 --fragmentLength $fragmentLength
|
|
24 --binSize $binSize
|
|
25
|
|
26 #if $scaling.method == 'SES':
|
|
27 --scaleFactorsMethod SES
|
|
28 --sampleLength $scaling.sampleLength
|
|
29 #elif $scaling.method == 'readCount':
|
|
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
|
|
42 #if $comparison.normalization.effectiveGenomeSize.effectiveGenomeSize_opt == "specific":
|
|
43 --normalizeTo1x $comparison.normalization.effectiveGenomeSize.effectiveGenomeSize
|
|
44 #else:
|
|
45 --normalizeTo1x $comparison.normalization.effectiveGenomeSize.effectiveGenomeSize_opt
|
|
46 #end if
|
|
47
|
|
48 #end if
|
|
49 #elif $comparison.type in ['ratio','log2']:
|
|
50 --pseudocount $comparison.pseudocount
|
|
51 #end if
|
|
52
|
|
53 #if str($region).strip() != '':
|
|
54 --region '$region'
|
|
55 #end if
|
|
56
|
|
57 #if $advancedOpt.showAdvancedOpt == "yes":
|
|
58 #if $advancedOpt.smoothLength:
|
|
59 --smoothLength '$advancedOpt.smoothLength'
|
|
60 #end if
|
|
61
|
|
62 $advancedOpt.doNotExtendPairedEnds
|
|
63 $advancedOpt.ignoreDuplicates
|
|
64
|
|
65 #if $advancedOpt.minMappingQuality:
|
|
66 --minMappingQuality '$advancedOpt.minMappingQuality'
|
|
67 #end if
|
|
68
|
|
69 --missingDataAsZero $advancedOpt.missingDataAsZero
|
|
70
|
|
71 #if str($advancedOpt.ignoreForNormalization).strip() != '':
|
|
72 --ignoreForNormalization '$advancedOpt.ignoreForNormalization'
|
|
73 #end if
|
|
74
|
|
75 #end if
|
|
76 ]]>
|
|
77 </command>
|
|
78 <inputs>
|
|
79 <param name="bamFile1" format="bam" type="data" label="First BAM file (e.g. treated sample)"
|
|
80 help="The BAM file must be sorted."/>
|
|
81 <param name="bamFile2" format="bam" type="data" label="Second BAM file (e.g. control sample)"
|
|
82 help="The BAM file must be sorted."/>
|
|
83 <param name="fragmentLength" type="integer" value="200" min="1"
|
|
84 label="Length of the average fragment size"
|
|
85 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 "normalize coverage to 1x"). 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. (--fragmentLength)"/>
|
|
86
|
|
87 <param name="binSize" type="integer" value="50" min="1"
|
|
88 label="Bin size in bp"
|
|
89 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. (--binSize)"/>
|
|
90
|
|
91 <conditional name="scaling">
|
|
92 <param name="method" type="select"
|
|
93 label="Method to use for scaling the largest sample to the smallest">
|
|
94 <option value="readCount" selected="true">read count</option>
|
|
95 <option value="SES">signal extraction scaling (SES), check the bamFingerprint plot before using it!</option>
|
|
96 <option value="own">enter own scaling factors</option>
|
|
97 </param>
|
|
98 <when value="SES">
|
|
99 <param name="sampleLength" type="integer" value="1000" min="10"
|
|
100 label="Length in base pairs used to sample the genome and compute the size or scaling factors to compare the two BAM files "
|
|
101 help="The default is fine. Only change it if you know what you are doing" />
|
|
102 </when>
|
|
103 <when value="readCount" />
|
|
104 <when value="own">
|
|
105 <expand macro="scaleFactor" />
|
|
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 <expand macro="pseudocount" />
|
|
118 </when>
|
|
119 <when value="ratio">
|
|
120 <expand macro="pseudocount" />
|
|
121 </when>
|
|
122 <when value="subtract">
|
|
123 <conditional name="normalization">
|
|
124 <param name="type" type="select" label="Normalization method" >
|
|
125 <option value="1x">Normalize coverage to 1x</option>
|
|
126 <option value="rpkm">Normalize to fragments (reads) per kilobase per million (RPKM)</option>
|
|
127 <option value="no">Do not normalize or scale</option>
|
|
128 </param>
|
|
129 <when value="rpkm" />
|
|
130 <when value="no" />
|
|
131 <when value="1x">
|
|
132 <expand macro="effectiveGenomeSize" />
|
|
133 </when>
|
|
134 </conditional>
|
|
135 </when>
|
|
136 </conditional>
|
|
137
|
|
138 <param name="outFileFormat" type="select" label="Coverage file format">
|
|
139 <option value="bigwig" selected="true">bigwig</option>
|
|
140 <option value="bedgraph">bedgraph</option>
|
|
141 </param>
|
|
142 <expand macro="region_limit_operation" />
|
|
143 <conditional name="advancedOpt">
|
|
144 <param name="showAdvancedOpt" type="select" label="Show advanced options" >
|
|
145 <option value="no" selected="true">no</option>
|
|
146 <option value="yes">yes</option>
|
|
147 </param>
|
|
148 <when value="no" />
|
|
149 <when value="yes">
|
|
150 <param name="smoothLength" type="integer" value="1" optional="true" min="1"
|
|
151 label="Smooth values using the following length (in bp)"
|
|
152 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. (--smoothLength)"/>
|
|
153 <expand macro="doNotExtendPairedEnds" />
|
|
154 <expand macro="ignoreDuplicates" />
|
|
155 <expand macro="minMappingQuality" />
|
|
156 <expand macro="missingDataAsZero" />
|
|
157 <param name="ignoreForNormalization" type="text" value="" size="50"
|
|
158 label="regions that should be excluded for calculating the scaling factor"
|
|
159 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" />
|
|
160 </when>
|
|
161 </conditional>
|
|
162 </inputs>
|
|
163 <outputs>
|
|
164 <data format="bigwig" name="outFileName">
|
|
165 <change_format>
|
|
166 <when input="outFileFormat" value="bigwig" format="bigwig" />
|
|
167 <when input="outFileFormat" value="bedgraph" format="bedgraph" />
|
|
168 </change_format>
|
|
169 </data>
|
|
170 </outputs>
|
|
171 <tests>
|
|
172 <test>
|
|
173 <param name="bamFile1" value="bowtie2-test1.bam" ftype="bam" />
|
|
174 <param name="bamFile2" value="bowtie2-test1.bam" ftype="bam" />
|
|
175 <param name="showAdvancedOpt" value="no" />
|
|
176 <param name="outFileFormat" value="bigwig" />
|
|
177 <param name="fragmentLength" value="100" />
|
|
178 <param name="outFileFormat" value="bedgraph" />
|
|
179 <param name="binSize" value="5" />
|
|
180 <param name="type" value="ratio" />
|
|
181 <output name="outFileName" file="bamCompare_result1.bg" ftype="bedgraph" />
|
|
182 </test>
|
|
183 </tests>
|
|
184 <help>
|
|
185 <![CDATA[
|
|
186 **What it does**
|
|
187
|
|
188 This tool compares two BAM files based on the number of mapped reads. To
|
|
189 compare the BAM files, the genome is partitioned into bins of equal size, then
|
|
190 the number of reads found in each BAM file is counted for such bins and
|
|
191 finally a summarizing value is reported. This value can be the ratio of the
|
|
192 number of reads per bin, the log2 of the ratio or the difference. This tool
|
|
193 can normalize the number of reads on each BAM file using the SES method
|
|
194 proposed by Diaz et al. (2012). "Normalization, bias correction, and peak
|
|
195 calling for ChIP-seq". Statistical applications in genetics and molecular
|
|
196 biology, 11(3). Normalization based on read counts is also available. The
|
|
197 output is either a bedgraph or a bigwig file containing the bin location and
|
|
198 the resulting comparison values. By default, if reads are mated, the fragment
|
|
199 length reported in the BAM file is used. In the case of paired-end mapping
|
|
200 each read mate is treated independently to avoid a bias when a mixture of
|
|
201 concordant and discordant pairs is present. This means that *each end* will be
|
|
202 extended to match the fragment length.
|
|
203
|
|
204
|
|
205 .. image:: $PATH_TO_IMAGES/norm_IGVsnapshot_indFiles.png
|
|
206
|
|
207
|
|
208 You can find more details on the bamCompare wiki page: https://github.com/fidelram/deepTools/wiki/Normalizations#wiki-bamCompare
|
|
209
|
|
210
|
|
211 **Output files**:
|
|
212
|
|
213 - same as for bamCoverage, except that you now obtain 1 coverage file that is based on 2 BAM files.
|
|
214
|
|
215 -----
|
|
216
|
|
217 @REFERENCES@
|
|
218 ]]>
|
|
219 </help>
|
|
220 <expand macro="citations" />
|
|
221 </tool>
|