This notebook will serve as a template for exploring your data in R. It only shows the main libraries needed (though additional libraries may be needed later), How to read in your saved Phyloseq objects, and how to save your graphs. The best thing to do is to launch a new notebook and then copy the following cells over to the new one. You can create one notebook for all downstream data exploration, or (recommended) create a new one for each major category.
As this notebook serves as a guide, here are some links to other tutorials and cheat sheets for exploring your data:
The Phyloseq web page has many good tutorials
The Micca pipeline has a good intro tutorial for Phyloseq
RStudio has cheat sheets for Tidyverse that you can download, and here is another reference page for ggplot
# load the libraries you will need
library('phyloseq')
library('ggplot2')
library('ape')
library("vegan")
library("gridExtra")
Warning message: “replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’” Loading required package: permute Loading required package: lattice This is vegan 2.5-6
# go to the plots directory
setwd('../plots')
# first the original
physeq <- readRDS('fish_phyloseq.rds')
print(physeq)
phyloseq-class experiment-level object otu_table() OTU Table: [ 33 taxa and 11 samples ] sample_data() Sample Data: [ 11 samples by 8 sample variables ] tax_table() Taxonomy Table: [ 33 taxa by 8 taxonomic ranks ] phy_tree() Phylogenetic Tree: [ 33 tips and 32 internal nodes ]
# Now the rarefied version
physeq.rarefied <- readRDS('fish_phyloseq_rarefied.rds')
print(physeq.rarefied)
phyloseq-class experiment-level object otu_table() OTU Table: [ 33 taxa and 11 samples ] sample_data() Sample Data: [ 11 samples by 8 sample variables ] tax_table() Taxonomy Table: [ 33 taxa by 8 taxonomic ranks ] phy_tree() Phylogenetic Tree: [ 33 tips and 32 internal nodes ]