Skip to content

docs: Add developing modules tutorial#4155

Open
christopher-hakkaart wants to merge 4 commits intomainfrom
chris-module-guide
Open

docs: Add developing modules tutorial#4155
christopher-hakkaart wants to merge 4 commits intomainfrom
chris-module-guide

Conversation

@christopher-hakkaart
Copy link
Copy Markdown
Member

@christopher-hakkaart christopher-hakkaart commented Apr 19, 2026

  • Migrate tutorial
  • Style tutorial
  • Redirect tutorial

Closes #4145

@netlify /docs/developing/tutorials/writing-nf-core-modules/1-introduction

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 19, 2026

Deploy Preview for nf-core-docs ready!

Name Link
🔨 Latest commit 6d89ee3
🔍 Latest deploy log https://app.netlify.com/projects/nf-core-docs/deploys/69e553b69ff9e00008d1f3ce
😎 Deploy Preview https://deploy-preview-4155--nf-core-docs.netlify.app/docs/developing/tutorials/writing-nf-core-modules/1-introduction
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 19, 2026

Deploy Preview for nf-core-main-site ready!

Name Link
🔨 Latest commit 6d89ee3
🔍 Latest deploy log https://app.netlify.com/projects/nf-core-main-site/deploys/69e553b6e432be00081bcf41
😎 Deploy Preview https://deploy-preview-4155--nf-core-main-site.netlify.app/docs/developing/tutorials/writing-nf-core-modules/1-introduction
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@christopher-hakkaart
Copy link
Copy Markdown
Member Author

@nf-core-bot fix linting

Copy link
Copy Markdown
Member

@jfy133 jfy133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got side tracked and have to get kits up now, but conceptual question on first page for consideration


Duration: **4hr**

Original author: James A. Fellows Yates (@jfy133), with corrections and improvements from Niklas Schandry (@nschan) and Alexandru Mizeranschi (@amizeranschi).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Original author: James A. Fellows Yates (@jfy133), with corrections and improvements from Niklas Schandry (@nschan) and Alexandru Mizeranschi (@amizeranschi).
Original author: James A. Fellows Yates (@jfy133), with corrections and improvements from Niklas Schandry (@nschan) and Alexandru Mizeranschi (@amizeranschi).
Refreshed style by: Chris Hakkaart (@christopher-hakkaart )

@@ -0,0 +1,57 @@
---
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I was never sure about in the first version was whether it made sense having this page actually as an index.md or overview.md page instead of the first chapter... what do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I wasn't convinced by this either, but decided it really doesn't matter in the scheme of things.

I think Overview is more of a summary, but this is more of a setting-the-scene, which is more of an Introduction.

IMO - it's fine the way it is. If we have more tutorials and something else fits better, we can reshuffle them.

@christopher-hakkaart
Copy link
Copy Markdown
Member Author

Also - feel free to push changes. I'm not attached to anything strongly.

Copy link
Copy Markdown
Member

@jfy133 jfy133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished up to page 3, will continue from 4 onwards when I have time

Original author: James A. Fellows Yates (@jfy133), with corrections and improvements from Niklas Schandry (@nschan) and Alexandru Mizeranschi (@amizeranschi).
:::

