Skip to content
Greg Gloor edited this page Apr 4, 2018 · 12 revisions

Before we start, we need a working directory.

Make a directory (folder) in a place where you can output files. For example, in your Documents folder.

Next, we recommend you download the entire GitHub repository to your working directory so that you have all the code examples and data.

Go here And download the zip file. Decompress the file in your working directory.

Now open R (or RStudio) and set your working directory by typing the commands in your Console:

setwd("...")

in which, the "..." is the specific pathway, e.g.,

in Windows:

setwd("C:/Users/User Name/Documents/FOLDER")

in Macs:

setwd("/Users/User Name/Documents/FOLDER")

Load packages

We need to load the packages we'll be using. You will have had to previously installed the packages.

library("compositions")

And then

library("zCompositions")

The Dataset

The example data we are using is from the Human Microbiome Project (HMP) and are 16S rRNA gene sequenced samples from Attached keratinized gingiva (gums) (ak) and Outside the gum plaque (op)

Using your own data

You are welcome to bring your own data to work though.

Data files are expected to be in a very simple format. Please ensure that they are in the following format if you are using your own data.

It is absolutely essential that if you bring your own raw data that you bring tables of raw OTU counts and NOT tables of proportions or normalized abundances!

The data table should be a tab-delimited file with the gene names as row-names and the sample identifiers as column names. Make a special effort to have row and sample names simple with no spaces, or any characters that are not letters, numbers or the underscore character. It is simplest if your row and column names start with a letter, but this is not mandatory.

An example table is given below (note that spaces are used instead of tabs in this example).

# sample OTU table format
gene_IDs    A1    A20    A3    B6    B10 ...
o1         10    100     3    59      9 ...
o2          0      2     5    46      8 ...
...