From 6c030679b73cbd46b2b496906ffe7b449c5776aa Mon Sep 17 00:00:00 2001 From: MA-Tianrui Date: Tue, 19 May 2026 13:55:06 -0400 Subject: [PATCH] Add validation in dep() to catch error when every condition has only one replicate --- server.R | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.R b/server.R index 785e04e..7266083 100644 --- a/server.R +++ b/server.R @@ -935,6 +935,14 @@ server <- function(input, output, session) { "QC plots (PCA, sample correlation, missing values, etc.) are still available." ) )) + validate(need( + ncol(data) > length(conditions), + paste0( + "Differential expression analysis requires at least 2 replicates per condition. ", + "The current design has ", length(conditions), " condition(s) across ", ncol(data), " sample(s), ", + "leaving no residual degrees of freedom for variance estimation." + ) + )) if (input$exp == "LFQ" & input$lfq_type == "Spectral Count") { assay(data) <- log2(assay(data)) } else if (input$exp == "LFQ-peptide" & input$lfq_pept_type == "Spectral Count") {