An nf-core module is an atomic, standardised, reproducible, and tested [Nextflow DSL2 module](https://www.nextflow.io/docs/latest/module.html). You can install an nf-core module into any Nextflow pipeline with a single command, then integrate it into your workflow thanks to its consistent internal structure.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An nf-core module is an atomic, standardised, reproducible, and tested [Nextflow DSL2 module](https://www.nextflow.io/docs/latest/module.html). You can install an nf-core module into any Nextflow pipeline with a single command, then integrate it into your workflow thanks to its consistent internal structure.
An nf-core module is an atomic, standardised, reproducible, and tested [Nextflow DSL2 module](https://www.nextflow.io/docs/latest/module.html).
You can install an nf-core module into any Nextflow pipeline with a single command, then efficiently integrate it into your workflow thanks to its consistent internal structure.

shortTitle: "Chapter 3: What is a module?"
---

An nf-core module is an opinionated, open-source Nextflow wrapper around a single command-line tool or script. The [central community repository](https://github.com/nf-core/modules) holds more than [1000 modules](https://nf-co.re/modules) that you can reuse in your own pipelines.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An nf-core module is an opinionated, open-source Nextflow wrapper around a single command-line tool or script. The [central community repository](https://github.com/nf-core/modules) holds more than [1000 modules](https://nf-co.re/modules) that you can reuse in your own pipelines.
An nf-core module is an opinionated, open-source Nextflow wrapper around a single command-line tool or script. The [central community repository](https://github.com/nf-core/modules) holds more than [1800 modules](https://nf-co.re/modules) that you can reuse in your own pipelines.

:::info{collapse title="Comparison with Nextflow modules"}
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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
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.

- Use of [meta maps](../../../specifications/components/modules/general#use-of-meta-maps).
- Use of [stubs](../../../specifications/components/modules/general#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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
The specifications also expand the minimum required single file from a single Nextflow `.nf` script to five required files.
This reflects the nf-core focus on standardisation, reproducibility, and high-quality documentation.


The following diagram shows how these files relate to each other:

<img width=80% alt="Diagram showing how the execution, documentation, and testing files in an nf-core module relate to each other." src="../../../../../assets/images/tutorials/training/nf-core-module-file-relationship.png">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't working...

Copy link
Copy Markdown
Member

@jfy133 jfy133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chapter 5 review done. Continuing next time from chapter 6

```bash
nf-core modules create <toolname>/<subcommand>
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:::note
If your module does not have subcommands, just use `<toolname>`
:::

### Naming conventions

- All parts of the module name must be lowercase, alphanumeric, with no punctuation or special characters.
- Single-command tools use the tool name only. For a tool executed with `fastp -i <input> -o <output>`, run `nf-core modules create fastp`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Single-command tools use the tool name only. For a tool executed with `fastp -i <input> -o <output>`, run `nf-core modules create fastp`.
- Single-command tools use the tool name only. For example, for a tool executed with `fastp -i <input> -o <output>`, run `nf-core modules create fastp`.


- All parts of the module name must be lowercase, alphanumeric, with no punctuation or special characters.
- Single-command tools use the tool name only. For a tool executed with `fastp -i <input> -o <output>`, run `nf-core modules create fastp`.
- Tools with subcommands use `<tool>/<subcommand>`, even if you only plan to wrap one subcommand. For `samtools view`, run `nf-core modules create samtools/view`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Tools with subcommands use `<tool>/<subcommand>`, even if you only plan to wrap one subcommand. For `samtools view`, run `nf-core modules create samtools/view`.
- Tools with subcommands use `<tool>/<subcommand>`, even if you only plan to wrap one subcommand. For example, `samtools view`, run `nf-core modules create samtools/view`.


### Prompts from `nf-core modules create`

The command tries to pre-fill the boilerplate. It searches [Bioconda](https://bioconda.github.io/) and [biocontainers](https://biocontainers.pro/) for the latest version of your tool and adds the container definitions automatically.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The command tries to pre-fill the boilerplate. It searches [Bioconda](https://bioconda.github.io/) and [biocontainers](https://biocontainers.pro/) for the latest version of your tool and adds the container definitions automatically.
The command tries to pre-fill the boilerplate.
It searches [Bioconda](https://bioconda.github.io/) and [biocontainers](https://biocontainers.pro/) for the latest version of your tool and adds the container definitions automatically.

shortTitle: "Chapter 5: Writing modules"
---

Once you have generated the boilerplate template files, you can update them to make your module function. The boilerplate contains many `TODO` comments and example content to guide you.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once you have generated the boilerplate template files, you can update them to make your module function. The boilerplate contains many `TODO` comments and example content to guide you.
Once you have generated the boilerplate template files, you can update them to make your module function.
The boilerplate contains many `TODO` comments and example content to guide you.

Comment on lines +448 to +452

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tool: \$(samtools --version |& sed '1!d ; s/samtools //')
END_VERSIONS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cat <<-END_VERSIONS > versions.yml
"${task.process}":
tool: \$(samtools --version |& sed '1!d ; s/samtools //')
END_VERSIONS

"""
```

Keep the `versions.yml` HEREDOC command. It runs during the dry run.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Keep the `versions.yml` HEREDOC command. It runs during the dry run.


## The `meta.yml` file

The `meta.yml` file documents the module with descriptions, keywords, and links to the tool's resources. This information powers the searchable [modules page](https://nf-co.re/modules), improves discoverability on external databases, and supports future automated linkage between modules.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `meta.yml` file documents the module with descriptions, keywords, and links to the tool's resources. This information powers the searchable [modules page](https://nf-co.re/modules), improves discoverability on external databases, and supports future automated linkage between modules.
The `meta.yml` file documents the module with descriptions, keywords, and links to the tool's resources.
This information powers the searchable [modules page](https://nf-co.re/modules), improves discoverability on external databases, and supports future automated linkage between modules.

Comment on lines +523 to +527
- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"
versions_drep:
- - ${task.process}:
type: string
description: The name of the process
- drep:
type: string
description: The name of the tool
- drep version 2>&1 | sed 's/^.*drep v//':
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- drep:
type: string
description: The name of the tool
- drep version 2>&1 | sed 's/^.*drep v//':
type: eval
description: The expression to obtain the version of the tool

Comment on lines +729 to +733
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
versions_bwamem2:
- - ${task.process}:
type: string
description: The name of the process
- bwamem2:
type: string
description: The name of the tool
- bwa-mem2 version | grep -o -E "[0-9]+(\.[0-9]+)+":
type: eval
description: The expression to obtain the version of the tool
versions_samtools:
- - ${task.process}:
type: string
description: The name of the process
- samtools:
type: string
description: The name of the tool
- samtools version | sed '1!d;s/.* //':
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- bwamem2:
type: string
description: The name of the tool
- bwa-mem2 version | grep -o -E "[0-9]+(\.[0-9]+)+":
type: eval
description: The expression to obtain the version of the tool
- - ${task.process}:
type: string
description: The name of the process
- samtools:
type: string
description: The name of the tool
- samtools version | sed '1!d;s/.* //':
type: eval
description: The expression to obtain the version of the tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[404] Page not found: https://www.google.com/

3 participants