From 346780a8a4efa2b6fdb9013cdfceb4be19645059 Mon Sep 17 00:00:00 2001 From: Daniel Danis Date: Wed, 4 Dec 2024 16:51:16 +0100 Subject: [PATCH] Transcript id is a must for `CohortViewer`. --- src/gpsea/view/_viewers.py | 12 +++++++++--- tests/view/test_view.py | 9 +++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gpsea/view/_viewers.py b/src/gpsea/view/_viewers.py index bcbe144c..2a5c7b1d 100644 --- a/src/gpsea/view/_viewers.py +++ b/src/gpsea/view/_viewers.py @@ -31,26 +31,32 @@ def __init__( """ Args: hpo(MinimalOntology): An HPO ontology object from hpo-toolkit + tx_id(str): the transcript accession `str` (e.g. `NM_123456.7`) top_phenotype_count(int): Maximum number of phenotype items (HPO terms, measurements, ...) to display in the HTML table (default: 10) top_variant_count(int): Maximum number of variants to display in the HTML table (default: 10) """ super().__init__() + assert isinstance(hpo, hpotk.MinimalOntology) self._hpo = hpo + assert isinstance(top_phenotype_count, int) self._top_phenotype_count = top_phenotype_count + assert isinstance(top_variant_count, int) self._top_variant_count = top_variant_count self._cohort_template = self._environment.get_template("cohort.html") def process( self, cohort: Cohort, - transcript_id: typing.Optional[str] = None, + transcript_id: str, ) -> GpseaReport: """ Generate the report for a given `cohort`. + The variant effects will be reported with respect to the provided transcript. + Args: - cohort (Cohort): The cohort being analyzed in the current Notebook - transcript_id (str): the transcript that we map variants onto + cohort (Cohort): the cohort to visualize + transcript_id (str): the accession of the target transcript (e.g. `NM_123456.7`) Returns: GpseaReport: a report that can be stored to a path or displayed in diff --git a/tests/view/test_view.py b/tests/view/test_view.py index f29ef78e..ace650cd 100644 --- a/tests/view/test_view.py +++ b/tests/view/test_view.py @@ -2,9 +2,10 @@ import os import hpotk -import pytest import pandas as pd +import pytest +from gpsea.analysis import StatisticResult from gpsea.analysis.pcats import HpoTermAnalysisResult from gpsea.analysis.pcats.stats import FisherExactTest from gpsea.analysis.predicate.genotype import GenotypePolyPredicate @@ -104,9 +105,9 @@ def hpo_term_analysis_result( columns=pd.Index(suox_gt_predicate.get_categories()), ), ), - pvals=( - math.nan, - 0.005, + statistic_results=( + StatisticResult(statistic=None, pval=math.nan), + StatisticResult(statistic=1.23, pval=0.01), ), corrected_pvals=(math.nan, 0.01), mtc_filter_name="Random MTC filter",