Exclude non existent samples or samples without reads after ingress

This commit is contained in:
Natalia Garcia 2026-05-26 07:53:34 +00:00
parent a5c25ec0a1
commit 04ddfbf872

23
main.nf
View File

@ -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.")