raxml module provides the
RaxmlRunner class, which is a lighweight (i.e., mostly “pass-through”) wrapper to the RAxML maximum-likelihood tree estimation program. RAxML needs to be installed in the system for this class to be used.
The class handles the exporting of the DendroPy dataset in a format suitable for RAxML analysis, and re-reading the resulting tree back into a DendroPy object.
The basic call assumes nucleotide data and estimates a tree under the
#! /usr/bin/env python import dendropy from dendropy.interop import raxml data = dendropy.DnaCharacterMatrix.get( path="pythonidae.nex", schema="nexus") rx = raxml.RaxmlRunner() tree = rx.estimate_tree( char_matrix=data, raxml_args=["--no-bfgs"]) print(tree.as_string(schema="newick"))
Currently, the only way to customize the call to the underlying RAxML program using
estimate_tree is to pass it a list of command-line arguments, with each argument token a separate list element. So, for example, to include invariant sites in the substitutio model and run 250 independent tree searches:
>>> tree = rx.estimate_tree(data, ['-m', 'GTRCATI', '-N', '250'])
Obviously, while this works, it is neither ideal nor very Pythonic. Future releases will polish up the interface.