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
mf = load_mf('moving-pictures/sample-metadata.tsv') res = OrdinationResults.read('moving-pictures/ordination.txt')
Recall that in this study two subjects are sampled longitudinally over four different sites (gut, left palm, right palm and tongue). In order to look at an individual trace per body site and per subject, we need to combine the
Subject and the
mf['animated_trace'] = mf.Subject + ' ' + mf.BodySite
If you want to share your notebook via GitHub use
remote=True and make sure you share your notebook using nbviewer.
viz = Emperor(res, mf, remote=False) viz.custom_axes.append('DaysSinceExperimentStart')
Gradient dropdown, select the
DaysSinceExperimentStart category. This category determines the order to connect the samples in a trace. And in the
Trajectory dropdown, select the
animated_trace category. This category indicates which samples will constitute each trace. Lastly, to look at the animated traces, go to the
Animations tab and click the play button.
As you can see in the animation, each body site for each subject is animated individually over time.