-
Notifications
You must be signed in to change notification settings - Fork 595
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
ifEmpty operator doesn't return expected value (value channel) #4953
Comments
Hello, have you been able to replicate the issue? Do you think my expectation about the ifEmpty operator is correct? |
It turns out the docs are incorrect. They say that |
I see. Could you please suggest another way to check whether the channel is empty or not? I want to return Value Channel if channel is empty. |
I recommend that you explicitly combine the process inputs instead of relying on the implicit value channel behavior: process test2 {
input:
tuple val(a), file(b)
script:
"""
"""
}
workflow {
test (ch,ch_empty_file)
test2( ch.combine(testChn) )
} |
My goal is creating optional input for a process, so "combine" operator might not work for some cases. For example if secondChannel is empty, I want to use file("$baseDir/NO_FILE") so that process will work even secondChannel is empty. Similar to https://nextflow-io.github.io/patterns/optional-input/ but I need to check channel. So is there any way to write condition like this:
|
Expected behavior and actual behavior
I anticipate receiving the file() block when the channel is empty. However, it looks like it returns queue channel and it gets consumed after one job submission. Are there any other way to check whether the channel is empty?
Steps to reproduce the problem
Here is the example code to reproduce the problem:
Program output
N E X T F L O W ~ version 23.10.1
Launching
/opt/run1372/test.nf
[exotic_swartz] DSL2 - revision: 663225ff37[1b/66845b] Submitted process > test (1)
[8c/7fb0e1] Submitted process > test (2)
[41/eda731] Submitted process > test2 (1)
[f5/470f5e] Submitted process > test (3)
[ac/f0ad1a] Submitted process > test (4)
It executes test2 only once. I was expecting 4 test2 jobs similar to test process.
Environment
The text was updated successfully, but these errors were encountered: