comparison sambamba_filter.xml @ 1:806b3253c996

add test data
author lomereiter
date Tue, 14 Aug 2012 21:25:40 +0400
parents 668e187566d5
children
comparison
equal deleted inserted replaced
0:668e187566d5 1:806b3253c996
1 <tool id="sambamba_filter" name="Filter BAM or SAM" version="0.2.3"> 1 <tool id="sambamba_filter" name="Filter BAM or SAM" version="0.2.4">
2 <requirements> 2 <requirements>
3 <requirement type="binary">sambamba</requirement> 3 <requirement type="binary">sambamba</requirement>
4 </requirements> 4 </requirements>
5 <description> 5 <description>
6 on flags, fields, and tags 6 on flags, fields, and tags
7 </description> 7 </description>
8 <command> 8 <command>
9 #if $query != None: 9 #if $query != None:
10 #set $query = $query.replace('__sq__', '\'') 10 #set $query = $query.replace('__sq__', '\'')
11 #set $query = $query.replace('__ob__', '[') 11 #set $query = $query.replace('__ob__', '[')
12 #set $query = $query.replace('__cb__', ']') 12 #set $query = $query.replace('__cb__', ']')
13 #set $query = $query.replace('__dq__', '"') 13 #set $query = $query.replace('__dq__', '"')
14 #set $query = $query.replace('__oc__', '{') 14 #set $query = $query.replace('__oc__', '{')
15 #set $query = $query.replace('__cc__', '}') 15 #set $query = $query.replace('__cc__', '}')
16 #set $query = $query.replace('__gt__', chr(62)) 16 #set $query = $query.replace('__gt__', chr(62))
17 #set $query = $query.replace('__lt__', chr(60)) 17 #set $query = $query.replace('__lt__', chr(60))
18 #end if 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__): 19 #if isinstance($input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('bam').__class__):
25 #set $input1 = 'input.bam' 20 #set $input1 = 'input.bam'
26 ln -s $input $input1 &amp;&amp; 21 ln -s $input $input1 &amp;&amp;
27 ln -s $input.metadata.bam_index input.bai &amp;&amp; 22 ln -s $input.metadata.bam_index input.bai &amp;&amp;
28 sambamba view --filter="$query" -f $outputformat.format -o $outfile $input1 $header $region 23 sambamba view -h --filter="$query" -f $outputformat.format -o $outfile $input1 $region
29 #else 24 #else
30 sambamba view -S --filter="$query" -f $outputformat.format -o $outfile $input $header 25 sambamba view -S -h --filter="$query" -f $outputformat.format -o $outfile $input
31 #end if 26 #end if
32 </command> 27 </command>
33 <inputs> 28 <inputs>
34 <param name="input" type="data" format="bam,sam" label="BAM or SAM file to filter"/> 29 <param name="input" type="data" format="bam,sam" label="BAM or SAM file to filter"/>
35 <param name="query" type="text" size="80"> 30 <param name="query" type="text" size="80">
38 The syntax is described at sambamba wiki: https://github.com/lomereiter/sambamba/wiki/%5Bsambamba-view%5D-Filter-expression-syntax 33 The syntax is described at sambamba wiki: https://github.com/lomereiter/sambamba/wiki/%5Bsambamba-view%5D-Filter-expression-syntax
39 </help> 34 </help>
40 </param> 35 </param>
41 36
42 <conditional name="outputformat"> 37 <conditional name="outputformat">
43 <param name="format" type="select"> 38 <param name="format" type="select">
44 <label>Output format</label> 39 <label>Output format</label>
45 <option value="sam">SAM</option> 40 <option value="sam">SAM</option>
46 <option value="bam">BAM</option> 41 <option value="bam">BAM</option>
47 </param> 42 </param>
48 <when value="sam"> 43 <when value="sam">
49 <param name="header" type="select"> 44 <!-- TODO
50 <label>Include SAM header in output</label> 45 <param name="header" type="select">
51 <option value="-h">Yes</option> 46 <label>Include SAM header in output</label>
52 <option value="">No</option> 47 <option value="yes">Yes</option>
53 </param> 48 <option value="no">No</option>
54 </when> 49 </param>-->
55 <when value="bam"/> 50 </when>
51 <when value="bam"/>
56 </conditional> 52 </conditional>
57 <param name="region" type="text" size="40" label="Region in format chr:beg-end, works for BAM input only"> 53 <param name="region" type="text" size="40" label="Region in format chr:beg-end, works for BAM input only">
58 <help> 54 <help>
59 The syntax is the same as in samtools, start and end coordinates are 1-based. 55 The syntax is the same as in samtools, start and end coordinates are 1-based.
60 </help> 56 </help>
61 </param> 57 </param>
62 </inputs> 58 </inputs>
63 <outputs> 59 <outputs>
64 <data name="outfile" format="bam"> 60 <data name="outfile" format="bam">
65 <change_format> 61 <change_format>
66 <when input="outputformat.format" value="sam" format="sam"/> 62 <when input="outputformat.format" value="sam" format="sam"/>
67 </change_format> 63 </change_format>
68 </data> 64 </data>
69 </outputs> 65 </outputs>
66 <tests>
67 <test>
68 <param name="input" value="ex1_header.sam" ftype="sam" />
69 <param name="query" value="[H0] == 1 and read_name =~ /^EAS51_62/" />
70 <param name="format" value="bam" />
71 <param name="region" value="" />
72 <output name="outfile" file="ex1_header_filtered.bam" ftype="bam" />
73 </test>
74 <test>
75 <param name="input" value="c1215_fixmate.bam" ftype="bam" />
76 <param name="query" value="[MD] =~ /^\d+T\d+A\d+/ and first_of_pair" />
77 <param name="format" value="sam" />
78 <!--<param name="header" value="yes" />-->
79 <param name="region" value="AL096846:1000-5000" />
80 <output name="outfile" file="c1215_fixmate_filtered.sam" ftype="sam" />
81 </test>
82 </tests>
70 <help> 83 <help>
71 **What it does** 84 **What it does**
72 85
73 This tool uses sambamba view to filter BAM/SAM on flags, fields, tags, and region. 86 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 87 In order to install sambamba, visit its website_ and either download
76 89
77 Input is SAM or BAM file, output is chosen by user. 90 Input is SAM or BAM file, output is chosen by user.
78 91
79 **Note** 92 **Note**
80 93
81 Filtering by region works only for coordinate-sorted BAM files. For SAM files this parameter is just ignored. 94 Filtering by region works only for coordinate-sorted BAM files. For SAM files this parameter is ignored.
82 95
83 ----- 96 -----
84 97
85 .. _website: http://github.com/lomereiter/sambamba 98 .. _website: http://github.com/lomereiter/sambamba
86 99
87 100
88 </help> 101 </help>
89 <!-- TODO: tests -->
90 </tool> 102 </tool>