In [1]:
# setup the presentation settings
from notebook.services.config import ConfigManager
cm = ConfigManager()
cm.update('livereveal', {
              'theme': 'serif',
              'start_slideshow_at': 'selected',
              'transition': 'fade'
})
Out[1]:
{'start_slideshow_at': 'selected', 'theme': 'serif', 'transition': 'fade'}
In [2]:
# some good ol' imports
import pandas as pd, numpy as np
from emperor import Emperor, nbinstall
from skbio import OrdinationResults

from emperor.qiime_backports.parse import parse_mapping_file
from emperor.qiime_backports.format import format_mapping_file

from skbio.io.util import open_file

nbinstall()

def load_mf(fn):
    with open_file(fn) as f:
        mapping_data, header, _ = parse_mapping_file(f)
        _mapping_file = pd.DataFrame(mapping_data, columns=header)
        _mapping_file.set_index('SampleID', inplace=True)
    return _mapping_file

def write_mf(f, _df):
    with open(f, 'w') as fp:
        lines = format_mapping_file(['SampleID'] + _df.columns.tolist(),
                                    list(_df.itertuples()))
        fp.write(lines+'\n')
In [3]:
def one_more_thing():
    return 'We are hiring, contact [email protected]'

Emperor: interactive $\beta$-diversity visualization

In [ ]:
# @ElDeveloper on GitHub
__presenter__ = 'Yoshiki Vazquez-Baeza'
__email__ = '[email protected]'


__license__ = 'BSD-3'
__url__ = 'https://github.com/biocore/emperor'
ucsd knight-lab

Outline

  • Background (why $\beta$-diversity).

  • What is Emperor.

  • How can we use Emperor.

  • Analyzing a use case.

Outline

  • Background (why $\beta$-diversity).

  • What is Emperor.

  • How can we use Emperor.

  • Analyzing a use case.

Microscopic worlds on and inside our bodies

Photograph by Martin Oeggerli, Micronaut, Supported by School of Life Sciences.

How do we make sense out of them?

microbe

How do we make sense out of them?

microbe

What is $\beta$-diversity

  • Comparison of two individual communities to determine how similar they are.

ucsd

What is $\beta$-diversity

  • Comparison of two individual communities to determine how similar they are.

dm

What is $\beta$-diversity

  • Comparison of two individual samples to determine how similar they are.
  • Elucidate patterns.

costello

Bacterial community variation in human body habitats across space and time. Costello EK et al. 2009.

What is $\beta$-diversity

  • Comparison of two individual samples to determine how similar they are.
  • Elucidate patterns.

costello

Bacterial community variation in human body habitats across space and time. Costello EK et al. 2009.

What is $\beta$-diversity

  • Comparison of two individual samples to determine how similar they are.
  • Elucidate patterns.

costello

Bacterial community variation in human body habitats across space and time. Costello EK et al. 2009.

In [4]:
from skbio import OrdinationResults

coordinates = OrdinationResults.read('costello/unweighted_unifrac_pc.txt')
metadata = load_mf('costello/mapping-file.txt')
In [6]:
coordinates
Out[6]:
In [7]:
from emperor import Emperor
In [8]:
Emperor(coordinates, metadata, remote=False)
Emperor resources missing. Expected them to be found in /nbextensions/emperor/support_files