view sam_to_bam.xml @ 0:d59a7ac34414 draft

Uploaded tool tarball.
author devteam
date Tue, 20 Aug 2013 11:59:47 -0400
parents
children 7095d651c95f
line wrap: on
line source

<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" version="0.1.18">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

------

**Citation**

For the underlying tool, please cite `Li H, Handsaker B, Wysoker A, Fennell T, Ruan J, Homer N, Marth G, Abecasis G, Durbin R; 1000 Genome Project Data Processing Subgroup. The Sequence Alignment/Map format and SAMtools. Bioinformatics. 2009 Aug 15;25(16):2078-9. &lt;http://www.ncbi.nlm.nih.gov/pubmed/19505943&gt;`_

  </help>
</tool>