Error while using ComplexHeatmap
1
1
Entering edit mode
5.1 years ago

Hi,

I am using the ComplexHeatmap library to obtain the heatmap of the data. There are 19 rows (samples- different timepoints) and 264 genes (columns). There are few missing values in the data frame. I keep getting the below error message. Also attached is the screenshot of the data. Please assist me in resolving this error.

library(ComplexHeatmap)
library(circlize)

Neg_Dct <- read.csv(file = "./NegDCt_Subject_B1.csv",stringsAsFactors = FALSE)

## Check missing values ##
is.na(Neg_Dct)

## Create a data frame by ignoring columns 1 to 4- categorical data###
df = Neg_Dct[,-c(1:4)]

my_matrix <- as.matrix(df)

class(df)
[1] "data.frame"
class(my_matrix)
[1] "matrix"

Heatmap(my_matrix)

Error in hclust(get_dist(t(mat), distance), method = method) : 
  NA/NaN/Inf in foreign function call (arg 11)

Imgur

ComplexHeatmap missing values R library • 1.5k views
ADD COMMENT
3
Entering edit mode
5.1 years ago
russhh 5.7k

The NAs in your data are causing the clustering to fail. If you want clustering, you could either restrict to complete cases or do the clustering over imputed values; then I think you can pass in the cluster object to ComplexHeatmap (Can't quite remember TBH)

ADD COMMENT
0
Entering edit mode

Thank you very much @russhh.

ADD REPLY

Login before adding your answer.

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