This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error while plotting heatmap

I am getting this strange error while plotting my heatmap which contains the matrix, sampleDistMatrix. sampleDistMatrix is a matrix that contains 28 rows and 1 column. sampleDists contain 28 rows . The following are the screenshot of the values inside sampleDistmatrix and sampleDists respectively.

enter image description here enter image description here

The code is as follows:

pheatmap(sampleDistMatrix,
       clustering_distance_rows = sampleDists,
       clustering_distance_cols = sampleDists,
       clustering_method = 'ward.D', fontsize = 8,
       col = colors)

The error that I receive to the following code :

Error in cluster_mat(mat, distance = clustering_distance_rows, method = clustering_method) : distance has to be a dissimilarity structure as produced by dist or one measure form the list: 'correlation', 'euclidean', 'maximum', 'manhattan', 'canberra', 'binary', 'minkowski'

What is the necessary correction that I need to do in order to plot my heat map successfully?

heatmap rstudio

It is telling you that ward.D is not a supported clustering method, and that you need to pick between the supported ones: c('dist','correlation', 'euclidean', 'maximum', 'manhattan', 'canberra', 'binary', 'minkowski'). Aloso, not sure if this will cause an error later, but pheatmap might not like to work with only 1 column, especially if you are trying to cluster on 1 value.

Thank you for the help. But I tried using the following methods and it still outputs the same error.If the error is caused due to the second reason as you stated, then how should I input my data in order to plot the heat map?

0 answers

No answers yet.

Log in to answer this question.