Phyloseq (R)
Description
It is recommended to use an IDE of R such as Rstudio, for easier R analysis. https://www.rstudio.com/products/rstudio/download/
For further information about phyloseq, see these tutorials below:
- http://bioconductor.org/packages/release/bioc/vignettes/phyloseq/inst/doc/phyloseq-basics.html
- http://bioconductor.org/packages/release/bioc/vignettes/phyloseq/inst/doc/phyloseq-analysis.html
- http://bioconductor.org/packages/release/bioc/vignettes/phyloseq/inst/doc/phyloseq-mixture-models.html
1. Preparing QIIME Data for Phyloseq
First you must convert your OTU Table (.biom
) into an older version. Future updates may fix this issue.
# Start macqiime
macqiime
# Convert to JSON format
# See http://biom-format.org/documentation/biom_conversion.html
biom convert \
-i otu_table.biom \
-o otu_table_json.biom \
--to-json \
--table-type='OTU Table'
2. Installing phyloseq and other R-packages
# Install packages
source("https://bioconductor.org/biocLite.R")
biocLite("phyloseq")
biocLite("metagenomeSeq")
biocLite("ggplot2")
biocLite("vegan")
biocLite("randomforests")
biocLite("ape")
biocLite("microbiome")
biocLite("dplyr")
biocLite("pheatmap")
biocLite("RColorBrewer")
biocLite("ggtree")
3. Importing QIIME into Phyloseq
# Load required libraries
library(phyloseq)
library(ggplot2)
# Import OTU table and tree
otutable <- import_biom(BIOMfilename = 'otu_table_json.biom',
treefilename = 'rep_set.tre',
parseFunction = parse_taxonomy_greengenes)
# Import mapping file
mapping <- import_qiime_sample_data(mapfilename = 'mapping_file.txt')
# Merge map and otu table into once phyloseq object
phylo <- merge_phyloseq(otutable, mapping)
# Remove zero sum OTU's
phylo = prune_taxa(taxa_sums(phylo) > 0, phylo)
# Check sample + OTU count
phylo
Verify taxonomic lineage names are correct
rank_names(phylo)
> [1] "Kingdom" "Phylum" "Class" "Order" "Family" "Genus" "Species"