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:
- Generate a new module using the
nf-core
template. - Edit the template.
- Document your module.
- 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 :
git clone https://github.com/scilus/nf-neuro.gitcd 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) :
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 :
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 throughnf-neuro
. - Resource label : select
process_single
if you required a single core. If your tool support multiprocessing, you can selectprocess_low
for 2 cores,process_medium
for 4 cores, andprocess_high
for 6 cores. Please set this up responsibly. Fordenoising/nlmeans
, we will selectprocess_medium
. - Meta map : select
yes
.
Alternatively, you can use the following command to supply nearly all information :
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.