Question: Heatmap making via Complexheatmap package
0
gravatar for citronxu
7 months ago by
citronxu10
citronxu10 wrote:

Hello there,

Recently I've changed into MacOS and encountered some problems in Rstudio using. The thing is, when I plotted my data into heat map using ComplexHeatmap package in R studio, following the commands

mat <- read.table("xxx.csv", header = T, na.string = "-", sep = ";") #read the table from a .csv file
rownames(mat)  = mat$gene # set the first 'gene' column as row names
mat <- data.matrix(mat[-1]) # basically changing into matrix which could be used

after these commands, the problem is that all values in my table are transformed from numeric into integers automatically... I figure that it may lies on the properties of all of my data in the original csv file are somehow inappropriate, but I don't know how should I change it... also with the same commands desired heat map could be build perfectly in windows...

also,I tried another command, replacing 'data.matrix' with 'as.matrix' and it did solve my former problem, but only heat map with discrete pattern, which means each data is represented by one unique colour, could be established. When it comes to plotting my data into a continuous pattern with data shown by continuous colour bar, for which I tended to achieve by following commands:

library(circlize)
col_fun = colorRamps2(c(-2,0,2), c("green", "white", "red"))
Heatmap(mat, col = col_fun)

then came the error info:

Error in x - break2 : non-numeric argument to binary operator In addition: Warning message: In .bincode(x2, breaks, right = TRUE, include.lowest = TRUE) : NAs introduced by coercion

appreciate any advice, many thanks in advance.

heatmap R • 346 views
ADD COMMENTlink modified 7 months ago • written 7 months ago by citronxu10

Can you post the first few lines of your matrix after calling as.matrix on it?

ADD REPLYlink written 7 months ago by jared.andrews078.4k

yeah, sure.

enter image description here

ADD REPLYlink modified 7 months ago • written 7 months ago by citronxu10
1

Well, whatever is the cause of the error, you cannot generate a heatmap with NA values. You will have to remove any gene with NA or impute these values.

ADD REPLYlink written 7 months ago by Kevin Blighe69k
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: 1973 users visited in the last hour
_