def clock_filter(self):
if self.config["clock_filter"] == False:
return
self.tree.tt.clock_filter(reroot='best', n_iqd=self.config["clock_filter"]["n_iqd"], plot=self.config["clock_filter"]["plot"])
leaves = [x for x in self.tree.tree.get_terminals()]
for n in leaves:
if n.bad_branch:
self.tree.tt.tree.prune(n)
print('pruning leaf ', n.name)
if self.config["clock_filter"]["remove_deep_splits"]:
self.tree.tt.tree.ladderize()
current_root = self.tree.tt.tree.root
if sum([x.branch_length for x in current_root])>0.1 \
and sum([x.count_terminals() for x in current_root.clades[:-1]])<5:
new_root = current_root.clades[-1]
new_root.up=False
self.tree.tt.tree.root = new_root
with open(self.output_path+"_outliers.txt", 'a') as ofile:
for x in current_root.clades[:-1]:
ofile.write("\n".join([leaf.name for leaf in x.get_terminals()])+'\n')
self.tree.tt.prepare_tree()
评论列表
文章目录