0

I am getting an error while plotting the beta diversity from phyloseq object with ggplot2, could you please suggest how I can resolve this issue?

R code
 phyloseq_prop = transform_sample_counts(physeq, function(x) 1E6 * x/sum(x))
 expt1.ord <- ordinate(phyloseq_prop, "PCoA", "bray")


# melt the phyloseq object

p1 <- psmelt(expt1.ord)
pdf("PcoASampleType.pdf", width = 10, height = 8)
p2 <- p1 + geom_point(aes(colour = Season), size = 3,alpha=0.8) +
   scale_color_manual(values = c("#E78AC3", "#A6D854")) +
  geom_vline(xintercept = 0, linetype = 2) +
  geom_hline(yintercept = 0, linetype = 2) +
  theme_bw() +
  theme(text = element_text(size = 18),
        legend.position = "bottom") +
  guides(colour = guide_legend(title.position = "top", title.hjust = 0.5)) 

print(p2)
dev.off()

Error
   
Error in access(object, "otu_table", errorIfNULL) :
  otu_table slot is empty.
Calls: psmelt -> otu_table -> otu_table -> .local -> access
Execution halted

Many thanks

bioinfonext
  • 119
  • 7
  • 1
    Without some sample data, it is hard to help you. – YBS Jul 13 '20 at 18:53
  • 1
    From your error message I'm guessing the problem is not with ggplot but with the `psmelt()` function. I recommend you reduce your code to the problematic bits and make it reproducible if you want us to be of any help. To make it reproducible, you'd have to include a bit of (dummy) data and note the packages you're using. – teunbrand Jul 13 '20 at 18:54

0 Answers0