Chapter 3: What is an nf-core module?
An nf-core module is an opinionated, open-source Nextflow wrapper around a single command-line tool or script. The central community repository holds more than 1000 modules that you can reuse in your own pipelines.
This page describes what an nf-core module is and what distinguishes it from a standard Nextflow process.
Contents of an nf-core module
An nf-core module usually wraps one tool command, or one tool with a single subcommand.
A Nextflow process or module has no restrictions on the number of tools or subcommands it can execute.
An nf-core module aims for a single analysis command per module. This atomic design supports lego-block construction of pipelines and makes modules easier to understand, share, and test, although it is not always the most resource-efficient approach.
Each nf-core module follows strict specifications agreed by community consensus. The specifications cover:
- Naming and formatting conventions.
- Software environments.
- Standardised tags.
- Input and output channels.
- Tool parameters configurable by pipeline developers.
- Use of meta maps.
- Use of stubs.
The specifications also expand the minimum file set from a single Nextflow .nf script to five required files. This reflects the nf-core focus on standardisation, reproducibility, and high-quality documentation.
A complete nf-core module directory can contain up to six files:
├── environment.yml
├── main.nf
├── meta.yml
└── tests/
├── main.nf.test
├── main.nf.test.snap
└── nextflow.config ## optional!These files fall into three categories:
- Module execution
- Module documentation
- Module testing
The following diagram shows how these files relate to each other:
Schematic diagram showing the relationship between the three main categories of files in an nf-core module.
main.nfdefines the Nextflow process that the module executes.environment.ymlis a Conda environment file loaded bymain.nf. It specifies the software dependencies used when a pipeline runs with-profile conda.meta.ymldocuments the contents ofmain.nf, including tool metadata and input and output specifications.main.nf.testdescribes an nf-test unit test for themain.nfprocess.main.nf.test.snapis a snapshot file generated by nf-test. It compares the output of one test run with another to confirm reproducibility.nextflow.configis an optional Nextflow configuration file used whenmain.nf.testexecutes.
Writing an nf-core module means creating these files and populating them with content that follows the nf-core specifications.