R语言:plotExprHeatmap绘制表达热图

导读

CATALYST流式细胞数据分析工具包,plotExprHeatmap函数能进行怎样的可视化。

plotExprHeatmap文档:https://rdrr.io/bioc/CATALYST/man/plotExprHeatmap.html

依赖安装CATALYST

BiocManager::install("CATALYST")
library("CATALYST")

一、输入数据

data(PBMC_fs, PBMC_panel, PBMC_md)
sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
sce <- cluster(sce) 

二、"first": scale & trim then aggregate

median scaled & trimmed expression by cluster

中位数标准化:https://www.plob.org/article/829.html

# median scaled & trimmed expression by cluster
plotExprHeatmap(sce, 
  by = "cluster_id", k = "meta8",
  scale = "first", q = 0.05, bars = FALSE)

三、"last": aggregate then scale & trim

scale each marker between 0 and 1
after aggregation (without trimming)

plotExprHeatmap(sce, 
  scale = "last", q = 0,
  bars = TRUE, perc = TRUE,
  hm_pal = hcl.colors(10, "YlGnBu", rev = TRUE))

四、"never": aggregate only

raw (un-scaled) median expression by cluster-sample

plotExprHeatmap(sce,
  features = "pp38", by = "both", k = "meta10", 
  scale = "never", row_anno = FALSE, bars = FALSE)

五、Include subset of samples and specific annotations

# include only subset of samples
sub <- filterSCE(sce, 
  patient_id != "Patient",
  sample_id != "Ref3")
 
# includes specific annotations &
# split into CDx & all other markers
is_cd <- grepl("CD", rownames(sce))
plotExprHeatmap(sub, 
  rownames(sce)[is_cd], 
  row_anno = "condition", 
  bars = FALSE)
plotExprHeatmap(sub, 
  rownames(sce)[!is_cd], 
  row_anno = "patient_id",
  bars = FALSE)