heatmap of genes pseudotime in monocle3
1
0
Entering edit mode
2.7 years ago
Bogdan ★ 1.4k

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 and • 2.7k views
ADD COMMENT
2
Entering edit mode
2.3 years ago
Bogdan ★ 1.4k

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)
ADD COMMENT

Login before adding your answer.

Traffic: 1976 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6