There’s a confusion here between Channels and the Objects that come through them. Channels pass Objects (data, e.g. files, lists, maps/dictionaries, etc) from one process to another. Channel factories like Channel.fromPath
create Channels. Channel operators like flatMap
operate on the Objects so you need to use methods available to the Object to manipulate it. The Objects are often Groovy Collections or Paths so they can confusingly share similar method names to channel operators but do different things. The DataflowStream
error means you’re trying to reference a Channel rather than an Object for example a List. Channel operators that use a closure { <code> }
should not reference channels, only the objects that come through them. For example .map { meta, img -> img }
means my Channel has a List type Object passing through it which I infer from the closure input { meta, img ->
. The first element is some kind of Object which I can reference using the variable meta
, and the second element is some kind of Object I can reference using img
. In this closure, I return the img
part of the list. Closures are like anonymous functions. The methods that are available on these Objects are based on what you know you’ve put into the Channel in the first place.
If I understand your question correctly, you’re attempting to generate a cartesian product (outer product, cross product) of the list files and the list of intervals. This is done with the combine
operator. Operators — Nextflow documentation
workflow {
img_files = Channel.fromPath('images/image*.tiff')
intervals = Channel.fromPath('intervals.csv').splitCsv(header: true)
img_files.combine(intervals).view()
}
Produces these entries in a channel:
[/workspace/Nextflow_sandbox/images/image1.tiff, [Start:1, End:600]]
[/workspace/Nextflow_sandbox/images/image2.tiff, [Start:1, End:600]]
[/workspace/Nextflow_sandbox/images/image3.tiff, [Start:1, End:600]]
[/workspace/Nextflow_sandbox/images/image1.tiff, [Start:601, End:1200]]
[/workspace/Nextflow_sandbox/images/image2.tiff, [Start:601, End:1200]]
[/workspace/Nextflow_sandbox/images/image3.tiff, [Start:601, End:1200]]
[/workspace/Nextflow_sandbox/images/image1.tiff, [Start:1201, End:1800]]
[/workspace/Nextflow_sandbox/images/image2.tiff, [Start:1201, End:1800]]
[/workspace/Nextflow_sandbox/images/image3.tiff, [Start:1201, End:1800]]
[/workspace/Nextflow_sandbox/images/image1.tiff, [Start:1801, End:2400]]
[/workspace/Nextflow_sandbox/images/image2.tiff, [Start:1801, End:2400]]
[/workspace/Nextflow_sandbox/images/image3.tiff, [Start:1801, End:2400]]
[/workspace/Nextflow_sandbox/images/image1.tiff, [Start:2401, End:3000]]
[/workspace/Nextflow_sandbox/images/image2.tiff, [Start:2401, End:3000]]
[/workspace/Nextflow_sandbox/images/image3.tiff, [Start:2401, End:3000]]
[/workspace/Nextflow_sandbox/images/image1.tiff, [Start:3001, End:3600]]
[/workspace/Nextflow_sandbox/images/image2.tiff, [Start:3001, End:3600]]
[/workspace/Nextflow_sandbox/images/image3.tiff, [Start:3001, End:3600]]
[/workspace/Nextflow_sandbox/images/image1.tiff, [Start:3601, End:4200]]
[/workspace/Nextflow_sandbox/images/image2.tiff, [Start:3601, End:4200]]
[/workspace/Nextflow_sandbox/images/image3.tiff, [Start:3601, End:4200]]
Is this what you’re looking for in the output?