I'm trying to create a phyloseq class object with an OTU table, taxa names, sample data and a phylogenetic tree using the following commands
ps <- phyloseq(otu_table(seqtab.nochim, taxa_are_rows=F),
tax_table(taxa),
sample_data(Metadata))
physeq = merge_phyloseq(ps, treefile)
I can create the ps object just find, but I cannot add the phylogenetic tree to this object. This appears to fail because the names on my OTU table and my tree (downloaded from the SILVA database) do not match. Using taxa_names, I can see that the tree has taxa names assigned to it as is expected, but my OTU table has the names as each sequence read instead.
The OTU table (seqtab.nochim), the taxonomy assignments and the sample data are all made exactly following the dada2 pipeline tutorial, and everything that I've read so far indicates that it's normal for the OTU table to have the sequences as the column names.
I'm confused because my taxa object already has taxonomy from Kingdom to Genus assigned to each sequence read, but I don't see a way to use these assignments to match with the phylogenetic tree instead of the sequence reads from the OTU table.
I'm sure it's probably something simple and glaringly obvious that I'm missing, but any help is greatly appreciated!