Hello all,

I have a series of .idat files I am willing to cluster (I am actually replicating some publication's results). Here is how the authors have described the methodology they have used in their paper fro clustering methylation data:

"Samples were clustered using Pearson correlation coeffcient as the distance measure and average linkage (x-axis). Methylation probes were reordered by hierarchical clustering using Euclidean distance and average linkage (y-axis)".

I have worked around this but the problem is I am not getting the exact same heatmap as theirs in the paper.

Bellow is the heatmap command in R that I have used for this clustering.

```
heatmap.2(rcorr(beta[o[1:probecount],],type = "pearson")$r, labRow = FALSE,labCol =phenoData$Diagnosis, margins = c(7,1), hclustfun = function(x) hclust(dist(x),"ave") , trace = "none", dendrogram = "column",Rowv = FALSE)
```

Can someone kindly let me know if this is the right way to plot the heatmap based on the methodology described above and if there is something that needs to be changed would you please point out what that might be?

The beta values were quantile normalized and the SNP rows were removed before. The rest of the methylation data extraction follows the routine methodology. I don't copy the entire code here so I won't pollute here but I can add it as a comment if needed.

Thank you all very much for your help in advance.

Cheers

Thank you very much Kevin for your very thorough explanation. I appreciate you taking your time to answer. I will try both ways you suggested.

Cheers

No problem. Good luck and let me know if I can help further.