changeset 0:668e187566d5

uploaded xml wrapper
author lomereiter
date Mon, 13 Aug 2012 02:13:09 -0400
parents
children 806b3253c996
files sambamba_filter.xml
diffstat 1 files changed, 90 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sambamba_filter.xml	Mon Aug 13 02:13:09 2012 -0400
@@ -0,0 +1,90 @@
+<tool id="sambamba_filter" name="Filter BAM or SAM" version="0.2.3">
+    <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 $outputformat.format == 'bam':
+			#set $header = ''
+		#else
+			#set $header = $outputformat.header
+		#end if
+        #if isinstance($input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('bam').__class__):
+            #set $input1 = 'input.bam'
+            ln -s $input $input1 &amp;&amp;
+            ln -s $input.metadata.bam_index input.bai &amp;&amp;
+			sambamba view --filter="$query" -f $outputformat.format -o $outfile $input1 $header $region
+		#else
+            sambamba view -S --filter="$query" -f $outputformat.format -o $outfile $input $header
+        #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">
+				<param name="header" type="select">
+					<label>Include SAM header in output</label>
+					<option value="-h">Yes</option>
+					<option value="">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>
+    <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 just ignored.
+
+-----
+
+.. _website: http://github.com/lomereiter/sambamba
+
+
+    </help>
+    <!-- TODO: tests -->
+</tool>