Importing microbiome data in R

Importing standard formats (CSV, Mothur, BIOM)

The microbiome package has import functions for certain standard data formats for 16S profiling (Simple CSV, Mothur, biom). For details, see the function help. To import these, use:

# Import output CSV files generated by write_phyloseq
pseq1 <- read_phyloseq(otu.file, taxonomy.file, metadata.file, type = "simple")

# Import mother .shared and .taxonomy and metadata files
pseq2 <- read_phyloseq(otu.file, taxonomy.file, metadata.file, type = "mothur")

# Import BIOM files
pseq3 <- read_phyloseq(otu.file, taxonomy.file, metadata.file, type = "biom")

You can also use additional import functions from the independent phyloseq R package.

Converting you own data to phyloseq format in R

Alternatively, you can read your data in R (read.table, read.csv or other standard functions) and convert into phyloseq format. The procedure is well explained in the phyloseq tutorial from the independent phyloseq R package. See also examples on manipulating for phyloseq objects.

Microbiome example data sets

Intestinal microbiota profiling of 1006 Western adults

The HITChip Atlas data set is available via the microbiome R package in phyloseq format, and via Data Dryad in tabular format. This data set from Lahti et al. Nat. Comm. 5:4344, 2014 comes with 130 genus-like taxonomic groups across 1006 western adults with no reported health complications. Some subjects have also short time series. Load the data in R with:

# Data citation doi: 10.1038/ncomms5344
library(microbiome)
data(atlas1006) 
print(atlas1006)
## phyloseq-class experiment-level object
## otu_table()   OTU Table:         [ 130 taxa and 1151 samples ]
## sample_data() Sample Data:       [ 1151 samples by 10 sample variables ]
## tax_table()   Taxonomy Table:    [ 130 taxa by 3 taxonomic ranks ]

Diet swap between Rural and Western populations

A two-week diet swap study between western (USA) and traditional (rural Africa) diets, reported in O’Keefe et al. Nat. Comm. 6:6342, 2015. The data is also available for download from Data Dryad. Load in R with:

# Data citation doi: 10.1038/ncomms7342
data(dietswap)
print(dietswap)
## phyloseq-class experiment-level object
## otu_table()   OTU Table:         [ 130 taxa and 222 samples ]
## sample_data() Sample Data:       [ 222 samples by 8 sample variables ]
## tax_table()   Taxonomy Table:    [ 130 taxa by 3 taxonomic ranks ]

Intestinal microbiota versus blood metabolites

Data set from Lahti et al. PeerJ 1:e32, 2013 characterizes associations between human intestinal microbiota and blood serum lipids. Note that this data set contains an additional data matrix of lipid species. Load the data in R with:

# Data citation doi: 10.7717/peerj.32
data(peerj32)
print(names(peerj32))
## [1] "lipids"   "microbes" "meta"     "phyloseq"