CAS Output Visualization

class cellarium.cas.visualization.CASCircularTreePlotUMAPDashApp(adata: AnnData, cas_ontology_aware_response: CellTypeOntologyAwareResults, cluster_label_obs_column: str | None = None, aggregation_op: CellOntologyScoresAggregationOp = CellOntologyScoresAggregationOp.MEAN, aggregation_domain: CellOntologyScoresAggregationDomain = CellOntologyScoresAggregationDomain.OVER_THRESHOLD, score_threshold: float = 0.05, min_cell_fraction: float = 0.01, umap_marker_size: float = 3.0, umap_padding: float = 0.15, umap_min_opacity: float = 0.1, umap_max_opacity: float = 1.0, umap_inactive_cell_color: str = 'rgb(180,180,180)', umap_inactive_cell_opacity: float = 0.5, umap_active_cell_color: str = 'rgb(250,50,50)', umap_default_cell_color: str = 'rgb(180,180,180)', umap_default_opacity: float = 0.9, circular_tree_plot_linecolor: str = 'rgb(200,200,200)', circular_tree_start_angle: int = 180, circular_tree_end_angle: int = 360, figure_height: int = 400, hidden_cl_names_set: set[str] = {}, shown_cl_names_set: set[str] = {'CL_0000019', 'CL_0000023', 'CL_0000039', 'CL_0000057', 'CL_0000058', 'CL_0000060', 'CL_0000064', 'CL_0000066', 'CL_0000076', 'CL_0000084', 'CL_0000092', 'CL_0000094', 'CL_0000097', 'CL_0000115', 'CL_0000125', 'CL_0000126', 'CL_0000127', 'CL_0000136', 'CL_0000148', 'CL_0000151', 'CL_0000163', 'CL_0000182', 'CL_0000187', 'CL_0000222', 'CL_0000223', 'CL_0000235', 'CL_0000236', 'CL_0000322', 'CL_0000451', 'CL_0000499', 'CL_0000540', 'CL_0000576', 'CL_0000646', 'CL_0000679', 'CL_0000786', 'CL_0000789', 'CL_0000798', 'CL_0000814', 'CL_0000827', 'CL_0001065', 'CL_0002319', 'CL_0002419', 'CL_0002420', 'CL_0005006', 'CL_0005026', 'CL_0007005', 'CL_0008019', 'CL_0008034', 'CL_0009004', 'CL_0011005'}, score_colorscale: str | list = 'Viridis')[source]

A Dash app for visualizing the results of a Cellarium CAS cell type ontology-aware analysis.

Parameters:
  • adata – The AnnData object containing the cell type ontology-aware analysis results.

  • cas_ontology_aware_response – The response from the Cellarium CAS cell type ontology-aware analysis.
    Default: None

  • cluster_label_obs_column – The name of the observation column containing the cluster labels.
    Default: None

  • aggregation_op – The aggregation operation to apply to the cell type ontology-aware scores.
    Default: CellOntologyScoresAggregationOp.MEAN

  • aggregation_domain – The domain over which to aggregate the cell type ontology-aware scores.
    Default: CellOntologyScoresAggregationDomain.OVER_THRESHOLD

  • score_threshold – The threshold for the cell type ontology-aware scores.
    Default: 0.05

  • min_cell_fraction – The minimum fraction of cells that must have a cell type ontology-aware score above the threshold.
    Default: 0.01

  • umap_marker_size – The size of the markers in the UMAP scatter plot.
    Default: 3.0

  • umap_padding – The padding to apply to the UMAP scatter plot bounds.
    Default: 0.15

  • umap_min_opacity – The minimum opacity for the UMAP scatter plot markers.
    Default: 0.1

  • umap_max_opacity – The maximum opacity for the UMAP scatter plot markers.
    Default: 1.0

  • umap_inactive_cell_color – The color for inactive cells in the UMAP scatter plot.
    Default: "rgb(180,180,180)"

  • umap_inactive_cell_opacity – The opacity for inactive cells in the UMAP scatter plot.
    Default: 0.5

  • umap_active_cell_color – The color for active cells in the UMAP scatter plot.
    Default: "rgb(250,50,50)"

  • umap_default_cell_color – The default color for cells in the UMAP scatter plot.
    Default: "rgb(180,180,180)"

  • umap_default_opacity – The default opacity for cells in the UMAP scatter plot.
    Default: 0.9

  • circular_tree_plot_linecolor – The line color for the circular tree plot.
    Default: "rgb(200,200,200)"

  • circular_tree_start_angle – The start angle for the circular tree plot.
    Default: 180

  • circular_tree_end_angle – The end angle for the circular tree plot.
    Default: 360

  • figure_height – The height of the figures in the Dash app.
    Default: 400

  • hidden_cl_names_set – The set of cell type ontology terms to hide from the visualization.
    Default: DEFAULT_HIDDEN_CL_NAMES_SET

  • shown_cl_names_set – The set of cell type ontology terms to always show as text labels in the visualization.
    Default: DEFAULT_SHOWN_CL_NAMES_SET

  • score_colorscale – The colorscale to use for the cell type ontology-aware scores.
    Default: "Viridis"

Example:

>>> from cellarium.cas._io import suppress_stderr
>>> from cellarium.cas.visualization import CASCircularTreePlotUMAPDashApp
>>> DASH_SERVER_PORT = 8050
>>> adata = ... # get your matrix
>>> cas_ontology_aware_response = cas.annotate_matrix_cell_type_ontology_aware_strategy(
>>>     matrix=adata,
>>>     chunk_size=500
>>> )
>>> with suppress_stderr():
>>>     CASCircularTreePlotUMAPDashApp(
>>>         adata,
>>>         cas_ontology_aware_response,
>>>         cluster_label_obs_column="cluster_label",
>>>     ).run(port=DASH_SERVER_PORT, debug=False, jupyter_width="100%")
run(port: int = 8050, **kwargs)[source]

Run the Dash application on the specified port.

Parameters:

port – The port on which to run the Dash application.
Default: 8050

class cellarium.cas.postprocessing.ontology_aware.CellOntologyScoresAggregationOp(value)[source]

The aggregation operation to apply to the scores of each ontology term.

MEAN = 1
MEDIAN = 2
class cellarium.cas.postprocessing.ontology_aware.CellOntologyScoresAggregationDomain(value)[source]

The domain over which to aggregate the scores of each ontology term.

ALL_CELLS = 1
OVER_THRESHOLD = 2