Using nf-core configs outside nf-core
When you’ve been working with nf-core pipelines for a while, you often will get very used to many of the convenience functionality offered by the wider nf-core infrastructure.
One such thing is the centralised nf-core/configs repository of pre-configured configuration files that allow nf-core pipelines to run optimally on institutional clusters via the -profile
parameter, e.g. -profile uppmax
. A list of existing institutional profiles can be seen on the nf-core website.
If you want to write your own institutional profile, see the guide on how to write a new institutional profile.
One great thing about nf-core/configs is that they aren’t just restricted to nf-core pipelines, they can also be used in fully fledged ‘unofficial’ nf-core pipelines but also in your own custom mini-scripts and pipelines!
Here we will describe the steps you will need to perform in your custom script or pipeline to use nf-core institutional configs.
-
In a
conf/base.config
file set default basic resources for all processes. Can be named something else.At the bare minimum, the file should contain:
(or other sensible default values)
Note on older nf-core template/Nextflow versionsWhen running pipelines generated with the nf-core template before version v3.0.0 or with Nextflow before version 24.04.0 you may need to use an older syntax for setting resources. The following closures prevent resources from exceeding a maximum limit.
Set in
conf/base.config
default values.Then add the
check_max
function tonextflow.config
The following should be placed outside all scopes, typically at the bottom of the file:
For a more sophisticated
base.config
, see the full nf-core template -
In a top level
nextflow.config
, specify twoparams
to specify the URL where to look for nf-core/configs from.The two parameters together make it easy to test from forks and development profiles on specific branches.
-
In the top level
nextflow.config
, load the newly made base config.The following should be placed outside all scopes:
-
In the top level
nextflow.config
, load nf-core’s institutional profile repository based on the newparams
. This should be placed after theconf/base.config
include.Note that instead of the parameters, you can just directly specify a URL, e.g.
Note on older nf-core template/Nextflow versionsIf you wish to use pipelines generated with the nf-core template before
v3.0.0
, and/or when running with Nextflow versions earlier than 24.04.0 you may need to use an older syntax for loading the configs:
With this, you should be able to run nextflow run mainf.nf -profile <your_institutional_profile>
, and your custom script/pipeline should integrate nicely with your cluster!