Run_stats.tpl 19 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{*
Copyright (C) 2009 INRA
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*}

{extends file='AnalysisTemplate.tpl'}
19

20
{block name=params}
21

22
23
24
25
26
{/block}


{block name=results_title} Reports {/block}
{block name=results}
27
28
29
30
31
32
33
34
	{* find if user is CTD *}
	<input type="hidden" id="user_login" value="{$user_login}" />
	{if $user_login == "CTD"}
		{assign var="isCTD" value=true}
	{else}
		{assign var="isCTD" value=false}
	{/if}
	{assign var="template_status" value=$analyse_results["metrics"].analyse_info.template_status}
35
	{assign var="metrics" value=$analyse_results["metrics"]}
36
	{* If it is the version 2.0 of the Runstats analysis *}
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	{if $template_status == "2.0"}
		{assign var="sample_name" value=$analyse_results["metrics"].analyse_info.Sample_name}
		{assign var="rawdata" value=$analyse_results[$sample_name].rawdata}
		{assign var='rawdata_headers' value=','|explode:$metrics['rawdata'].headers}
		{assign var='rawdata_count' value=$rawdata_headers|@count}
		{assign var="Q7" value=$analyse_results[$sample_name].Q7}
		{assign var='Q7_headers' value=','|explode:$metrics['Q7'].headers}
		{assign var='Q7_count' value=$Q7_headers|@count}
		{assign var="Q9" value=$analyse_results[$sample_name].Q9}
		{assign var='Q9_headers' value=','|explode:$metrics['Q9'].headers}
		{assign var='Q9_count' value=$Q9_headers|@count}
	{else}
		{assign var="sample_name" value="ONT_sample"}
		{assign var="basic" value=$analyse_results[$sample_name].basic}
		{assign var="quality" value=$analyse_results[$sample_name].quality}
		{assign var='basic_headers' value=','|explode:$metrics['basic'].headers}
		{assign var='quality_headers' value=','|explode:$metrics['quality'].headers}
		{assign var='quality_count' value=$quality_headers|@count}
		{assign var='basic_count' value=$basic_headers|@count}
	{/if}
57
	
58
59
60
	{assign var="analyse_results_sorted" value=$analyse_results[$sample_name]|@ksort}
	{assign var="plots" value=$analyse_results[$sample_name].plots}
	{assign var="plots_barcode" value=$analyse_results[$sample_name].plots_barcode}
61
62
	
	{assign var='plots_headers' value=','|explode:$metrics['plots'].headers}
63
64
65
66
67
68
69
70
71
	{assign var='plots_count' value=$plots_headers|@count}
	
	{assign var='plots_barcode_headers' value=','|explode:$metrics['plots_barcode'].headers}
	{assign var='plots_barcode_count' value=$plots_barcode_headers|@count}
    
	{assign var='barcode_headers' value=','|explode:$metrics['barcode'].headers|@ksort}
	{assign var='barcode_headers_count' value=$barcode_headers|@count}
    {assign var='barcode_name_sample' value=','|explode:$metrics['barcode'].names|@ksort}
    {assign var='barcode_name_count' value=$barcode_name_sample|@count}
72
    
73
	<legend>Analyse results report - Sample name : {$sample_name}</legend>
74
	
75
	{if $template_status != "2.0"}
76
77
78
79
		{assign var='data_col' value=2}
		<div class="row">
			{if $metrics['basic']}
				<div class="col-md-4 col-lg-4">
80
					<table id="ont_table_basic" class="table table-striped table-bordered dataTable">
81
					<thead><tr><th colspan="2"><h4>Basic metrics report</h4></thead></tr></th>
82
83
84
						<tbody>
						{foreach from=$basic_headers key=k item=head}
							<tr>
85
86
								{if ($head == 'median_yield_per_sec')}
									<td><label>{$head|replace:'_':' '}</label></td>
87
									<td>{($basic.$head)|number_format:2:',':' '}</td>
88
								{elseif $head == 'nb_actif_channel'}
89
								{else}
90
									<td><label>{$head|replace:'_':' '}</label></td>
