comparison reheader.xml @ 0:aa82b2e54055 draft

planemo upload for repository https://github.com/wm75/mimodd_galaxy_wrappers commit b36048cd608ede0ec6f6559648525c9350caae34-dirty
author wolma
date Sat, 11 Nov 2017 18:19:22 -0500
parents
children 1425ea794026
comparison
equal deleted inserted replaced
-1:000000000000 0:aa82b2e54055
1 <tool id="mimodd_reheader" name="MiModD Reheader" version="@MIMODD_WRAPPER_VERSION@">
2 <description>
3 takes a BAM file and generates a copy with the original header (if any) replaced or modified by that found in a template SAM file
4 </description>
5 <macros>
6 <import>macros.xml</import>
7 <macro name="getreadgroupinfo">
8 <conditional name="rginfo">
9 <param name="source" type="select"
10 label="source of new read-group information">
11 <option value="from_file">existing SAM file</option>
12 <option value="from_form">input form</option>
13 </param>
14 <when value="from_file">
15 <param name="data" type="data" format="sam"
16 label="read-group template file in SAM format"
17 help="use the read group information found in this file" />
18 <repeat name="rg" title="custom read-group mapping" default="0" min="0"
19 help="read-group information found in the input file, by default, gets updated / replaced with information from template file read-groups with matching IDs. Alternatively, you may specify explicit read-group mappings below.">
20 <param name="source_id" type="text"
21 label="modify input file information for read-group ID (will create the read-group if it does not exist)" />
22 <param name="rg_id" type="text"
23 label="with template file information for read-group ID" />
24 </repeat>
25 </when>
26 <when value="from_form">
27 <repeat name="rg" title="new read-group info" default="1" min="1">
28 <param name="source_id" type="text"
29 label="read-group ID (will create the read-group if it does not exist)"
30 help="required field">
31 <validator type="empty_field" />
32 </param>
33 <param name="rg_id" type="hidden" value="" />
34 <param name="rg_sm" type="text" label="sample name"
35 help="required field">
36 <validator type="empty_field" />
37 </param>
38 <param name="rg_ds" type="text" label="description" />
39 <param name="rg_date" type="text"
40 label="date (YY-MM-DD format) the run was produced" />
41 <param name="rg_cn" type="text"
42 label="name of sequencing center" />
43 <param name="rg_lb" type="text" label="read-group library" />
44 <param name="rg_pl" type="text"
45 label="platform/technology used to produce the reads" />
46 <param name="rg_pi" type="text"
47 label="predicted median insert size" />
48 <param name="rg_pu" type="text"
49 label="platform unit; unique identifier" />
50 </repeat>
51 </when>
52 </conditional>
53 </macro>
54 </macros>
55 <expand macro="requirements" />
56 <expand macro="stdio" />
57 <expand macro="version_command" />
58 <command><![CDATA[
59 #if ($str($rg.treat_rg) != "ignore" and $str($rg.rginfo.source) == "from_form") or $str($co.treat_co) != "ignore":
60 mimodd header
61 #if $str($rg.treat_rg) != "ignore" and $str($rg.rginfo.source) == "from_form":
62 #for $rginfo in $rg.rginfo.rg
63 #if $str($rginfo.source_id):
64 --rg-id '${rginfo.source_id}'
65 #end if
66 #if $str($rginfo.rg_sm):
67 --rg-sm '${rginfo.rg_sm}'
68 #end if
69 #if $str($rginfo.rg_cn):
70 --rg-cn '${rginfo.rg_cn}'
71 #else:
72 --rg-cn ""
73 #end if
74 #if $str($rginfo.rg_ds):
75 --rg-ds '${rginfo.rg_ds}'
76 #else:
77 --rg-ds ""
78 #end if
79 #if $str($rginfo.rg_date):
80 --rg-dt '${rginfo.rg_date}'
81 #else:
82 --rg-dt ""
83 #end if
84 #if $str($rginfo.rg_lb):
85 --rg-lb '${rginfo.rg_lb}'
86 #else:
87 --rg-lb ""
88 #end if
89 #if $str($rginfo.rg_pl):
90 --rg-pl '${rginfo.rg_pl}'
91 #else:
92 --rg-pl ""
93 #end if
94 #if $str($rginfo.rg_pi):
95 --rg-pi '${rginfo.rg_pi}'
96 #else:
97 --rg-pi ""
98 #end if
99 #if $str($rginfo.rg_pu):
100 --rg-pu '${rginfo.rg_pu}'
101 #else:
102 --rg-pu ""
103 #end if
104 #end for
105 #end if
106 #if $str($co.treat_co) != "ignore":
107 --co
108 #for $comment in $co.coinfo
109 #if $str($comment.line):
110 '${comment.line}'
111 #end if
112 #end for
113 #end if
114 |
115 #end if
116 mimodd reheader '$inputfile' --sq ignore --rg ${rg.treat_rg}
117 #if $str($rg.treat_rg) != "ignore":
118 #if $str($rg.rginfo.source) == "from_file":
119 '${rg.rginfo.data}'
120 #else:
121 -
122 #end if
123 #for $rgmapping in $rg.rginfo.rg
124 #if $str($rgmapping.source_id) and $str($rgmapping.rg_id):
125 '$str($rgmapping.source_id)' : '$str($rgmapping.rg_id)'
126 #end if
127 #end for
128 #end if
129
130 --co ${co.treat_co}
131 #if $str($co.treat_co) != "ignore":
132 -
133 #end if
134
135 #set $restr = ""
136 #for $rename in $rg_renaming
137 #set $restr = $restr + ($str($rename.from) and $str($rename.to) and "'" + $str($rename.from) + "' : '" + $str($rename.to) + "' ")
138 #end for
139 #if $restr
140 --rgm $restr
141 #end if
142
143 #set $restr = ""
144 #for $rename in $sq_renaming
145 #set $restr = $restr + ($str($rename.from) and $str($rename.to) and "'" + $str($rename.from) + "' : '" + $str($rename.to) + "' ")
146 #end for
147 #if $restr
148 --sqm $restr
149 #end if
150
151 -o '$output'
152 ]]></command>
153
154 <inputs>
155 <param name="inputfile" type="data" format="bam"
156 label="input dataset in BAM format" help="the file to reheader." />
157 <conditional name="rg">
158 <param name="treat_rg" type="select"
159 label="modify read-group information?"
160 help="Replace mode will ignore ALL existing read group information in the input file and use ONLY template information, Update mode will COPY existing input file information and UPDATE it with template information; choose No, ... to leave read-group information alone.">
161 <option value="ignore">No, do not change read-groups.</option>
162 <option value="update">Yes, update existing information</option>
163 <option value="replace">Yes, replace existing information</option>
164 </param>
165 <when value="update">
166 <expand macro="getreadgroupinfo" />
167 </when>
168 <when value="replace">
169 <expand macro="getreadgroupinfo" />
170 </when>
171 <when value="ignore">
172 </when>
173 </conditional>
174 <conditional name="co">
175 <param name="treat_co" type="select"
176 label="modify comments in the input file?">
177 <option value="ignore">No, do not change comments.</option>
178 <option value="update">Yes, append new comments to existing ones</option>
179 <option value="replace">Yes, replace all existing comments</option>
180 </param>
181 <when value="update">
182 <repeat name="coinfo" title="comment line" default="0" min="0">
183 <param name="line" type="text" size="80" />
184 </repeat>
185 </when>
186 <when value="replace">
187 <repeat name="coinfo" title="comment line" default="0" min="0">
188 <param name="line" type="text" size="80" />
189 </repeat>
190 </when>
191 <when value="ignore">
192 </when>
193 </conditional>
194 <repeat name="rg_renaming" title="rename read-group" default="0" min="0"
195 help="Warning: changing read-group IDs may increase job runtime substantially.">
196 <param name="from" type="text" size="30" label="old name"
197 help="as it appears in the current input file header"/>
198 <param name="to" type="text" size="30" label="new name" />
199 </repeat>
200 <repeat name="sq_renaming" title="rename sequence" default="0" min="0"
201 help="Warning: changing sequence names may increase job runtime substantially.">
202 <param name="from" type="text" size="30" label="old name"
203 help="as it appears in the current input file header"/>
204 <param name="to" type="text" size="30" label="new name" />
205 </repeat>
206 </inputs>
207
208 <outputs>
209 <data name="output" format="bam"
210 label="(Re)headered bam file from MiModd ${tool.name} on ${on_string}" />
211 </outputs>
212
213 <tests>
214 <test>
215 <param name="inputfile" value="a.bam" />
216 <conditional name="co">
217 <param name="treat_co" value="update" />
218 <repeat name="coinfo">
219 <param name="line" value="ceterum censeo ..." />
220 </repeat>
221 </conditional>
222 <output name="output" file="a.bam" ftype="bam" lines_diff="1" />
223 </test>
224 <test>
225 <param name="inputfile" value="header_only.bam" />
226 <conditional name="rg">
227 <param name="treat_rg" value="update" />
228 <conditional name="rginfo">
229 <param name="source" value="from_form" />
230 <repeat name="rg">
231 <param name="source_id" value="000" />
232 <param name="rg_sm" value="Bristol" />
233 </repeat>
234 </conditional>
235 </conditional>
236 <output name="output" file="header_only.bam" ftype="bam" lines_diff="2" />
237 </test>
238 <test>
239 <param name="inputfile" value="header_only.bam" />
240 <conditional name="rg">
241 <param name="treat_rg" value="update" />
242 <conditional name="rginfo">
243 <param name="source" value="from_form" />
244 <repeat name="rg">
245 <param name="source_id" value="001" />
246 <param name="rg_sm" value="Hawaiian" />
247 </repeat>
248 </conditional>
249 </conditional>
250 <output name="output" file="header_only.bam" ftype="bam" lines_diff="1" />
251 </test>
252 </tests>
253
254 <help><![CDATA[
255 .. class:: infomark
256
257 **What it does**
258
259 The tool generates a copy of the BAM input file with a modified header (i.e., metadata).
260
261 It can update or replace read-group information (i.e., information about the samples in the file), add or replace comment lines, and rename reference sequences declared in the header.
262
263 The tool ensures that the resulting BAM file is valid and can be further processed by other MiModD tools and standard software like samtools. It aborts with an error message if a valid BAM file cannot be generated with the user-specified settings.
264
265 The template information used to modify or replace the input file metadata is provided through forms or, in the case of read-group information, can be taken from an existing SAM file as can be generated, for example, with the *NGS Run Annotation* tool.
266
267 @HELP_FOOTER@
268 ]]></help>
269 <expand macro="citations" />
270 </tool>