Mercurial > repos > devteam > samtool_filter2
annotate samtool_filter2.xml @ 13:aa8dc5cf70be draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
| author | devteam |
|---|---|
| date | Thu, 17 Mar 2016 11:41:18 -0400 |
| parents | 543405859e60 |
| children | cc2b231ab5e1 |
| rev | line source |
|---|---|
|
13
aa8dc5cf70be
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
devteam
parents:
12
diff
changeset
|
1 <tool id="samtool_filter2" name="Filter SAM or BAM, output SAM or BAM" version="1.1.2"> |
| 7 | 2 <description>files on FLAG MAPQ RG LN or by region</description> |
| 3 <requirements> | |
|
13
aa8dc5cf70be
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
devteam
parents:
12
diff
changeset
|
4 <requirement type="package" version="1.2">samtools</requirement> |
| 7 | 5 </requirements> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
6 <stdio> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
7 <exit_code range="1:" /> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
8 </stdio> |
| 7 | 9 <command> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
10 <![CDATA[ |
| 7 | 11 ##set up input files, regions requires input.bam and input.bai |
| 12 #if isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension('bam').__class__): | |
| 13 #set $input = 'input.bam' | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
14 ln -s "$input1" $input && |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
15 ln -s "$input1.metadata.bam_index" input.bai && |
| 7 | 16 #elif isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension('sam').__class__): |
| 17 #set $input = 'input.sam' | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
18 ln -s "$input1" $input && |
| 7 | 19 #end if |
|
13
aa8dc5cf70be
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
devteam
parents:
12
diff
changeset
|
20 samtools view $possibly_select_inverse "$output1" $header |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
21 |
| 7 | 22 #if $input1.datatype.file_ext == 'sam': |
| 23 -S | |
| 24 #end if | |
| 25 | |
| 26 #if $outputtype.__str__ == "bam": | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
27 -b |
| 7 | 28 #end if |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
29 |
| 7 | 30 #if $mapq.__str__ != '': |
| 31 -q $mapq | |
| 32 #end if | |
| 33 #if $flag.filter.__str__ == 'yes': | |
| 34 #if $flag.reqBits.__str__ != 'None': | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
35 #set $reqs = $flag.reqBits.__str__.split(',') |
| 7 | 36 #set $reqFlag = 0 |
| 37 #for $xn in $reqs: | |
| 38 #set $reqFlag += int(xn,16) | |
| 39 #end for | |
| 40 -f $hex($reqFlag) | |
| 41 #end if | |
| 42 #if $flag.skipBits.__str__ != 'None': | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
43 #set $skips = $flag.skipBits.__str__.split(',') |
| 7 | 44 #set $skipFlag = 0 |
| 45 #for $xn in $skips: | |
| 46 #set $skipFlag += int(xn,16) | |
| 47 #end for | |
| 48 -F $hex($skipFlag) | |
| 49 #end if | |
| 50 #end if | |
| 51 #if $read_group.__str__.strip() != '': | |
| 52 -r $read_group | |
| 53 #end if | |
| 54 #if $library.__str__.strip() != '': | |
| 55 -l $library | |
| 56 #end if | |
| 57 #if $bed_file.__str__ != "None" and len($bed_file.__str__) > 0: | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
58 -L "$bed_file" |
| 7 | 59 #end if |
| 60 $input | |
| 61 #if $regions.__str__.strip() != '' and $input1.datatype.file_ext == 'bam': | |
| 62 $regions.__str__.strip() | |
| 63 #end if | |
| 64 ## need to redirect stderr message so galaxy does not think this failed | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
65 2>&1 |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
66 ]]> |
| 7 | 67 </command> |
| 68 <inputs> | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
69 <param name="input1" type="data" format="sam,bam" label="SAM or BAM file to filter" /> |
| 7 | 70 <param name="header" type="select" label="Header in output"> |
| 71 <option value="-h">Include Header</option> | |
| 72 <option value="">Exclude Header</option> | |
| 73 <option value="-H">Only the Header</option> | |
| 74 </param> | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
75 <param name="mapq" type="integer" value="" optional="true" label="Minimum MAPQ quality score" help="(-q)"> |
| 7 | 76 <validator type="in_range" message="The MAPQ quality score can't be negative" min="0"/> |
| 77 </param> | |
| 78 <conditional name="flag"> | |
| 79 <param name="filter" type="select" label="Filter on bitwise flag"> | |
| 80 <option value="no">no</option> | |
| 81 <option value="yes">yes</option> | |
| 82 </param> | |
| 83 <when value="no"/> | |
| 84 <when value="yes"> | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
85 <param name="reqBits" type="select" multiple="true" display="checkboxes" label="Only output alignments with all of these flag bits set" help="(-f)"> |
| 7 | 86 <option value="0x0001">Read is paired</option> |
| 87 <option value="0x0002">Read is mapped in a proper pair</option> | |
| 88 <option value="0x0004">The read is unmapped</option> | |
| 89 <option value="0x0008">The mate is unmapped</option> | |
| 90 <option value="0x0010">Read strand</option> | |
| 91 <option value="0x0020">Mate strand</option> | |
| 92 <option value="0x0040">Read is the first in a pair</option> | |
| 93 <option value="0x0080">Read is the second in a pair</option> | |
| 94 <option value="0x0100">The alignment or this read is not primary</option> | |
| 95 <option value="0x0200">The read fails platform/vendor quality checks</option> | |
| 96 <option value="0x0400">The read is a PCR or optical duplicate</option> | |
| 97 </param> | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
98 <param name="skipBits" type="select" multiple="true" display="checkboxes" label="Skip alignments with any of these flag bits set" help="(-F)"> |
| 7 | 99 <option value="0x0001">Read is paired</option> |
| 100 <option value="0x0002">Read is mapped in a proper pair</option> | |
| 101 <option value="0x0004">The read is unmapped</option> | |
| 102 <option value="0x0008">The mate is unmapped</option> | |
| 103 <option value="0x0010">Read strand</option> | |
| 104 <option value="0x0020">Mate strand</option> | |
| 105 <option value="0x0040">Read is the first in a pair</option> | |
| 106 <option value="0x0080">Read is the second in a pair</option> | |
| 107 <option value="0x0100">The alignment or this read is not primary</option> | |
| 108 <option value="0x0200">The read fails platform/vendor quality checks</option> | |
| 109 <option value="0x0400">The read is a PCR or optical duplicate</option> | |
| 110 </param> | |
| 111 </when> | |
| 112 </conditional> | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
113 <param name="library" type="text" value="" label="Select alignments from Library" |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
114 help="(-l) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
115 <param name="read_group" type="text" value="" label="Select alignments from Read Group" |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
116 help="(-r) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
117 <param name="bed_file" type="data" format="bed" optional="true" label="Output alignments overlapping the regions in the BED FILE" help="(-L)"/> |
|
13
aa8dc5cf70be
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
devteam
parents:
12
diff
changeset
|
118 <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" /> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
119 <param name="regions" type="text" value="" label="Select regions (only used when the input is in BAM format)" |
| 7 | 120 help="region should be presented in one of the following formats: `chr1', `chr2:1,000' and `chr3:1000-2,000'"/> |
| 121 <param name="outputtype" type="select" label="Select the output format"> | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
122 <option value="bam">BAM (-b)</option> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
123 <option value="sam">SAM</option> |
| 7 | 124 </param> |
| 125 </inputs> | |
| 126 <outputs> | |
| 11 | 127 <data name="output1" format="sam" label="${tool.name} on ${on_string}: ${outputtype}"> |
|
9
ce2ed9f2d811
added test data from samtools_filter, renamed xml file, fixed tests, changed changeset revision of dependency
Dorine <dorine@bx.psu.edu>
parents:
8
diff
changeset
|
128 <change_format> |
|
ce2ed9f2d811
added test data from samtools_filter, renamed xml file, fixed tests, changed changeset revision of dependency
Dorine <dorine@bx.psu.edu>
parents:
8
diff
changeset
|
129 <when input="outputtype" value="bam" format="bam" /> |
| 7 | 130 </change_format> |
| 131 </data> | |
| 132 </outputs> | |
| 133 <tests> | |
| 134 <test> | |
| 135 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> | |
| 136 <param name="header" value=""/> | |
| 137 <param name="filter" value="yes"/> | |
| 138 <param name="reqBits" value="0x0080"/> | |
|
9
ce2ed9f2d811
added test data from samtools_filter, renamed xml file, fixed tests, changed changeset revision of dependency
Dorine <dorine@bx.psu.edu>
parents:
8
diff
changeset
|
139 <param name="outputtype" value="sam"/> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
140 <output name="output1"> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
141 <assert_contents> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
142 <has_text text="141" /> |
| 7 | 143 <not_has_text text="77" /> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
144 </assert_contents> |
| 7 | 145 </output> |
| 146 </test> | |
| 147 <test> | |
| 148 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> | |
| 149 <param name="header" value=""/> | |
| 150 <param name="filter" value="no"/> | |
| 151 <param name="read_group" value="rg1"/> | |
|
9
ce2ed9f2d811
added test data from samtools_filter, renamed xml file, fixed tests, changed changeset revision of dependency
Dorine <dorine@bx.psu.edu>
parents:
8
diff
changeset
|
152 <param name="outputtype" value="sam"/> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
153 <output name="output1"> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
154 <assert_contents> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
155 <has_text text="rg1" /> |
| 7 | 156 <not_has_text text="rg2" /> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
157 </assert_contents> |
| 7 | 158 </output> |
| 159 </test> | |
| 160 <test> | |
| 161 <param name="input1" value="bam_to_sam_in1.sam" ftype="sam" /> | |
| 162 <param name="header" value=""/> | |
| 163 <param name="filter" value="yes"/> | |
| 164 <param name="skipBits" value="0x0008"/> | |
| 165 <param name="mapq" value="250"/> | |
|
9
ce2ed9f2d811
added test data from samtools_filter, renamed xml file, fixed tests, changed changeset revision of dependency
Dorine <dorine@bx.psu.edu>
parents:
8
diff
changeset
|
166 <param name="outputtype" value="sam"/> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
167 <output name="output1"> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
168 <assert_contents> |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
169 <has_text text="both_reads_align_clip_marked" /> |
| 7 | 170 <not_has_text text="both_reads_present_only_first_aligns" /> |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
171 </assert_contents> |
| 7 | 172 </output> |
| 173 </test> | |
| 174 </tests> | |
| 175 <help> | |
| 176 **What it does** | |
| 177 | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
178 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. |
| 7 | 179 |
| 180 **Input** | |
| 181 | |
| 182 Input is either a SAM or BAM file. | |
| 183 | |
| 184 **Output** | |
| 185 | |
| 186 The output file will be SAM or BAM (depending on the chosen option), filtered by the selected options. | |
| 187 | |
| 188 **Options** | |
| 189 | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
190 Filtering by read group or library requires headers in the input SAM or BAM file. |
| 7 | 191 |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
192 If regions are specified, only alignments overlapping the specified regions will be output. An alignment may be given multiple times if it is overlapping several regions. |
| 7 | 193 A region can be presented, for example, in the following format:: |
| 194 | |
| 195 chr2 (the whole chr2) | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
196 chr2:1000000 (region starting from 1,000,000bp) |
|
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
197 chr2:1,000,000-2,000,000 (region between 1,000,000 and 2,000,000bp including the end points). |
| 7 | 198 |
| 199 Note: The coordinate is 1-based. | |
| 200 | |
| 201 Multiple regions may be specified, separated by a space character:: | |
| 202 | |
| 203 chr2:1000000-2000000 chr2:1,000,000-2,000,000 chrX | |
| 204 | |
| 205 | |
| 206 | |
|
12
543405859e60
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
11
diff
changeset
|
207 .. _SAMtools: http://samtools.sourceforge.net/ |
| 7 | 208 |
| 209 </help> | |
| 210 </tool> |
