def count_vectors(table: biom.Table, phylogeny: skbio.TreeNode, method: str = 'weighted_unifrac') -> biom.Table: table = _map_observations(table) pruned_phylo = prune_features_from_phylogeny(table, phylogeny) pruned_phylo = rename_nodes(pruned_phylo) table = table.sort(axis='observation') otu_ids = np.asarray(table.ids('observation')) counts = np.asarray(table.matrix_data.todense().transpose()) features, tree_index = _run_unifrac(counts, otu_ids, pruned_phylo, method) return biom.Table(data=features.transpose(), observation_ids=rename_otus(tree_index), sample_ids=table.ids())