Skip to content

Commit

Permalink
Merge pull request #370 from monarch-initiative/require-tx-id-in-coho…
Browse files Browse the repository at this point in the history
…rt-viewer

`CohortViewer` needs transcript ID to visualize a cohort
  • Loading branch information
ielis authored Dec 4, 2024
2 parents edf3306 + 346780a commit e234924
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/gpsea/view/_viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions tests/view/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit e234924

Please sign in to comment.