import os
import qiime2
import numpy as np
import pandas as pd
from skbio import TreeNode
%matplotlib inline
table_art = qiime2.Artifact.load('composition.biom.qza')
table = table_art.view(pd.DataFrame)
balance_art = qiime2.Artifact.load('balances.qza')
balances = balance_art.view(pd.DataFrame)
tree_art = qiime2.Artifact.load('correlated_hierarchy.nwk.qza')
tree = tree_art.view(TreeNode)
taxa_art = qiime2.Artifact.load('taxa.qza')
taxa = taxa_art.view(pd.DataFrame)
metadata = pd.read_table('map.txt', index_col=0)
To get the 500 foot overview what the balances represent, let's first plot them on a heatmap.
Note that when constructing the highlights, the order is fixed. This means that the first column will denote the numerator colors, and the second column will denote the denominator colors.
from gneiss.plot import heatmap
highlights = pd.DataFrame([['#00D617', '#E6A519'],
['#00D617', '#E6A519']],
index=['y0', 'y2'],
columns=['numerator', 'denominator'])
_ = heatmap(np.log(table), tree, mdvar=metadata.Subject,
highlights=highlights, figsize=(10, 10))