jModelTest is a tool to carry out statistical selection of best-fit models of nucleotide substitution. It implements five different model selection strategies: hierarchical and dynamical likelihood ratio tests (hLRT and dLRT), Akaike and Bayesian information criteria (AIC and BIC), and a decision theory method (DT). It also provides estimates of model selection uncertainty, parameter importances and model-averaged parameter estimates, including model-averaged tree topologies. jModelTest 2 includes High Performance Computing (HPC) capabilities and additional features like new strategies for tree optimization, model-averaged phylogenetic trees (both topology and branch lenght), heuristic filtering and automatic logging of user activity. (from jModeltest website )


Use jModelTest to evaluate many different nucleotide substitution models

jmodeltest -tr 2 -d dna_alignment.fasta -g 4 -i -f -AIC -BIC -o jmodeltest.out

JModelTest will try to estimate a maximum liklihood tree by default, but sometimes this fails. You can have jmodeltest just use a neighbor-joining tree by specifying the -t BIONJ option on the command line

jmodeltest -tr 2 -d dna_alignment.fasta -t BIONJ -g 4 -i -f -AIC -BIC -o jmodeltest.out

You can get the “Best Model” from the output in a script using:

if [ $(grep -F -c "::Best Models::" jmodeltest.out) -eq 1 ] ; then
  declare -a jmout="($(tail -n 1 jmodeltest.out))"
  echo "jmodeltest failed"