Пример #1
0
def compare_trees(tree_filename1, tree_filename2):
	from dendropy import Tree, TreeList
	from dendropy.treecalc import symmetric_difference, euclidean_distance, robinson_foulds_distance as rbd
	c = TreeList([g(tree_filename1), g(tree_filename2)])
	return {'nBSD':euclidean_distance(c[0],c[1]), 'SDD':symmetric_difference(c[0], c[1]), \
			'RBD':rbd(c[0],c[1])}
Пример #2
0
def compare_trees(tree_filename1, tree_filename2):
	from dendropy import Tree, TreeList
	from dendropy.treecalc import symmetric_difference, euclidean_distance, robinson_foulds_distance as rbd, PatristicDistanceMatrix as pdm
	c = TreeList([g(tree_filename1), g(tree_filename2)])
	pp1 = pdm(c[0]).distances()
	pp2 = pdm(c[1]).distances()
	sumbl1 = sum(n.edge_length for n in c[0].nodes() if n.edge_length is not None)
	sumbl2 = sum(n.edge_length for n in c[1].nodes() if n.edge_length is not None)
	e = [n.edge_length for n in c[0].nodes() if n.edge_length is not None]
	return {'nBSD':euclidean_distance(c[0], c[1]), 'SDD':symmetric_difference(c[0], c[1]), 'RBD':rbd(c[0], c[1]), 'edgeDelta1': max(pp1)-min(pp1), 'edgeStd1': np.std(pp1),\
			'edgeDelta2': max(pp2)-min(pp2), 'edgeStd2': np.std(pp2), 'SumBranchLen1': sumbl1, 'SumBranchLen2': sumbl2}