Using nf-core configs outside nf-core
Institutional profiles from the nf-core/configs repository can be integrated into custom scripts and workflows, extending their utility beyond nf-core pipelines. These centralized configurations provide pre-configured cluster settings without duplicating configuration management across multiple projects.
Integration steps
To integrate nf-core configs outside nf-core:
-
Create a
conf/base.configfile with default process resources:process { cpus = 1 memory = 7.GB time = 4.h }NoteOlder nf-core templates (pre-v3.0.0) and Nextflow versions before 24.04.0 require alternative syntax using the
check_max()function to enforce resource limits. -
In your top-level
nextflow.config, define parameters for accessing the institutional configs repository:params { custom_config_version = 'master' custom_config_base = "https://raw.githubusercontent.com/nf-core/configs/${params.custom_config_version}" } -
Include the base configuration file in your
nextflow.config:includeConfig 'conf/base.config' -
Load the nf-core institutional repository:
includeConfig !System.getenv('NXF_OFFLINE') && params.custom_config_base ? "${params.custom_config_base}/nfcore_custom.config" : "/dev/null"NoteThis conditional statement:
- Checks if Nextflow is running in offline mode
- Verifies the
custom_config_baseparameter exists - Loads the nf-core configs if both conditions are met
- Falls back to
/dev/nullif offline or the parameter is not set
Alternative approach
For simpler setups, use a direct URL approach without conditional logic:
includeConfig 'https://raw.githubusercontent.com/nf-core/configs/master/nfcore_custom.config'This approach does not support offline mode or testing against development branches.
Usage
Once configured, execute your custom workflow using an institutional profile:
nextflow run main.nf -profile <institutional_profile>Replace <institutional_profile> with your institution’s profile name (for example, biohpc_gen, uppmax, czbiohub_aws).
You can also combine multiple profiles:
nextflow run main.nf -profile <institutional_profile>,dockerTroubleshooting
Profile not found
Problem: You receive a “Profile not found” error when running your workflow
Solution: Verify your profile configuration and network access:
- Check that the profile name matches an existing profile in nf-core/configs
- Verify the
custom_config_baseparameter points to a valid URL - Ensure you have network access to the nf-core/configs repository
- Test the URL directly in a browser to confirm it is accessible
Offline mode
Problem: Institutional profiles do not load when running in offline mode
Solution: Configure your workflow to use local profile files:
- Download the required profile files from
nf-core/configsto your local system - Update the
includeConfigstatement innextflow.configto point to the local file path - Remove the conditional check for
NXF_OFFLINEto always load from local files - Ensure the local files remain synchronized with updates to nf-core/configs if needed
Resource limits not enforced
Problem: Resource limits are not being enforced correctly in your workflow
Solution: Check your configuration and Nextflow version:
- Verify your Nextflow version (version 24.04.0 or later recommended for
resourceLimitssupport) - Confirm the institutional profile includes
resourceLimitsin the process scope - Check that your base configuration does not override profile settings (load base config before institutional profiles)
- Review the order of
includeConfigstatements innextflow.config