diff tools/samtools/sam_to_bam.xml @ 0:9071e359b9a3

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:37:19 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/samtools/sam_to_bam.xml	Fri Mar 09 19:37:19 2012 -0500
@@ -0,0 +1,91 @@
+<tool id="sam_to_bam" name="SAM-to-BAM" version="1.1.2">
+  <description>converts SAM format to BAM format</description>
+  <requirements>
+    <requirement type="package">samtools</requirement>
+  </requirements>
+  <command interpreter="python">
+    sam_to_bam.py
+      --input1=$source.input1
+      #if $source.index_source == "history":
+        --dbkey=${ref_file.metadata.dbkey} 
+        --ref_file=$source.ref_file
+      #else
+        --dbkey=${input1.metadata.dbkey} 
+      #end if
+      --output1=$output1
+      --index_dir=${GALAXY_DATA_INDEX_DIR}
+  </command>
+  <inputs>
+    <conditional name="source">
+      <param name="index_source" type="select" label="Choose the source for the reference list">
+        <option value="cached">Locally cached</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="input1" type="data" format="sam" metadata_name="dbkey" label="SAM File to Convert">
+           <validator type="unspecified_build" />
+           <validator type="dataset_metadata_in_file" filename="sam_fa_indices.loc" metadata_name="dbkey" metadata_column="1" message="Sequences are not currently available for the specified build." line_startswith="index" />
+        </param>
+      </when>
+      <when value="history">
+        <param name="input1" type="data" format="sam" label="Convert SAM file" />
+        <param name="ref_file" type="data" format="fasta" metadata_name="dbkey" label="Using reference file" />
+      </when>
+    </conditional>
+  </inputs>
+  <outputs>
+    <data format="bam" name="output1" label="${tool.name} on ${on_string}: converted BAM">
+      <actions>
+        <conditional name="source.index_source">
+          <when value="cached">
+            <action type="metadata" name="dbkey">
+              <option type="from_param" name="source.input1" param_attribute="dbkey" />
+            </action>
+          </when>
+          <when value="history">
+            <action type="metadata" name="dbkey">
+              <option type="from_param" name="source.ref_file" param_attribute="dbkey" />
+            </action>
+          </when>
+        </conditional>
+      </actions>
+    </data>
+  </outputs>
+  <tests>
+    <test>
+      <!--
+      Sam-to-Bam command:
+      cp test-data/chr_m.fasta .
+      samtools faidx chr_m.fasta
+      samtools view -hbt chr_m.fasta.fai -o unsorted.bam test-data/sam_to_bam_in1.sam
+      samtools sort unsorted.bam sam_to_bam_out1
+      chr_m.fasta is the reference file (chrM from equCab2)
+      -->
+      <param name="index_source" value="history" /> 
+      <param name="input1" value="sam_to_bam_in1.sam" ftype="sam" />
+      <param name="ref_file" value="chr_m.fasta" ftype="fasta" dbkey="equCab2" />
+      <output name="output1" file="sam_to_bam_out1.bam" ftype="bam" />
+    </test>
+    <test>
+      <!--
+      Sam-to-Bam command:
+      samtools view -hbt chr_m.fasta.fai -o unsorted.bam test-data/sam_to_bam_in1.sam
+      samtools sort unsorted.bam sam_to_bam_out2
+      chr_m.fasta is the reference file and the index chr_m.fasta.fai 
+      these should be in the same directory, and chrM is from equCab2
+      -->
+      <param name="index_source" value="cached" />
+      <param name="input1" value="sam_to_bam_in1.sam" ftype="sam" dbkey="chrM" />
+      <output name="output1" file="sam_to_bam_out2.bam" ftype="bam" />
+    </test>
+  </tests>
+  <help>
+
+**What it does**
+
+This tool uses the SAMTools_ toolkit to produce an indexed BAM file based on a sorted input SAM file.
+
+.. _SAMTools: http://samtools.sourceforge.net/samtools.shtml
+
+  </help>
+</tool>