91
92
93
94
95
96
97
98
99
100
101
									<td>{($basic.$head)|number_format:0:',':' '}</td>
								{/if}
							</tr>
							{$data_col = $data_col + 1}
						{/foreach}
						</body>
					</table>
				</div>
			{/if}
			{if $metrics['quality']}
				<div class="col-md-4 col-lg-4">
102
					<table id="ont_table_quality" class="table table-striped table-bordered dataTable">
103
104
105
106
						<thead><tr><th colspan="2"><h4>Quality report</h4></thead></tr></th>
					<tbody>
						{foreach from=$quality_headers key=k item=head}
							<tr>
107
108
								{if ($head == 'median_read_quality')  or ($head == 'median read quality')}
									<td><label>{$head|replace:'_':' '}</label></td>
109
									<td>{($quality.$head)|number_format:2:',':' '}</td>
110
111
112
								{elseif ($head == 'N50_read_length_utils') or ($head == 'N50_read_length_useful_data')}
									<td><label>N50 read length useful data</label></td>
									<td>{($quality.$head)|number_format:0:',':' '}
113
								{elseif $head|strstr:"nb_read"}
114
									<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
115
									<td>{($quality.$head)|number_format:0:',':' '} ({($quality.$head / $basic.nb_reads*100)|number_format:2:',':' '}%)</td>
116
117
								{elseif $head|strstr:"total_bases"}
									<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
118
119
120
121
122
123
124
125
126
127
128
									<td>{($quality.$head)|number_format:0:',':' '} ({($quality.$head / $basic.total_bases*100)|number_format:2:',':' '}%)</td>
								{/if}
							</tr>
							{$data_col = $data_col + 1}
						{/foreach}
					</tbody>
					</table>
				</div>
			{/if}
			{if $metrics['plots']}
				<div class="col-md-3 col-lg-3">
129
					<table id="ont_table_plot" class="table table-striped table-bordered dataTable">
130
131
132
133
						<thead><tr><th colspan="2"><h4>Plots report</h4></h4></thead></tr></th>
					<tbody>
						{foreach from=$plots_headers key=k item=head}
							<tr>
134
									<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
135
136
137
									<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
							</tr>
						{/foreach}
138
139
140
						{if $barcode_name_count > 1 }
						{foreach from=$plots_barcode_headers key=k item=head}
							<tr>
141
									<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
142
143
144
145
									<td><a class="imglink" href="{$plots_barcode.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
							</tr>
						{/foreach}
						{/if}
146
147
148
149
150
					</tbody>
					</table>
				</div>
			{/if}
		</div>
151
152
153
	
	{* If it is the version 2.0 of the Runstats analysis *}
	{else}
154
155
		
		<div class="row">
156
157
158
159
160
161
162
163
164
165
166
167
168
		<div class="col-md-6 col-lg-6">
			{if $metrics['rawdata'] and $metrics['Q7'] and $metrics['Q7']}
				<table id="ont_table_rawdata" class="table table-striped table-bordered dataTable" style="white-space:nowrap;">
					<thead>
						<tr><th colspan="4"><h4><center>ONT Metrics report</center</h4></th></tr>
						<tr>
							<th colspan="1"><h4>Metrics</h4></th>
							<th colspan="1"><h4>Rawdata</h4></th>
							<th colspan="1"><h4>Q7</h4></th>
							<th colspan="1"><h4>Q9</h4></th>
						</tr>
					</thead>
					<tbody>
169
						{foreach from=$rawdata_headers key=k item=head}
170
171
							{assign var="headQ7" value=$head|cat:"_Q7"}
							{assign var="headQ9" value=$head|cat:"_Q9"}
172
173
174
175
							<tr>
								{if ($head == 'mean_read_quality')}
									<td><label>{$head|replace:'_':' '}</label></td>
									<td>{($rawdata.$head)|number_format:2:',':' '}</td>
176
177
178
									<td>{($Q7.$headQ7)|number_format:2:',':' '}</td>
									<td>{($Q9.$headQ9)|number_format:2:',':' '}</td>
								{elseif ($head == 'nb_reads')}
179
180
									<td><label>{$head|replace:'_':' '}</label></td>
									<td>{($rawdata.$head)|number_format:0:',':' '}</td>
