comparison tools/samtools_bam2fq/samtools_bam2fq.xml @ 0:c961d16801e4 draft default tip

Uploaded v0.0.2
author peterjc
date Tue, 04 Nov 2014 07:15:50 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c961d16801e4
1 <tool id="samtools_bam2fq" name="Convert BAM to FASTQ" version="0.0.2">
2 <description>samtools bam2fq</description>
3 <requirements>
4 <requirement type="binary">samtools</requirement>
5 <requirement type="package" version="1.1">samtools</requirement>
6 </requirements>
7 <version_command>samtools 2&gt;&amp;1 | grep -i "Version:"</version_command>
8 <command>
9 #if $action_mode.mode == "pairs":
10 ## Sort by name for pair-aware output (should give nice interlaced FASTQ)
11 ## Galaxy has a tendancy to automatically apply co-ordindate sorting,
12 ## so just do this every time. If it was name sorted, pay an IO overhead.
13 ## Note requiring -T is samtools issue 295
14 samtools sort -n -O bam -T TEMP_SORT "$input_bam" | samtools bam2fq -s "$singletons_fastq" - &gt; "$pairs_fastq"
15 #else
16 ## Naive conversion using order in the input file
17 samtools bam2fq $suffices $orig_qual "$input_bam" &gt; "$out_fastq"
18 #end if
19 </command>
20 <inputs>
21 <!-- Unlike samtools 0.1.x, samtools 1.1 will autodetect SAM vs BAM -->
22 <param name="input_bam" type="data" format="bam,sam" label="Input SAM/BAM file" />
23 <param name="suffices" type="boolean" label="Add /1 and /2 suffices to paired reads?"
24 truevalue="" falsevalue="-n" checked="true" />
25 <param name="orig_qual" type="boolean" label="Use original qualities (OQ tags) if present?"
26 truevalue="-O" falsevalue="" checked="false" />
27 <!-- Using a condition here to allow different output files; default to paired mode -->
28 <conditional name="action_mode">
29 <param name="mode" type="select" label="Mode of action">
30 <option value="pairs" selected="true">Sort by name, then divide into paired and singletons (two FASTQ files)</option>
31 <option value="naive">No pre-sorting, all reads in a single FASTQ file</option>
32 </param>
33 </conditional>
34 </inputs>
35 <outputs>
36 <data name="pairs_fastq" format="fastqsanger" label="$input_bam.name (bam2fq pairs)">
37 <filter>(action_mode['mode'] == 'pairs')</filter>
38 </data>
39 <data name="singletons_fastq" format="fastqsanger" label="$input_bam.name (bam2fq singletons)">
40 <filter>(action_mode['mode'] == 'pairs')</filter>
41 </data>
42 <data name="out_fastq" format="fastqsanger" label="$input_bam.name (bam2fq)">
43 <filter>(action_mode['mode'] == 'naive')</filter>
44 </data>
45 </outputs>
46 <stdio>
47 <!-- Assume anything other than zero is an error -->
48 <exit_code range="1:" />
49 <exit_code range=":-1" />
50 </stdio>
51 <tests>
52 <test>
53 <param name="input_bam" value="sam_spec_padded.bam" ftype="bam" />
54 <param name="suffices" value="true" />
55 <param name="orig_qual" value="false" />
56 <param name="mode" value="naive" />
57 <output name="out_fastq" file="sam_spec_padded.bam2fq.fastq" ftype="fastqsanger" />
58 </test>
59 <test>
60 <param name="input_bam" value="sam_spec_padded.bam" ftype="bam" />
61 <param name="suffices" value="true" />
62 <param name="orig_qual" value="true" />
63 <param name="mode" value="naive" />
64 <output name="out_fastq" file="sam_spec_padded.bam2fq.fastq" ftype="fastqsanger" />
65 </test>
66 <test>
67 <param name="input_bam" value="sam_spec_padded.sam" ftype="sam" />
68 <param name="mode" value="naive" />
69 <output name="out_fastq" file="sam_spec_padded.bam2fq.fastq" ftype="fastqsanger" />
70 </test>
71 <test>
72 <param name="input_bam" value="sam_spec_padded.depad.bam" ftype="bam" />
73 <param name="mode" value="naive" />
74 <output name="out_fastq" file="sam_spec_padded.bam2fq.fastq" ftype="fastqsanger" />
75 </test>
76 <test>
77 <param name="input_bam" value="sam_spec_padded.bam" ftype="bam" />
78 <param name="suffices" value="false"/>
79 <param name="mode" value="naive" />
80 <output name="out_fastq" file="sam_spec_padded.bam2fq_no_suf.fastq" ftype="fastqsanger" />
81 </test>
82 <test>
83 <param name="input_bam" value="sam_spec_padded.bam" ftype="bam" />
84 <param name="suffices" value="true" />
85 <param name="orig_qual" value="false" />
86 <param name="mode" value="pairs" />
87 <output name="pairs_fastq" file="sam_spec_padded.bam2fq_pairs.fastq" ftype="fastqsanger" />
88 <output name="singletons_fastq" file="sam_spec_padded.bam2fq_singles.fastq" ftype="fastqsanger" />
89 </test>
90 <test>
91 <param name="input_bam" value="sam_spec_padded.sam" ftype="sam" />
92 <param name="suffices" value="true" />
93 <param name="orig_qual" value="false" />
94 <param name="mode" value="pairs" />
95 <output name="pairs_fastq" file="sam_spec_padded.bam2fq_pairs.fastq" ftype="fastqsanger" />
96 <output name="singletons_fastq" file="sam_spec_padded.bam2fq_singles.fastq" ftype="fastqsanger" />
97 </test>
98 </tests>
99 <help>
100 **What it does**
101
102 This tool runs the ``samtools bam2fq`` command in the SAMtools toolkit.
103
104 By default this will pre-sort your SAM/BAM file by read name and split your
105 reads into an interlaced FASTQ file for paired reads, and a separate FASTQ
106 file for singleton reads. A naive conversion is also offered which gives a
107 single FASTQ file with the reads ordered as in the input SAM/BAM file.
108
109 It is quite common to wish to remap high-throughput sequencing data. If you
110 only have the mapped reads in SAM/BAM format, this tool can "unmap" them to
111 recover FASTQ format reads to input into an alternative mapping tool.
112
113 BAM files can hold both aligned reads and unaligned reads, so another example
114 usage would be to filter your BAM file to get only the unaligned reads, and
115 turn those back in FASTQ using this tool ready for *de novo* assembly, or to
116 try mapping against another reference sequence.
117
118
119 **Citation**
120
121 If you use this Galaxy tool in work leading to a scientific publication please
122 cite:
123
124 Heng Li et al (2009). The Sequence Alignment/Map format and SAMtools.
125 Bioinformatics 25(16), 2078-9.
126 http://dx.doi.org/10.1093/bioinformatics/btp352
127
128 Peter J.A. Cock (2014), Galaxy wrapper for the samtools bam2fq command
129 http://toolshed.g2.bx.psu.edu/view/peterjc/samtools_bam2fq
130
131 This wrapper is available to install into other Galaxy Instances via the Galaxy
132 Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/samtools_bam2fq
133 </help>
134 <citations>
135 <citation type="doi">10.1093/bioinformatics/btp352</citation>
136 </citations>
137 </tool>