{% extends "base_QC.html" %}

{% import 'pcaReport.html' as pca %}
{% import 'sampleReportChunk.html' as sampleReport %}

{% block title %}Assay Summary Report For: {{ item.Name }}{% endblock %}

{% block content %}

<!--Overall Summary_______________________________________________________________________________________________________________-->
<h2>Final Dataset</h2>

<div class='content'>
	<p>{{ item['Nsamples'] }} samples</p>
	<p>{{ item['Nfeatures'] }} features</p>
	<p></p>
</div>

<!--Sample Details________________________________________________________________________________________________________________-->
<h2>Sample Summary</h2>

<!--Summary of samples in final dataset-->
<h3>Sample Summary Table</h3>
{{ item.sampleSummary['Acquired'].to_html() }}

<div class='content'>
	<p>*Details of any missing samples given at the end of the report</p>
	<p></p>
</div>

<!--Acquisition Structure_________________________________________________________________________________________________________-->
<h2>Sample Acquisition Structure</h2>

<div class='content'>
	<p>Samples acquired in {{ item['nBatchesCollect'] }} between {{ item['start'] }} and {{ item['end'] }}</p>
	<p>Batch correction applied (LOESS regression fitted to SR samples in {{ item['nBatchesCorrect'] }}) for run-order correction and batch alignment</p>
	<p></p>
</div>

<!--Figure 1: Sample Acquisition Structure-->
<div class='figure'>
	<p class="caption"><span class="heading">Figure&nbsp;1.</span> Sample Acquisition Structure.</p>
	<img src="{{ item['finalTICbatches'] }}" alt="Sample Acquisition Structure.">
</div>


<!--Feature Selection______________________________________________________________________________________________________________-->
<h2>Feature Selection Summary</h2>

<div class='content'>
	<p>Features selected based on the following criteria:</p>
	{{ item['FeatureSelectionTable'].to_html() }}
</div>

<!--Figure 2: TIC for all samples and features passing selection-->
<div class='figure'>
	<p class="caption"><span class="heading">Figure&nbsp;2.</span> TIC for all samples and all features in final dataset.</p>
	<img src="{{ item['finalTIC'] }}" alt="TIC for all samples and all features passing selection.">
</div>

<!--Figure 3: TIC for all samples and features passing selection-->
<div class='figure'>
	<p class="caption"><span class="heading">Figure&nbsp;3.</span> Feature Intensity Histogram for all samples and all features in final dataset (by sample type).</p>
	<img src="{{ item['finalFeatureIntensityHist'] }}" alt="Feature Intensity Histogram for all samples and all features in final dataset (by sample type).">
</div>	

<!--Figure 4: RSD for all samples and features passing selection-->
<div class='figure'>
	<p class="caption"><span class="heading">Figure&nbsp;4.</span> Residual Standard Deviation (RSD) distribution for all samples and all features in final dataset (by sample type).</p>
	<img src="{{ item.finalRSDdistributionFigure }}" alt="Residual Standard Deviation (RSD) distribution for all samples and all features in final dataset (by sample type).">
</div>

<!--Figure 5: Ion map of all features (coloured by log median intensity)-->
<div class='figure'>
	<p class="caption"><span class="heading">Figure&nbsp;5.</span> Ion map of all features (coloured by log median intensity).</p>
	<img src="{{ item.finalIonMap}}" alt="Ion map of all features (coloured by log median intensity).">
</div>

<!--Multivariate -->
{% if pcaPlots %}
	{{ pca.basicPCAReport(pcaPlots) }}
{% endif %}

<!--Samples -->
{{ sampleReport.sampleReport(item.sampleSummary) }}

{% endblock %}