Entering edit mode
6.1 years ago
mdsiddra
▴
30
I have used python 3.6 and biopython 1.72 for viewing phylogenetiv trees. I have a protein msa file and a resulting tree file from the data. To evaluate the tree topology, I have generated a 1000 replicate trees for my data. In order to get branch support for my original tree with bootstrap replicates I have used following function;
def get_support(target_tree, trees, len_trees=None):
"""Calculate branch support for a target tree given bootstrap replicate trees.
:Parameters:
target_tree : Tree
tree to calculate branch support for.
trees : iterable
iterable of trees used to calculate branch support.
len_trees : int
optional count of replicates in trees. len_trees must be provided
when len(trees) is not a valid operation.
"""
term_names = sortedterm.name
for term in target_tree.find_clades(terminal=True))
bitstrs = {}
size = len_trees
if size is None:
try:
size = len(trees)
except TypeError:
raise TypeError("Trees does not support len(trees), "
"you must provide the number of replicates in trees "
"as the optional parameter len_trees.")
for clade in target_tree.find_clades(terminal=False):
bitstr = _clade_to_bitstr(clade, term_names)
bitstrs[bitstr] = (clade, 0)
for tree in trees:
for clade in tree.find_clades(terminal=False):
bitstr = _clade_to_bitstr(clade, term_names)
if bitstr in bitstrs:
c, t = bitstrs[bitstr]
c.confidence = round ((t + 1) * 100.0 / size)
bitstrs[bitstr] = (c, t + 1)
return target_tree
The problem I am facing is that this function results a tree that shows branch support values for a few of the branches and not for all. I'm really stuck with this point and can't figure out what is the real problem?
Can anyone come up with a solution for this?