diff --git a/subworkflows/nf-core/bcl_demultiplex/main.nf b/subworkflows/nf-core/bcl_demultiplex/main.nf index 939e11e0..774c0362 100644 --- a/subworkflows/nf-core/bcl_demultiplex/main.nf +++ b/subworkflows/nf-core/bcl_demultiplex/main.nf @@ -76,12 +76,11 @@ workflow BCL_DEMULTIPLEX { ch_invalid_fastqs.view { "Invalid FASTQ file: $it" } println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") - // 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() + // 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 @@ -182,4 +181,20 @@ def readgroup_from_fastq(path) { } } -// println("Current directory inside the process is: ${task.workDir}") +// Collect and publish invalid FASTQ file paths +process WriteInvalidFastqs { + input: + val ch_invalid_fastqs from ch_invalid_fastqs.collect() + // DEBUG + println("Current directory inside the process is: ${task.workDir}") + + script: + """ + if [ -z "${ch_invalid_fastqs}" ]; then + echo "No invalid FASTQ files found." > invalid_fastqs.txt + else + printf '%s\n' "${ch_invalid_fastqs}" > invalid_fastqs.txt + fi + cat invalid_fastqs.txt + """ +}