Skip to content

Generate the template

Starting from the nf-core template

This page is the first of this tutorial series focusing on the creation of a custom module meant for nf-neuro. By following the different pages, you will learn how to:

  1. Generate a new module using the nf-core template.
  2. Edit the template.
  3. Document your module.
  4. Set up test cases for your module.

We welcome all new modules relevant to neuro-imaging, regardless of the modality it comes from! Let’s say, for the purpose of this tutorial, that you want to create a new module performing denoising on a T1w image using scil_denoising_nlmeans.py.

First steps

Before starting, if not done already, clone the nf-neuro repository locally and navigate to it :

Terminal window
git clone https://github.com/scilus/nf-neuro.git
cd nf-neuro

Then, create a new branch for your module (in this tutorial, you’ll re-develop the denoising/nlmeans module, so name it `module/denoising_nlmeans) :

Terminal window
git checkout -b module/denoising_nlmeans

Generate the template

Since nf-neuro is based on the nf-core tools, you have access to a command-line (CLI) script that will generate the skeleton, using a template, of your module. First verify you are located at the root of the nf-neuro repository (not in modules), then run the following interactive command :

Terminal window
nf-core modules create

You will be prompted several times to configure the new module correctly. Refer to the following to ensure configuration abides with nf-neuro :

  • Name of tool/subtool : category/tool of the module you plan creating (e.g. denoising/nlmeans).
  • Bioconda package : select no.
  • Github author : use your Github handle, or @scilus if you prefer not being identified through nf-neuro.
  • Resource label : select process_single if you required a single core. If your tool support multiprocessing, you can select process_low for 2 cores, process_medium for 4 cores, and process_high for 6 cores. Please set this up responsibly. For denoising/nlmeans, we will select process_medium.
  • Meta map : select yes.

Alternatively, you can use the following command to supply nearly all information :

Terminal window
nf-core modules create --author @scilus --label process_medium --meta denoising/nlmeans

You will still have to interact with the bioconda prompt, still select no.

The command will generate your new module template in the ./modules/nf-neuro/denoising/nlmeans directory. You now have all files required to properly set up your module! Now it is time to edit your main.nf file.