comparison reheader.xml @ 0:41e5558a2bad draft

Imported from capsule None
author wolma
date Sat, 13 Dec 2014 17:19:56 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:41e5558a2bad
1 <tool id="reheader" name="Reheader BAM file">
2 <description>From a BAM file generate a new file with the original header (if any) replaced or modified by that found in a second SAM file</description>
3 <requirements>
4 <requirement type="package" version="0.1.5">mimodd</requirement>
5 </requirements>
6 <version_command>mimodd version -q</version_command>
7 <command>
8 #if ($str($rg.treat_rg) != "ignore" and $str($rg.rginfo.source) == "from_form") or $str($co.treat_co) != "ignore":
9 mimodd header
10 #if $str($rg.treat_rg) != "ignore" and $str($rg.rginfo.source) == "from_form":
11 #for $rginfo in $rg.rginfo.rg
12 #if $str($rginfo.source_id):
13 --rg-id "${rginfo.source_id}"
14 #end if
15 #if $str($rginfo.rg_sm):
16 --rg-sm "${rginfo.rg_sm}"
17 #end if
18 #if $str($rginfo.rg_cn):
19 --rg-cn "${rginfo.rg_cn}"
20 #else:
21 --rg-cn ""
22 #end if
23 #if $str($rginfo.rg_ds):
24 --rg-ds "${rginfo.rg_ds}"
25 #else:
26 --rg-ds ""
27 #end if
28 #if $str($rginfo.rg_date):
29 --rg-dt "${rginfo.rg_date}"
30 #else:
31 --rg-dt ""
32 #end if
33 #if $str($rginfo.rg_lb):
34 --rg-lb "${rginfo.rg_lb}"
35 #else:
36 --rg-lb ""
37 #end if
38 #if $str($rginfo.rg_pl):
39 --rg-pl "${rginfo.rg_pl}"
40 #else:
41 --rg-pl ""
42 #end if
43 #if $str($rginfo.rg_pi):
44 --rg-pi "${rginfo.rg_pi}"
45 #else:
46 --rg-pi ""
47 #end if
48 #if $str($rginfo.rg_pu):
49 --rg-pu "${rginfo.rg_pu}"
50 #else:
51 --rg-pu ""
52 #end if
53 #end for
54 #end if
55 #if $str($co.treat_co) != "ignore":
56 --co
57 #for $comment in $co.coinfo
58 #if $str($comment.line):
59 "${comment.line}"
60 #end if
61 #end for
62 #end if
63 |
64 #end if
65 mimodd reheader $inputfile --sq ignore
66 --rg ${rg.treat_rg}
67 #if $str($rg.treat_rg) != "ignore":
68 #if $str($rg.rginfo.source) == "from_file":
69 ${rg.rginfo.data}
70 #else:
71 -
72 #end if
73 #for $rgmapping in $rg.rginfo.rg
74 #if $str($rgmapping.source_id) and $str($rgmapping.rg_id):
75 "$str($rgmapping.source_id)" : "$str($rgmapping.rg_id)"
76 #end if
77 #end for
78 #end if
79
80 --co ${co.treat_co}
81 #if $str($co.treat_co) != "ignore":
82 -
83 #end if
84
85 #set $restr = ""
86 #for $rename in $rg_renaming
87 #set $restr = $restr + ($str($rename.from) and $str($rename.to) and '"' + $str($rename.from) + '" : "' + $str($rename.to) + '"')
88 #end for
89 #if $restr
90 --rgm $restr
91 #end if
92
93 #set $restr = ""
94 #for $rename in $sq_renaming
95 #set $restr = $restr + ($str($rename.from) and $str($rename.to) and '"' + $str($rename.from) + '" : "' + $str($rename.to) + '"')
96 #end for
97 #if $restr
98 --sqm $restr
99 #end if
100
101 -o $output
102 </command>
103
104 <macros>
105 <macro name="getreadgroupinfo">
106 <conditional name="rginfo">
107 <param name="source" type="select" label="source of new read-group information" help="">
108 <option value="from_file">existing SAM file</option>
109 <option value="from_form">input form</option>
110 </param>
111 <when value="from_file">
112 <param name="data" type="data" format="sam" label="read-group template file in SAM format" help="use the read group information found in this file" />
113 <repeat name="rg" title="custom read-group mapping" default="0" min="0" 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.">
114 <param name="source_id" type="text" label="modify input file information for read-group ID (will create the read-group if it does not exist)" />
115 <param name="rg_id" type="text" label="with template file information for read-group ID" />
116 </repeat>
117 </when>
118 <when value="from_form">
119 <repeat name="rg" title="new read-group info" default="1" min="1">
120 <param name="source_id" type="text" label="read-group ID (will create the read-group if it does not exist)" help="required field" />
121 <param name="rg_id" type="hidden" value="" />
122 <param name="rg_sm" type="text" label="sample name" help="required field" />
123 <param name="rg_ds" type="text" label="description" />
124 <param name="rg_date" type="text" label="date (YY-MM-DD format) the run was produced" />
125 <param name="rg_cn" type="text" label="name of sequencing center" />
126 <param name="rg_lb" type="text" label="read-group library" />
127 <param name="rg_pl" type="text" label="platform/technology used to produce the reads" />
128 <param name="rg_pi" type="text" label="predicted median insert size" />
129 <param name="rg_pu" type="text" label="platform unit; unique identifier" />
130 </repeat>
131 </when>
132 </conditional>
133 </macro>
134 </macros>
135
136 <inputs>
137
138 <param name="inputfile" type="data" format="bam" label="input file in BAM format" help="the file to reheader." />
139
140 <conditional name="rg">
141 <param name="treat_rg" type="select" label="modify read-group information ?" 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.">
142 <option value="ignore">No, do not change read-groups.</option>
143 <option value="update">Yes, update existing information</option>
144 <option value="replace">Yes, replace existing information</option>
145 </param>
146 <when value="update">
147 <expand macro="getreadgroupinfo" />
148 </when>
149 <when value="replace">
150 <expand macro="getreadgroupinfo" />
151 </when>
152 </conditional>
153
154 <conditional name="co">
155 <param name="treat_co" type="select" label="modify comments in the input file ?" help="">
156 <option value="ignore">No, do not change comments.</option>
157 <option value="update">Yes, append new comments to existing ones</option>
158 <option value="replace">Yes, replace all existing comments</option>
159 </param>
160 <when value="update">
161 <repeat name="coinfo" title="comment line" default="0" min="0">
162 <param name="line" type="text" size="80" />
163 </repeat>
164 </when>
165 <when value="replace">
166 <repeat name="coinfo" title="comment line" default="0" min="0">
167 <param name="line" type="text" size="80" />
168 </repeat>
169 </when>
170 </conditional>
171
172 <repeat name="rg_renaming" title="rename read-group" default="0" min="0" help="Warning: changing read-group IDs may increase job runtime substantially.">
173 <param name="from" type="text" size="30" label="old name" help="as it appears in the current input file header"/>
174 <param name="to" type="text" size="30" label="new name" />
175 </repeat>
176
177 <repeat name="sq_renaming" title="rename sequence" default="0" min="0" help="Warning: changing sequence names may increase job runtime substantially.">
178 <param name="from" type="text" size="30" label="old name" help="as it appears in the current input file header"/>
179 <param name="to" type="text" size="30" label="new name" />
180 </repeat>
181
182 </inputs>
183
184 <outputs>
185 <data name="output" format="bam" label="(Re)headered bam file from MiModd ${tool.name} on ${on_string}">
186 </data>
187 </outputs>
188
189 <help>
190 .. class:: infomark
191
192 **What it does**
193
194 The tool generates a copy of the BAM input file with a modified header (i.e., metadata).
195
196 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.
197
198 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.
199
200 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.
201
202 </help>
203 </tool>
204