Entering edit mode
4.6 years ago
garciajessica0311
▴
10
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")
I tried this :
It's working ! :) Thanks !