comparison samtool_filter2.xml @ 7:56c31114ad4a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/samtool_filter2 commit 24d5defd0880276f60d3d2f6abed9a00fa57eb0e
author iuc
date Wed, 06 Jun 2018 18:43:29 -0400
parents dc6ff68ea5e8
children a7add3e93cc5
comparison
equal deleted inserted replaced
6:dc6ff68ea5e8 7:56c31114ad4a
1 <tool id="samtool_filter2" name="Filter SAM or BAM, output SAM or BAM" version="1.1.2"> 1 <tool id="samtool_filter2" name="Filter SAM or BAM, output SAM or BAM" version="1.8">
2 <description>files on FLAG MAPQ RG LN or by region</description> 2 <description>files on FLAG MAPQ RG LN or by region</description>
3 <requirements> 3 <requirements>
4 <requirement type="package" version="1.2">samtools</requirement> 4 <requirement type="package" version="1.8">samtools</requirement>
5 </requirements> 5 </requirements>
6 <stdio> 6 <command detect_errors="exit_code"><![CDATA[
7 <exit_code range="1:" />
8 </stdio>
9 <command>
10 <![CDATA[
11 ##set up input files, regions requires input.bam and input.bai 7 ##set up input files, regions requires input.bam and input.bai
12 #if $input1.is_of_type('bam') 8 #if $input1.is_of_type('bam')
13 #set $input = 'input.bam' 9 #set $input = 'input.bam'
14 ln -s '$input1' $input && 10 ln -s '$input1' $input &&
15 ln -s '$input1.metadata.bam_index' input.bai && 11 ln -s '$input1.metadata.bam_index' input.bai &&
16 #elif $input1.is_of_type('sam') 12 #elif $input1.is_of_type('sam')
17 #set $input = 'input.sam' 13 #set $input = 'input.sam'
18 ln -s '$input1' $input && 14 ln -s '$input1' $input &&
19 #end if 15 #end if
20 samtools view $possibly_select_inverse '$output1' $header 16 samtools view
21 17 $possibly_select_inverse '$output1'
22 #if $input1.is_of_type('sam') 18 $header
19
20 #if $input1.is_of_type('sam')
23 -S 21 -S
24 #end if 22 #end if
25 23
26 #if str($outputtype) == 'bam' 24 #if str($outputtype) == 'bam'
27 -b 25 -b
28 #end if 26 #end if
29 27
30 #if str($mapq) 28 #if str($mapq)
31 -q $mapq 29 -q $mapq
32 #end if 30 #end if
33 #if $flag.filter == 'yes' 31 #if $flag.filter == 'yes'
34 #if str($flag.reqBits) != 'None' 32 #if str($flag.reqBits) != 'None'
35 #set $reqs = str($flag.reqBits).split(',') 33 #set $reqs = str($flag.reqBits).split(',')
36 #set $reqFlag = 0 34 #set $reqFlag = 0
37 #for $xn in $reqs: 35 #for $xn in $reqs:
38 #set $reqFlag += int($xn, 16) 36 #set $reqFlag += int($xn, 16)
39 #end for 37 #end for
40 -f $hex($reqFlag) 38 -f $hex($reqFlag)
41 #end if 39 #end if
42 #if str($flag.skipBits) != 'None' 40 #if str($flag.skipBits) != 'None'
43 #set $skips = str($flag.skipBits).split(',') 41 #set $skips = str($flag.skipBits).split(',')
44 #set $skipFlag = 0 42 #set $skipFlag = 0
45 #for $xn in $skips: 43 #for $xn in $skips:
46 #set $skipFlag += int(xn,16) 44 #set $skipFlag += int(xn,16)
47 #end for 45 #end for
48 -F $hex($skipFlag) 46 -F $hex($skipFlag)
49 #end if 47 #end if
50 #end if 48 #end if
51 #if str($read_group).strip() 49 #if str($read_group).strip()
52 -r '$read_group' 50 -r '$read_group'
53 #end if 51 #end if
54 #if str($library).strip() 52 #if str($library).strip()
55 -l '$library' 53 -l '$library'
56 #end if 54 #end if
57 #if $bed_file 55 #if $bed_file
58 -L '$bed_file' 56 -L '$bed_file'
59 #end if 57 #end if
60 $input 58 $input
61 #if str($regions).strip() and $input1.is_of_type('bam') 59 #if str($regions).strip() and $input1.is_of_type('bam')
62 #for region in str($regions).split(): 60 #for region in str($regions).split():
63 '$region' 61 '$region'
64 #end for 62 #end for
65 #end if 63 #end if
66 ## need to redirect stderr message so galaxy does not think this failed 64 ]]></command>
67 2>&1 65 <inputs>
68 ]]> 66 <param name="input1" type="data" format="sam,bam" label="SAM or BAM file to filter" />
69 </command> 67 <param name="header" type="select" label="Header in output">
70 <inputs> 68 <option value="-h">Include header</option>
71 <param name="input1" type="data" format="sam,bam" label="SAM or BAM file to filter" /> 69 <option value="">Exclude header</option>
72 <param name="header" type="select" label="Header in output"> 70 <option value="-H">Only the header</option>
73 <option value="-h">Include Header</option>
74 <option value="">Exclude Header</option>
75 <option value="-H">Only the Header</option>
76 </param>
77 <param name="mapq" type="integer" value="" optional="true" label="Minimum MAPQ quality score" help="(-q)">
78 <validator type="in_range" message="The MAPQ quality score can't be negative" min="0"/>
79 </param>
80 <conditional name="flag">
81 <param name="filter" type="select" label="Filter on bitwise flag">
82 <option value="no">no</option>
83 <option value="yes">yes</option>
84 </param>
85 <when value="no"/>
86 <when value="yes">
87 <param name="reqBits" type="select" multiple="true" display="checkboxes" label="Only output alignments with all of these flag bits set" help="(-f)">
88 <option value="0x0001">Read is paired</option>
89 <option value="0x0002">Read is mapped in a proper pair</option>
90 <option value="0x0004">The read is unmapped</option>
91 <option value="0x0008">The mate is unmapped</option>
92 <option value="0x0010">Read strand</option>
93 <option value="0x0020">Mate strand</option>
94 <option value="0x0040">Read is the first in a pair</option>
95 <option value="0x0080">Read is the second in a pair</option>
96 <option value="0x0100">The alignment or this read is not primary</option>
97 <option value="0x0200">The read fails platform/vendor quality checks</option>
98 <option value="0x0400">The read is a PCR or optical duplicate</option>
99 <option value="0x0800">Supplementary alignment</option>
100 </param> 71 </param>
101 <param name="skipBits" type="select" multiple="true" display="checkboxes" label="Skip alignments with any of these flag bits set" help="(-F)"> 72 <param name="mapq" type="integer" min="0" value="" optional="true" label="Minimum MAPQ quality score" help="(-q)" />
102 <option value="0x0001">Read is paired</option> 73 <conditional name="flag">
103 <option value="0x0002">Read is mapped in a proper pair</option> 74 <param name="filter" type="select" label="Filter on bitwise flag">
104 <option value="0x0004">The read is unmapped</option> 75 <option value="no">no</option>
105 <option value="0x0008">The mate is unmapped</option> 76 <option value="yes">yes</option>
106 <option value="0x0010">Read strand</option> 77 </param>
107 <option value="0x0020">Mate strand</option> 78 <when value="no"/>
108 <option value="0x0040">Read is the first in a pair</option> 79 <when value="yes">
109 <option value="0x0080">Read is the second in a pair</option> 80 <param name="reqBits" type="select" multiple="true" display="checkboxes" label="Only output alignments with all of these flag bits set" help="(-f)">
110 <option value="0x0100">The alignment or this read is not primary</option> 81 <option value="0x0001">Read is paired</option>
111 <option value="0x0200">The read fails platform/vendor quality checks</option> 82 <option value="0x0002">Read is mapped in a proper pair</option>
112 <option value="0x0400">The read is a PCR or optical duplicate</option> 83 <option value="0x0004">The read is unmapped</option>
113 <option value="0x0800">Supplementary alignment</option> 84 <option value="0x0008">The mate is unmapped</option>
85 <option value="0x0010">Read strand</option>
86 <option value="0x0020">Mate strand</option>
87 <option value="0x0040">Read is the first in a pair</option>
88 <option value="0x0080">Read is the second in a pair</option>
89 <option value="0x0100">The alignment or this read is not primary</option>
90 <option value="0x0200">The read fails platform/vendor quality checks</option>
91 <option value="0x0400">The read is a PCR or optical duplicate</option>
92 <option value="0x0800">Supplementary alignment</option>
93 </param>
94 <param name="skipBits" type="select" multiple="true" display="checkboxes" label="Skip alignments with any of these flag bits set" help="(-F)">
95 <option value="0x0001">Read is paired</option>
96 <option value="0x0002">Read is mapped in a proper pair</option>
97 <option value="0x0004">The read is unmapped</option>
98 <option value="0x0008">The mate is unmapped</option>
99 <option value="0x0010">Read strand</option>
100 <option value="0x0020">Mate strand</option>
101 <option value="0x0040">Read is the first in a pair</option>
102 <option value="0x0080">Read is the second in a pair</option>
103 <option value="0x0100">The alignment or this read is not primary</option>
104 <option value="0x0200">The read fails platform/vendor quality checks</option>
105 <option value="0x0400">The read is a PCR or optical duplicate</option>
106 <option value="0x0800">Supplementary alignment</option>
107 </param>
108 </when>
109 </conditional>
110 <param name="library" type="text" value="" label="Select alignments from Library"
111 help="(-l) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/>
112 <param name="read_group" type="text" value="" label="Select alignments from Read Group"
113 help="(-r) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/>
114 <param name="bed_file" type="data" format="bed" optional="true" label="Output alignments overlapping the regions in the BED file" help="(-L)"/>
115 <param name="possibly_select_inverse" type="boolean" truevalue="-U" falsevalue="-o" checked="false" label="Use inverse selection" help="Select the opposite of the listed chromosomes" />
116 <param name="regions" type="text" value="" label="Select regions (only used when the input is in BAM format)"
117 help="region should be presented in one of the following formats: `chr1', `chr2:1,000' and `chr3:1000-2,000'"/>
118 <param name="outputtype" type="select" label="Select the output format">
119 <option value="bam">BAM (-b)</option>
120 <option value="sam">SAM</option>
114 </param> 121 </param>
115 </when> 122 </inputs>
116 </conditional> 123 <outputs>
117 <param name="library" type="text" value="" label="Select alignments from Library" 124 <data name="output1" format="sam" label="${tool.name} on ${on_string}: ${outputtype}">
118 help="(-l) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> 125 <change_format>
119 <param name="read_group" type="text" value="" label="Select alignments from Read Group" 126 <when input="outputtype" value="bam" format="bam" />
120 help="(-r) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> 127 </change_format>
121 <param name="bed_file" type="data" format="bed" optional="true" label="Output alignments overlapping the regions in the BED FILE" help="(-L)"/> 128 </data>
122 <param name="possibly_select_inverse" checked="false" label="Use inverse selection" type="boolean" truevalue="-U" falsevalue="-o" help="Select the opposite of the listed chromosomes" /> 129 </outputs>
123 <param name="regions" type="text" value="" label="Select regions (only used when the input is in BAM format)" 130 <tests>
124 help="region should be presented in one of the following formats: `chr1', `chr2:1,000' and `chr3:1000-2,000'"/> 131 <test>
125 <param name="outputtype" type="select" label="Select the output format"> 132 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" />
126 <option value="bam">BAM (-b)</option> 133 <param name="header" value=""/>
127 <option value="sam">SAM</option> 134 <param name="filter" value="yes"/>
128 </param> 135 <param name="reqBits" value="0x0080"/>
129 </inputs> 136 <param name="outputtype" value="sam"/>
130 <outputs> 137 <output name="output1">
131 <data name="output1" format="sam" label="${tool.name} on ${on_string}: ${outputtype}"> 138 <assert_contents>
132 <change_format> 139 <has_text text="141" />
133 <when input="outputtype" value="bam" format="bam" /> 140 <not_has_text text="77" />
134 </change_format> 141 </assert_contents>
135 </data> 142 </output>
136 </outputs> 143 </test>
137 <tests> 144 <test>
138 <test> 145 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" />
139 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> 146 <param name="header" value=""/>
140 <param name="header" value=""/> 147 <param name="filter" value="no"/>
141 <param name="filter" value="yes"/> 148 <param name="read_group" value="rg1"/>
142 <param name="reqBits" value="0x0080"/> 149 <param name="outputtype" value="sam"/>
143 <param name="outputtype" value="sam"/> 150 <output name="output1">
144 <output name="output1"> 151 <assert_contents>
145 <assert_contents> 152 <has_text text="rg1" />
146 <has_text text="141" /> 153 <not_has_text text="rg2" />
147 <not_has_text text="77" /> 154 </assert_contents>
148 </assert_contents> 155 </output>
149 </output> 156 </test>
150 </test> 157 <test>
151 <test> 158 <param name="input1" value="bam_to_sam_in1.sam" ftype="sam" />
152 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> 159 <param name="header" value=""/>
153 <param name="header" value=""/> 160 <param name="filter" value="yes"/>
154 <param name="filter" value="no"/> 161 <param name="skipBits" value="0x0008"/>
155 <param name="read_group" value="rg1"/> 162 <param name="mapq" value="250"/>
156 <param name="outputtype" value="sam"/> 163 <param name="outputtype" value="sam"/>
157 <output name="output1"> 164 <output name="output1">
158 <assert_contents> 165 <assert_contents>
159 <has_text text="rg1" /> 166 <has_text text="both_reads_align_clip_marked" />
160 <not_has_text text="rg2" /> 167 <not_has_text text="both_reads_present_only_first_aligns" />
161 </assert_contents> 168 </assert_contents>
162 </output> 169 </output>
163 </test> 170 </test>
164 <test> 171 </tests>
165 <param name="input1" value="bam_to_sam_in1.sam" ftype="sam" /> 172 <help><![CDATA[
166 <param name="header" value=""/>
167 <param name="filter" value="yes"/>
168 <param name="skipBits" value="0x0008"/>
169 <param name="mapq" value="250"/>
170 <param name="outputtype" value="sam"/>
171 <output name="output1">
172 <assert_contents>
173 <has_text text="both_reads_align_clip_marked" />
174 <not_has_text text="both_reads_present_only_first_aligns" />
175 </assert_contents>
176 </output>
177 </test>
178 </tests>
179 <help>
180 **What it does** 173 **What it does**
181 174
182 This tool uses the samtools view command in SAMtools_ toolkit to filter a SAM or BAM file on the MAPQ (mapping quality), FLAG bits, Read Group, Library, or region. 175 This tool uses the samtools view command in SAMtools_ toolkit to filter a SAM or BAM file on the MAPQ (mapping quality), FLAG bits, Read Group, Library, or region.
183 176
184 **Input** 177 **Input**
204 197
205 Multiple regions may be specified, separated by a space character:: 198 Multiple regions may be specified, separated by a space character::
206 199
207 chr2:1000000-2000000 chr2:1,000,000-2,000,000 chrX 200 chr2:1000000-2000000 chr2:1,000,000-2,000,000 chrX
208 201
209
210
211 .. _SAMtools: http://www.htslib.org/ 202 .. _SAMtools: http://www.htslib.org/
212 203 ]]></help>
213 </help> 204 <citations>
205 <citation type="doi">10.1093/bioinformatics/btp352</citation>
206 </citations>
214 </tool> 207 </tool>