Entering edit mode
2.0 years ago
mohammedtoufiq91
▴
260
Hi,
I was wondering if there is a possibility of marking genes of interest on the heatmap via ComplexHeatmap
R package. Instead of specifying row numbers inanno_mark
function, can we specify the gene list and mark on the heatmap? For long gene list, it's bit challenging to identify the rownames of each gene and specify them. Thank you.
Genes of interest
genes_to_show = c('Gene_A', 'Gene_F', 'Gene_L', 'Gene_R', 'Gene_GG', 'Gene_ZZ', 'Gene_Test')
Mark rownames
ha = rowAnnotation(foo = anno_mark(at = c(1:4, 11, 28, 44,:47),
labels = rownames(m)) ## Mention gene list here "genes_to_show" instead of specifying row numbers
This would work, but still need to specify row numbers
ha = rowAnnotation(foo = anno_mark(at = c(1:4, 11, 28, 44,:47),
labels = genes_to_show))
Plot heatmap
Heatmap(m, name = "mat", cluster_rows = FALSE, right_annotation = ha,
row_names_side = "left", row_names_gp = gpar(fontsize = 4))
Best Regards,
Mohammed
Giuseppe thank you very much. This was very helpful.
Maybe another question, there are associated p-values with all the genes diff.exp between two groups in the
heatmap
(full matrix), is there a possibility to add anotherright_annotation
by color code based on the strength of p-values and add a legend scale.Yes, it is actually in the manual that you can find here.
However, it shows how to build an annotation for p-values only for columns.
I have written a working example (statistically invalid so don't mind that part!) with simulated data where I add a row annotation with -log10(FDR), which is better for visualization. You will also need the
circlize
package to build the color vector.Giuseppe thank you. I will test this.