annotate reheader.xml @ 0:41e5558a2bad draft

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