comparison alignmentSieve.xml @ 0:dfc5a344e2c2 draft

planemo upload for repository https://github.com/deeptools/deepTools/tree/master/galaxy/wrapper/ commit b1f975422b307927bbbe245d57609e9464d5d5c8-dirty
author bgruening
date Thu, 15 Feb 2018 08:13:20 -0500
parents
children ea8efdcf151f
comparison
equal deleted inserted replaced
-1:000000000000 0:dfc5a344e2c2
1 <tool id="deeptools_alignmentsieve" name="alignmentsieve" version="@WRAPPER_VERSION@.0">
2 <description>Filter BAM/CRAM files according to specified parameters</description>
3 <macros>
4 <token name="@BINARY@">alignmentSieve</token>
5 <import>deepTools_macros.xml</import>
6 </macros>
7 <expand macro="requirements" />
8 <command>
9 <![CDATA[
10 #import re
11 #set label = re.sub('[^\.\s\w\-]', '_', str($bamfile.element_identifier))
12 ln -s '$bamfile' one.bam &&
13 #if $bamfile.ext == 'bam':
14 ln -s '${bamfile.metadata.bam_index}' one.bam.bai &&
15 #else:
16 ln -s '${bamfile.metadata.cram_index}' one.bam.crai &&
17 #end if
18
19 @BINARY@
20 @THREADS@
21 -b one.bam
22
23 --label '$label'
24
25 #if str($filterRNAstrand) != 'no':
26 --filterRNAstrand '$filterRNAstrand'
27 #end if
28
29 $ignoreDuplicates
30
31 #if $minMappingQuality:
32 --minMappingQuality '$minMappingQuality'
33 #end if
34
35 #if $samFlagInclude:
36 --samFlagInclude $samFlagInclude
37 #end if
38
39 #if $samFlagExclude:
40 --samFlagExclude $samFlagExclude
41 #end if
42
43 #if $minFragmentLength:
44 --minFragmentLength $minFragmentLength
45 #end if
46
47 #if $maxFragmentLength:
48 --maxFragmentLength $maxFragmentLength
49 #end if
50
51 #if ' '.join( map(str, $blackListFileName) ) != 'None':
52 #set blfiles=[]
53 #for $f in $blackListFileName:
54 #silent $blfiles.append("'%s'" % $f)
55 #end for
56 #if $blfiles != ["'None'"]:
57 --blackListFileName #echo ' '.join($blfiles)#
58 #end if
59 #end if
60
61 #if $filterMetrics:
62 --filterMetrics '$filterMetricsFile'
63 #end if
64
65 #if $filteredOutReads:
66 --filteredOutReads '$outFileFiltered'
67 #end if
68
69 #if str($shift) != "":
70 #set shifts = " ".join(["'{}'".format(x) for x in $shift.split(" ")])
71 --shift $shifts
72 #elif $ATACshift:
73 --ATACshift
74 #end if
75 #if $BED:
76 --BED
77 -o '$outFile'
78 #elif str($shift) != "":
79 -o foo.bam &&
80 samtools sort -o '$outFile' -T foo.tmp -@ "\${GALAXY_SLOTS:-4}" foo.bam &&
81 rm foo.bam
82 #else:
83 -o '$outFile'
84 #end if
85 ]]>
86 </command>
87
88 <inputs>
89 <param name="bamfile" format="bam,cram" type="data" label="BAM file" />
90 <param name="BED" argument="--BED" type="boolean" label="Output in BEDPE format?"
91 help="Instead of producing BAM files, write output in BEDPE format (as defined by MACS2). Note that only reads/fragments passing filtering criterion are written in BEDPE format." />
92 <param argument="--shift" type="text" label="Amount to shift fragments" value=""
93 help="Shift the left and right end of a fragment. A positive
94 value shift an end to the right (on the + strand) and
95 a negative value shifts a fragment to the left. Either
96 2 or 4 integers can be provided. For example, '2 -3'
97 will shift the left-most fragment end two bases to the
98 right and the right-most end 3 bases to the left. If 4
99 integers are provided, then the first and last two
100 refer to fragments whose read 1 is on the left or
101 right, respectively. Consequently, it is possible to
102 take strand into consideration for strand-specific
103 protocols. Note that only properly paired reads are considered."/>
104 <param argument="--ATACshift" type="boolean" label="Shift fragment ends as appropriate for ATAC-seq" />
105 <param argument="filterRNAstrand" type="select" label="Only include reads originating from fragments from the forward or reverse strand."
106 help="By default (the no option), all reads are processed, regardless of the strand they originated from. For RNAseq, it can be useful to separately create bigWig files for the forward or reverse strands.
107 Note that this tools assumes that a dUTP-based method was used, so fragments will be assigned to the reverse strand if the second read in a pair is reverse complemented.">
108 <option value="no" selected="true">no</option>
109 <option value="forward">forward</option>
110 <option value="reverse">reverse</option>
111 </param>
112
113 <expand macro="ignoreDuplicates" />
114 <expand macro="minMappingQuality" />
115 <expand macro="samFlags" />
116 <expand macro="fragLength" />
117 <expand macro="blacklist" />
118 <param argument="--filterMetrics" type="boolean" label="Save the total number of reads seen and remaining after filtering to a text file?" help="" />
119 <param argument="--filteredOutReads" type="boolean" label="Save alignments NOT passing the filtering criteria?" help="" />
120 </inputs>
121 <outputs>
122 <data format="tabular" name="filterMetricsFile" label="${tool.name} on ${on_string}: filtering metrics">
123 <filter>filterMetrics is True</filter>
124 </data>
125 <data format="bam" name="outFileFiltered" label="${tool.name} on ${on_string}: Filtered Out Alignments">
126 <filter>filteredOutReads is True</filter>
127 </data>
128 <data format="bam" name="outFile" label="${tool.name} on ${on_string}">
129 <change_format>
130 <when input="BED" value='true' format='bed'/>
131 </change_format>
132 </data>
133 </outputs>
134 <tests>
135 <test>
136 <param name="bamfile" value="paired_chr2L.bam" ftype="bam" />
137 <param name="minMappingQuality" value="10" />
138 <param name="filterMetrics" value="True" />
139 <output name="outFile" file="alignmentSieve.bam" ftype="bam" />
140 <output name="filterMetricsFile" file="alignmentSieve.txt" ftype="tabular" />
141 </test>
142 <test>
143 <param name="bamfile" value="paired_chr2L.bam" ftype="bam" />
144 <param name="minMappingQuality" value="10" />
145 <param name="BED" value="yes" />
146 <param name="shift" value="1 -2 3 -4" />
147 <output name="outFile" file="alignmentSieve.bed" ftype="bed" />
148 </test>
149 <test>
150 <param name="bamfile" value="paired_chr2L.bam" ftype="bam" />
151 <param name="minMappingQuality" value="10" />
152 <param name="shift" value="1 -2 3 -4" />
153 <output name="outFile" file="alignmentSieve2.bam" ftype="bam" />
154 </test>
155 <test>
156 <param name="bamfile" value="paired_chr2L.cram" ftype="cram" />
157 <param name="minMappingQuality" value="10" />
158 <param name="shift" value="1 -2 3 -4" />
159 <output name="outFile" file="alignmentSieve3.bam" ftype="bam" />
160 </test>
161 </tests>
162
163 <help>
164 <![CDATA[
165
166 What it does
167 -------------
168
169 This tool is very much the counterpart of estimateReadFiltering, in that it can filter alignments based on a variety of desired criterion. While much of this can be done with samtools, this tool can additionally filter by fragment strand and length (e.g., for RNA-seq and ATAC-seq experiments, respectively). Finally, this program can produce BEDPE files, which can be used as input into MACS2 for peak calling, where the fragment ends have been optionally shifted.
170
171 Output
172 --------
173
174 The primary output is a BAM file with all alignments passing the desired criteria. Note that all unmapped reads are removed. Additionally, an optional text file can be produced with the following entries:
175
176 * Number of reads passing the filtering criteria
177 * Total number of initial reads
178
179 Instead of producing a filtered BAM file, a BEDPE file appropriate for use with MACS2 can be used, optionally with fragment ends shifted. This is useful in cases like ATAC-seq.
180
181 The ``--shift`` option can take either 2 or 4 integers. If two integers are given, then the first value shifts the left-most end of a fragment and the second the right-most end. Positive values shift to the right and negative values to the left. See below for how setting ``--shift`` to '-5 3' would shift a single fragment::
182
183 ----> read 1
184 read 2 <----
185
186 ------------------------ fragment
187
188 -------------------------------- shifted fragment
189
190 The same results will be produced if read 1 and read 2 are swapped. If, instead, the protocol is strand-specific, then the first set of integers in a pair would be applied to fragments where read 1 precedes read 2, and the second set to cases where read 2 precedes read 1. In this case, the first value in each pair is applied to the end of read 1 and the second to the end of read 2. For example, suppose "-5 3 -1 4" were given as the option to ``--shift``. The ``-5 3`` set would produce the following::
191
192 ----> read 1
193 read 2 <----
194
195 ------------------------ fragment
196
197 -------------------------------- shifted fragment
198
199 and the ``-1 4`` set would produce the following::
200
201 ----> read 2
202 read 1 <----
203
204 ------------------------ fragment
205
206 --------------------- shifted fragment
207
208 As can be seen, such fragments are considered to be on the ``-`` strand, so negative values then shift to the left on its frame of reference (thus, to the right relative to the ``+`` strand).
209
210 -----
211
212 @REFERENCES@
213 ]]>
214 </help>
215 <expand macro="citations" />
216 </tool>