Nick
Nick

Reputation: 11

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

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?

Upvotes: 1

Views: 665

Answers (1)

Steve
Steve

Reputation: 54502

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.

Upvotes: 4

Related Questions