Add gene name in ComplexHeatmap
2
0
Entering edit mode
4.6 years ago

Hi, I am a beginner in R and I would like to add gene name in my heatmap generated. I imported a txt file from a normalized transcriptomic data with row = gene and colum = cell Only numerical value can be used for generating the heatmap, so I remove the first colum with all gene names. How can I add the gene name stored in the data frame "gene_info" in the heatmap ? Thanks a lot for your help, Best, Jessica

> library(ComplexHeatmap)
> filename<-"Dataset-APM.txt"
> my_data <- read.table(filename, sep="\t", quote="", stringsAsFactors=FALSE,header=TRUE)
> my_matrix <- as.matrix(my_data[  ,c(2:32)])
> gene_info <- data.frame(gene=my_data$Gene) 
> my_matrix <- t(my_matrix)
> Heatmap(my_matrix, cluster_columns=FALSE)
> Heatmap(my_matrix,
    cluster_columns=FALSE,
    row_names_side = "left",
    row_hclust_side = "right",
    row_names_gp=gpar(cex=0.8),
    row_hclust_width = unit(3, "cm"),
    clustering_distance_rows ="maximum",
    clustering_method_rows = "ward.D")
R complexheatmap • 2.4k views
ADD COMMENT
0
Entering edit mode
4.6 years ago

Set genes names as rownames in the matrix.

ADD COMMENT
0
Entering edit mode

I tried this :

rownames(my_matrix) = my_data$Gene

It's working ! :) Thanks !

ADD REPLY
0
Entering edit mode
4.6 years ago
kakukeshi ▴ 80

add the argument row_labels = my_data$Gene in the function Heatmap.

ADD COMMENT

Login before adding your answer.

Traffic: 2068 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