Error in validObject(.Object) : invalid class “phyloseq” object: Component sample names do not match. Try sample_names()

I am attempting to create a phyloseq object in R using artefacts generated from QIIME2 but every time I try to create the object I get the following error:

Error in validObject(.Object) : invalid class “phyloseq” object:
Component sample names do not match.
Try sample_names()

I ran: gplots::venn(list(metadata=rownames(metadata), featuretable=colnames(SVs$data)))

and got this:

So I am wondering what I am doing wrong that is causing this mis-match.

Hi @Coskun_Guclu,
Can you provide the code you ran that gave you that error?

Thanks!

Hi Chloe,

Here is the code I used:

physeq <- phyloseq(
otu_table(ASVs$data, taxa_are_rows = T),
phy_tree(tree$data),
tax_table(tax_table),
sample_data(metadata)
)

I can also share the files I was using if needed.

Hi @Coskun_Guclu,
Have you checked to make sure that your taxonomy has the same feature-ids as the table?

Alternatively, this issue on github might point you in the right direction: Transform to phyloseq objects (Error in validObject(.Object) : invalid class “phyloseq” object: Component sample names do not match. Try sample_names()) · Issue #1363 · joey711/phyloseq · GitHub