highest_expressed_genes#

API pages include interactive (HTML) plots that would possibly not render correctly on a mobile device.

highest_expressed_genes(data: AnnData | MuData, n: int = 20, *, modality: str | None = None, mapping: FeatureSpec | None = None, threshold: float | None = None, observation_id_column: str = 'Barcode', value_column: str = 'value', variable_column: str = 'variable', color: str = '#1f1f1f', size: float = 0.5, outlier_size: float = 0.2, outlier_alpha: float = 0.5, fatten: float = 1, **geom_kwargs) → PlotSpec#

Highest Expressed Genes Plot.

Parameters:
  • data (AnnData | MuData) – The single-cell data object.

  • n (int, default 20) – Number of top expressed genes to display, ranked by mean percentage across all cells.

  • modality (str | None, default None) – Which modality’s stored analysis results to use. Required for a multimodal object holding more than one modality, and not accepted otherwise.

  • mapping (FeatureSpec | None, default None) – Additional aesthetic mappings for the plot, the result of aes().

  • threshold (float | None, default None) – If provided, filters out rows where the value column is below the threshold.

  • observation_id_column (str, default 'Barcode') – The name to give to barcode (or index) column in the dataframe.

  • value_column (str, default 'value') – The name to give to the value column after unpivoting.

  • variable_column (str, default 'variable') – The name to give to the variable column after unpivoting.

  • color (str, default '#1f1f1f') – Border color of the boxplots.

  • size (float, default 0.5) – Line size of the boxplots.

  • outlier_size (float, default 0.2) – Size of the outlier points.

  • outlier_alpha (float, default 0.5) – Transparency of the outlier points.

  • fatten (float, default 1) – Factor to fatten the median line.

  • **geom_kwargs – Additional parameters for the geom_boxplot layer. For more information on geom_boxplot parameters, see: https://lets-plot.org/python/pages/api/lets_plot.geom_boxplot.html

Returns:

PlotSpec – Highest expressed genes boxplot.

Raises:

UnsupportedDataTypeError – If data is not a supported single-cell data object.

Examples

A simple Highest expressed genes boxplot.

import scanpy as sc
from ggrust import *

import cellestial as cl

data = cl.datasets.pbmc3k()

cl.highest_expressed_genes(data,n=20)
0 1 2 3 4 5 6 7 8 RPS27 TPT1 B2M RPL41 HBD RPS12 MT-ND2 MTRNR2L12 MT-ND1 MT-ND4 MT-CYB MT-ND3 MT-CO2 MT-CO3 MT-ATP6 HBA1 MT-CO1 MALAT1 HBA2 HBB Percentage of Total Counts

Customize the plot.

import scanpy as sc
from ggrust import *

import cellestial as cl

data = cl.datasets.pbmc3k()

cl.highest_expressed_genes(
    data,
    n=10,
    outlier_size=0.1,
    outlier_alpha=0.2,
    outlier_shape=5)+scale_fill_viridis()
0 1 2 3 4 5 6 7 8 MT-CYB MT-ND3 MT-CO2 MT-CO3 MT-ATP6 HBA1 MT-CO1 MALAT1 HBA2 HBB Percentage of Total Counts