Skip to content

Commit

Permalink
output re-labeled tree
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronmartino committed Jun 25, 2020
1 parent d9a09c0 commit beb9790
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions deicode/rpca.py
Expand Up @@ -168,9 +168,15 @@ def frequency_filter(val, id_, md):
if len(table.ids('observation')) != len(set(table.ids('observation'))):
raise ValueError('Data-table contains duplicate columns')
# built table
tree_res = tree.copy() # make a copy to no overwrite
counts_by_node, tree_index, branch_lengths, tids\
= fast_unifrac(table, tree, frequency_filter)
= fast_unifrac(table, tree_res, frequency_filter)
rclr_table = phylo_rclr(counts_by_node, branch_lengths)
# re-label tree to return with labels
tree_relabel = {tid_:tree_index['id_index'][int(tid_[1:])]
for tid_ in tids}
for new_id, node_ in tree_relabel.items():
node_.name = new_id
# Robust-clt (rclr) preprocessing and OptSpace (RPCA)
opt = MatrixCompletion(n_components=n_components,
max_iterations=max_iterations,
Expand Down Expand Up @@ -228,4 +234,4 @@ def frequency_filter(val, id_, md):
dist_res = skbio.stats.distance.DistanceMatrix(
opt.distance, ids=sample_loading.index)

return ord_res, dist_res
return ord_res, dist_res, tree_res

0 comments on commit beb9790

Please sign in to comment.