Commit 14d919ed authored by Maxime Manno's avatar Maxime Manno 🍜
Browse files

Add new version of ONT run stats analysis : new graph, new visu.

old runs are still ok
parent e0889190
......@@ -16,6 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*}
{extends file='AnalysisTemplate.tpl'}
{block name=params}
{assign var="params" value=" "|explode:$analyse.params}
{foreach from=$analyse_results key=sample item=sample_results}
......@@ -48,18 +49,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{block name=results_title} Reports {/block}
{block name=results}
{assign var="analyse_results_sorted" value=$analyse_results["ONT_sample"]|@ksort}
{* 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}
{assign var="metrics" value=$analyse_results["metrics"]}
{assign var="basic" value=$analyse_results["ONT_sample"].basic}
{assign var="quality" value=$analyse_results["ONT_sample"].quality}
{assign var="plots" value=$analyse_results["ONT_sample"].plots}
{assign var="plots_barcode" value=$analyse_results["ONT_sample"].plots_barcode}
{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}
{assign var='basic_headers' value=','|explode:$metrics['basic'].headers}
{assign var='basic_count' value=$basic_headers|@count}
{assign var='quality_headers' value=','|explode:$metrics['quality'].headers}
{assign var='quality_count' value=$quality_headers|@count}
{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}
{assign var='plots_headers' value=','|explode:$metrics['plots'].headers}
{assign var='plots_count' value=$plots_headers|@count}
......@@ -72,10 +94,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{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>
<legend>Analyse results report - Sample name : {$descriptions.sample_1}</legend>
{if $template_status != "2.0"}
{assign var='data_col' value=2}
<div class="row">
{if $metrics['basic']}
......@@ -88,6 +109,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{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>
......@@ -152,16 +174,142 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
{/if}
</div>
{else}
{assign var='data_col' value=2}
<div class="row">
{if $metrics['rawdata']}
<div class="col-md-4 col-lg-4">
<table id="ont_table_rawdata" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Rawdata metrics report</h4></thead></tr></th>
<tbody>
{foreach from=$rawdata_headers key=k item=head}
<tr>
{if ($head == 'mean_read_quality')}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($rawdata.$head)|number_format:2:',':' '}</td>
{else}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($rawdata.$head)|number_format:0:',':' '}</td>
{/if}
</tr>
{$data_col = $data_col + 1}
{/foreach}
</body>
</table>
</div>
{/if}
{if $metrics['Q7'] and $metrics['Q7']}
<div class="col-md-4 col-lg-4">
<table id="ont_table_filtered" class="table table-striped table-bordered dataTable">
<thead><tr><th colspan="2"><h4>Filtered Q7 metrics report</h4></thead></tr></th>
<tbody>
{foreach from=$Q7_headers key=k item=head}
<tr>
{if ($head == 'mean_read_quality_Q7')}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q7.$head)|number_format:2:',':' '}</td>
{elseif ($head == 'N50_read_length_Q7')}
<td><label>N50 read length Q7</label></td>
<td>{($Q7.$head)|number_format:0:',':' '}
{elseif $head|strstr:"nb_reads_Q7"}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q7.$head)|number_format:0:',':' '} ({($Q7.$head / $rawdata.nb_reads*100)|number_format:2:',':' '}%)</td>
{elseif $head|strstr:"total_bases_Q7"}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q7.$head)|number_format:0:',':' '} ({($Q7.$head / $rawdata.total_bases*100)|number_format:2:',':' '}%)</td>
{else}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q7.$head)|number_format:0:',':' '}
{/if}
</tr>
{$data_col = $data_col + 1}
{/foreach}
</tbody>
<thead><tr><th colspan="2"><h4>Filtered Q9 metrics report</h4></thead></tr></th>
<tbody>
{foreach from=$Q9_headers key=k item=head}
<tr>
{if ($head == 'mean_read_quality_Q9')}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q9.$head)|number_format:2:',':' '}</td>
{elseif ($head == 'N50_read_length_Q9')}
<td><label>N50 read length Q9</label></td>
<td>{($Q9.$head)|number_format:0:',':' '}
{elseif $head|strstr:"nb_reads_Q9"}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q9.$head)|number_format:0:',':' '} ({($Q9.$head / $rawdata.nb_reads*100)|number_format:2:',':' '}%)</td>
{elseif $head|strstr:"total_bases_Q9"}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q9.$head)|number_format:0:',':' '} ({($Q9.$head / $rawdata.total_bases*100)|number_format:2:',':' '}%)</td>
{else}
<td><label>{$head|replace:'_':' '}</label></td>
<td>{($Q9.$head)|number_format:0:',':' '}
{/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>
{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>
{$data_col = $data_col + 1}
{/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>
{$data_col = $data_col + 1}
{/foreach}
{/if}
</tbody>
</table>
</div>
{/if}
</div>
{/if}
<br><br>
{*If there are barcodes file in the run*}
{if $barcode_name_count > 1 }
<table id="ont_stats_datatable" class="table table-striped table-bordered dataTable analysis-result-table">
<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}
......@@ -171,26 +319,50 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<tr>
{assign var="th_id" value=2}
{foreach from=$barcode_headers key=k item=head}
{if $head == 'total_bases'}
<th class = "numeric-sort" id="th_id_{$th_id}">Total bases</th>
{elseif $head == 'nb_reads'}
{if $head == 'nb_reads'}
<th class = "numeric-sort" id="th_id_{$th_id}">Nb reads</th>
{elseif $head == 'median_read_length'}
<th class = "numeric-sort" id="th_id_{$th_id}">Median read length</th>
{elseif $head == 'median_read_quality'}
<th class = "numeric-sort" id="th_id_{$th_id}">Median read quality</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 == 'median_yield_per_sec'}
<th class = "numeric-sort" id="th_id_{$th_id}">Median yield per sec</th>
{elseif ($head == 'nb_read_utils') or ($head == 'nb_read_useful_data')}
<th class = "numeric-sort" id="th_id_{$th_id}">Nb reads useful data</th>
{elseif ($head == 'total_bases_utils') or ($head == 'total_bases_useful_data')}
<th class = "numeric-sort" id="th_id_{$th_id}">Total bases useful data</th>
{elseif ($head == 'N50_read_length_useful_data')}
<th class = "numeric-sort" id="th_id_{$th_id}">N50 read length useful data</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}
......@@ -207,26 +379,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<td id='sample_{$i}_col_1' class="sample_name">{$sample}</td>
{$col_id = 2}
{foreach from=$barcode_headers key=k item=head}
{if $head == 'total_bases'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $basic.total_bases*100)|number_format:2:',':' '}%)</th>
{elseif $head == 'nb_reads'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $basic.nb_reads*100)|number_format:2:',':' '}%)</th>
{elseif $head == 'median_read_length'}
{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 == 'median_read_quality'}
{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'}
{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'}
{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 == 'median_yield_per_sec'}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '}</th>
{elseif ($head == 'nb_read_utils') or ($head == 'nb_read_useful_data')}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $basic.nb_reads*100)|number_format:2:',':' '}%)</th>
{elseif ($head == 'total_bases_utils') or ($head == 'total_bases_useful_data')}
<th id="sample_{$i}_col_{$col_id}">{($sample_results.$head)|number_format:0:',':' '} ({($sample_results.$head / $basic.total_bases*100)|number_format:2:',':' '}%)</th>
{elseif ($head == 'N50_read_length_useful_data')}
{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}
......@@ -303,8 +476,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<li><strong>N50 read length</strong> :
50% of all bases come from reads longer than this value.
</li>
<li><strong>Median yield per sec</strong> :
The median number of bases per second for the pores of this Flow Cell.
<li><strong>Mean yield per sec</strong> :
The mean number of bases per second for the pores of this Flow Cell.
</li>
</ul>
</span>
......@@ -314,15 +487,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p>Help for Quality report :</p>
<span class="meta">
<ul>
<li><strong>Median read quality</strong> :
The median quality (qscore ONT) for this Flow Cell.
</li>
<li><strong>Nb read/bases useful data</strong> :
The total number of reads/bases for the reads that have a quality > 7 and a length > 3000bp.
</li>
<li><strong>N50 read length useful data</strong> :
50% of all bases come from reads longer than this value for the reads that have a quality > 7 and a length > 3000bp.
<li><strong>Mean read quality</strong> :
The mean quality (qscore ONT) for this Flow Cell.
</li>
{if $template_status != "2.0"}
<li><strong>Useful data</strong> :
Filtered data composed by reads with length > 3000 and quality > 7.
</li>
{/if}
</ul>
</span>
</div>
......@@ -332,21 +504,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p>Help for Plots report :</p>
<span class="meta">
<ul>
<li><strong>outrm </strong> :
For the length distribution plots and the density plot the outsiders have been removed.
</li>
<li><strong>Cumulate yield per hour</strong> :
The cumulate number of bases per hour for this Flow Cell.
</li>
<li><strong>Distribution length</strong> :
The length distribution of reads for this Flow Cell.
The length distribution of reads for this Flow Cell with reads count or bases count.
</li>
<li><strong>Distribution qscore</strong> :
The quality (qscore ONT) distribution of reads for this Flow Cell.
</li>
<li><strong> Length vs qscore density</strong> :
The length and qscore distribution of reads with density 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.
......
......@@ -49,7 +49,7 @@ class OntQualityCheck (NG6Workflow):
addrawfiles = self.add_component("AddRawFiles", [self.runobj, self.get_all_reads(), self.compression])
#nanoplot = self.add_component("Nanoplot", [sample.name,self.get_all_reads(), self.nb_threads, True, "png", self.nanoplot_color,"nanoplot.tar.gz"])
ontstat = self.add_component("Run_stats", [self.summary_file, self.barcoded])
ontstat = self.add_component("Run_stats", [self.summary_file, self.barcoded, sample_names[0]])
if self.trimming == "yes":
trim_porechop = self.add_component("Trim_porechop", [self.get_all_reads() , "discard_middle"])
if self.fast5dir != None:
......
This diff is collapsed.
......@@ -16,7 +16,7 @@
#
--date
25/06/2018
08/04/2019
--data-nature
DNA
--sequencer
......@@ -33,16 +33,10 @@ arabido
test-dev
--summary-file
workflows/ont_qc/data/sequencing_summary_barcoded_test.txt
/save/ng6-test/src/ng6-git-mmanno/workflows/ont_qc/data/sequencing_summary_barcoded_test.txt
--barcoded
yes
--nb-threads
4
--fileformat
fastq
--fast5dir
workflows/ont_qc/data/fast5_dir
--sample
sample-name=ONT_sample
read1=workflows/ont_qc/data/test*.fastq
read1=/save/ng6-test/src/ng6-git-mmanno/workflows/ont_qc/data/test*.fastq
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