carpentries-incubator / workflows-nextflow

Workflow management with Nextflow and nf-core
https://carpentries-incubator.github.io/workflows-nextflow/
Other
18 stars 29 forks source link

Add to channels episode to use `file` to make a value channel. #53

Closed mahesh-panchal closed 2 months ago

mahesh-panchal commented 2 years ago

Often one wants to make a value channel for a file input. The channel factory fromPath however creates a queue channel. One can either do:

input_ch = fromPath( params.input, checkIfExists: true ).collect()
// OR
input_ch = file ( params.input, checkIfExists: true )

The difference here is that the first is a true channel, while the second is a file object. However, in DSL2, non-channel objects are implicitly converted into a value channel when used as input to a process.