Question: Add gene name in ComplexHeatmap
0
gravatar for garciajessica0311
3 months ago by
garciajessica031110 wrote:

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")
complexheatmap R • 165 views
ADD COMMENTlink modified 3 months ago by kakukeshi50 • written 3 months ago by garciajessica031110
0
gravatar for Arup Ghosh
3 months ago by
Arup Ghosh2.6k
India
Arup Ghosh2.6k wrote:

Set genes names as rownames in the matrix.

ADD COMMENTlink modified 3 months ago • written 3 months ago by Arup Ghosh2.6k

I tried this :

rownames(my_matrix) = my_data$Gene

It's working ! :) Thanks !

ADD REPLYlink written 3 months ago by garciajessica031110
0
gravatar for kakukeshi
3 months ago by
kakukeshi50
kakukeshi50 wrote:

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

ADD COMMENTlink modified 3 months ago by genomax87k • written 3 months ago by kakukeshi50
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1486 users visited in the last hour