Question: (Closed) K Means Clustering Two Matrices for ComplexHeatmap
0
gravatar for pthom010
4 months ago by
pthom0100
pthom0100 wrote:

I have a csv file with the log2 scores of eight different timepoints. The header of the table looks like this:

head(templogs)

     SB         SC         SD         SE
TRINITY_DN1001_c0_g1_i1  -0.5638283 -1.2861425 -0.8790812 -1.9667007
TRINITY_DN1001_c0_g1_i5  -0.3484778 -0.8097831 -0.3951722 -1.2755624
TRINITY_DN1001_c0_g2_i1  -0.4141790 -1.4300189 -1.0538773 -2.3604466
TRINITY_DN1001_c2_g1_i1  -0.3890476 -1.5069918 -0.9539496 -2.4254780
TRINITY_DN10027_c0_g1_i2 -0.2425431  0.4412087  0.4699400  0.7566083
TRINITY_DN10030_c0_g1_i1  1.0605554  0.4989614  0.2710047  0.8756346
                                  RB         RC         RD        RE
TRINITY_DN1001_c0_g1_i1  -0.29717574 -0.8332547 -0.8467823 -1.343256
TRINITY_DN1001_c0_g1_i5  -0.45046536 -0.9659265 -1.1268979 -1.572577
TRINITY_DN1001_c0_g2_i1  -0.49264872 -1.0463790 -1.1199727 -1.916905
TRINITY_DN1001_c2_g1_i1  -0.58782459 -1.0346161 -1.0258695 -1.920455
TRINITY_DN10027_c0_g1_i2 -0.03957106  0.7577178  0.6700604  1.681934
TRINITY_DN10030_c0_g1_i1  4.94468049  5.6052340  6.0095423  4.954922

The table has about 2100 rows. What I would like to do is k-means clustering on the matrix and use those results to cluster my rows on a heatmap. However, I seem to be having issues with the hclust function in R. Here is how far I have gotten:

km = kmeans(templogs, centers = 2)$cluster

I then try to run

rows = hclust(templogs)$order

but get the following error message:

Error in if is.na(n) || n > 65536L) stop("size cannot be NA nor exceed 65536") :
  missing value where TRUE/FALSE needed

Would anybody by chance know how to resolve this issue. I am also trying to use the split function with the km$cluster object I made before but I am getting this error message:

Error in Heatmap(templogs, row_order = d, split = cluster) :
  object 'cluster' not found

I'm not sure how to resolve this. Alternatively, if anybody has any suggestions to make this easier, I am also receptive to those.Thanks.

complexheatmap rna-seq R • 252 views
ADD COMMENTlink modified 4 months ago • written 4 months ago by pthom0100

I then try to run

rows = hclust(templogs)$order

hclust should be run on a dissimilarity matrix calculated by dist , not your data frame! use ?hclust to find more.

ADD REPLYlink modified 4 months ago • written 4 months ago by Hamid Ghaedi1.2k

Hello pthom010!

We believe that this post does not fit the main topic of this site.

Please post this on https://support.bioconductor.org/ as ComplexHeatmap is a bioConductor package and the developer seems to be more active there

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink written 4 months ago by _r_am32k

This question has now been posted on bioConduuctor support: https://support.bioconductor.org/p/133981/

ADD REPLYlink written 4 months ago by _r_am32k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

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