def test_faith_pd_table_not_subset_tree(self): tree = TreeNode.read(StringIO('((OTU1:0.5,OTU3:1.0):1.0)root;')) table_ids = ['OTU1', 'OTU2'] table, tree = self.write_table_tree([1, 0], table_ids, ['foo'], tree) expected_message = "The table does not appear to be completely "\ "represented by the phylogeny." with self.assertRaisesRegex(ValueError, expected_message): faith_pd(table, tree)
def faith_pd_work(self, u_counts, otu_ids, sample_ids, tree): ta, tr = self.write_table_tree(u_counts, otu_ids, sample_ids, tree) return faith_pd(ta, tr)
from unifrac import faith_pd import time import sys print('Running-stacked_faith') args = sys.argv t0 = time.time() obs = faith_pd(args[1], args[2]) t1 = time.time() print('Python time-{}'.format(t1 - t0))
def faith_pd(table: BIOMV210Format, phylogeny: NewickFormat) -> pd.Series: table_str = str(table) tree_str = str(phylogeny) result = unifrac.faith_pd(table_str, tree_str) result.name = 'faith_pd' return result
def transform(self, X): with self.hdf5_table(X) as f: fpd = faith_pd(f.name, self.tree_path) return fpd.to_frame()