gpsea.view package
- class gpsea.view.GpseaReport[source]
Bases:
object
GpseaReport summarizes an aspect of an analysis for the user.
- class gpsea.view.CohortVariantViewer(tx_id: str)[source]
Bases:
object
CohortVariantViewer creates an HTML report with the cohort variants.
The report can be either written into an HTML file or displayed in a Jupyter notebook.
See :ref:show-cohort-variants: for an example usage.
- process(cohort: Cohort, only_hgvs: bool = True) GpseaReport [source]
Generate the variant report.
- Parameters:
- Returns:
- a report that can be stored to a path or displayed in
interactive environment such as Jupyter notebook.
- Return type:
- class gpsea.view.CohortViewer(hpo: MinimalOntology, top_phenotype_count: int = 10, top_variant_count: int = 10)[source]
Bases:
BaseViewer
CohortViewer summarizes the most salient
Cohort
aspects into an HTML report.
- class gpsea.view.ProteinVisualizer(random_seed: int = 42)[source]
Bases:
object
Draw a schema of a protein with variants of the cohort.
- draw_protein_diagram(tx_coordinates: TranscriptCoordinates, protein_metadata: ProteinMetadata, cohort: Cohort, ax: Axes | None = None, labeling_method: Literal['abbreviate', 'enumerate'] = 'abbreviate') Axes | None [source]
- draw_fig(pvis: ProteinVisualizable, ax: Axes | None = None, labeling_method: Literal['abbreviate', 'enumerate'] = 'abbreviate') Axes | None [source]
Visualize the cohort variants on a protein diagram.
By default, the legend is drawn to the right of the figure to avoid overlap between the variant markers and the legend.
- Parameters:
pvis –
ProteinVisualizable
with information about the transcript coordinates, protein metadata, and the cohort for plottingax – a Matplotlib
plt.Axes
to plot on or None if a new Axes should be createdlabeling_method – the strategy for generating labels. Valid values of labeling_method are {‘abbreviate’, ‘enumerate’}
- Returns:
None if an
plt.Axes
was provided via ax argument or an Axes created by the visualizer if ax was None.
- class gpsea.view.ProteinVisualizable(tx_coordinates: TranscriptCoordinates, protein_meta: ProteinMetadata, cohort: Cohort)[source]
Bases:
object
- property transcript_coordinates: TranscriptCoordinates
- property protein_metadata: ProteinMetadata
- property variant_effects: Sequence[VariantEffect]
- property marker_counts
- class gpsea.view.ProteinVariantViewer(protein_metadata: ProteinMetadata, tx_id: str)[source]
Bases:
object
Class to create a pretty HTML table to display the protein information in the Jupyter notebook.
- process(cohort: Cohort) GpseaReport [source]
Summarize the data regarding the protein into a HTML table.
- Parameters:
cohort (Cohort) – the cohort of patients being analyzed
- Returns:
- a report that can be stored to a path or displayed in
interactive environment such as Jupyter notebook.
- Return type:
- class gpsea.view.DiseaseViewer(hpo: MinimalOntology, transcript_id: str | None = None)[source]
Bases:
object
TODO
- process(cohort: Cohort) GpseaReport [source]
- class gpsea.view.MtcStatsViewer[source]
Bases:
object
MtcStatsViewer uses a Jinja2 template to create an HTML element for showing in the Jupyter notebook or for writing into a standalone HTML file.
- process(result: HpoTermAnalysisResult) GpseaReport [source]
Create an HTML to present MTC part of the
HpoTermAnalysisResult
.Use the display(HTML(..)) functions of the IPython package.
- Parameters:
result (HpoTermAnalysisResult) – the result to show
- Returns:
- a report that can be stored to a path or displayed in
interactive environment such as Jupyter notebook.
- Return type:
- gpsea.view.summarize_hpo_analysis(hpo: MinimalOntology, result: HpoTermAnalysisResult) DataFrame [source]
Create a dataframe with counts, frequencies, and p values for the tested HPO terms.
The HPO terms that were not tested will not be included in the frame.
- Parameters:
hpo – HPO data.
result – the HPO term analysis results to show.
- class gpsea.view.VariantTranscriptVisualizer[source]
Bases:
object
VariantTranscriptProteinArtist creates a graphic to show distributions of variants across a provided transcript and its protein product.
- draw_variants(variants: Iterable[Variant], tx: TranscriptCoordinates, protein: ProteinMetadata)[source]