Visualizing an interactive ordination

In [ ]:
import pandas as pd, numpy as np
from emperor import Emperor, nbinstall
from skbio import OrdinationResults

nbinstall()

def load_mf(fn, index='#SampleID'):
    _df = pd.read_csv(fn, sep='\t', dtype=str, keep_default_na=False, na_values=[])
    _df.set_index(index, inplace=True)
    return _df

We are going to load data from Fierer et al. 2010 (the data was retrieved from study 232 in Qiita, remember you need to be logged in to access the study).

Specifically, here we will reproduce Figure 1 A.

In [ ]:
mf = load_mf('keyboard/mapping-file.txt')
res = OrdinationResults.read('keyboard/unweighted-unifrac.even1000.txt')

If you want to share your notebook via GitHub use remote=True and make sure you share your notebook using nbviewer.

In [ ]:
viz = Emperor(res, mf, remote=False)
In [ ]:
viz