Typed workflows
Typed workflows are a preview feature. The syntax and behavior may change in future releases.
Typed workflows can use type annotations in the take: and emit: sections:
nextflow.enable.types = true
workflow hello_bye {
take:
samples: Channel<Path>
main:
ch_hello = hello(samples)
val_bye = bye(ch_hello.collect())
emit:
result: Value<Path> = val_bye
}
In the above example, hello_bye takes a channel of files (Channel<Path>) and emits a dataflow value with a single file (Value<Path>). For more information about the available types, see Types.
Restricted syntax
The following syntax patterns are no longer supported in typed workflows:
-
Using
Channelto access channel factories (usechannelinstead) -
Using implicit closure parameters (declare parameters explicitly instead)
-
Using
setortapto assign channels (use standard assignments instead) -
Composing dataflow logic with
|and&(use standard method calls instead) -
Accessing process and workflow outputs via
.out(use standard assignments instead)
For more information about preparing existing code, see Preparing for static typing.
Operators
The operator library supports static typing and records. All operators work in both typed and legacy workflows, but only a core subset of operators is recommended for static typing.
For more information about best practices when migrating existing code, see Using operators with static typing.