Using an OTU table in QIIME and finding Unifraq distances


For this you will need some additional programs to be in your path:

module load muscle
module load qiime

QIIME expects OTU tables to be in biom format, developed by QIIME and VAMPS to be easy for programs to parse (at the expense of human legibility).

1. To convert a standard OTU table into biom fomat:

biom convert -i -o otu.biom --table-type "otu table"
where "" is your otu table and "otu.biom" is whatever you want to call the output biom file

2. Unifraq requires a phylogenetic tree. Building trees from sequence data requires sequences to be aligned. A fast aligner that's easy to use is Robert Edgar's muscle

muscle -in otus.fa -out otus.aligned.fa
muscle is iterative; depending on how many sequences you have and how diverse they are this step may take a few minutes.

3. Now you can make a phylogenetic tree in QIIME using the FastTree algorithm: -i otus.aligned.fa -o otus.aligned.tre 
As usual the input and output filenames can be anything you want.

4. Now compute weighted and unweighted beta diversity: -i otu.biom -o beta -t otu.aligned.tre
The output will be written to the "beta" directory or any other directory you specify with the -o flag. Like the analogous USEARCH command, this script can compute many different diversity metrics by adding the -m flag and listing them.