Statistics, metrics, measurements, and values calculated between two trees.
Returns the Euclidean distance (a.k.a. Felsenstein’s 2004 “branch length distance”) between two trees based on edge_weight_attr.
Trees need to share the same TaxonNamespace reference. The bipartition bitmasks of the trees must be correct for the current tree structures (by calling Tree.encode_bipartitions method) or the is_bipartitions_updated argument must be False to force recalculation of bipartitions.
Parameters: 


Returns:  d (int) – The Euclidean distance between tree1 and tree2. 
Examples
import dendropy
from dendropy.calculate import treecompare
tns = dendropy.TaxonNamespace()
tree1 = tree.get_from_path(
"t1.nex",
"nexus",
taxon_namespace=tns)
tree2 = tree.get_from_path(
"t2.nex",
"nexus",
taxon_namespace=tns)
tree1.encode_bipartitions()
tree2.encode_bipartitions()
print(treecompare.euclidean_distance(tree1, tree2))
Counts and returns number of false positive bipar (bipartitions found in comparison_tree but not in reference_tree) and false negative bipartitions (bipartitions found in reference_tree but not in comparison_tree).
Trees need to share the same TaxonNamespace reference. The bipartition bitmasks of the trees must be correct for the current tree structures (by calling Tree.encode_bipartitions method) or the is_bipartitions_updated argument must be False to force recalculation of bipartitions.
Parameters: 


Returns:  t (tuple(int)) – A pair of integers, with first integer being the number of false positives and the second being the number of false negatives. 
Examples
import dendropy
from dendropy.calculate import treecompare
tns = dendropy.TaxonNamespace()
tree1 = tree.get_from_path(
"t1.nex",
"nexus",
taxon_namespace=tns)
tree2 = tree.get_from_path(
"t2.nex",
"nexus",
taxon_namespace=tns)
tree1.encode_bipartitions()
tree2.encode_bipartitions()
print(treecompare.false_positives_and_negatives(tree1, tree2))
Returns a list of bipartitions that are in reference_tree, but not in comparison_tree.
Trees need to share the same TaxonNamespace reference. The bipartition bitmasks of the trees must be correct for the current tree structures (by calling Tree.encode_bipartitions method) or the is_bipartitions_updated argument must be False to force recalculation of bipartitions.
Parameters: 


Returns:  s (list[Bipartition]) – A list of bipartitions that are in the first tree but not in the second. 
MasonGamer and Kellogg. Testing for phylogenetic conflict among molecular data sets in the tribe Triticeae (Gramineae). Systematic Biology (1996) vol. 45 (4) pp. 524
DEPRECATED: Use :func:symmetric_difference for the common unweighged RobinsonFould’s distance metric (i.e., the symmetric difference between two trees) :func:weighted_robinson_foulds_distance or for the RF distance as defined by Felsenstein, 2004.
Returns unweighted RobinsonFoulds distance between two trees.
Trees need to share the same TaxonNamespace reference. The bipartition bitmasks of the trees must be correct for the current tree structures (by calling Tree.encode_bipartitions method) or the is_bipartitions_updated argument must be False to force recalculation of bipartitions.
Parameters: 


Returns:  d (int) – The symmetric difference (a.k.a. the unweighted RobinsonFoulds distance) between tree1 and tree2. 
Examples
import dendropy
from dendropy.calculate import treecompare
tns = dendropy.TaxonNamespace()
tree1 = tree.get_from_path(
"t1.nex",
"nexus",
taxon_namespace=tns)
tree2 = tree.get_from_path(
"t2.nex",
"nexus",
taxon_namespace=tns)
tree1.encode_bipartitions()
tree2.encode_bipartitions()
print(treecompare.symmetric_difference(tree1, tree2))
Alias for symmetric_difference().
Returns weighted RobinsonFoulds distance between two trees based on edge_weight_attr.
Trees need to share the same TaxonNamespace reference. The bipartition bitmasks of the trees must be correct for the current tree structures (by calling Tree.encode_bipartitions method) or the is_bipartitions_updated argument must be False to force recalculation of bipartitions.
Parameters: 


Returns:  d (float) – The edgeweighted RobinsonFoulds distance between tree1 and tree2. 
Examples
import dendropy
from dendropy.calculate import treecompare
tns = dendropy.TaxonNamespace()
tree1 = tree.get_from_path(
"t1.nex",
"nexus",
taxon_namespace=tns)
tree2 = tree.get_from_path(
"t2.nex",
"nexus",
taxon_namespace=tns)
tree1.encode_bipartitions()
tree2.encode_bipartitions()
print(treecompare.weighted_robinson_foulds_distance(tree1, tree2))