Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions subworkflows/nf-core/bcl_demultiplex/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ include { BCLCONVERT } from "../../../modules/nf-core/bclconvert/main"
include { BCL2FASTQ } from "../../../modules/nf-core/bcl2fastq/main"

// Define the log file path before the workflow starts
def logFile = new File("${params.outdir}/invalid_fastqs.log")
def logFile = new File("${params.outdir}/skipped_fastqs.log")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we generally try to avoid using params in subworkflows 😦

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, if not it was ending in some temp workdir, this way it is saved inside the outdir provided in the nextflow run --outdir /some/path/outdir, shall I remove it and leave it as def logFile = new File("skipped_fastqs.log")?


workflow BCL_DEMULTIPLEX {
take:
ch_flowcell // [[id:"", lane:""],samplesheet.csv, path/to/bcl/files]
demultiplexer // bclconvert or bcl2fastq
log_skipped_fastqs // New parameter to control logging of empty FASTQ files

main:
ch_versions = Channel.empty()
Expand Down Expand Up @@ -118,12 +119,14 @@ def generate_fastq_meta(ch_reads, logFile) {
meta.readgroup = readgroup_from_fastq(fastq)
meta.readgroup.SM = meta.samplename
} else {
appendToLogFile(
"Empty or invalid FASTQ file: ${fastq}",
logFile
if (params.log_skipped_fastqs) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (params.log_skipped_fastqs) {
if (log_skipped_fastqs) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, when I remove params. I get ERROR ~ No such variable: log_skipped_fastqs

appendToLogFile(
"Empty or invalid FASTQ file: ${fastq}",
logFile
)
fastq = null
}
}
fastq = null
}

return [meta, fastq]
}.filter { it[0] != null }
Expand All @@ -132,8 +135,8 @@ def generate_fastq_meta(ch_reads, logFile) {
// Add meta.single_end
.map { meta, fastq ->
if (meta != null) {
meta.single_end = fastq.size() == 1
}
meta.single_end = fastq.size() == 1
}
return [meta, fastq.flatten()]
}
}
Expand Down