PAUPΒΆ
The paup
module provides functions to estimate a tree given a data matrix, or a substitution model given a tree and a data model.
Trees can be estimated using likelihood:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
import dendropy
from dendropy.interop import paup
warnings.warn("This example requires paup to be installed to run.")
data = dendropy.DnaCharacterMatrix.get(
path="pythonidae.nex",
schema="nexus")
tree = paup.estimate_tree(data,
tree_est_criterion='likelihood',
num_subst=2,
unequal_base_freqs=True,
gamma_rates=False,
prop_invar=False)
print(tree.as_string(schema="newick"))
Or neighbor-joining:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
import dendropy
from dendropy.interop import paup
warnings.warn("This example requires paup to be installed to run.")
data = dendropy.DnaCharacterMatrix.get(
path="pythonidae.nex",
schema="nexus")
tree = paup.estimate_tree(data,
tree_est_criterion='nj')
print(tree.as_string(schema="newick"))
Estimating a substitution model parameters requires both a tree and a data matrix:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
import dendropy
from dendropy.interop import paup
warnings.warn("This example requires paup to be installed to run.")
data = dendropy.DnaCharacterMatrix.get(
path="pythonidae.nex",
schema="nexus")
tree = paup.estimate_tree(data,
tree_est_criterion='nj')
est_tree, est_model = paup.estimate_model(data,
tree,
num_subst=2,
unequal_base_freqs=True,
gamma_rates=False,
prop_invar=False)
for k, v in est_model.items():
print("{}: {}".format(k, v))