Build & Run

This guide covers how you can can build a Nextflow module and run it as a standalone pipeline.

Building a Nextflow VDSL3 module

To start off, either follow along with the Nextflow component creation guide to create a simple hello_world component that targets Nextflow or download the zip below containing the component in all supported languages.


If you downloaded the zip above, rename the language folder you want to use to hello_world and use that as your working directory.

To let Viash generate a Nextflow module from your component, use the viash build command:

viash build src/config.vsh.yaml --platform nextflow --output target

This will generate two files in the target directory: a pipeline script named and a Nextflow config file named nextflow.config. Your directory structure should now look like this:

├── src
│   ├── config.vsh.yaml
│   └──
└── target
    └── nextflow.config

Running a standalone pipeline

With the module built, you can now call the pipeline script with nextflow to run it standalone:

nextflow run target/ --publishDir ./output --output myFile.txt 

You might be wondering where the --publishDir argument comes from. This is required by Nextflow, it specifies the directory where the output from the module should be put. In this case, a new folder named output. The --output argument sets the filename, myFile.txt.

Here’s what should be shown in the console:

N E X T F L O W  ~  version 22.04.5
Launching `target/` [prickly_brattain] DSL2 - revision: 3c1902d86f
WARN: Key for module 'hello_world' is duplicated.

executor >  local (1)
[90/735d3c] process > hello_world:hello_world_process1 (1) [100%] 1 of 1 ✔
input: [hello_world, [input:World, id:hello_world, output:myFile.txt]]
output: [hello_world, /home/user/hello_world/work/90/735d3cc9396ce3aa5629eb9ede59b7/myFile.txt]

Nextflow will have generated several directories and files, but the one we’re interested in is the output directory. It should contain a file named myFile.txt with a single line of text: Hello World. You can check this by opening the file or printing its contents to the terminal like this:

cat output/myFile.txt 

Which should result in:

Hello World

What’s next?

To use generated modules inside an actual Nextflow pipeline, take a look at our Pipeline Basics guide.