-
Notifications
You must be signed in to change notification settings - Fork 683
Combining with empty list should produce a list #6026
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
Comments
It is because of how nextflow/modules/nextflow/src/main/groovy/nextflow/extension/CombineOp.groovy Lines 111 to 120 in 9280b59
It creates a tuple, appends the elements of the left and right tuples, and then emits either the tuple or the first element if the tuple has only one element It should be possible to work around this by wrapping the empty list in another list: names = channel.empty().toList().map { [it] }
names.combine(channel.value("empty combined with value")).view() But I am hesitant to change the behavior of |
Hi Ben, thanks for the detailed explanation. Why would the following affect other use cases?
I mean, this is supposed to be the cartesian product, concatenating the elements from the combination, without any flattening, and returning it as is, no? I also have followed the discussion in the past issues and in all of them the way the lists are handled is completely not how it is explained in the documentation, and very counter-intuitive. I have a lot of combines in my workflows, and any empty list case would have to be dealt with what you propose. For now, what I am doing is to use |
Bug report
A
combine
operation should always produce a list, but the output is instead depending on whether the input arguments list size is 0:Example:
Output:
This creates a lot of problems in downstream operations that expect a certain number of input arguments.
It would be far more preferable to have a deterministic number of output from the
combine
operation, independent on the content of each variable. In the above operation, I would expect[[], "x combined with value]
, as this is the expected result of a cartesian productEnvironment
The text was updated successfully, but these errors were encountered: