From 121c1ae8f31c2ac129dea908d924075aeed19720 Mon Sep 17 00:00:00 2001 From: supersonSoge Date: Mon, 4 Nov 2024 19:00:58 +0100 Subject: [PATCH] Update analysis.R To avoid introducing NA values, which cause errors when clustering rows in the pheatmap function, I modified the color palette to start with white for zero values. This adjustment leaves the data unchanged but enables consistent visualization without triggering the error. --- R/analysis.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/analysis.R b/R/analysis.R index d01ba45..6409085 100644 --- a/R/analysis.R +++ b/R/analysis.R @@ -2852,14 +2852,14 @@ netAnalysis_signalingRole_heatmap <- function(object, signaling = NULL, pattern } mat.ori <- mat mat <- sweep(mat, 1L, apply(mat, 1, max), '/', check.margin = FALSE) - mat[mat == 0] <- NA + #mat[mat == 0] <- NA if (is.null(color.use)) { color.use <- scPalette(length(colnames(mat))) } - color.heatmap.use = grDevices::colorRampPalette((RColorBrewer::brewer.pal(n = 9, name = color.heatmap)))(100) - + #color.heatmap.use = grDevices::colorRampPalette((RColorBrewer::brewer.pal(n = 9, name = color.heatmap)))(100) + color.heatmap.use <- c("white", grDevices::colorRampPalette(RColorBrewer::brewer.pal(n = 9, name = color.heatmap))(100)) df<- data.frame(group = colnames(mat)); rownames(df) <- colnames(mat) names(color.use) <- colnames(mat) col_annotation <- HeatmapAnnotation(df = df, col = list(group = color.use),which = "column",