benjjneb / dada2

Accurate sample inference from amplicon data with single nucleotide resolution
http://benjjneb.github.io/dada2/
GNU Lesser General Public License v3.0
469 stars 142 forks source link

addSpecies() error if assignTaxonomy() was run with outputBootstraps=TRUE #690

Closed roey-angel closed 5 years ago

roey-angel commented 5 years ago

This is because getUniques() fails to run and gives the following error:

Error in getUniques(object, collapse = collapse, silence = silence) : 
  Unrecognized format: Requires named integer vector, dada-class, derep-class, sequence matrix, or a data.frame with $sequence and $abundance columns.

But running assignTaxonomy() with outputBootstraps=FALSE and then addSpecies() works (eventhough getUniques() would still fail)

roey-angel commented 5 years ago

OK this is of course because outputBootstraps=TRUE produces a list so addSpecies() needs to be run on taxa[[1]] rather than taxa

pdcountway commented 4 years ago

OK this is of course because outputBootstraps=TRUE produces a list so addSpecies() needs to be run on taxa[[1]] rather than taxa

Hi @roey-angel & @benjjneb , I've hit the same problem described in issue #690 in a batch processing script where I'd like to run assignTaxonomy, then addSpecies and then write an output *.csv file. Would you mind explaining what taxa[[1]] is? I cannot find any reference to this in the tutorial. I have used outputBootstraps = TRUE in my batch script and understand that it's probably causing the issue but the workaround is unclear. Thanks!

benjjneb commented 4 years ago

When outputBootstraps=TRUE the return value of assignTaxonomy is a two element list. The first element (taxa[[1]]) is the usual taxonomy matrix, which is acceptable input to addSpecies. The second element (taxa[[2]]) is a numeric matrix of the bootstrap values at each taxonomic level.

So, if you want to run addSpecies, you should run it on taxa[[1]], the normal taxonomy table. I'm not sure what you are wanting to do with the bootstrap value matrix, but remember that it won't have a species column, since addSpecies doesn't use boostrapping.