Skip to contents

Create a heatmap showing gene expression patterns across conditions with optional dendrograms and gene age annotation.

Usage

plot_gene_heatmap(
  phyex_set,
  genes = NULL,
  top_p = 0.2,
  std = TRUE,
  show_reps = FALSE,
  cluster_rows = FALSE,
  cluster_cols = FALSE,
  show_gene_age = TRUE,
  show_gene_ids = FALSE,
  ...
)

Arguments

phyex_set

A PhyloExpressionSet object (BulkPhyloExpressionSet or ScPhyloExpressionSet)

genes

Character vector of specific gene IDs to include (default: NULL for auto-selection)

top_p

Numeric value specifying the top proportion of genes to include (default: 0.2)

std

Logical indicating whether to standardize expression values (default: TRUE)

show_reps

Logical indicating whether to show replicates or collapsed data (default: FALSE)

cluster_rows

Logical indicating whether to cluster genes/rows (default: FALSE)

cluster_cols

Logical indicating whether to cluster conditions/columns (default: FALSE)

show_gene_age

Logical indicating whether to show gene age annotation (default: TRUE)

show_gene_ids

Logical indicating whether to show gene identifiers (default: FALSE)

...

Additional arguments passed to specific methods

Value

A ggplot object (converted from pheatmap) showing the gene expression heatmap

Details

This function creates a comprehensive heatmap visualization of gene expression patterns. By default, genes are ordered by their expression angle (developmental trajectory). The function supports clustering of both genes and identities, and can optionally display gene age (phylostratum) as a colored annotation bar.

For bulk data, the heatmap shows expression across developmental conditions. For single-cell data, the heatmap shows expression across cell types.

The gene age annotation uses the PS_colours function to create a consistent color scheme across different myTAI visualizations.

Examples

# Basic heatmap with gene age annotation
# p1 <- plot_gene_heatmap(bulk_phyex_set, show_gene_age = TRUE)

# Single-cell heatmap with subset of cells
# p2 <- plot_gene_heatmap(sc_phyex_set, show_reps = TRUE, max_cells_per_type = 3)