Commit 9efb4b49 authored by Maxime Manno's avatar Maxime Manno 🍜
Browse files

Add new template for ONT demultiplex #112

parent 6ab4ff55
......@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{block name=results_title} Reports {/block}
{block name=results}
{* find if user is CTD *}
<input type="hidden" id="user_login" value="{$user_login}" />
{if $user_login == "CTD"}
......@@ -32,217 +33,37 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{assign var="isCTD" value=false}
{/if}
{assign var="template_status" value=$analyse_results["metrics"].analyse_info.template_status}
{assign var="metrics" value=$analyse_results["metrics"]}
{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="analyse_results_sorted" value=$analyse_results[$sample_name]|@ksort}
{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}
{debug}
<legend>Analyse results report - Sample name : {$sample_name}</legend>
{assign var='data_col' value=2}
<div class="row">
{if $metrics['basic']}
<div class="col-md-4 col-lg-4">
<table id="ont_table_basic" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Basic metrics report</h4></thead></tr></th>
<tbody>
{foreach from=$basic_headers key=k item=head}
<tr>
{if ($head == 'median_yield_per_sec')}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($basic.$head)|number_format:2:',':' '}</td>
{elseif $head == 'nb_actif_channel'}
{else}
<td><label>{$head|replace:'_':' '}</label></td>
<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">
<table id="ont_table_quality" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Quality report</h4></thead></tr></th>
<tbody>
{foreach from=$quality_headers key=k item=head}
<tr>
{if ($head == 'median_read_quality') or ($head == 'median read quality')}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($quality.$head)|number_format:2:',':' '}</td>
{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:',':' '}
{elseif $head|strstr:"nb_read"}
<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
<td>{($quality.$head)|number_format:0:',':' '} ({($quality.$head / $basic.nb_reads*100)|number_format:2:',':' '}%)</td>
{elseif $head|strstr:"total_bases"}
<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
<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">
<table id="ont_table_plot" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Plots report</h4></h4></thead></tr></th>
<tbody>
{foreach from=$plots_headers key=k item=head}
<tr>
<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
<td><a class="imglink" href="{$plots.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
</tr>
{/foreach}
{if $barcode_name_count > 1 }
{foreach from=$plots_barcode_headers key=k item=head}
<tr>
<td><label>{$head|replace:'_':' '|replace:'utils':'useful data'}</label></td>
<td><a class="imglink" href="{$plots_barcode.$head}" ><i class="glyphicon glyphicon-picture"></i></a></td>
</tr>
{/foreach}
{/if}
</tbody>
</table>
</div>
{/if}
</div>
<br><br>
{*If there are barcodes file in the run*}
{if $barcode_name_count > 1 }
{assign var="stats_metrics" value=$analyse_results["stats_metrics"]|@ksort}
{assign var="stats_headers" value=','|explode:$analyse_results["metrics"].stats_names.headers}
{assign var="stats_names" value=['format' => 'Format','num_seqs' => 'NB Sequences','sum_len' => 'Total Length','avg_len' => 'Mean Length','min_len' => 'Min Length','max_len' => 'Max Length','N50' => 'N50']}
<table id="ont_stats_datatable" class="table table-striped table-bordered dataTable analysis-result-table" style="white-space:nowrap;">
<thead>
<tr>
{assign var="nb_samples" value=$barcode_name_count}
<th class="string-sort" rowspan="2" id="th_id_1"><center>Sample {if $nb_samples > 1 }({$nb_samples}){/if}</center></th>
<th colspan="{$barcode_headers_count}"><center>Barcode ONT results</center></th>
</tr>
<tr>
{assign var="th_id" value=2}
{foreach from=$barcode_headers key=k item=head}
{if $head == 'nb_reads'}
<th class = "numeric-sort" id="th_id_{$th_id}">Nb reads</th>
{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>
{elseif $head == 'N50_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">N50 read length</th>
{elseif $head == 'barcode_score'}
<th class = "numeric-sort" id="th_id_{$th_id}">Barcode score</th>
{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>
{/if}
{$th_id = $th_id +1}
{/foreach}
</tr>
<th>Sample</th>
{foreach from=$stats_headers key=k item=stat}
<th>{$stats_names.$stat}</th>
{/foreach}
</thead>
<tbody>
{$i = 1}
{assign var="totalReads" value=0}
{assign var="totalBases" value=0}
{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}
{foreach from=$barcode_headers key=k item=head}
{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'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'mean_read_quality' || $head == 'mean_read_quality_Q7' || $head == 'mean_read_quality_Q9'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
{elseif $head == 'N50_read_length' || $head == 'N50_read_length_Q7' || $head == 'N50_read_length_Q9'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif $head == 'barcode_score' || $head == 'barcode_score_Q7' || $head == 'barcode_score_Q9'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:1:',':' '}</th>
{elseif $head == 'mean_yield_per_sec' || $head == 'mean_yield_per_sec_Q7' || $head == 'mean_yield_per_sec_Q9'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{/if}
{$col_id = $col_id + 1}
{/foreach}
</tr>
{$i = $i + 1}
{/if}
{/foreach}
{foreach from=$stats_metrics key=fastq item=fastq_metrics}
<tr><th>{$fastq}</th>
{foreach from=$stats_headers key=k item=stat}
<td>{$fastq_metrics[$stat]}</td>
{/foreach}
</tr>
{/foreach}
</tbody>
</table>
<br><br>
{/if}
{* Help block *}
{if $template_status == "2.0"}
<div class="tx-nG6-pi1-help">
<img src="" alt="" class="img" />
<p>Help for ONT metrics report :</p>
<span class="meta">
<ul>
<li><strong>Format</strong> :
The format of the sample file.
</li>
<li><strong>Nb reads</strong> :
The total number of reads for this Flow Cell (including the reads that are filtered during the basecalling).
</li>
......@@ -254,66 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</li>
<li><strong>N50 read length</strong> :
50% of all bases come from reads longer than this value.
</li>
<li><strong>N90 read length</strong> :
90% of all bases come from reads longer than this value.
</li>
</li>
<li><strong>N10 read length</strong> :
10% of all bases come from reads longer than this value.
</li>
<li><strong>Mean read quality</strong> :
The mean quality (qscore ONT) for this Flow Cell.
</li>
<li><strong>Mean yield per sec</strong> :
The mean number of bases per second for the pores of this Flow Cell.
</li>
<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>
</ul>
</span>
</div>
<div class="tx-nG6-pi1-help">
<img src="" alt="" class="img" />
<p>Help for Plots report :</p>
<span class="meta">
<ul>
<li><strong>Cumulate yield per second</strong> :
The cumulate number of bases per hour for this Flow Cell.
</li>
<li><strong>Length distribution</strong> :
The length distribution of reads for this Flow Cell with reads count or bases count.
</li>
<li><strong>Quality distribution</strong> :
The quality (qscore ONT) distribution of reads for this Flow Cell.
</li>
{if $barcode_name_count > 1 }
<li><strong> Qscore boxplot</strong> :
Boxplots for each barcode of the mean qscore of reads for this Flow Cell.
</li>
<li><strong> Qscore per time intervals boxplot</strong> :
Boxplots for each barcode of the mean qscore of reads per interval of time for this Flow Cell.
</li>
{/if}
</ul>
</span>
</div>
{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}
{/block}
{/block}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment