Hi, everyone,
My question is not 100% related to qiime2, but to qiime2r. I'm following the tutorial made by @jbisanz (Tutorial: Integrating QIIME2 and R for data visualization and analysis using qiime2R) which is helping me a lot (thanks for that)!!! However, I'm stuck in a problem that I cannot fix.
I uploaded my files:
metadata<-read_tsv (metadata_16s_run1.tsv")
cons_taxonomy<-read_qza ("classifier_Run1_tax.qza")
cons_taxtable<-cons_taxonomy$data %>% as.tibble() %>% separate(Taxon, sep=";", c("Kingdom","Phylum","Class","Order","Family","Genus","Species"))
table<- read_qza ("table.qza")
constax=as.data.frame(cons_taxtable)%>%select(-Confidence) %>% column_to_rownames("Feature.ID")%>%as.matrix()
constax[,"Kingdom"]<-gsub("D_0__", "", constax [,"Kingdom"])
constax[,"Phylum"]<-gsub("D_1__", "", constax [,"Phylum"])
constax[,"Class"]<-gsub("D_2__", "", constax [,"Class"])
constax[,"Order"]<-gsub("D_3__", "", constax [,"Order"])
constax[,"Family"]<-gsub("D_4__", "", constax [,"Family"])
constax[,"Genus"]<-gsub("D_5__", "", constax [,"Genus"])
constax[,"Species"]<-gsub("D_6__", "", constax [,"Species"])
and tried to create a phyloseq object merging them:
physeq<-phyloseq(
otu_table(table$data, taxa_are_rows = T),
tax_table(constax),
sample_data(metadata %>% as.data.frame() %>% column_to_rownames("sample_name"))
)
but I keep on getting the error message:
Error in validObject(.Object) : invalid class “phyloseq” object:
Component sample names do not match.
Try sample_names()
and when I run sample_names(), I get:
sample_names(table)
NULL
sample_names(cons_taxonomy)
NULL
sample_names(metadata)
NULL
I don't really know what to do, already searched online for help but couldn't fit any of the solutions here. Also, when I visualize the files in R, they all look fine.
Can someone help me with this, please?
Thanks!
Adriana