Mercurial > repos > lomereiter > sambamba_filter
view sambamba_filter.xml @ 1:806b3253c996
add test data
author | lomereiter |
---|---|
date | Tue, 14 Aug 2012 21:25:40 +0400 |
parents | 668e187566d5 |
children |
line wrap: on
line source
<tool id="sambamba_filter" name="Filter BAM or SAM" version="0.2.4"> <requirements> <requirement type="binary">sambamba</requirement> </requirements> <description> on flags, fields, and tags </description> <command> #if $query != None: #set $query = $query.replace('__sq__', '\'') #set $query = $query.replace('__ob__', '[') #set $query = $query.replace('__cb__', ']') #set $query = $query.replace('__dq__', '"') #set $query = $query.replace('__oc__', '{') #set $query = $query.replace('__cc__', '}') #set $query = $query.replace('__gt__', chr(62)) #set $query = $query.replace('__lt__', chr(60)) #end if #if isinstance($input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('bam').__class__): #set $input1 = 'input.bam' ln -s $input $input1 && ln -s $input.metadata.bam_index input.bai && sambamba view -h --filter="$query" -f $outputformat.format -o $outfile $input1 $region #else sambamba view -S -h --filter="$query" -f $outputformat.format -o $outfile $input #end if </command> <inputs> <param name="input" type="data" format="bam,sam" label="BAM or SAM file to filter"/> <param name="query" type="text" size="80"> <label>Filter expression</label> <help> The syntax is described at sambamba wiki: https://github.com/lomereiter/sambamba/wiki/%5Bsambamba-view%5D-Filter-expression-syntax </help> </param> <conditional name="outputformat"> <param name="format" type="select"> <label>Output format</label> <option value="sam">SAM</option> <option value="bam">BAM</option> </param> <when value="sam"> <!-- TODO <param name="header" type="select"> <label>Include SAM header in output</label> <option value="yes">Yes</option> <option value="no">No</option> </param>--> </when> <when value="bam"/> </conditional> <param name="region" type="text" size="40" label="Region in format chr:beg-end, works for BAM input only"> <help> The syntax is the same as in samtools, start and end coordinates are 1-based. </help> </param> </inputs> <outputs> <data name="outfile" format="bam"> <change_format> <when input="outputformat.format" value="sam" format="sam"/> </change_format> </data> </outputs> <tests> <test> <param name="input" value="ex1_header.sam" ftype="sam" /> <param name="query" value="[H0] == 1 and read_name =~ /^EAS51_62/" /> <param name="format" value="bam" /> <param name="region" value="" /> <output name="outfile" file="ex1_header_filtered.bam" ftype="bam" /> </test> <test> <param name="input" value="c1215_fixmate.bam" ftype="bam" /> <param name="query" value="[MD] =~ /^\d+T\d+A\d+/ and first_of_pair" /> <param name="format" value="sam" /> <!--<param name="header" value="yes" />--> <param name="region" value="AL096846:1000-5000" /> <output name="outfile" file="c1215_fixmate_filtered.sam" ftype="sam" /> </test> </tests> <help> **What it does** This tool uses sambamba view to filter BAM/SAM on flags, fields, tags, and region. In order to install sambamba, visit its website_ and either download a Debian package for your architecture, or build the tool from source. Input is SAM or BAM file, output is chosen by user. **Note** Filtering by region works only for coordinate-sorted BAM files. For SAM files this parameter is ignored. ----- .. _website: http://github.com/lomereiter/sambamba </help> </tool>