yiluheihei / microbiomeMarker

R package for microbiome biomarker discovery
https://yiluheihei.github.io/microbiomeMarker
GNU General Public License v3.0
170 stars 40 forks source link

Error in compare_DA: Component taxa/OTU names do not match. #83

Open kstagaman opened 2 years ago

kstagaman commented 2 years ago

I'm having an issue where compare_DA returns an error (I believe from phyloseq), but I'm not sure why. This is code I'm running:

ps.url <- "https://www.dropbox.com/s/2ckxg7djky2nbfv/example_ps.rds?dl=1"
ps.file <- "example_ps.rds"
download.file(ps.url, destfile = ps.file)
ps <- readRDS(ps.file)
res <- microbiomeMarker::compare_DA(
  ps,
  group = "BaP_uM",
  methods = c("ancombc", "deseq2", "lefse")
)

This is the error:

Error in validObject(.Object) : invalid class “phyloseq” object: 
 Component taxa/OTU names do not match.
 Taxa indices are critical to analysis.
 Try taxa_names()

But there's nothing wrong with the taxa names:

identical(taxa_names(otu_table(ps)), taxa_names(tax_table(ps)))
[1] TRUE
identical(taxa_names(otu_table(ps)), taxa_names(phy_tree(ps)))
[1] TRUE