Problem
In a script without nextflow.enable.types, declaring a params { } block causes the entry
workflow to lose the DSL1 operators (view, map, filter, …) from its scope. Any operator called
via the pipe form then fails to compile with "x is not defined". Named workflows in the same file
are unaffected, and so is the dotted call form.
The script does not run — this is not limited to nextflow lint.
Minimal reproducible example
params {
greeting: String = 'hello'
}
workflow {
channel.of(1, 2) | view()
}
Observed:
Error mre.nf:6:24: `view` is not defined
│ 6 | channel.of(1, 2) | view()
╰ | ^^^^
ERROR ~ Script compilation failed
Expected: the pipeline runs and prints 1 and 2.
Deleting the params block — the only change — makes it run:
workflow {
channel.of(1, 2) | view()
}
An empty params { } block triggers it too, so it is the block's presence rather than its
contents.
Scope
One file showing what is and is not affected:
params {
greeting = 'hello'
}
workflow SUB {
take:
ch
main:
ch | view() // OK — named workflow
}
workflow {
def a = channel.of(1, 2)
a.view() // OK — dotted form
a | view() // Error: `view` is not defined
}
The params block is otherwise fully functional — the same script with the dotted form runs and
reads the param:
params {
greeting = 'hello'
}
workflow {
channel.of(1, 2).view()
println "greeting is ${params.greeting}"
}
Summary
|
no params block |
params block |
| untyped (no flag) |
a | view() works |
a | view() fails |
nextflow.enable.types = true |
fails |
fails |
Per https://docs.seqera.io/nextflow/workflow-typed I don't think there should be a problem with using the params block without typing:
Set nextflow.enable.types = true in every script that uses typed workflows. The params block
and output block can be used without this feature flag.
And per https://docs.seqera.io/nextflow/workflow#special-operators--and- I don't think | is disallowed either?:
These operators are not supported when static typing is enabled
Environment
- Nextflow 26.04.4
- Reproduced with both
nextflow run and nextflow lint
Problem
In a script without
nextflow.enable.types, declaring aparams { }block causes the entryworkflow to lose the DSL1 operators (
view,map,filter, …) from its scope. Any operator calledvia the pipe form then fails to compile with "
xis not defined". Named workflows in the same fileare unaffected, and so is the dotted call form.
The script does not run — this is not limited to
nextflow lint.Minimal reproducible example
params { greeting: String = 'hello' } workflow { channel.of(1, 2) | view() }Observed:
Expected: the pipeline runs and prints
1and2.Deleting the
paramsblock — the only change — makes it run:workflow { channel.of(1, 2) | view() }An empty
params { }block triggers it too, so it is the block's presence rather than itscontents.
Scope
One file showing what is and is not affected:
params { greeting = 'hello' } workflow SUB { take: ch main: ch | view() // OK — named workflow } workflow { def a = channel.of(1, 2) a.view() // OK — dotted form a | view() // Error: `view` is not defined }The
paramsblock is otherwise fully functional — the same script with the dotted form runs andreads the param:
params { greeting = 'hello' } workflow { channel.of(1, 2).view() println "greeting is ${params.greeting}" }Summary
paramsblockparamsblocka | view()worksa | view()failsnextflow.enable.types = truePer https://docs.seqera.io/nextflow/workflow-typed I don't think there should be a problem with using the
paramsblock without typing:And per https://docs.seqera.io/nextflow/workflow#special-operators--and- I don't think
|is disallowed either?:Environment
nextflow runandnextflow lint