diff --git a/subworkflows/nf-core/bcl_demultiplex/main.nf b/subworkflows/nf-core/bcl_demultiplex/main.nf index 774c0362..f593c35e 100644 --- a/subworkflows/nf-core/bcl_demultiplex/main.nf +++ b/subworkflows/nf-core/bcl_demultiplex/main.nf @@ -76,11 +76,12 @@ workflow BCL_DEMULTIPLEX { ch_invalid_fastqs.view { "Invalid FASTQ file: $it" } println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") - // ch_invalid_fastqs - // .ifEmpty { "No invalid FASTQ files found." } - // .map { it -> it.toString() } - // .collectFile(name: 'invalid_fastqs.txt', newLine: true) - // .view() + // Collect and publish invalid FASTQ file paths + ch_invalid_fastqs + .ifEmpty { "No invalid FASTQ files found." } + .map { it -> it.toString() } + .collectFile(name: 'invalid_fastqs.txt', newLine: true) + .view() emit: fastq = ch_fastq_with_meta @@ -103,7 +104,7 @@ def generate_fastq_meta(ch_reads) { // Get readgroup; skip file if null (invalid FASTQ) def readgroup = readgroup_from_fastq(fastq) if (!readgroup) { - println("Warning 02 - Missing Header, FASTQ skipped: ${fastq}") + println("Warning 01 - Missing Header, FASTQ skipped: ${fastq}") ch_invalid_fastqs << "${fastq}" return [] // Return empty to exclude this file } @@ -120,7 +121,8 @@ def generate_fastq_meta(ch_reads) { // Return metadata and fastq path return [meta, fastq] - } + }.filter { it[0] != null } // Filter out invalid fastq entries + // Group by meta.id for paired-end (PE) samples .groupTuple(by: [0]) // Add single_end flag based on fastq count @@ -144,7 +146,7 @@ def readgroup_from_fastq(path) { } if (line == null || !line.startsWith('@')) { - println("Warning 01 - Skipping file: ${path}.\n" + + println("Warning 02 - Skipping file: ${path}.\n" + "Expected a FASTQ file starting with '@', but found null.\n" + "File is likely empty, corrupt or inaccessible.\n" + "It will be skipped from further analyses.") @@ -181,12 +183,10 @@ def readgroup_from_fastq(path) { } } -// Collect and publish invalid FASTQ file paths +// println("Current directory inside the process is: ${task.workDir}") process WriteInvalidFastqs { input: val ch_invalid_fastqs from ch_invalid_fastqs.collect() - // DEBUG - println("Current directory inside the process is: ${task.workDir}") script: """