0
votes

I am following this pipeline (https://www.nicholas-ollberding.com/post/introduction-to-the-statistical-analysis-of-microbiome-data-in-r/) for relative abundance in box plot image like this (https://www.nicholas-ollberding.com/post/2019-07-28-introduction-to-the-statistical-analysis-of-microbiome-data-in-r_files/figure-html/box%20plot-1.png).

I have tried the following codes

ps_phylum <- phyloseq::tax_glom(ps, "Phylum")
phyloseq::taxa_names(ps_phylum) <- phyloseq::tax_table(ps_phylum)[, "Phylum"]

phyloseq::psmelt(ps_phylum) %>%
ggplot(data = ., aes(x = Status, y = Abundance)) +
  geom_boxplot(outlier.shape  = NA) +
  geom_jitter(aes(color = OTU), height = 0, width = .2) +
  labs(x = "", y = "Abundance\n") +
  facet_wrap(~ OTU, scales = "free")

But I want to modify the figure like phylum level plot but here, the points will indicate the genus/ family/species.enter image description here

1

1 Answers

0
votes

I have luckily solved the issue,

ps_phylum <- phyloseq::tax_glom(ps, "class/order/family/genus")
phyloseq::taxa_names(ps_phylum) <- phyloseq::tax_table(ps_phylum)[, "class/order/family/genus"]

phyloseq::psmelt(ps_phylum) %>%
ggplot(data = ., aes(x = Status, y = Abundance)) +
  geom_boxplot(outlier.shape  = NA) +
  geom_jitter(aes(color = OTU), height = 0, width = .2) +
  labs(x = "", y = "Abundance\n") +
  facet_wrap(~ Phylum, scales = "free")