This is a test version of Biostars. For the public version, visit https://www.biostars.org.
heatmap of genes pseudotime in monocle3

Dear all, following some conversations at https://github.com/cole-trapnell-lab/monocle-release/issues/295, is there a way to plot the heatmap of differential progressing genes along the trajectory ? Thank you very much !

monocle2 monocle3

1 answer

Replying to my own message above, the R code can be found in the publication :

"https://pubmed.ncbi.nlm.nih.gov/32094115/"

https://github.com/crickbabs/ZebrafishDevelopingHindbrainAtlas

and the lines or R code that are relevant are :

genes     <- read.delim("data/TF_heatmap.txt",header=T,sep="\t",stringsAsFactors=F)[,2]
pt.matrix <- as.matrix(cds@assays$data$counts[match(genes,rowData(cds)[,2]),order(pseudotime(cds))])
pt.matrix <- t(apply(pt.matrix,1,function(x){smooth.spline(x,df=3)$y}))
pt.matrix <- t(apply(pt.matrix,1,function(x){(x-mean(x))/sd(x)}))
rownames(pt.matrix) <- genes;
ht <- Heatmap(
  pt.matrix,
  name                         = "z-score",
  col                          = colorRamp2(seq(from=-2,to=2,length=11),rev(brewer.pal(11, "Spectral"))),
  show_row_names               = TRUE,
  show_column_names            = FALSE,
  row_names_gp                 = gpar(fontsize = 6),
  km = 6,
  row_title_rot                = 0,
  cluster_rows                 = TRUE,
  cluster_row_slices           = FALSE,
  cluster_columns              = FALSE)
print(ht)

Log in to answer this question.