Nextflow config
¶
All nf-lamin configuration lives in the lamin {} scope of your nextflow.config.
Best-practice config¶
A recommended starting point for nf-core-style pipelines. The key idea is to exclude all output files by default (exclude_pattern = '.*'), then use type = 'include' rules to opt-in to the files that matter. Pre-define rules for optional outputs with enabled = false so users can turn them on without writing new patterns.
plugins {
id 'nf-lamin'
}
lamin {
instance = "your-org/your-instance"
api_key = secrets.LAMIN_API_KEY
// Link all artifacts, runs, and transforms to a project
project_uids = ['projXXXXXXXXXXXXXX']
// Track input artifacts
input_artifacts {
rules {
// Explicitly track files not staged into Nextflow processes
samplesheet { include_paths = { params.input }; kind = 'dataset' }
fastq_reads { pattern = '.*\\.fastq(\\.gz)?$'; kind = 'dataset' }
reference { pattern = '.*\\.(fasta|fa)(\\.gz)?$'; kind = 'dataset' }
annotation { pattern = '.*\\.(gtf|gff)(\\.gz)?$'; kind = 'dataset' }
}
}
// Track output artifacts, stripping the outdir prefix from keys
output_artifacts {
key = [relativize: params.outdir]
exclude_pattern = '.*'
rules {
// Enabled by default
reports { type = 'include'; pattern = '.*\\.html$'; kind = 'report' }
mapped_reads { type = 'include'; pattern = '.*\\.bam$'; kind = 'dataset' }
// Disabled (set enabled = true to include)
bam_index { type = 'include'; enabled = false; pattern = '.*\\.bai$'; kind = 'dataset' }
}
}
}
To enable the optional BAM index tracking, a user could modify the config above, or create a new config file with just the override:
lamin.output_artifacts.rules.bam_index.enabled = true
The sections below document each setting in detail.
lamin - top-level settings¶
Setting |
Type |
Default |
Env variable |
Description |
|---|---|---|---|---|
|
String |
(required) |
|
LaminDB instance ( |
|
String |
(required) |
|
LaminHub API key (use |
|
List |
|
|
Project UIDs to link to all records |
|
List |
|
ULabel UIDs to link to all records |
|
|
String |
|
Space UID |
|
|
String |
|
Branch UID |
|
|
String |
|
|
Environment ( |
|
Boolean |
|
|
Validate config without creating records |
|
String |
|
|
Override the auto-generated transform UID |
|
String |
|
|
Override the auto-generated run UID |
Experimental: UID fields (project_uids, ulabel_uids, space_uid, branch_uid) also accept named references: '?name' (lookup by name), '!name' (lookup, error if missing), '+name' (create if missing). This is an experimental feature and may be removed in a future release.
lamin.run / lamin.transform - record-specific metadata¶
Attach ULabel UIDs specifically to runs or transforms. These are merged with the root-level ulabel_uids.
Setting |
Type |
Default |
|---|---|---|
|
List |
|
lamin {
run { ulabel_uids = ['ulab-run-specific'] }
transform { ulabel_uids = ['ulab-transform-specific'] }
}
Artifact tracking¶
Control which files are tracked and what metadata is attached. Configure tracking either globally (artifacts) or separately for inputs and outputs (input_artifacts / output_artifacts). These two approaches are mutually exclusive.
Artifact config options¶
Apply to artifacts, input_artifacts, or output_artifacts:
Setting |
Type |
Default |
Description |
|---|---|---|---|
|
Boolean |
|
Enable/disable tracking |
|
Boolean |
|
Track local ( |
|
Boolean |
|
Skip Nextflow work dir (input artifacts only) |
|
Boolean |
|
Skip |
|
String |
|
Regex; only matching files are tracked |
|
String |
|
Regex; matching files are skipped |
|
List |
|
ULabel UIDs for matched artifacts |
|
String |
|
Artifact kind (e.g. |
|
String / Closure / Map |
|
How to derive artifact keys (see below) |
|
String / List / Closure |
|
Paths to explicitly track (see below) |
|
Map |
|
Pattern-based rules (see below) |
Key derivation¶
The key option controls how artifact keys are generated from file paths. By default, the basename is used.
Map shorthand (recommended for nf-core-style pipelines):
key = [relativize: params.outdir]
// /home/user/results/multiqc/report.html → multiqc/report.html
String template with variables:
{basename}: filename with extension{filename}: filename without extension{ext}: extension including dot{parent}: parent directory name ({parent.parent}for grandparent, etc.)
key = '{parent}/{basename}'
Closure for full control:
key = { path -> "${path.parent.fileName}/${path.fileName}" }
Falls back to basename if resolution fails.
Explicit paths (include_paths)¶
Some files are never staged into Nextflow process input channels (e.g. samplesheets parsed by Groovy helpers like nf-schema’s samplesheetToList). Use include_paths to explicitly track these files.
include_paths accepts a string, a list of strings, or a closure returning a string or list:
On an artifact config:
input_artifacts {
include_paths = { params.input }
}
On a rule (to attach metadata like kind):
input_artifacts {
rules {
samplesheet {
include_paths = { params.input }
kind = 'dataset'
}
}
}
As a static list:
input_artifacts {
include_paths = ["foo.txt", "bar.txt"]
}
Note
Wrap include_paths in a closure ({ ... }) when accessing params, because params are not fully resolved at config parse time. Writing include_paths = params.input directly will cause an error.
Input paths are resolved at the beginning of the workflow (onFlowBegin), and output paths just before finalizing the run. Resolved paths go through the same deduplication, metadata linking, and rule evaluation as auto-detected artifacts.
Rules¶
Rules apply different settings based on file patterns or explicit paths. Each rule is a named block. Either pattern or include_paths (or both) must be specified.
Setting |
Type |
Default |
Description |
|---|---|---|---|
|
String |
|
Java regex to match file paths |
|
String / List / Closure |
|
Paths to explicitly track |
|
Boolean |
|
Enable/disable this rule |
|
String |
|
|
|
String |
|
|
|
Integer |
|
Priority (lower = evaluated first) |
|
List |
|
ULabel UIDs for matched artifacts |
|
String |
|
Override artifact kind |
|
String / Closure / Map |
|
Override key derivation |
Evaluation order:
Global
include_pattern/exclude_patternare checked firstRules are evaluated by
order(lower first)All matching rules are applied; later rules can override earlier ones
ULabel UIDs from all matching rules are merged (deduplicated)
Patterns are Java regular expressions. Backslashes must be escaped in Groovy: \\. not \.
Example: direction-specific tracking¶
lamin {
input_artifacts {
rules {
samplesheet { include_paths = { params.input }; kind = 'dataset'; order = 1 }
reference { pattern = '.*\\.(fasta|gtf)$'; kind = 'dataset' }
fastqs { pattern = '.*\\.fastq\\.gz$'; kind = 'dataset' }
}
}
output_artifacts {
key = [relativize: params.outdir]
exclude_pattern = '.*\\.(log|tmp)$'
rules {
exclude_intermediate { type = 'exclude'; pattern = '.*intermediate.*'; order = 1 }
bam_files { pattern = '.*\\.bam$'; kind = 'dataset'; order = 2 }
vcf_files { pattern = '.*\\.vcf\\.gz$'; kind = 'dataset'; order = 3 }
}
}
}
Example: disable all artifact tracking¶
lamin {
output_artifacts { enabled = false }
input_artifacts { enabled = false }
}
lamin.api - API connection (Advanced settings)¶
Setting |
Type |
Default |
Env variable |
|---|---|---|---|
|
String |
|
|
|
String |
|
|
|
Integer |
|
|
|
Integer |
|
|
Only needed for custom LaminHub deployments or to tune retry behavior.