Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify API for CohortViewable #262

Open
pnrobinson opened this issue Sep 11, 2024 · 1 comment
Open

Simplify API for CohortViewable #262

pnrobinson opened this issue Sep 11, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@pnrobinson
Copy link
Member

pnrobinson commented Sep 11, 2024

Currently, we have this:

from gpsea.view import CohortViewable
cv = CohortViewable(hpo=hpo)
report = cv.process(cohort=cohort, transcript_id=POLR1A_MANE_transcript)
display(HTML(report))

but the report object is only used here. We could simplify the API by allowing something like this:

from gpsea.view import CohortViewable
display(HTML(CohortViewable.to_html(hpo=hpo, cohort=cohort, transcript_id=POLR1A_MANE_transcript)))

It would be great to reduce the number of lines of code for the Notebooks in general, this would help users!

@ielis
Copy link
Member

ielis commented Sep 11, 2024

Yeah, this could be turned into a free function that uses CohortViewable (CohortSummaryViewer would be a better name) under the hood.

So, instead of exporting CohortViewable from gpsea.view, there should be a function

def summarize_cohort(cohort: Cohort, hpo: hpotk.MinimalOntology, tx_id: str) -> str:
    # Implement!
    pass

which we should use as

from gpsea.view import summarize_cohort

summary = summarize_cohort(cohort, hpo, tx_id=POLR1A_MANE_transcript)
display(HTML(summary))

@ielis ielis added the enhancement New feature or request label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants