diff --git a/ExonCov/templates/sample.html b/ExonCov/templates/sample.html index c5290b3..42519e7 100644 --- a/ExonCov/templates/sample.html +++ b/ExonCov/templates/sample.html @@ -50,6 +50,7 @@ Gene Panel + Summary Size (bp) {% for type in measurement_types %} {{ measurement_types[type] }} @@ -60,6 +61,11 @@ {% for panel in panels %} {{ panels[panel]['name_version'] }} + {% if panels[panel]['measurement_percentage15'] < panels[panel]['coverage_requirement_15'] %} + Dekking {{ panels[panel]['name_version'] }} >15X = {{ panels[panel]['measurement_percentage15']|float|round(2) }}% ; QC failed. + {% else %} + Dekking {{ panels[panel]['name_version'] }} >15X = {{ panels[panel]['measurement_percentage15']|float|round(2) }}%. + {% endif %} {{ panels[panel]['len'] }} {% for type in measurement_types %} {{ render_panel_measurement_td(panels[panel][type], type, panels[panel]) }} diff --git a/ExonCov/templates/sample_panel.html b/ExonCov/templates/sample_panel.html index 754d59c..a6e5b13 100644 --- a/ExonCov/templates/sample_panel.html +++ b/ExonCov/templates/sample_panel.html @@ -12,7 +12,26 @@
Type
{{ sample.type }}
Sequencing runs
Panel
{{ panel.name_version }}
-
Minimal % 15x
{{ panel.coverage_requirement_15 }}
+
Minimal % 15x

{{ panel.coverage_requirement_15 }}

+
Summary
+ {% if panel_summary['measurement_percentage15'] < panel.coverage_requirement_15 %} +

Dekking {{ panel.name_version }} >15X = {{ panel_summary['measurement_percentage15']|float|round(2) }}% ; QC failed.

+ {% else %} +

Dekking {{ panel.name_version }} >15X = {{ panel_summary['measurement_percentage15']|float|round(2) }}%.

+ {% endif %} + {% if panel.core_genes %} + {% if panel_summary['core_genes'] %} + Core genen met 15x dekking < 100%: {{panel_summary['core_genes']}}.
+ {% else %} + Core genen met 15x dekking < 100%: geen.
+ {% endif %} + {% endif %} + {% if panel_summary['genes_15'] %} + Genen met 15x dekking < 95%: {{panel_summary['genes_15']}}.
+ {% else %} + Genen met 15x dekking < 95%: geen.
+ {% endif %} +
diff --git a/ExonCov/views.py b/ExonCov/views.py index 017c47d..1ca9ab9 100644 --- a/ExonCov/views.py +++ b/ExonCov/views.py @@ -142,15 +142,31 @@ def sample_panel(sample_id, panel_id): .filter_by(sample_id=sample.id) .options(joinedload(Transcript.exons, innerjoin=True)) .options(joinedload(Transcript.gene)) + .order_by(TranscriptMeasurement.measurement_percentage15.asc()) .all() ) + # Setup panel summary + panel_summary = { + 'measurement_percentage15': weighted_average( + [tm[1].measurement_percentage15 for tm in transcript_measurements], + [tm[1].len for tm in transcript_measurements] + ), + 'core_genes': ', '.join( + ['{}({}) = {:.2f}%'.format(tm[0].gene, tm[0], tm[1].measurement_percentage15) for tm in transcript_measurements if tm[0].gene in panel.core_genes and tm[1].measurement_percentage15 < 100] + ), + 'genes_15': ', '.join( + ['{}({}) = {:.2f}%'.format(tm[0].gene, tm[0], tm[1].measurement_percentage15) for tm in transcript_measurements if tm[0].gene not in panel.core_genes and tm[1].measurement_percentage15 < 95] + ) + } + return render_template( 'sample_panel.html', sample=sample, panel=panel, transcript_measurements=transcript_measurements, - measurement_types=measurement_types + measurement_types=measurement_types, + panel_summary=panel_summary )