Finally dug into the phyloseq package in R. This is designed to make microbiome studies easier to analyze in R. I found that most of the functionality is sort of useless for me - since I already have functions and routines for everything they do. But they do have a nice quick function to read OTU tables in .biom format, and a similarly easy qiime mapping file entry.
Installation instructions are here: http://joey711.github.io/phyloseq/install
So here is my code for
installing phyloseq
importing data
putting those data into normal R format for analysis.
Install:
They are not on CRAN, but they do have a nice bioconductor function for installation:
source("http://bioconductor.org/biocLite.R") biocLite("phyloseq") library(phyloseq)
Upon installation, they will ask you to update lots of dependencies, and they have also made this totally painless. Just let them do it.
Import:
I downloaded the Jeon household bacteria data to play, and unzipped into a desktop folder.
directory <- '~/Desktop/study_2025_split_library_seqs_and_mapping/study_2025' biomfile <- paste0(directory, '_closed_reference_otu_table.biom') jeon.biom <- import_biom(biomfile, parseFunction=parse_taxonomy_greengenes) sdfile <- paste0(directory, '_mapping_file.txt') jeon.mapping <- import_qiime_sample_data(sdfile)
Now everything is in phyloseq format, which I find annoying, so I put into normal formatting.
Unpack:
jeon.table <- t(otu_table(jeon.biom)) jeon.map <- data.frame(jeon.mapping) jeon.taxa <- data.frame(tax_table(jeon.biom))
Then they are in easy formats, but need to be jived with one another.
jeon.map <- jeon.map[sort(row.names(jeon.map)), ] jeon.table <- jeon.table[sort(row.names(jeon.table)), ] identical(row.names(jeon.map), row.names(jeon.table)) #True identical(row.names(jeon.taxa), colnames(jeon.table)) #True
So now everything is in normal ecology format for R analysis!













