Question: Error while using ComplexHeatmap
1
gravatar for mohammedtoufiq91
4 months ago by
mohammedtoufiq91110 wrote:

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

ADD COMMENTlink modified 4 months ago • written 4 months ago by mohammedtoufiq91110
3
gravatar for russhh
4 months ago by
russhh5.2k
UK, U. Glasgow
russhh5.2k wrote:

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 COMMENTlink modified 4 months ago by zx87549.1k • written 4 months ago by russhh5.2k

Thank you very much @russhh.

ADD REPLYlink written 4 months ago by mohammedtoufiq91110
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: 965 users visited in the last hour