Mercurial > repos > lomereiter > sambamba_filter
annotate sambamba_filter.xml @ 5:123168c85390
updated to 0.4.7; use precompiled binaries
author | lomereiter <lomereiter@gmail.com> |
---|---|
date | Tue, 04 Nov 2014 18:34:37 +0300 |
parents | a03e95059256 |
children |
rev | line source |
---|---|
5
123168c85390
updated to 0.4.7; use precompiled binaries
lomereiter <lomereiter@gmail.com>
parents:
3
diff
changeset
|
1 <tool id="sambamba_filter" name="Filter BAM or SAM" version="1.1"> |
3 | 2 <requirements> |
5
123168c85390
updated to 0.4.7; use precompiled binaries
lomereiter <lomereiter@gmail.com>
parents:
3
diff
changeset
|
3 <requirement type="package" version="0.4.7">sambamba</requirement> |
3 | 4 </requirements> |
5 <description> | |
6 on flags, fields, and tags using Sambamba | |
7 </description> | |
8 <version_command>sambamba 2>&1 | grep "sambamba v" | sed 's/^sambamba v\(.*\)/\1/'</version_command> | |
9 <command> | |
10 #if $query != None: | |
11 #set $query = $query.replace('__sq__', '\'') | |
12 #set $query = $query.replace('__ob__', '[') | |
13 #set $query = $query.replace('__cb__', ']') | |
14 #set $query = $query.replace('__dq__', '"') | |
15 #set $query = $query.replace('__oc__', '{') | |
16 #set $query = $query.replace('__cc__', '}') | |
17 #set $query = $query.replace('__gt__', chr(62)) | |
18 #set $query = $query.replace('__lt__', chr(60)) | |
19 #end if | |
20 #set $input1 = 'input.bam' | |
21 ln -s $input $input1 && | |
22 ln -s $input.metadata.bam_index input.bai && | |
5
123168c85390
updated to 0.4.7; use precompiled binaries
lomereiter <lomereiter@gmail.com>
parents:
3
diff
changeset
|
23 sambamba view -t \${GALAXY_SLOTS:-8} |
3 | 24 #if $query != "": |
25 --filter="$query" | |
26 #end if | |
27 -f bam -o $outfile $input1 $region | |
28 </command> | |
29 <inputs> | |
30 <param name="input" type="data" format="bam" label="BAM or SAM file to filter"/> | |
31 <param name="query" type="text" size="80"> | |
32 <label>Filter expression</label> | |
33 <help>See below for query syntax.</help> | |
34 </param> | |
35 | |
36 <param name="region" type="text" size="40" label="Region in format chr:beg-end"> | |
37 <help> | |
38 Regions can be specified as 'chr2' (the whole chr2), 'chr2:1000000' (region starting from 1,000,000bp) or 'chr2:1,000,000-2,000,000' (region between 1,000,000 and 2,000,000bp including the end points). The coordinates are 1-based. | |
39 </help> | |
40 </param> | |
41 </inputs> | |
42 <outputs> | |
43 <data name="outfile" format="bam"></data> | |
44 </outputs> | |
45 <stdio> | |
46 <exit_code range="1:" level="fatal" description="Error occured" /> | |
47 </stdio> | |
48 <tests> | |
49 <test> | |
50 <param name="input" value="ex1_header.sam" ftype="sam" /> | |
51 <param name="query" value="[H0] == 1 and read_name =~ /^EAS51_62/" /> | |
52 <param name="format" value="bam" /> | |
53 <param name="region" value="" /> | |
54 <output name="outfile" file="ex1_header_filtered.bam" ftype="bam" /> | |
55 </test> | |
56 <test> | |
57 <param name="input" value="c1215_fixmate.bam" ftype="bam" /> | |
58 <param name="query" value="[MD] =~ /^\d+T\d+A\d+/ and first_of_pair" /> | |
59 <param name="format" value="sam" /> | |
60 <param name="region" value="AL096846:1000-5000" /> | |
61 <output name="outfile" file="c1215_fixmate_filtered.sam" ftype="sam" /> | |
62 </test> | |
63 </tests> | |
64 <help> | |
65 Sambamba Filter Overview | |
66 ======================== | |
67 | |
68 This tool uses the sambamba_ ``view`` command to filter BAM/SAM on flags, fields, tags, and region. Input is SAM or BAM file. | |
69 | |
70 | |
71 Filter Syntax | |
72 ============= | |
73 | |
74 A *filter expression* is a number of *basic conditions* linked by ``and``, ``or``, ``not`` logical operators, and enclosed in parentheses where needed. | |
75 | |
76 *Basic condition* is a one for a single record field, tag, or flag. | |
77 | |
78 You can use ``==,`` ``!=,`` ``>``, ``<``, ``>=``, ``<=`` comparison operators for both integers and strings. | |
79 | |
80 Strings are delimited by single quotes, if you need a single quote inside a string, escape it with ``\\``. | |
81 | |
82 Examples of filter expressions | |
83 ------------------------------ | |
84 | |
85 :: | |
86 | |
87 mapping_quality >= 30 and ([RG] =~ /^abcd/ or [NM] == 7) | |
88 read_name == 'abc\'def' | |
89 | |
90 Basic conditions for flags | |
91 -------------------------- | |
92 | |
93 The following flag names are recognized: | |
94 * paired | |
95 * proper_pair | |
96 * unmapped | |
97 * mate_is_unmapped | |
98 * reverse_strand | |
99 * mate_is_reverse_strand | |
100 * first_of_pair | |
101 * second_of_pair | |
102 * secondary_alignment | |
103 * failed_quality_control | |
104 * duplicate | |
105 | |
106 Example | |
107 ~~~~~~~ | |
108 | |
109 :: | |
110 | |
111 not (unmapped or mate_is_unmapped) and first_of_pair | |
112 | |
113 Basic conditions for fields | |
114 --------------------------- | |
115 | |
116 Conditions for integer and string fields are supported. | |
117 | |
118 List of integer fields: | |
119 * ref_id | |
120 * position | |
121 * mapping_quality | |
122 * sequence_length | |
123 * mate_ref_id | |
124 * mate_position | |
125 * template_length | |
126 | |
127 | |
128 List of string fields: | |
129 * read_name | |
130 * sequence | |
131 * cigar | |
132 | |
133 | |
134 Example | |
135 ~~~~~~~ | |
136 | |
137 :: | |
138 | |
139 ref_id == 3 and mapping_quality >= 50 and sequence_length >= 80 | |
140 | |
141 Basic conditions for tags | |
142 ------------------------- | |
143 | |
144 Tags are denoted by their names in square brackets, for instance, ``[RG]`` or ``[Q2].`` They support conditions for both integers and strings, i.e. the tag must also hold value of the corresponding type. | |
145 | |
146 In order to do filtering based on the presence of a particular tag, you can use special ``null`` value. | |
147 | |
148 Example | |
149 ~~~~~~~ | |
150 | |
151 :: | |
152 | |
153 [RG] != null and [AM] == 37 | |
154 | |
155 ----- | |
156 | |
157 .. _sambamba: http://github.com/lomereiter/sambamba | |
158 | |
159 </help> | |
160 </tool> |