rnaseq icon indicating copy to clipboard operation
rnaseq copied to clipboard

Replace collect with toList

Open pditommaso opened this issue 3 years ago • 3 comments

The operator chain .collect().ifEmpty{[]} could be replaced with toList() simplifying a bit the code

https://github.com/nf-core/rnaseq/blob/e049f51f0214b2aef7624b9dd496a404a7c34d14/workflows/rnaseq.nf#L768

pditommaso avatar Oct 07 '22 12:10 pditommaso

@nf-core/core - let's also put this into the template right ?

apeltzer avatar Oct 08 '22 17:10 apeltzer

I did. Have a look at the linked issues...

maxulysse avatar Oct 08 '22 17:10 maxulysse

Thanks! This won't work when we need to use a closure with collect though like below: https://github.com/nf-core/rnaseq/blob/e049f51f0214b2aef7624b9dd496a404a7c34d14/workflows/rnaseq.nf#L777-L786

Given that we will have to use a closure to remove the meta map (first element) from most channels in a proper pipeline I am wondering whether it is worth keeping the current syntax for consistency. This way we can quite easily see which channels have a meta map and those that don't.

+1 for fixing in tools though.

drpatelh avatar Oct 09 '22 10:10 drpatelh

Going to stick with what we have as mentioned in my comment above and use toList() wherever appropriate. Thanks!

drpatelh avatar Dec 16 '22 11:12 drpatelh