Skip to content

Instantly share code, notes, and snippets.

@clintval
Last active September 16, 2025 01:51
Show Gist options
  • Select an option

  • Save clintval/c27ccd64ebca39dfb43df5079f12a9c4 to your computer and use it in GitHub Desktop.

Select an option

Save clintval/c27ccd64ebca39dfb43df5079f12a9c4 to your computer and use it in GitHub Desktop.
Using eval and topic publishing for versions in Nextflow
process FASTQC {
container "community.wave.seqera.io/library/fastqc:0.12.1--af7a5314d5015c29"
input:
tuple val(meta), path(fastqs, arity: "1..*")
output:
path("*.zip"), topic: "for_multiqc"
tuple val(meta), path("*.html"), emit: reports, topic: "per_sample"
tuple val(meta), path("*.zip"), emit: metrics, topic: "per_sample"
eval("echo fastqc: \$( fastqc --version | sed -e 's/FastQC v//g' )"), topic: "versions"
script:
"""
fastqc ${fastqs.join(' ')}
"""
}
include { FASTQC } from "./fastqc.nf"
include { MULTIQC } from "./multiqc.nf"
nextflow.preview.output = true
workflow {
main:
samples = Channel.fromList([[[sample_id: "sample1"], [file("R1.fastq.gz"), file("R2.fastq.gz")]]])
FASTQC(samples)
qc = Channel.empty()
qc = qc.mix(Channel.topic("for_multiqc"))
qc = qc.mix(Channel.topic("versions") | collectFile(name: "versions.yml", newLine: true))
MULTIQC(qc.collect())
publish:
per_sample = Channel.topic("per_sample")
run_detail = Channel.topic("run_detail")
}
output {
per_sample {
path { meta, _file -> "${meta.sample_id}" }
mode "copy"
}
run_detail {
path { _file -> "./" }
mode "copy"
}
}
process MULTIQC {
container "community.wave.seqera.io/library/multiqc:1.31--1efbafd542a23882"
input:
path(qc_files)
output:
path("*.html"), emit: report, topic: "run_detail"
script:
"""
multiqc \\
--cl-config 'no_ai: true' \\
--cl-config 'plot_theme: "plotly_dark"' \\
--cl-config 'table_columns_visible: { FastQC: false }' \\
--filename multiqc_report.html \\
--force \\
--interactive \\
--no-data-dir \\
--verbose \\
./
"""
}
docker.enabled = true
#!/usr/bin/env bash
nextflow run main.nf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment