From 04ddfbf872344bed31b53ef8e807e9de4fa9f77a Mon Sep 17 00:00:00 2001 From: Natalia Garcia Date: Tue, 26 May 2026 07:53:34 +0000 Subject: [PATCH] Exclude non existent samples or samples without reads after ingress --- main.nf | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/main.nf b/main.nf index 88053f9..a22858b 100644 --- a/main.nf +++ b/main.nf @@ -300,14 +300,27 @@ workflow { "input": params.bam, ] + ingress_args, ref_genome) } - analysis_samples = samples .filter { meta, xam, xai, stats -> - if (meta.n_seqs == 0) { - log.warn("Sample ${meta.alias} has no reads - excluded from transcriptome analysis.") - return false + boolean is_excluded = false + String excluded_reason = null + if (meta.n_primary == 0) { + excluded_reason = "has no reads" + is_excluded = true + } else if (meta.n_primary == null) { + excluded_reason = "was not found during ingress" + is_excluded = true } - true + if (is_excluded) { + log.warn("Sample ${meta.alias} ${excluded_reason} and will be excluded from transcriptome analysis.") + if (params.de_analysis) { + throw new Exception("""\ + Differential gene expression and differential transcript analyses + requires all the samples present in the sample sheet to have reads. + """.stripIndent()) + } + } + return !is_excluded } .ifEmpty { throw new Exception("No samples with reads were available for transcriptome analysis.")