Syntax question: When I run `channel.fromPath("dir...
# help
m
Syntax question: When I run
channel.fromPath("directory/*.bed")
I get a queue channel with all the bed files. What’s the best way to get a
value
channel containing an array of bed files? I thought
collect
was the way to go, but that doesn’t work.
✅ 1
another catch is I need the resulting channel to be empty if there’s no files found
a
What do you mean "collect doesn't work"
m
It doesn’t produce an array
I need
channel.value([bed1,bed2,...])
a
So it does nothing? That feels like a bug potentially?
Can you do
toList
or is that operator deprecated now?
m
no, I get a value channel with bed files, but for some reason it isn’t interpreted as an array
the purpose it to
combine
with another channel of
[bam,bai]
so I get
[bam,bai,[bed1,bed2,...]]
a
Do you have a failing MRE
m
instead I’m getting
[bam,bai,bed1,bed2,...]
a
Well, combine flattens the array no? That would seem fairly intuitive when you think about how combine works with tuple channels (it flattens them, you don't get two tuples inside another one)
If you want to have your files stay in array after the combine then you need to do something like
.collect().map{ files -> [ files ] }
m
Let me try that real quick
map
seems to have done the trick! Thanks for the duck!