I’m trying to create a phyloseq object from some QIIME 2 artifacts. I have a problem similar to later posts in this question.
I have imported the data from QIIME 2 as follows:
> #Importing metadata > HGS_metadata<-read_tsv("HGS_mapping_file.txt") > HGS_metadata > #Looks good > > #Importing feature table > HGS_features<-read_qza("HGS_merged_table_filtered3.qza") > HGS_features$data[1:5,1:5] > > #Importing taxonomy > HGS_taxonomy<-read_qza("silva_HGS_taxonomy.qza") > #Converting to taxtable > HGS_taxtable<-HGS_taxonomy$data %>% as.tibble() %>% separate(Taxon, sep = ";", c("Kingdom","Phylum","Class","Order","Family","Genus","Species")) > HGS_taxtable > #Looks good I think > > HGS_tree<-read_qza("insertion-tree.qza") > HGS_tree$data
This was the command I used to try to create a phyloseq object:
HGS_phy<-phyloseq(otu_table(HGS_features$data, taxa_are_rows=T), phy_tree(HGS_tree$data), tax_table(as.data.frame(HGS_taxtable%>% select(-Confidence) %>% column_to_rownames("Feature.ID") %>% as.matrix()), sample_data(HGS_metadata %>% as.data.frame() %>% column_to_rownames("SampleID"))))
This is the error I got:
Error in validObject(.Object) : invalid class “phyloseq” object: Component taxa/OTU names do not match. Taxa indices are critical to analysis. Try taxa_names() In addition: Warning message: In .local(object) : Coercing from data.frame class to character matrix prior to building taxonomyTable. This could introduce artifacts. Check your taxonomyTable, or coerce to matrix manually.
I tried making a Venn diagram of IDs shared between the feature table and taxonomy table with gplots as recommended in the linked post:
> gplots::venn(list(taxonomy=rownames(HGS_taxtable), featuretable=colnames(HGS_features)))
When I view the HGS_features data and HGS_taxtable, I can see that feature IDs are definitely shared between the two even though the program doesn’t seem to be picking them up. I’m wondering if this is a problem with how I’m importing the feature table (which has no header names, just all the sample names listed across the top and feature IDs down the side) … but not sure how to fix this.
Thank you for any help!