plot_heatmap_DEseq: Plot a heatmap of differentially expressed genes for a single...

View source: R/BulkRNAseq.R

plot_heatmap_DEseqR Documentation

Plot a heatmap of differentially expressed genes for a single contrast

Description

This function selects DEGs from a contrast result, optionally applies voom transformation and batch correction, then displays a z‑scored heatmap of expression across samples.

Usage

plot_heatmap_DEseq(
  contrast_df,
  count_mat,
  meta_df,
  cleanBatch = TRUE,
  VoomTrans = FALSE,
  BatchFeat = NULL,
  gene_meta,
  filter = FALSE,
  padj_thr = 0.05,
  absLog2FC_thr = 0.58
)

Arguments

contrast_df

A data.frame of DE results with columns:

ensembl_ID

gene IDs matching rownames of count_mat

log2FoldChange

numeric log2 fold changes

padj

numeric adjusted p‑values

contrast_name

character string used for the plot title

count_mat

Numeric matrix of raw counts (rows=genes, cols=samples). Row names must match contrast_df$ensembl_ID, column names match rownames of meta_df.

meta_df

Data.frame of sample metadata; rows must align with cols of count_mat. Must include the column named by BatchFeat for batch removal and optionally PD1status, seqrun for annotations.

cleanBatch

Logical; if TRUE, calls limma::removeBatchEffect on BatchFeat. Default TRUE.

VoomTrans

Logical; if TRUE, applies limma::voom before batch correction. Default FALSE.

BatchFeat

Character; the column name in meta_df indicating batch. Required when cleanBatch = TRUE.

gene_meta

Data.frame mapping ensembl_ID (rownames) to final gene names. Must contain column final_GeneName.

filter

Logical; if TRUE, DEGs are filtered by padj and absLog2FC. Default FALSE.

padj_thr

Numeric cutoff for adjusted p‑value when filter=TRUE. Default 0.05.

absLog2FC_thr

Numeric cutoff for absolute log2 fold‑change when filter=TRUE. Default 0.58.

Value

Invisibly returns the pheatmap object.


eisascience/scCustFx documentation built on June 2, 2025, 3:59 a.m.