layout: page title: “QIIME Tutorial 2” comments: true date: 2016-07-13

#QIIME Tutorial 2 Authored by Ashley Shade, with contributions by Sang-Hoon Lee, Siobhan Cusack, Jackson Sorensen, and John Chodkowski. Modified by Adina Howe. EDAMAME-2016 wiki

EDAMAME tutorials have a CC-BY license. Share, adapt, and attribute please!

##Overarching Goal

  • This tutorial will contribute towards an understanding of microbial amplicon analysis

##Learning Objectives

  • Extract summary information from a biom OTU table
  • Calculate and visualize within-sample (alpha) diversity

###Handout of workflow:

Welcome back, Microbe Enthusiasts!

Working with the OTU table in QIIME

Previously, we left off with quality-controlled merged Illumina paired-end sequences, and then used a QIIME workflow script to pick OTUs with one representative sequence from each OTU, align the representative sequences, build a tree build the alignment, and assign taxonomy to the OTU based on the representative sequence. Wow. That is a LOT. Take a moment to relish in your own computational prowess.

If you wish to filter your table before proceeding with summary statistics and visual representations (for example to remove chloroplast or mitochondrial sequences), check out these QIIME tutorials addressing this.

2.1 Summarize an OTU table

Navigate to the uclust_openref/ directory. The OTU table is the table on which all ecological analyses (e.g. diversity, patterns, etc) are performed. Let’s use biom commands to summarize the table. Let’s proceed with the table that has singletons removed and taxonomy assigned (“mc2_w_tax.biom”).

biom summarize-table -i otu_table_mc2_w_tax.biom -o summary_otu_table_mc2_w_tax.txt

less summary_otu_table_mc2_w_tax.txt

The summary file contains information about the number of sequences per sample, which will help us to make decisions about rarefaction (subsampling). When we inspect the file, we see that sample C08.05102014.R1.D01.GCTGATGAGCTG has the minimum number of reads observed. This is what we will use as a subsampling depth. Also, a lot of the info in this file is typically reported in methods sections of manuscripts.


2.3 Calculating within-sample (alpha) diversity

Make sure you are in the the uclust_openref/ directory, and make a new directory for alpha diversity results.

mkdir WS_aDiversity_even5196

We will calculate richness (observed # taxa) and phylogenetic diversity (PD) for each sample. Documentation is here. -i otu_table_mc2.biom -m observed_species,PD_whole_tree -o WS_aDiversity_even5196/WS_aDiversity_even5196.txt -t rep_set.tre

The -t flag designates the tree file for calculating phylogenetic diversity. As always, inspect the results file. What are the ranges that were observed in richness and PD?

head WS_aDiversity_even5196/WS_aDiversity_even5196.txt

QIIME offers a variety of additional options for calculating diversity, and the -s option prints them all! -s

There is workflow script,, which is useful if you want to understand how measures of alpha diversity change with sequencing effort. The script calculates alpha diversity on iterations of a subsampled OTU table.

2.4 Visualizing within-sample diversity is a QIIME workflow script that calculates summaries of OTUs at different taxonomic levels. Documentation is here. This will take about 10 minutes; if you want to be safe, you can tmux. -o WS_aDiversity_even5196/taxa_summary5196/ -i otu_table_mc2_w_tax_even5196.biom  

When the script is finished, navigate into the results file, and into the “taxa_summary_plots” and find the html area and bar charts. As you are navigating to these html files, notice that the script has produced an OTU/biom table for every taxonomic level (designated by the “L”):


The “L” stands for “lineage”, and each “level” is designated by a number. L1 is Domain, L2 is Phylum, L3 is Class, etc. The more resolved the lineage (higher number), the less accurate the definition (e.g., L6 is not entirely and consistently the same as “genus”).

To view the HTML files, you will need to transfer the HTML files themselves and their companion files in the charts directory to your desktop using scp. Open a terminal with the working directory on your computer, not the EC2.

Where to find QIIME resources and help

  • QIIME offers a suite of developer-designed tutorials.
  • Documentation for all QIIME scripts.
  • There is a very active QIIME Forum on Google Groups. This is a great place to troubleshoot problems, responses often are returned in a few hours!
  • The QIIME Blog provides updates like bug fixes, new features, and new releases.
  • QIIME development is on GitHub.