0
|
1 <tool id="sambamba_filter" name="Filter BAM or SAM" version="0.2.3">
|
|
2 <requirements>
|
|
3 <requirement type="binary">sambamba</requirement>
|
|
4 </requirements>
|
|
5 <description>
|
|
6 on flags, fields, and tags
|
|
7 </description>
|
|
8 <command>
|
|
9 #if $query != None:
|
|
10 #set $query = $query.replace('__sq__', '\'')
|
|
11 #set $query = $query.replace('__ob__', '[')
|
|
12 #set $query = $query.replace('__cb__', ']')
|
|
13 #set $query = $query.replace('__dq__', '"')
|
|
14 #set $query = $query.replace('__oc__', '{')
|
|
15 #set $query = $query.replace('__cc__', '}')
|
|
16 #set $query = $query.replace('__gt__', chr(62))
|
|
17 #set $query = $query.replace('__lt__', chr(60))
|
|
18 #end if
|
|
19 #if $outputformat.format == 'bam':
|
|
20 #set $header = ''
|
|
21 #else
|
|
22 #set $header = $outputformat.header
|
|
23 #end if
|
|
24 #if isinstance($input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('bam').__class__):
|
|
25 #set $input1 = 'input.bam'
|
|
26 ln -s $input $input1 &&
|
|
27 ln -s $input.metadata.bam_index input.bai &&
|
|
28 sambamba view --filter="$query" -f $outputformat.format -o $outfile $input1 $header $region
|
|
29 #else
|
|
30 sambamba view -S --filter="$query" -f $outputformat.format -o $outfile $input $header
|
|
31 #end if
|
|
32 </command>
|
|
33 <inputs>
|
|
34 <param name="input" type="data" format="bam,sam" label="BAM or SAM file to filter"/>
|
|
35 <param name="query" type="text" size="80">
|
|
36 <label>Filter expression</label>
|
|
37 <help>
|
|
38 The syntax is described at sambamba wiki: https://github.com/lomereiter/sambamba/wiki/%5Bsambamba-view%5D-Filter-expression-syntax
|
|
39 </help>
|
|
40 </param>
|
|
41
|
|
42 <conditional name="outputformat">
|
|
43 <param name="format" type="select">
|
|
44 <label>Output format</label>
|
|
45 <option value="sam">SAM</option>
|
|
46 <option value="bam">BAM</option>
|
|
47 </param>
|
|
48 <when value="sam">
|
|
49 <param name="header" type="select">
|
|
50 <label>Include SAM header in output</label>
|
|
51 <option value="-h">Yes</option>
|
|
52 <option value="">No</option>
|
|
53 </param>
|
|
54 </when>
|
|
55 <when value="bam"/>
|
|
56 </conditional>
|
|
57 <param name="region" type="text" size="40" label="Region in format chr:beg-end, works for BAM input only">
|
|
58 <help>
|
|
59 The syntax is the same as in samtools, start and end coordinates are 1-based.
|
|
60 </help>
|
|
61 </param>
|
|
62 </inputs>
|
|
63 <outputs>
|
|
64 <data name="outfile" format="bam">
|
|
65 <change_format>
|
|
66 <when input="outputformat.format" value="sam" format="sam"/>
|
|
67 </change_format>
|
|
68 </data>
|
|
69 </outputs>
|
|
70 <help>
|
|
71 **What it does**
|
|
72
|
|
73 This tool uses sambamba view to filter BAM/SAM on flags, fields, tags, and region.
|
|
74 In order to install sambamba, visit its website_ and either download
|
|
75 a Debian package for your architecture, or build the tool from source.
|
|
76
|
|
77 Input is SAM or BAM file, output is chosen by user.
|
|
78
|
|
79 **Note**
|
|
80
|
|
81 Filtering by region works only for coordinate-sorted BAM files. For SAM files this parameter is just ignored.
|
|
82
|
|
83 -----
|
|
84
|
|
85 .. _website: http://github.com/lomereiter/sambamba
|
|
86
|
|
87
|
|
88 </help>
|
|
89 <!-- TODO: tests -->
|
|
90 </tool>
|