181
182
183
									<td>{($Q7.$headQ7)|number_format:0:',':' '} ({($Q7.$headQ7 / $rawdata.nb_reads*100)|number_format:2:',':' '}%)</td>
									<td>{($Q9.$headQ9)|number_format:0:',':' '} ({($Q9.$headQ9 / $rawdata.nb_reads*100)|number_format:2:',':' '}%)</td>
								{elseif ($head == 'total_bases')}
184
									<td><label>{$head|replace:'_':' '}</label></td>
185
186
187
									<td>{($rawdata.$head)|number_format:0:',':' '}</td>
									<td>{($Q7.$headQ7)|number_format:0:',':' '} ({($Q7.$headQ7 / $rawdata.total_bases*100)|number_format:2:',':' '}%)</td>
									<td>{($Q9.$headQ9)|number_format:0:',':' '} ({($Q9.$headQ9 / $rawdata.total_bases*100)|number_format:2:',':' '}%)</td>
188
189
								{else}
									<td><label>{$head|replace:'_':' '}</label></td>
190
191
192
									<td>{($rawdata.$head)|number_format:0:',':' '}</td>
									<td>{($Q7.$headQ7)|number_format:0:',':' '}</td>
									<td>{($Q7.$headQ7)|number_format:0:',':' '}</td>
193
194
195
196
								{/if}
							</tr>
						{/foreach}
					</tbody>
197
				</table>
198
			{/if}
199
200
		</div>
		<div class="col-md-3 col-lg-3">
201
			{if $metrics['plots']}
202
203
				<table id="ont_table_plot" class="table table-striped table-bordered dataTable">
					<thead><tr><th colspan="2"><h4><center>Plots report</center></h4></h4></thead></tr></th>
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
					<tbody>
						{foreach from=$plots_headers key=k item=head}
							<tr>
								{if ($head == 'cumulyield')}
									<td><label>Cumulate Yield per second</label></td>
									<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
								{elseif ($head == 'distriblength')}
									<td><label>Length distribution</label></td>
									<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
								{elseif ($head == 'distriblength_bybases')}
									<td><label>Length distribution by bases</label></td>
									<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
								{elseif ($head == 'distribquality')}
									<td><label>Quality distribution</label></td>
									<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
								{/if}
								{if $isCTD == true}
									{if ($head == 'seqrate')}
										<td><label>Sequencing rate over time</label></td>
										<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
									{elseif ($head == 'channelbases')}
										<td><label>FlowCell Channel overview for number of bases</label></td>
										<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
									{elseif ($head == 'channelreads')}
										<td><label>FlowCell Channel overview for number of reads</label></td>
										<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
									{/if}
								{/if}
							</tr>
						{/foreach}
						{if $barcode_name_count > 1 }
						{foreach from=$plots_barcode_headers key=k item=head}
							<tr>
									<td><label>{$head|replace:'_':' '}</label></td>
									<td><a class="imglink" href="{$plots_barcode.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
							</tr>
						{/foreach}
						{/if}
					</tbody>
243
				</table>
244
245
			{/if}
		</div>
246
247
		</div>
	{/if}
248
	
Maxime Manno's avatar
Maxime Manno committed
249
	<br><br>
250
	{*If there are barcodes file in the run*}
251
	{if $barcode_name_count > 1 }	
252
	
253
	<table id="ont_stats_datatable" class="table table-striped table-bordered dataTable analysis-result-table" style="white-space:nowrap;">
254
255
		<thead>
			<tr>
256
				{assign var="nb_samples" value=$barcode_name_count}
257
				<th class="string-sort" rowspan="2" id="th_id_1"><center>Sample {if $nb_samples > 1 }({$nb_samples}){/if}</center></th>
258
        		<th colspan="{$barcode_headers_count}"><center>Barcode ONT results</center></th>
259
260
261
262
			</tr>
			<tr>
				{assign var="th_id" value=2}
				{foreach from=$barcode_headers key=k item=head}
263
					{if $head == 'nb_reads'}
264
						<th class = "numeric-sort"  id="th_id_{$th_id}">Nb reads</th>
