Calculating the maximum likelihood tree from a multiple sequence alignment is easy, and only requires nexus files containing the taxa and sequences.
Currently, there is only support for DNA, but SNP, Bimarkers, and other data types are in the works.
from PhyNetPy.tools import ML_TREE from PhyNetPy.GTR import * filenames = ["file1.nex", "file2.nex"] log_output = "out.txt" tree_output = "ml_tree.tree" # Default, with substitution model JC() and number of iterations = 3000 likelihoods_1 = ML_TREE(filenames, tree_output, log_output) # num_iter keyword set likelihoods_2 = ML_TREE(filenames, tree_output, log_output, num_iter=5000) # submodel keyword set likelihoods_3 = ML_TREE(filenames, tree_output, log_output, submodel=K2P(.4, .6))
Here is a sample nexus file:
#NEXUS BEGIN TAXA; DIMENSIONS NTAX=4; TAXLABELS seq_1 seq_2 seq_3 seq_4 ; END; BEGIN CHARACTERS; DIMENSIONS NCHAR=5; FORMAT DATATYPE=DNA MISSING=? GAP=- MATCHCHAR=. ; MATRIX seq_1 GACCC seq_2 GACCG seq_3 CACCT seq_4 CACCC ; END;