Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process named output channels #1290

Closed
pditommaso opened this issue Aug 24, 2019 · 4 comments
Closed

Process named output channels #1290

pditommaso opened this issue Aug 24, 2019 · 4 comments
Milestone

Comments

@pditommaso
Copy link
Member

The goal of this enhancement is to implement the ability to associate a custom name to each output channel declared in the process definition.

For example:

process foo {
  output:
    set val(sample_name), file('*_trimmed.fastq'), emit: named_fastq
    set val('trimmed'), file('*_trimmed.fastq'), emit: flagged_fastq
    file '*.log', emit: logs
  """
  command_here
  """
}

Using the above syntax the emit: option allows the association of a name that can be used to reference the channel output once the process has been invoked. For example:

workflow {
  foo()
  foo.out.named_fastq.view()
  foo.out.flagged_fastq.view()
}

This is similar to the request made by #1181, however, the use of as is discouraged because is a groovy lang keyword. Moreover the use of emit: is consistent with the new workflow output syntax definition #1276.

@mes5k
Copy link
Contributor

mes5k commented Aug 28, 2019

This could be really nice!

I was thinking of a related feature, which is just the ability to destructure the output list, something like:

workflow {
  named_fastq, flagged_fastq = foo()
}

@pditommaso
Copy link
Member Author

You can. foo.out implements a List therefore you can assign it as

workflow {
 foo()
 (named_fastq, flagged_fastq) = foo.out
}

@mes5k
Copy link
Contributor

mes5k commented Aug 28, 2019

Oh perfect! I think I just had a bug in my test script that was leading me astray.

@pditommaso
Copy link
Member Author

Use 19.08.1-edge for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants