I am using Biopython Phylo and RDkit Cluster to obtain a UPGMA tree from a distance matrix of 5k x 5k entries. How can I extract clustered entry names given a number of clusters?
For example, Bio.Phylo can return plain-text representation of a tree, so I think I can parse it by the number of tabs:
Phylogeny() Clade() Clade(branch_length=0.06) Clade(branch_length=0.102, name='A') Clade(branch_length=0.23, name='B') Clade(branch_length=0.4, name='C') ...
or, ASCII format:
_____________ A _______| _| |_______________________________ B | |_______________________________________________________ C
Which, I think is more difficult to parse but possible. Either way, those are not established methods for this kind of task, so I would use a hint.