These are chat archives for nextflow-io/nextflow

22nd
Dec 2017
Toni Hermoso Pulido
@toniher
Dec 22 2017 16:38
Hello, one question I'm trying to capture a stdout into a channel from one process to another. I would assume every channel value from an stdout line, but no luck, any example somewhere?
"""
sort -u lengths_* > readLengths
"""
Paolo Di Tommaso
@pditommaso
Dec 22 2017 16:41
Hi Toni, not sure to understand
in the above example you are redirecting the stdout to a file
then you want to output that file?
Toni Hermoso Pulido
@toniher
Dec 22 2017 16:46
Well, no need for a file
Hi Paolo
it could be a variable
let's say the sort would be 2, 10, 15
output would be separatd by line. I wondered if I could get these values straight into a Channel
separated by line -> newline
Paolo Di Tommaso
@pditommaso
Dec 22 2017 16:47
if you want to capture the task stdout you can do
process foo {
  output: 
  stdout channel_name
  """
  sort -u lengths_* 
  """
}
but I'm not getting the separated by line thing
Toni Hermoso Pulido
@toniher
Dec 22 2017 16:49
yep, that's it
Paolo Di Tommaso
@pditommaso
Dec 22 2017 16:49
do you want to handle each line independently ?
Toni Hermoso Pulido
@toniher
Dec 22 2017 16:49
stdout gives only one value to the channel
[ 1\n2\n3]
Paolo Di Tommaso
@pditommaso
Dec 22 2017 16:50
yes, exactly
instead you would like [1,2,3] ?
Toni Hermoso Pulido
@toniher
Dec 22 2017 16:50
i wondered if it was any direct way to retrieve [1, 2, 3] -> assuming \n as a sesparator
yes, that's it
Paolo Di Tommaso
@pditommaso
Dec 22 2017 16:51
ok, assuming that channel_name is emitting [ 1\n2\n3 ], you can do
channel_name.flatMap { it.readLines() }
then use the resulting channel in the next process
Toni Hermoso Pulido
@toniher
Dec 22 2017 16:53
cool! I'll take a look. Thanks!