class emperor.core.Emperor(ordination, mapping_file_data, mapping_file_headers)

Display principal coordinates analysis plots

Use this object to interactively display a PCoA plot using the Emperor GUI. IPython provides a rich display system that will let you display a plot inline, without the need of creating a temprorary file or having to write to disk.


ordination: skbio.maths.stats.ordination.OrdinationResults

Object containing the computed values for an ordination method in scikit-bio.

mapping_file_data: list of list objects

Metadata mapping file used to color the plot.

mapping_file_headers: list of str objects

List of strings representing the header names of the mapping_file_data. All names should be unique.


This object currently does not support the full range of actions that the GUI does support and should be considered experimental at the moment.


[R2]EMPeror: a tool for visualizing high-throughput microbial community data Vazquez-Baeza Y, Pirrung M, Gonzalez A, Knight R. Gigascience. 2013 Nov 26;2(1):16.


Create an Emperor object and display it from the IPython notebook:

>>> data = [['PC.354', 'Control', '20061218', 'Control_mouse_I.D._354'],
... ['PC.355', 'Control', '20061218', 'Control_mouse_I.D._355'],
... ['PC.356', 'Control', '20061126', 'Control_mouse_I.D._356'],
... ['PC.481', 'Control', '20070314', 'Control_mouse_I.D._481'],
... ['PC.593', 'Control', '20071210', 'Control_mouse_I.D._593'],
... ['PC.607', 'Fast', '20071112', 'Fasting_mouse_I.D._607'],
... ['PC.634', 'Fast', '20080116', 'Fasting_mouse_I.D._634'],
... ['PC.635', 'Fast', '20080116', 'Fasting_mouse_I.D._635'],
... ['PC.636', 'Fast', '20080116', 'Fasting_mouse_I.D._636']]
>>> headers = ['SampleID', 'Treatment', 'DOB', 'Description']
>>> ordination = OrdinationResults.read('unweighted_unifrac_pc.txt')

Now import the Emperor object and display it using IPython, note that this call will have no effect under an interactive Python session:

>>> from emperor import Emperor
>>> Emperor(ordination, data, headers)