dada2 icon indicating copy to clipboard operation
dada2 copied to clipboard

Implementing dada-class and derep-class vectors

Open nr0cinu opened this issue 5 years ago • 3 comments

Hi!

I am confused as to why many of the dada2 functions unlist their return value, if there is only one input/output object, e.g.:

  • https://github.com/benjjneb/dada2/blob/963f4e023023bc528177a2c04ab7f1ae5332461c/R/dada.R#L478
  • https://github.com/benjjneb/dada2/blob/963f4e023023bc528177a2c04ab7f1ae5332461c/R/sequenceIO.R#L114
  • https://github.com/benjjneb/dada2/blob/963f4e023023bc528177a2c04ab7f1ae5332461c/R/paired.R#L199

This gives an inconsistent return value, and then every follow up R code (i.e., pipelines, extension packages, etc) need to always deal with this special case.

And it’s not always clear from the beginning how many objects will go into the commands, e.g., if there are multiple samples put in, some may get filtered out (https://github.com/benjjneb/dada2/issues/931#issuecomment-580435843) and we end up with only one object.

Not sure what happens if dada(), etc receive empty lists, but IMHO this should also be handled gracefully, like base R does (e.g., lapply(list(), fun) just returns an empty list).

Thanks!

Best, Bela

nr0cinu avatar Feb 25 '20 14:02 nr0cinu