[2] | 1 | <tool id="sam_to_bam" name="SAM-to-BAM" version="1.1.0"> |
---|
| 2 | <description>converts SAM format to BAM format</description> |
---|
| 3 | <requirements> |
---|
| 4 | <requirement type="package">samtools</requirement> |
---|
| 5 | </requirements> |
---|
| 6 | <command interpreter="python"> |
---|
| 7 | sam_to_bam.py --input1=$source.input1 --dbkey=${input1.metadata.dbkey} |
---|
| 8 | #if $source.index_source == "history": |
---|
| 9 | --ref_file=$source.ref_file |
---|
| 10 | #else |
---|
| 11 | --ref_file="None" |
---|
| 12 | #end if |
---|
| 13 | --output1=$output1 --index_dir=${GALAXY_DATA_INDEX_DIR} |
---|
| 14 | </command> |
---|
| 15 | <inputs> |
---|
| 16 | <conditional name="source"> |
---|
| 17 | <param name="index_source" type="select" label="Choose the source for the reference list"> |
---|
| 18 | <option value="cached">Locally cached</option> |
---|
| 19 | <option value="history">History</option> |
---|
| 20 | </param> |
---|
| 21 | <when value="cached"> |
---|
| 22 | <param name="input1" type="data" format="sam" label="SAM File to Convert"> |
---|
| 23 | <validator type="unspecified_build" /> |
---|
| 24 | <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" /> |
---|
| 25 | </param> |
---|
| 26 | </when> |
---|
| 27 | <when value="history"> |
---|
| 28 | <param name="input1" type="data" format="sam" label="Convert SAM file" /> |
---|
| 29 | <param name="ref_file" type="data" format="fasta" label="Using reference file" /> |
---|
| 30 | </when> |
---|
| 31 | </conditional> |
---|
| 32 | </inputs> |
---|
| 33 | <outputs> |
---|
| 34 | <data name="output1" format="bam"/> |
---|
| 35 | </outputs> |
---|
| 36 | <tests> |
---|
| 37 | <test> |
---|
| 38 | <!-- |
---|
| 39 | Sam-to-Bam command: |
---|
| 40 | samtools faidx chr_m.fasta |
---|
| 41 | samtools view -bt chr_m.fasta.fai -o unsorted.bam test-data/3.sam |
---|
| 42 | samtools sort unsorted.bam sam_to_bam_out1 |
---|
| 43 | chr_m.fasta is the reference file |
---|
| 44 | --> |
---|
| 45 | <param name="index_source" value="history" /> |
---|
| 46 | <param name="input1" value="3.sam" ftype="sam" /> |
---|
| 47 | <param name="ref_file" value="chr_m.fasta" ftype="fasta" dbkey="equCab2" /> |
---|
| 48 | <output name="output1" file="sam_to_bam_out1.bam" /> |
---|
| 49 | </test> |
---|
| 50 | <test> |
---|
| 51 | <!-- |
---|
| 52 | Sam-to-Bam command: |
---|
| 53 | samtools view -bt chr_m.fasta.fai -o unsorted.bam test-data/3.sam |
---|
| 54 | samtools sort unsorted.bam sam_to_bam_out2 |
---|
| 55 | chr_m.fasta is the reference file and the index chr_m.fasta.fai |
---|
| 56 | should be in the same directory |
---|
| 57 | --> |
---|
| 58 | <param name="index_source" value="cached" /> |
---|
| 59 | <param name="input1" value="3.sam" ftype="sam" dbkey="equCab2" /> |
---|
| 60 | <param name="output1" file="sam_to_bam_out2.bam" /> |
---|
| 61 | </test> |
---|
| 62 | </tests> |
---|
| 63 | <help> |
---|
| 64 | |
---|
| 65 | **What it does** |
---|
| 66 | |
---|
| 67 | This tool uses the SAMTools_ toolkit to produce an indexed BAM file based on a sorted input SAM file. |
---|
| 68 | |
---|
| 69 | .. _SAMTools: http://samtools.sourceforge.net/samtools.shtml |
---|
| 70 | |
---|
| 71 | </help> |
---|
| 72 | </tool> |
---|