Can we write a Nextflow script that executes Multiple Nextflow scripts?

Viewed 40

Instead of having one huge Nextflow script that run all the pipelines. To make to easier to read the file and edit pipeline down the road. Can we write a Nextflow script that executes Multiple Nextflow scripts?

1 Answers

The new DSL2 lets you define modules which can contain workflow components (i.e. functions, processes and worflows) which can be imported into another Nextflow script using the include keyword. The module inclusion example in the docs has a typo, but it should look like:

include { foo } from './some/module.nf'

workflow {
    data = channel.fromPath('/some/data/*.txt')
    foo(data)
}

The above snippet includes a process with name foo defined in the module script in the main execution context. This way, foo can be invoked in the workflow scope.

Nextflow implicitly looks for the script file ./some/module.nf resolving the path against the including script location.

Related