scmagnify.plotting.heatmap

Contents

scmagnify.plotting.heatmap#

scmagnify.plotting.heatmap(data, var_names, modal='GRN', layer='mlm_estimated', cmap='RdBu_r', tkey_cmap='Spectral_r', selected_genes=None, cell_selection=None, sortby='pseudotime', smooth_method='gam', n_splines=4, n_deg=3, n_convolve=30, standard_scale=0, sort=True, col_annos=None, col_cluster=False, row_cluster=False, row_split=None, figsize=(8, 4), dpi=100, show=None, save=None, **kwargs)#

Plot time series for genes as a heatmap.

Parameters:
  • data (AnnData | MuData | GRNMuData) – Single cell data object. Can be an anndata.AnnData, mudata.MuData, scmagnify.GRNMuData

  • var_names (str | list[str]) – Names of variables to use for the plot.

  • modal (Literal['GRN', 'ATAC', 'RNA'] (default: 'GRN')) – Modality key (e.g., ‘RNA’, ‘ATAC’) when using multi-modal data. mudata.MuData or scmagnify.GRNMuData must be provided.

  • layer (str (default: 'mlm_estimated')) – Layer in layers. If None, defaults to X.

  • cmap (str (default: 'RdBu_r')) – Colormap name or object. See matplotlib.cm.

  • tkey_cmap (str (default: 'Spectral_r')) – Colors to use for plotting continuous variables. e.g., pseudotime

  • selected_genes (Optional[list[str]] (default: None)) – List of genes to highlight in the heatmap.

  • cell_selection (Optional[list[str]] (default: None)) – List of cells to plot separately in the heatmap.

  • sortby (str (default: 'pseudotime')) – Observation key to extract time data from.

  • smooth_method (Literal['gam', 'convolve', 'polyfit'] (default: 'gam')) – Method used to smooth trends/values.

  • n_splines (int | None (default: 4)) – Number of splines for GAM smoothing.

  • n_deg (int | None (default: 3)) – Polynomial degree for polyfit smoothing.

  • n_convolve (int | None (default: 30)) – Kernel size for convolution along sorted axis.

  • standard_scale (int (default: 0)) – Standardize features over variables (0) or observations (1).

  • sort (bool (default: True)) – Whether to sort the expression values given by layer.

  • col_annos (Optional[list[str]] (default: None)) – List of observation keys to use as column annotations.

  • row_cluster (bool (default: False)) – Whether to cluster the rows.

  • col_cluster (bool (default: False)) – Whether to cluster the columns.

  • row_split (Optional[list[str]] (default: None)) – Observation key to split the rows by.

  • figsize (tuple (default: (8, 4))) – Figure size.

  • show (Optional[bool] (default: None)) – Whether to display the figure. If None, the figure will be shown by default.

  • save (Optional[str] (default: None)) – Whether to save the figure. If True, the figure is saved to a file using the writekey. If a str is provided, it is used as the filename, potentially overriding other settings. If None or False, the figure is not saved.

  • kwargs – Arguments passed to ClusterMapPlotter.

  • dpi (int)

Return type:

ClusterMapPlotter | None

Returns:

ClusterMapPlotter | None Returned when show is False.