Skip to content

Extract value from a file generated in a process to a value in the channel? #2100

Answered by davidmasp
davidmasp asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, I made it work I think. Not sure if it's the most elegant way though.

#!/usr/bin/env nextflow

cheers = Channel.from 'Bonjour', 'Ciao', 'Hello', 'Hola'

process sayHello {
  echo false
  input:
    val x from cheers
  output:
    file "${x}_out.tst" into out_channel
  script:
    """
    echo '$x world!' > ${x}_out.tst
    """
}

out_channel.map{it.getText()}.set{out_channel2}




process test {
  echo true
  input:
    val x from out_channel2
  script:
    """
    echo ${x}
    """
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@pditommaso
Comment options

@davidmasp
Comment options

@albertoriva
Comment options

Answer selected by pditommaso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants