Open lynneitelson opened 2 years ago
I also tried to turn the metadata also into a phyloseq object in order to merge both object, but still got "sam_data slot is empty" metadata=read.csv("metadata.csv", header = TRUE, row.names = 1) metadata_ps <- phyloseq(sample_data(as.matrix(metadata)))
Hi @lynneitelson Like I mentioned here, sample_data()
requires a data.frame
class object as input, not matrix.
Thank you very much!
@ycl6 Hi, I am having the same issue, but my metadata file is already a dataframe. I am able to make a phyloseq object but the sam_data remains empty
physeq <- phyloseq(otu_table(ASVs$data, taxa_are_rows = T), phy_tree(tree$data), sample_names(metadata), tax_table(tax_table))
if I use the sample_data function it returns this message:
Error in validObject(.Object) : invalid class “phyloseq” object: Component sample names do not match. Try sample_names()
Hi @coskun1guclu
Not sure if you have found a solution to create the phyloseq
object. But it seems to me it could be that the sample names didn't match or not in the same order or not have the same number of samples between the matadata sample_names(metadata)
and OTU table tax_table(tax_table)
.
Hi!
I'm trying to create a relative abundance plot and got this error which I cant figure out.
While making these changes the class changed from Large phyloseq to Formal class phyloseq. `` total_samples <- phyloseq::nsamples(ps)
ps.pruned <- prune_taxa(taxa_sums(ps) >0, ps)
merge all taxa that are detected rare
pseq.phylum <- aggregate_rare(ps, level="phylum", detection = 1/100, prevalence = 50/100)
Remove the "p__" before the family names
taxa_names(pseq.phylum) <- gsub("p__", "", taxa_names(pseq.phylum) )
p.phylum <- plot_composition(pseq.phylum), sample.sort = NULL, otu.sort = NULL, plot.type = "barplot", verbose = FALSE) + xlab("Bacterial community") + theme_bw() + theme(axis.text.x = element_blank(), axis.ticks.x=element_blank()) + scale_fill_brewer("Phylum", palette = "Paired") "
output:
Error in access(object, "sam_data", errorIfNULL) : sam_data slot is empty.
Thanks for the help!