265
266
267
268
269
270
					{elseif $head == 'total_bases'}
						<th class = "numeric-sort" id="th_id_{$th_id}">Total bases</th>
					{elseif $head == 'mean_read_length'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean read length</th>
					{elseif $head == 'mean_read_quality'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean read quality</th>
271
					{elseif $head == 'N50_read_length'}
272
						<th class = "numeric-sort"  id="th_id_{$th_id}">N50 read length</th>
273
					{elseif $head == 'barcode_score'}
274
						<th class = "numeric-sort"  id="th_id_{$th_id}">Barcode score</th>
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
					{elseif $head == 'mean_yield_per_sec'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean yield per sec</th>
						
					{elseif $head == 'nb_reads_Q7'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Nb reads Q7</th>
					{elseif $head == 'total_bases_Q7'}
						<th class = "numeric-sort" id="th_id_{$th_id}">Total bases Q7</th>
					{elseif $head == 'mean_read_length_Q7'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean read length Q7</th>
					{elseif $head == 'mean_read_quality_Q7'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean read quality Q7</th>
					{elseif $head == 'N50_read_length_Q7'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">N50 read length Q7</th>
					{elseif $head == 'barcode_score_Q7'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Barcode score Q7</th>
					{elseif $head == 'mean_yield_per_sec_Q7'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean yield per sec Q7</th>
						
					{elseif $head == 'nb_reads_Q9'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Nb reads Q9</th>
					{elseif $head == 'total_bases_Q9'}
						<th class = "numeric-sort" id="th_id_{$th_id}">Total bases Q9</th>
					{elseif $head == 'mean_read_length_Q9'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean read length Q9</th>
					{elseif $head == 'mean_read_quality_Q9'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean read quality Q9</th>
					{elseif $head == 'N50_read_length_Q9'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">N50 read length Q9</th>
					{elseif $head == 'barcode_score_Q9'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Barcode score Q9</th>
					{elseif $head == 'mean_yield_per_sec_Q9'}
						<th class = "numeric-sort"  id="th_id_{$th_id}">Mean yield per sec Q9</th>
307
308
309
310
311
312
313
314
315
					{/if}
					{$th_id = $th_id +1}
				{/foreach}
			</tr>
		</thead>
		<tbody>
			{$i = 1}
			{assign var="totalReads" value=0}
			{assign var="totalBases" value=0}
316
317
318
319
320
321
			
            {foreach from=$analyse_results_sorted key=sample item=sample_results}
            	{if $sample|in_array:$barcode_name_sample}
            		<tr>
						<td id='sample_{$i}_col_1' class="sample_name">{$sample}</td>
						{$col_id = 2}
322
						{foreach from=$barcode_headers key=k item=head}
323
324
325
326
327
328
329
330
331
332
333
334
335
							{if $head == 'nb_reads' || $head == 'nb_reads_Q7' || $head == 'nb_reads_Q9'}
								{if $template_status == "2.0"}
									<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $rawdata.nb_reads*100)|number_format:2:',':' '}%)</th>
								{else}
									<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $basic.nb_reads*100)|number_format:2:',':' '}%)</th>
								{/if}
							{elseif $head == 'total_bases' || $head == 'total_bases_Q7' || $head == 'total_bases_Q9'}
								{if $template_status == "2.0"}
									<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $rawdata.total_bases*100)|number_format:2:',':' '}%)</th>
								{else}
									<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $basic.total_bases*100)|number_format:2:',':' '}%)</th>
								{/if}
							{elseif $head == 'mean_read_length' || $head == 'mean_read_length_Q7' || $head == 'mean_read_length_Q9'}
Maxime Manno's avatar
Maxime Manno committed
336
								<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
337
							{elseif $head == 'mean_read_quality' || $head == 'mean_read_quality_Q7' || $head == 'mean_read_quality_Q9'}
Maxime Manno's avatar
Maxime Manno committed
338
								<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
339
							{elseif $head == 'N50_read_length' || $head == 'N50_read_length_Q7' || $head == 'N50_read_length_Q9'}
Maxime Manno's avatar
Maxime Manno committed
340
								<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
341
							{elseif $head == 'barcode_score' || $head == 'barcode_score_Q7' || $head == 'barcode_score_Q9'}
Maxime Manno's avatar
Maxime Manno committed
342
								<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
343
							{elseif $head == 'mean_yield_per_sec' || $head == 'mean_yield_per_sec_Q7' || $head == 'mean_yield_per_sec_Q9'}
Maxime Manno's avatar
Maxime Manno committed
344
								<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
345
346
347
							{/if}
							
							{$col_id = $col_id + 1}
348
						{/foreach}
349
350
351
352
353
					</tr>
					{$i = $i + 1}
          		{/if}
            {/foreach}

354
355
		</tbody>
	</table>
Maxime Manno's avatar
Maxime Manno committed
356
	<br><br>
357
358
	{/if}

359
360
361



362
363
364
365
366
	<div class="tx-nG6-pi1-help">
		<img src="" alt="" class="img" />
		<p>Help for Basic metrics report :</p>
		<span class="meta">
			<ul>
367
				<li><strong>Nb reads</strong> : 
maxime mano's avatar
maxime mano committed
368
					The total number of reads for this Flow Cell (including the reads that are filtered during the basecalling).
369
				</li>
370
				<li><strong>Total bases</strong> : 
371
372
					The number of bases for this Flow Cell.
				</li>
373
374
				<li><strong>Median/Mean read length</strong> : 
					The median or mean length of the total reads (bases).
375
				</li>
376
				<li><strong>N50 read length</strong> : 
377
378
					50% of all bases come from reads longer than this value.
				</li>
379
380
				<li><strong>Mean yield per sec</strong> : 
					The mean number of bases per second for the pores of this Flow Cell.
381
382
383
384
385
386
387
388
389
				</li>
			</ul>
		</span>
	</div>
	<div class="tx-nG6-pi1-help">
		<img src="" alt="" class="img" />
		<p>Help for Quality report :</p>
		<span class="meta">
			<ul>
390
391
				<li><strong>Mean read quality</strong> : 
					The mean quality (qscore ONT) for this Flow Cell.
392
				</li>
393
394
395
396
397
				{if $template_status != "2.0"}
					<li><strong>Useful data</strong> : 
						Filtered data composed by reads with length > 3000 and quality > 7.
					</li>
				{/if}
398
399
400
401
402
403
404
405
				{if $template_status == "2.0"}
					<li><strong>Q7</strong> : 
						Filtered data composed by reads with quality > 7.
					</li>
					<li><strong>Q9</strong> : 
						Filtered data composed by reads with quality > 9.
					</li>
				{/if}
406
407
408
409
410
411
412
413
414
			</ul>
		</span>
	</div>
	
	<div class="tx-nG6-pi1-help">
		<img src="" alt="" class="img" />
		<p>Help for Plots report :</p>
		<span class="meta">
			<ul>
415
				<li><strong>Cumulate yield per hour</strong> : 
416
417
					The cumulate number of bases per hour for this Flow Cell.
				</li>
418
				<li><strong>Distribution length</strong> : 
419
					The length distribution of reads for this Flow Cell with reads count or bases count.
420
				</li>
421
				<li><strong>Distribution qscore</strong> : 
422
423
					The quality (qscore ONT) distribution of reads for this Flow Cell.
				</li>
424
				{if $barcode_name_count > 1 }
425
				<li><strong> Qscore boxplot</strong> : 
426
427
					Boxplots for each barcode of the mean qscore of reads for this Flow Cell.
				</li>
428
				<li><strong> Qscore per time intervals boxplot</strong> : 
429
430
431
					Boxplots for each barcode of the mean qscore of reads per interval of time for this Flow Cell.
				</li>
				{/if}
432
433
434
			</ul>
		</span>
	</div>
435
436
437
438
439
440
441
442
443
444
445
446
447
	{if $barcode_name_count > 1 }
		<div class="tx-nG6-pi1-help">
			<img src="" alt="" class="img" />
			<p>Help for Barcode ONT results :</p>
			<span class="meta">
			<ul>
				<li><strong>Barcode score</strong> :
					The quality score of the barcode alignment.
				</li>
			</ul>
			</span>
		</div>
	{/if}
448
449
{/block}