6
|
1 <tool id="sam_to_bam" name="SAM-to-BAM" version="2.0">
|
|
2 <description>convert SAM to BAM</description>
|
|
3 <macros>
|
|
4 <import>macros.xml</import>
|
|
5 </macros>
|
|
6 <expand macro="requirements"></expand>
|
|
7 <expand macro="version_command"></expand>
|
|
8 <expand macro="stdio"></expand>
|
|
9 <command>
|
|
10 <![CDATA[
|
|
11 samtools sort -O bam -@ \${GALAXY_SLOTS:-1} -o sorted_input.bam -T temp "$input1" &&
|
|
12 #if $source.index_source == "history":
|
|
13 ln -s $source.ref_file input.fa &&
|
|
14 samtools faidx input.fa &&
|
|
15 #else
|
|
16 ln -s ${source.index.fields.path} input.fa &&
|
|
17 ln -s ${source.index.fields.path}.fai input.fa.fai &&
|
|
18 #end if
|
|
19 samtools view -@ \${GALAXY_SLOTS:-1} -b -h -o $output1 -T input.fa sorted_input.bam
|
|
20 ]]>
|
|
21 </command>
|
|
22 <inputs>
|
|
23 <conditional name="source">
|
|
24 <param label="Choose the source for the reference genome" name="index_source" type="select">
|
|
25 <option value="cached">Use a built-in genome</option>
|
|
26 <option value="history">Use a genome from the history</option>
|
|
27 </param>
|
|
28 <when value="cached">
|
|
29 <param format="sam" label="SAM file to convert" metadata_name="dbkey" name="input1" type="data">
|
|
30 <validator type="unspecified_build" />
|
|
31 <validator message="Sequences are not currently available for the specified build." metadata_column="1" metadata_name="dbkey" table_name="fasta_indexes" type="dataset_metadata_in_data_table" />
|
|
32 </param>
|
|
33 <param label="Using reference genome" name="index" type="select">
|
|
34 <options from_data_table="fasta_indexes">
|
|
35 <filter column="1" key="dbkey" ref="input1" type="data_meta" />
|
|
36 <validator message="No reference genome is available for the build associated with the selected input dataset" type="no_options" />
|
|
37 </options>
|
|
38 </param>
|
|
39 </when>
|
|
40 <when value="history">
|
|
41 <param format="sam" label="SAM file to convert" name="input1" type="data" />
|
|
42 <param format="fasta" label="Using reference file" metadata_name="dbkey" name="ref_file" type="data" />
|
|
43 </when>
|
0
|
44 </conditional>
|
6
|
45 </inputs>
|
|
46 <outputs>
|
|
47 <data format="bam" label="${tool.name} on ${on_string}: converted BAM" name="output1">
|
|
48 <actions>
|
|
49 <conditional name="source.index_source">
|
|
50 <when value="cached">
|
|
51 <action name="dbkey" type="metadata">
|
|
52 <option name="source.input1" param_attribute="dbkey" type="from_param" />
|
|
53 </action>
|
|
54 </when>
|
|
55 <when value="history">
|
|
56 <action name="dbkey" type="metadata">
|
|
57 <option name="source.ref_file" param_attribute="dbkey" type="from_param" />
|
|
58 </action>
|
|
59 </when>
|
|
60 </conditional>
|
|
61 </actions>
|
|
62 </data>
|
|
63 </outputs>
|
|
64 <tests>
|
|
65 <test>
|
|
66 <param name="index_source" value="history" />
|
|
67 <param name="input1" ftype="sam" value="sam_to_bam_in1.sam" />
|
|
68 <param dbkey="equCab2" ftype="fasta" name="ref_file" value="chr_m.fasta" />
|
|
69 <output file="sam_to_bam_out1.bam" ftype="bam" name="output1" />
|
|
70 </test>
|
|
71 </tests>
|
|
72 <help>
|
|
73 <![CDATA[
|
0
|
74 **What it does**
|
|
75
|
6
|
76 Converts SAM dataset into its binary, BAM, representation using ``samtools sort`` and ``view`` commands::
|
0
|
77
|
6
|
78 samtools sort -O bam -o sorted_input.bam [INPUT SAM]
|
|
79 samtools view -b -h -o -T [REFERENCE GENOME] [OUTPUT BAM] sorted_input.bam
|
0
|
80
|
6
|
81 ]]>
|
0
|
82 </help>
|
6
|
83 <expand macro="citations"></expand>
|
0
|
84 </tool>
|