annotate reheader.xml @ 2:72d20758ba2c

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