MD-Anderson-Bioinformatics / NGCHM-R

An R package for creating Next-Generation Clustered Heat Maps (NG-CHM)
http://bioinformatics.mdanderson.org/main/NG-CHM-V2:Overview
8 stars 3 forks source link

Provide better error message if errors in clustering #64

Open marohrdanz opened 3 months ago

marohrdanz commented 3 months ago

A user recently tried to create an NG-CHM with input data (inadvertently) having the same values for every column of one row. The code crashed in chmDefaultRowOrder() from the line:

    ddg <- stats::as.dendrogram(stats::hclust(dd, method = chm@rowAgglom))

with errors and warnings:

Error in stats::hclust(dd, method = chm@rowAgglom) : 
  NA/NaN/Inf in foreign function call (arg 10)
In addition: Warning message:
In cor(t(mat), use = "pairwise") : the standard deviation is zero

It would have been more helpful to the user if the error message provided a little more information to help them diagnose the input data problem.