tfmindi.pl.dbd_heatmap

Contents

tfmindi.pl.dbd_heatmap#

tfmindi.pl.dbd_heatmap(adata, dbd_column='cluster_dbd', cell_type_column='cell_type', cmap='Spectral_r', row_cluster=True, col_cluster=True, drop_na=True, linewidths=0.01, standard_scale=False, **kwargs)#

Create a clustered heatmap showing seqlet counts per cell type and DNA-binding domain.

Creates a cross-tabulation of cell types vs DBD annotations and visualizes it as a clustered heatmap, similar to the analysis in the original paper.

Parameters:
  • adata (AnnData) – AnnData object with seqlet data. Must contain specified dbd_column and cell_type_column in adata.obs.

  • dbd_column (str (default: 'cluster_dbd')) – Column name in adata.obs containing DNA-binding domain annotations.

  • cell_type_column (str (default: 'cell_type')) – Column name in adata.obs containing cell type annotations.

  • cmap (str (default: 'Spectral_r')) – Colormap for the heatmap.

  • row_cluster (bool (default: True)) – Whether to perform hierarchical clustering on the rows.

  • col_cluster (bool (default: True)) – Whether to perform hierarchical clustering on the columns.

  • drop_na (bool (default: True)) – Whether to drop columns/rows with NaN values.

  • linewidths (float (default: 0.01)) – Width of lines separating cells in the heatmap.

  • standard_scale (bool (default: False)) – Whether to standard scale the data across rows (cell types).

  • **kwargs – Additional arguments passed to render_plot() for styling and display options. Common options include width, height, title, show, save_path, dpi.

Return type:

Figure | None

Returns:

Figure with clustered heatmap, or None if show=True.

Examples

>>> import tfmindi as tm
>>> # After creating AnnData with cell type mapping
>>> cell_type_mapping = {0: "Neuron", 1: "Astrocyte", 2: "Microglia"}
>>> adata = tm.pp.create_seqlet_adata(..., cell_type_mapping=cell_type_mapping)
>>> # Create heatmap
>>> fig = tm.pl.plot_dbd_heatmap(adata, show=False)
>>> # Custom styling
>>> tm.pl.plot_dbd_heatmap(adata, width=12, height=8, title="DBD Counts per Cell Type")