From 46e8ab0caf5df210d878f5784bd9c9dd75acface Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Tue, 8 Oct 2024 08:44:56 +0200 Subject: [PATCH 1/3] Fom MANE overview link out to gene overview --- CHANGELOG.md | 1 + src/chanjo2/endpoints/overview.py | 5 ++-- src/chanjo2/meta/handle_report_contents.py | 1 + src/chanjo2/templates/mane-overview.html | 30 +++++++++++++++++++++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7f6383d..538eda67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Check that provided d4 files when running queries using `/coverage/d4/genes/summary` endpoint are valid, with test - General report with coverage over the entire genome when no genes or genes panels are provided - A MANE coverage report, showing coverage and coverage completeness only on MANE transcripts for the provided list of genes +- Link out from MANE overview to gene overview ### Changed - Do not use stored cases/samples any more and run stats exclusively on d4 files paths provided by the user in real time - How parameters are passed to starlette.templating since it was raising a deprecation warning. diff --git a/src/chanjo2/endpoints/overview.py b/src/chanjo2/endpoints/overview.py index b0ef16ae..ee5e000b 100644 --- a/src/chanjo2/endpoints/overview.py +++ b/src/chanjo2/endpoints/overview.py @@ -141,13 +141,14 @@ async def demo_mane_overview( @router.post("/mane_overview", response_class=HTMLResponse) async def mane_overview( request: Request, + build=Annotated[Builds, Form(...)], samples=Annotated[str, Form(...)], + interval_type=Annotated[IntervalType, Form(...)], completeness_thresholds=Annotated[Optional[str], Form(None)], ensembl_gene_ids=Annotated[Optional[str], Form(None)], hgnc_gene_ids=Annotated[Optional[str], Form(None)], hgnc_gene_symbols=Annotated[Optional[str], Form(None)], - case_display_name=Annotated[Optional[str], Form(None)], - panel_name=Annotated[Optional[str], Form("Custom panel")], + default_level=Annotated[Optional[int], Form(DEFAULT_COVERAGE_LEVEL)], db: Session = Depends(get_session), ): """Returns coverage overview stats for a group of samples over MANE transcripts of a list of genes.""" diff --git a/src/chanjo2/meta/handle_report_contents.py b/src/chanjo2/meta/handle_report_contents.py index c42a77d2..3d3f71a4 100644 --- a/src/chanjo2/meta/handle_report_contents.py +++ b/src/chanjo2/meta/handle_report_contents.py @@ -263,6 +263,7 @@ def get_mane_overview_coverage_stats(query: ReportQuery, session: Session) -> Di or query.hgnc_gene_symbols or query.ensembl_gene_ids, "interval_type": query.interval_type.value, + "default_level": query.default_level, "completeness_thresholds": query.completeness_thresholds, "samples": [_serialize_sample(sample) for sample in query.samples], "panel_name": query.panel_name, diff --git a/src/chanjo2/templates/mane-overview.html b/src/chanjo2/templates/mane-overview.html index 9f3ce519..40e40c0f 100644 --- a/src/chanjo2/templates/mane-overview.html +++ b/src/chanjo2/templates/mane-overview.html @@ -27,6 +27,7 @@

+ @@ -59,12 +60,21 @@

MANE Transcripts coverage report

Based on gene panel: {{ extras.panel_name }}

{% endif %}
+ + + + + + + {% for gene_id, samples_stats in mane_coverage_stats|sort(attribute='0') %}
- Gene {{ gene_id or samples_stats.gene.hgnc_id }} + Gene + {{ gene_id or samples_stats.gene.hgnc_id }} + {% if samples_stats.transcript.mane_select %} MANE Select: {{samples_stats.transcript.mane_select}} {% endif %} @@ -112,3 +122,21 @@

MANE Transcripts coverage report

{{report_filters() }} {{ mane_stats_macro() }} {% endblock %} + +{% block js_code %} + +{% endblock %} + From 78d1aa5707b251762a6716759f8ac5428f3b3faa Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Tue, 8 Oct 2024 09:04:39 +0200 Subject: [PATCH 2/3] Small fixes --- src/chanjo2/endpoints/overview.py | 4 ++-- src/chanjo2/templates/mane-overview.html | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/chanjo2/endpoints/overview.py b/src/chanjo2/endpoints/overview.py index ee5e000b..b14e06f1 100644 --- a/src/chanjo2/endpoints/overview.py +++ b/src/chanjo2/endpoints/overview.py @@ -141,9 +141,9 @@ async def demo_mane_overview( @router.post("/mane_overview", response_class=HTMLResponse) async def mane_overview( request: Request, - build=Annotated[Builds, Form(...)], + build=Annotated[Builds, Form(Builds.build_38)], samples=Annotated[str, Form(...)], - interval_type=Annotated[IntervalType, Form(...)], + interval_type=Annotated[IntervalType, Form(IntervalType.TRANSCRIPTS)], completeness_thresholds=Annotated[Optional[str], Form(None)], ensembl_gene_ids=Annotated[Optional[str], Form(None)], hgnc_gene_ids=Annotated[Optional[str], Form(None)], diff --git a/src/chanjo2/templates/mane-overview.html b/src/chanjo2/templates/mane-overview.html index 40e40c0f..6f3d5750 100644 --- a/src/chanjo2/templates/mane-overview.html +++ b/src/chanjo2/templates/mane-overview.html @@ -27,6 +27,7 @@

+ @@ -112,6 +113,7 @@

MANE Transcripts coverage report

{% else %} No MANE transcripts found in database for the provided gene list. {% endfor %} + {% endmacro %} {% block title %} From 9682a04d77abfe76af830f49bf596fd5b53c75aa Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Tue, 8 Oct 2024 10:21:43 +0200 Subject: [PATCH 3/3] Inherit js scripts from base template --- src/chanjo2/templates/mane-overview.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chanjo2/templates/mane-overview.html b/src/chanjo2/templates/mane-overview.html index 6f3d5750..fd211cde 100644 --- a/src/chanjo2/templates/mane-overview.html +++ b/src/chanjo2/templates/mane-overview.html @@ -126,6 +126,7 @@

MANE Transcripts coverage report

{% endblock %} {% block js_code %} + {{ super() }}