def __init__(self, raxml_args="-T 2 --JC69 -c 1"): self.raxml_args = [raxml_args] if platform.system() == 'Windows': # Windows version: raxml_path = os.path.join(SPECTRALTREE_RAXML_PATH, 'raxmlHPC-SSE3.exe') elif platform.system() == 'Darwin': #MacOS version: raxml_path = os.path.join(SPECTRALTREE_RAXML_PATH, 'raxmlHPC-macOS') elif platform.system() == 'Linux': #Linux version raxml_path = os.path.join(SPECTRALTREE_RAXML_PATH, 'raxmlHPC-SSE3-linux') else: raise OSError( f"Cannot identify operating system {platform.system()}.") self._rx = raxml.RaxmlRunner(raxml_path=raxml_path)
import dendropy from dendropy.interop import raxml pleth = dendropy.DnaCharacterMatrix.get( path="../data/full_plethodon_alignment.phy", schema="fasta" ) rx = raxml.RaxmlRunner(raxml_path="/bin/raxmlHPC") tree = rx.estimate_tree( char_matrix=pleth) tree.write_to_path("../data_output/tree.phy", schema="newick")
#! /usr/bin/env python import dendropy from dendropy.interop import raxml data = dendropy.DnaCharacterMatrix.get_from_path("pythonidae.nex", "nexus") rx = raxml.RaxmlRunner() tree = rx.estimate_tree(data)
## TEST WITHOUT CLASS ########################################################################### from dendropy.interop import raxml reference_tree = utils.balanced_binary(16) data = simulate_discrete_chars( 1000, reference_tree, Jc69(), mutation_rate=generation.Jukes_Cantor().p2t(0.95), ) if platform.system() == 'Windows': # Windows version: rx = raxml.RaxmlRunner(raxml_path=os.path.join( os.path.dirname(sys.path[0]), r'spectraltree\raxmlHPC-SSE3.exe')) elif platform.system() == 'Darwin': #MacOS version: rx = raxml.RaxmlRunner(raxml_path=os.path.join( os.path.dirname(sys.path[0]), 'spectraltree/raxmlHPC-macOS')) elif platform.system() == 'Linux': #Linux version rx = raxml.RaxmlRunner(raxml_path=os.path.join( os.path.dirname(sys.path[0]), 'spectraltree/raxmlHPC-SSE3-linux')) tree = rx.estimate_tree(char_matrix=data, raxml_args=["-T 2"]) type(data) #tree.print_plot()