\chapter{Introduction}\label{introduction}

\section{Why IQ-TREE?}\label{why-iq-tree}

Thanks to the recent advent of next-generation sequencing techniques,
the amount of phylogenomic/transcriptomic data have been rapidly
accumulated. This extremely facilitates resolving many ``deep
phylogenetic'' questions in the tree of life. At the same time it poses
major computational challenges to analyze such big data, where most
phylogenetic software cannot handle. Moreover, there is a need to
develop more complex probabilistic models to adequately capture
realistic aspects of genomic sequence evolution.

This trends motivated us to develop the IQ-TREE software with a strong
emphasis on phylogenomic inference. Our goals are:

\begin{itemize}
\tightlist
\item
  \textbf{Accuracy}: Proposing novel computational methods that perform
  better than existing approaches.
\item
  \textbf{Speed}: Allowing fast analysis on big data sets and utilizing
  high performance computing platforms.
\item
  \textbf{Flexibility}: Facilitating the inclusion of new (phylogenomic)
  models and sequence data types.
\item
  \textbf{Versatility}: Implementing a broad range of commonly-used
  maximum likelihood analyses.
\end{itemize}

IQ-TREE has been developed since 2011 and freely available at
\url{http://www.iqtree.org/} as open-source software under the
\href{http://www.gnu.org/licenses/licenses.en.html}{GNU-GPL license
version 2}. It is actively maintained by the core development team (see
below) and a number of collabrators.

The name IQ-TREE comes from the fact that it is the successor of
\href{http://www.cibiv.at/software/iqpnni/}{\textbf{IQ}PNNI} and
\href{http://www.tree-puzzle.de/}{\textbf{TREE}-PUZZLE} software.

\section{Key features}\label{key-features}

\begin{itemize}
\tightlist
\item
  \textbf{Efficient search algorithm}: Fast and effective stochastic
  algorithm to reconstruct phylogenetic trees by maximum likelihood.
  IQ-TREE compares favorably to RAxML and PhyML in terms of likelihood
  while requiring similar amount of computing time
  (\href{http://dx.doi.org/10.1093/molbev/msu300}{Nguyen et al., 2015}).
\item
  \textbf{Ultrafast bootstrap}: An ultrafast bootstrap approximation
  (UFBoot) to assess branch supports. UFBoot is 10 to 40 times faster
  than RAxML rapid bootstrap and obtains less biased support values
  (\href{http://dx.doi.org/10.1093/molbev/mst024}{Minh et al., 2013}).
\item
  \textbf{Ultrafast model selection}: An ultrafast and automatic model
  selection (ModelFinder) which is 10 to 100 times faster than
  jModelTest and ProtTest. ModelFinder also finds best-fit partitioning
  scheme like PartitionFinder.
\item
  \textbf{Big Data Analysis}: Supporting huge datasets with thousands of
  sequences or millions of alignment sites via
  \protect\hyperlink{checkpointing-to-resume-stopped-run}{checkpointing},
  safe numerical and low memory mode.
  \protect\hyperlink{utilizing-multi-core-cpus}{Multicore CPUs} and
  \protect\hyperlink{compiling-mpi-version}{parallel MPI system} are
  utilized to speedup analysis.
\item
  \textbf{Phylogenetic testing}: Several fast branch tests like SH-aLRT
  and aBayes test
  (\href{http://dx.doi.org/10.1093/sysbio/syr041}{Anisimova et al.,
  2011}) and tree topology tests like the approximately unbiased (AU)
  test (\href{http://dx.doi.org/10.1080/10635150290069913}{Shimodaira,
  2002}).
\end{itemize}

The strength of IQ-TREE is the availability of a wide variety of
phylogenetic models:

\begin{itemize}
\tightlist
\item
  \textbf{Common models}: All
  \protect\hyperlink{substitution-models}{common substitution models}
  for DNA, protein, codon, binary and morphological data with
  \protect\hyperlink{rate-heterogeneity-across-sites}{rate heterogeneity
  among sites} and
  \protect\hyperlink{ascertainment-bias-correction}{ascertainment bias
  correction} for e.g.~SNP data.
\item
  \textbf{\protect\hyperlink{partition-models}{Partition models}}:
  Allowing individual models for different genomic loci (e.g.~genes or
  codon positions), mixed data types, mixed rate heterogeneity types,
  linked or unlinked branch lengths between partitions.
\item
  \textbf{Mixture models}: \protect\hyperlink{mixture-models}{fully
  customizable mixture models} and
  \protect\hyperlink{protein-mixture-models}{empirical protein mixture
  models} and.
\item
  \textbf{Polymorphism-aware models}: Accounting for \emph{incomplete
  lineage sorting} to infer species tree from genome-wide population
  data (\href{http://dx.doi.org/10.1016/j.jtbi.2016.07.042}{Schrempf et
  al., 2016}).
\end{itemize}

\section{Free web server}\label{free-web-server}

For a quick start you can also try the IQ-TREE web server, which
performs online computation using a dedicated computing cluster. It is
very easy to use with as few as just 3 clicks! Try it out at

\url{http://iqtree.cibiv.univie.ac.at}

\section{User support}\label{user-support}

Please refer to the \href{http://www.iqtree.org/doc/}{user
documentation} and
\href{http://www.iqtree.org/doc/Frequently-Asked-Questions}{frequently
asked questions}. If you have further questions, feedback, feature
requests, and bug reports, please sign up the following Google group (if
not done yet) and post a topic to the

\url{https://groups.google.com/d/forum/iqtree}

\emph{The average response time is two working days.}

\section{Documentation}\label{documentation}

IQ-TREE has an extensive documentation with several tutorials and
manual:

\begin{itemize}
\item
  \protect\hyperlink{getting-started}{Getting started guide}:
  recommended for users who just downloaded IQ-TREE.
\item
  \protect\hyperlink{web-server-tutorial}{Web Server Tutorial}: A quick
  starting guide for the IQ-TREE Web Server.
\item
  \protect\hyperlink{beginners-tutorial}{Beginner's tutorial}:
  recommended for users starting to use IQ-TREE.
\item
  \protect\hyperlink{advanced-tutorial}{Advanced tutorial}: recommended
  for more experienced users who want to explore more features of
  IQ-TREE.
\item
  \protect\hyperlink{command-reference}{Command Reference}:
  Comprehensive documentation of command-line options available in
  IQ-TREE.
\item
  \protect\hyperlink{substitution-models}{Substitution Models}: All
  common substitution models and usages.
\item
  \protect\hyperlink{complex-models}{Complex Models}: Complex models
  such as partition and mixture models.
\item
  \protect\hyperlink{polymorphism-aware-models}{Polymorphism Aware
  Models}: Polymorphism-aware phylogenetic Models (PoMo) related
  documentation.
\item
  \protect\hyperlink{compilation-guide}{Compilation guide}: for advanced
  users who wants to compile IQ-TREE from source code.
\item
  \protect\hyperlink{frequently-asked-questions}{Frequently asked
  questions (FAQ)}: recommended to have a look before you post a
  question in the
  \href{https://groups.google.com/d/forum/iqtree}{IQ-TREE group}.
\end{itemize}

\section{How to cite IQ-TREE?}\label{how-to-cite-iq-tree}

\begin{quote}
\textbf{To maintain IQ-TREE, support users and secure fundings, it is
important for us that you cite the following papers, whenever the
corresponding features were applied for your analysis.}

\emph{Example 1:} ``\ldots{}We obtained branch supports with the
ultrafast bootstrap (Minh et al., 2013) implemented in the IQ-TREE
software (Nguyen et al., 2015)\ldots{}''

\emph{Example 2:} ``\ldots{}We inferred the maximum-likelihood tree
using the edge-linked partition model in IQ-TREE (Chernomor et al.,
2016; Nguyen et al., 2015)\ldots{}''
\end{quote}

If you performed tree reconstruction or other features please cite:

\begin{itemize}
\tightlist
\item
  L.-T. Nguyen, H.A. Schmidt, A. von Haeseler, and B.Q. Minh (2015)
  IQ-TREE: A fast and effective stochastic algorithm for estimating
  maximum likelihood phylogenies. \emph{Mol. Biol. Evol.}, 32, 268-274.
  \href{http://dx.doi.org/10.1093/molbev/msu300}{DOI:
  10.1093/molbev/msu300}
\end{itemize}

If you used partition models e.g., for phylogenomic analysis please
cite:

\begin{itemize}
\tightlist
\item
  O. Chernomor, A. von Haeseler, and B.Q. Minh (2016) Terrace aware data
  structure for phylogenomic inference from supermatrices. \emph{Syst.
  Biol.}, 65:997-1008.
  \href{http://dx.doi.org/10.1093/sysbio/syw037}{DOI:
  10.1093/sysbio/syw037}
\end{itemize}

If you performed the ultrafast bootstrap (UFBoot) please cite:

\begin{itemize}
\tightlist
\item
  B.Q. Minh, M.A.T. Nguyen, and A. von Haeseler (2013) Ultrafast
  approximation for phylogenetic bootstrap. \emph{Mol. Biol. Evol.},
  30:1188-1195. \href{http://dx.doi.org/10.1093/molbev/mst024}{DOI:
  10.1093/molbev/mst024}
\end{itemize}

If you used the polymorphism-aware models please cite:

\begin{itemize}
\tightlist
\item
  D. Schrempf, B.Q. Minh, N. De Maio, A. von Haeseler, and C. Kosiol
  (2016) Reversible polymorphism-aware phylogenetic models and their
  application to tree inference. \emph{J. Theor. Biol.}, 407:362--370.
  \href{http://dx.doi.org/10.1016/j.jtbi.2016.07.042}{DOI:
  10.1016/j.jtbi.2016.07.042}
\end{itemize}

If you used the \href{http://iqtree.cibiv.univie.ac.at/}{IQ-TREE web
server} please cite:

\begin{itemize}
\tightlist
\item
  J. Trifinopoulos, L.-T. Nguyen, A. von Haeseler, and B.Q. Minh (2016)
  W-IQ-TREE: a fast online phylogenetic tool for maximum likelihood
  analysis. \emph{Nucleic Acids Res.}, 44 (W1):W232-W235.
  \href{http://dx.doi.org/10.1093/nar/gkw256}{DOI: 10.1093/nar/gkw256}
\end{itemize}

If you used ModelFinder please cite:

\begin{itemize}
\tightlist
\item
  S. Kalyaanamoorthy, B.Q. Minh, T.K.F. Wong, A. von Haeseler, and L.S.
  Jermiin (2017) ModelFinder: Fast Model Selection for Accurate
  Phylogenetic Estimates, \emph{Nature Methods}, in press.
\end{itemize}

\section{Development team}\label{development-team}

IQ-TREE is actively developed by:

\textbf{Bui Quang Minh}, \emph{Team leader}, Designs IQ-TREE software
core, ultrafast bootstrap, model selection.

\textbf{Lam Tung Nguyen}, \emph{Developer}, Designs and parallelizes
IQ-TREE search algorithm.

\textbf{Olga Chernomor}, \emph{Developer}, Designs partition models and
phylogenomic tree search.

\textbf{Heiko A. Schmidt}, \emph{Developer}, Integrates TREE-PUZZLE
features into IQ-TREE.

\textbf{Jana Trifinopoulos}, \emph{Developer}, Designs and maintains
IQ-TREE web service.

\textbf{Dominik Schrempf}, \emph{Developer}, Implements
polymorphism-aware models (PoMo).

\textbf{Arndt von Haeseler}, \emph{Advisor}, Provides advice, inspiring
ideas and financial support.

\section{Credits and
Acknowledgements}\label{credits-and-acknowledgements}

Some parts of the code were taken from the following packages/libraries:
\href{http://www.libpll.org}{Phylogenetic likelihood library},
\href{http://www.tree-puzzle.de}{TREE-PUZZLE},
\href{http://dx.doi.org/10.1093/oxfordjournals.molbev.a025808}{BIONJ},
\href{http://dx.doi.org/10.1093/bioinformatics/btg319}{Nexus Class
Libary}, \href{http://eigen.tuxfamily.org/}{Eigen library},
\href{http://www.sprng.org}{SPRNG library},
\href{http://www.zlib.net}{Zlib library}, gzstream library,
\href{http://www.agner.org/optimize/}{vectorclass library},
\href{https://www.gnu.org/software/gsl/}{GNU scientific library}.

IQ-TREE was partially funded by the
\href{http://www.fwf.ac.at/}{Austrian Science Fund - FWF} (grant no.
I760-B17 from 2012-2015 and and I 2508-B29 from 2016-2019) and the
\href{https://www.univie.ac.at/}{University of Vienna} (Initiativkolleg
I059-N).

\hypertarget{getting-started}{\chapter{Getting
started}\label{getting-started}}

Recommended for users who just downloaded IQ-TREE the first time.

\section{IQ-TREE web server}\label{iq-tree-web-server}

The quickest is to try out the
\href{http://iqtree.cibiv.univie.ac.at}{IQ-TREE web server}, where you
only need to upload an alignment, choose the options and start the
analysis. There is a \protect\hyperlink{web-server-tutorial}{web server
tutorial here}.

If you want to use the command-line version, follow the instructions
below.

\section{Installation}\label{installation}

To achieve high performance IQ-TREE is a command-line program: you need
to run IQ-TREE from a Terminal/Console (this is called Command Prompt
under Windows). After you
\href{http://www.iqtree.org/\#download}{downloaded IQ-TREE}, please:

\begin{itemize}
\tightlist
\item
  Extract the \lstinline!.zip! (Windows, MacOSX) or \lstinline!.tar.gz!
  (Linux) file to create a directory \lstinline!iqtree-X.Y.Z-OS! or
  \lstinline!iqtree-omp-X.Y.Z-OS!, where \lstinline!X.Y.Z! is the
  version number and \lstinline!OS! is the operating system (Windows,
  MacOSX or Linux).
\item
  You will find the executable in the \lstinline!bin! sub-folder. Copy
  all files in \lstinline!bin! folder to your system search path such
  that you can run IQ-TREE by entering \lstinline!iqtree! or
  \lstinline!iqtree-omp! from the Terminal.
\end{itemize}

Now you need to open a Terminal (or Console) to run IQ-TREE. See below
the guide for \protect\hyperlink{for-windows-users}{Windows users} and
\protect\hyperlink{for-mac-os-x-users}{Mac OS X users}.

\hypertarget{for-windows-users}{\section{For Windows
users}\label{for-windows-users}}

Since IQ-TREE is a command-line program, clicking on
\lstinline!iqtree.exe! will not work. You have to open a Command Prompt
for all analyses:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  Click on ``Start'' menu (below left corner of Windows screen).
\item
  Type in ``cmd'' and press ``Enter''. It will open the Command Prompt
  window (see Figure below).
\item
  Go into IQ-TREE folder you just extracted by entering e.g. (assuming
  you downloaded version 1.5.0):

\begin{lstlisting}
cd Downloads\iqtree-1.5.0-Windows
\end{lstlisting}

  (assuming that IQ-TREE was downloaded into \lstinline!Downloads!
  folder).
\item
  Now you can try an example run by entering:

\begin{lstlisting}
bin\iqtree -s example.phy
\end{lstlisting}

  (\lstinline!example.phy! is the example PHYLIP alignment file also
  extracted in that folder).
\item
  After a few seconds, IQ-TREE finishes and you may see something like
  this:
\end{enumerate}

\begin{figure}
\centering
\includegraphics{images/win-cmd2.png}
\caption{Windows command prompt}
\end{figure}

Congratulations ;-) You have finished the first IQ-TREE analysis.

\hypertarget{for-mac-os-x-users}{\section{For Mac OS X
users}\label{for-mac-os-x-users}}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  Open the ``Terminal'', e.g., by clicking on the Spotlight icon
  (top-right corner), typing ``terminal'' and press ``Enter''.
\item
  Go into IQ-TREE folder by entering (assuming you downloaded version
  1.5.0):

\begin{lstlisting}
cd Downloads/iqtree-1.5.0-MacOSX
\end{lstlisting}

  (assuming that IQ-TREE was downloaded into \lstinline!Downloads!
  folder).
\item
  Now you can try an example run by entering

\begin{lstlisting}
bin/iqtree -s example.phy
\end{lstlisting}

  (\lstinline!example.phy! is the example PHYLIP alignment file also
  extracted in that folder).
\item
  After a few seconds, IQ-TREE finishes and you may see something like
  this:
\end{enumerate}

\begin{figure}
\centering
\includegraphics{images/mac-cmd2.png}
\caption{Mac terminal}
\end{figure}

Congratulations ;-) You have finished the first IQ-TREE analysis.

\section{Minimal command-line
examples}\label{minimal-command-line-examples}

A few typically analyses are listed in the following. Note that it is
assumed that \lstinline!iqtree! executable was already copied into
system search path. If not, please replace \lstinline!iqtree! with
actual path to executable.

\begin{itemize}
\item
  Infer maximum-likelihood tree from a sequence alignment
  (\lstinline!example.phy!) with the best-fit model automatically
  selected by ModelFinder:

\begin{lstlisting}
# for version >= 1.5.4
iqtree -s example.phy

# for version <= 1.5.3
iqtree -s example.phy -m TESTNEW

(use '-m TEST' to resemble jModelTest/ProtTest)
\end{lstlisting}
\item
  Infer maximum-likelihood tree using \lstinline!GTR+I+G! model:

\begin{lstlisting}
iqtree -s example.phy -m GTR+I+G
\end{lstlisting}
\item
  Perform ModelFinder without subsequent tree inference:

\begin{lstlisting}
# for version >= 1.5.4
iqtree -s example.phy -m MF

# for version <= 1.5.3
iqtree -s example.phy -m TESTNEWONLY

(use '-m TESTONLY' to resemble jModelTest/ProtTest)
\end{lstlisting}
\item
  Combine ModelFinder, tree search, SH-aLRT test and ultrafast bootstrap
  with 1000 replicates:

\begin{lstlisting}
# for version >= 1.5.4
iqtree -s example.phy -alrt 1000 -bb 1000

# for version <= 1.5.3
iqtree -s example.phy -m TESTNEW -alrt 1000 -bb 1000
\end{lstlisting}
\item
  Perform edge-linked proportional partition model
  (\lstinline!example.nex!):

\begin{lstlisting}
iqtree -s example.phy -spp example.nex

(replace '-spp' by '-sp' for edge-unlinked model)
\end{lstlisting}
\item
  Find best partition scheme by possibly merging partitions:

\begin{lstlisting}
# for version >= 1.5.4
iqtree -s example.phy -sp example.nex -m MF+MERGE

# for version <= 1.5.3
iqtree -s example.phy -sp example.nex -m TESTNEWMERGEONLY

(use '-m TESTMERGEONLY' to resemble PartitionFinder)
\end{lstlisting}
\item
  Find best partition scheme followed by tree inference and ultrafast
  bootstrap:

\begin{lstlisting}
# for version >= 1.5.4
iqtree -s example.phy -spp example.nex -m MFP+MERGE -bb 1000

# for version <= 1.5.3
iqtree -s example.phy -spp example.nex -m TESTNEWMERGE -bb 1000

(use '-m TESTMERGE' to resemble PartitionFinder)
\end{lstlisting}
\item
  Use 4 CPU cores to speed up computation:

\begin{lstlisting}
iqtree-omp -s example.phy -nt 4
\end{lstlisting}
\item
  Determine the best number of cores to use under \lstinline!GTR+R4!
  model:

\begin{lstlisting}
iqtree-omp -s example.phy -m GTR+R4 -nt AUTO
\end{lstlisting}
\item
  Show all available options:

\begin{lstlisting}
iqtree -h
\end{lstlisting}
\end{itemize}

\section{Where to go from here?}\label{where-to-go-from-here}

Please continue with the
\textbf{\protect\hyperlink{beginners-tutorial}{Beginner's tutorial}} for
further usages.

\hypertarget{web-server-tutorial}{\chapter{Web server
tutorial}\label{web-server-tutorial}}

A quick starting guide for the IQ-TREE Web Server.

This tutorial explains briefly how to use the IQ-TREE web server for
fast online phylogenetic inference, accessible at
iqtree.cibiv.univie.ac.at.

There are three tabs: \protect\hyperlink{tree-inference}{Tree
Inference}, \protect\hyperlink{model-selection}{Model Selection} and
\protect\hyperlink{analysis-results}{Analysis Results}.

\hypertarget{tree-inference}{\section{Tree
Inference}\label{tree-inference}}

Tree Inference provides the most frequently used features of IQ-TREE and
allows users to carry out phylogenetic analysis on a multiple sequence
alignment (MSA). In the most basic case, no more than an MSA file is
required to submit the job. Without further input, IQ-TREE will run with
the default parameters and auto-detect the sequence type as well as the
best-fitting substitution model. Additionally, Ultrafast Bootstrap (Minh
et al., 2013) and the SH-aLRT branch test (Guindon et al., 2010) will be
performed.

You can either try out the web server with an example alignment by
ticking the corresponding box or upload your own alignment file. By
clicking on `Browse' a dialog will open where you can select your MSA;
the file formats Phylip, Fasta, Nexus, Clustal and MSF are supported.

\begin{figure}
\centering
\includegraphics{images/tut1.png}
\caption{Tree Inference Tab}
\end{figure}

After that you can submit the job. If you provide an email address, a
notification will be sent to you once the job is finished. In case you
don't specify an email address, you will receive a link in the next
step; you can bookmark this link to retrieve your results after the job
is finished.

\hypertarget{model-selection}{\section{Model
Selection}\label{model-selection}}

IQ-TREE supports a wide range of substitution models for DNA, protein,
codon, binary and morphological alignments. In case you do not know
which model is appropriate for your data, IQ-TREE can automatically
determine the best-fit model for your alignment. Use the Model Selection
tab if you only want to find the best-fit model without doing tree
reconstruction.

\begin{figure}
\centering
\includegraphics{images/tut2.png}
\caption{Model Selection Tab}
\end{figure}

Like with \protect\hyperlink{tree-inference}{Tree Inference}, the only
obligatory input is a multiple sequence alignment. You can either upload
your own \textbf{alignment file} or use the \textbf{example alignment}
to try out the web server and then \textbf{submit the job}.

\hypertarget{analysis-results}{\section{Analysis
Results}\label{analysis-results}}

In the tab Analysis Results you can monitor your jobs. With our example
file, a run will only take a few seconds, depending on the server load.
For your own alignments the CPU time limit is 24 hours. If you provided
an email address when submitting the job, you will get an email once it
is finished.

\begin{figure}
\centering
\includegraphics{images/tut3.png}
\caption{Analysis Results}
\end{figure}

Once a job is finished, you can select it by checking the corresponding
box and then \textbf{download the selected jobs} as a zip file. This zip
file will contain the results of your run, including the \textbf{Run
Log} and the \textbf{Full Result} which are also accessible in the
webserver.

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.14\columnwidth}\raggedright\strut
Suffix\strut
\end{minipage} & \begin{minipage}[b]{0.80\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!.iqtree!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Full result of the run, this is the main report file\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!.log!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Run log\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!.treefile!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Maximum likelihood tree in NEWICK format, can be visualized with
treeviewer programs\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!.svg!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Graphical tree representation in SVG format, done with ete view\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!.pdf!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Graphical tree representation in PDF format, done with ete view\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!.contree!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Consensus tree with assigned branch supports where branch lengths are
optimized on the original alignment; printed if Ultrafast Bootstrap is
selected\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!.ckp.gz!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Checkpoint file; included if a job was stopped because of RAM/CPU
limits\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{NOTE}: Jobs which require more than 24 hours or 1GB RAM will be
stopped. In such a case, you can download the stopped job and resume the
run from the last checkpoint on your local PC as described here.
\end{quote}

\hypertarget{beginners-tutorial}{\chapter{Beginner's
tutorial}\label{beginners-tutorial}}

This tutorial gives a beginner's guide.

Please first \href{http://www.iqtree.org/\#download}{download} and
\protect\hyperlink{getting-started}{install} the binary for your
platform. For the next steps, the folder containing your
\lstinline!iqtree! executable should be added to your PATH enviroment
variable so that IQ-TREE can be invoked by simply entering
\lstinline!iqtree! at the command-line. Alternatively, you can also copy
\lstinline!iqtree! binary into your system search.

\begin{quote}
\textbf{TIP}: For quick overview of all supported options in IQ-TREE,
run the command \lstinline!iqtree -h!.
\end{quote}

\section{Input data}\label{input-data}

IQ-TREE takes as input a \emph{multiple sequence alignment} and will
reconstruct an evolutionary tree that is best explained by the input
data. The input alignment can be in various common formats. For example
the
\href{http://evolution.genetics.washington.edu/phylip/doc/sequence.html}{PHYLIP
format} which may look like:

\begin{lstlisting}
7 28
Frog       AAATTTGGTCCTGTGATTCAGCAGTGAT
Turtle     CTTCCACACCCCAGGACTCAGCAGTGAT
Bird       CTACCACACCCCAGGACTCAGCAGTAAT
Human      CTACCACACCCCAGGAAACAGCAGTGAT
Cow        CTACCACACCCCAGGAAACAGCAGTGAC
Whale      CTACCACGCCCCAGGACACAGCAGTGAT
Mouse      CTACCACACCCCAGGACTCAGCAGTGAT
\end{lstlisting}

This tiny alignment contains 7 DNA sequences from several animals with
the sequence length of 28 nucleotides. IQ-TREE also supports other file
formats such as FASTA, NEXUS, CLUSTALW. The FASTA file for the above
example may look like this:

\begin{lstlisting}
>Frog       
AAATTTGGTCCTGTGATTCAGCAGTGAT
>Turtle     
CTTCCACACCCCAGGACTCAGCAGTGAT
>Bird       
CTACCACACCCCAGGACTCAGCAGTAAT
>Human      
CTACCACACCCCAGGAAACAGCAGTGAT
>Cow        
CTACCACACCCCAGGAAACAGCAGTGAC
>Whale      
CTACCACGCCCCAGGACACAGCAGTGAT
>Mouse      
CTACCACACCCCAGGACTCAGCAGTGAT
\end{lstlisting}

\begin{quote}
\textbf{NOTE}: If you have raw sequences, you need to first apply
alignment programs like
\href{http://mafft.cbrc.jp/alignment/software/}{MAFFT} or
\href{http://www.clustal.org}{ClustalW} to align the sequences, before
feeding them into IQ-TREE.
\end{quote}

\hypertarget{first-running-example}{\section{First running
example}\label{first-running-example}}

From the download there is an example alignment called
\lstinline!example.phy! in PHYLIP format. This example contains parts of
the mitochondrial DNA sequences of several animals (Source:
\href{http://www.kuleuven.be/aidslab/phylogenybook/home.html}{Phylogenetic
Handbook}).

You can now start to reconstruct a maximum-likelihood tree from this
alignment by entering (assuming that you are now in the same folder with
\lstinline!example.phy!):

\begin{lstlisting}
iqtree -s example.phy
\end{lstlisting}

\lstinline!-s! is the option to specify the name of the alignment file
that is always required by IQ-TREE to work. At the end of the run
IQ-TREE will write several output files including:

\begin{itemize}
\tightlist
\item
  \lstinline!example.phy.iqtree!: the main report file that is
  self-readable. You should look at this file to see the computational
  results. It also contains a textual representation of the final tree
  (see below).
\item
  \lstinline!example.phy.treefile!: the ML tree in NEWICK format, which
  can be visualized by any supported tree viewer programs like FigTree
  or iTOL.
\item
  \lstinline!example.phy.log!: log file of the entire run (also printed
  on the screen). To report bugs, please send this log file and the
  original alignment file to the authors.
\end{itemize}

\begin{quote}
\textbf{NOTE}: Starting with version 1.5.4, with this simple command
IQ-TREE will by default perform ModelFinder (see
\protect\hyperlink{choosing-the-right-substitution-model}{choosing the
right substitution model} below) to find the best-fit substitution model
and then infer a phylogenetic tree using the selected model.
\end{quote}

For this example data the resulting maximum-likelihood tree may look
like this (extracted from \lstinline!.iqtree! file):

\begin{lstlisting}
NOTE: Tree is UNROOTED although outgroup taxon 'LngfishAu' is drawn at root

+--------------LngfishAu
|
|        +--------------LngfishSA
+--------|
|        +--------------LngfishAf
|
|      +-------------------Frog
+------|
       |               +-----------------Turtle
       |         +-----|
       |         |     |      +-----------------------Sphenodon
       |         |     |   +--|
       |         |     |   |  +--------------------------Lizard
       |         |     +---|
       |         |         |      +---------------------Crocodile
       |         |         +------|
       |         |                +------------------Bird
       +---------|
                 |                  +----------------Human
                 |               +--|
                 |               |  |  +--------Seal
                 |               |  +--|
                 |               |     |   +-------Cow
                 |               |     +---|
                 |               |         +---------Whale
                 |          +----|
                 |          |    |         +------Mouse
                 |          |    +---------|
                 |          |              +--------Rat
                 +----------|
                            |   +----------------Platypus
                            +---|
                                +-------------Opossum
\end{lstlisting}

This makes sense as the mammals (\lstinline!Human! to
\lstinline!Opossum!) form a clade, whereas the reptiles
(\lstinline!Turtle! to \lstinline!Crocodile!) and \lstinline!Bird! form
a separate sister clade. Here the tree is drawn at the \emph{outgroup}
Lungfish which is more accient than other species in this example.
However, please note that IQ-TREE always produces an \textbf{unrooted
tree} as it knows nothing about this biological background; IQ-TREE
simply draws the tree this way as \lstinline!LngfishAu! is the first
sequence occuring in the alignment.

During the example run above, IQ-TREE periodically wrote to disk a
checkpoint file \lstinline!example.phy.ckp.gz! (gzip-compressed to save
space). This checkpoint file is used to resume an interrupted run, which
is handy if you have a very large data sets or time limit on a cluster
system. If the run did not finish, invoking IQ-TREE again with the very
same command line will recover the analysis from the last stopped point,
thus saving all computation time done before.

If the run successfully completed, running again will issue an error
message:

\begin{lstlisting}
ERROR: Checkpoint (example.phy.ckp.gz) indicates that a previous run successfully finished
Use `-redo` option if you really want to redo the analysis and overwrite all output files.
\end{lstlisting}

This prevents lost of data if you accidentally re-run IQ-TREE. However,
if you really want to re-run the analysis and overwrite all previous
output files, use \lstinline!-redo! option:

\begin{lstlisting}
iqtree -s example.phy -redo
\end{lstlisting}

Finally, the default prefix of all output files is the alignment file
name. You can\\
change the prefix using the \lstinline!-pre! option:

\begin{lstlisting}
iqtree -s example.phy -pre myprefix
\end{lstlisting}

This prevents output files being overwritten when you perform multiple
analyses on the same alignment within the same folder.

\hypertarget{choosing-the-right-substitution-model}{\section{Choosing
the right substitution
model}\label{choosing-the-right-substitution-model}}

IQ-TREE supports a wide range of
\protect\hyperlink{substitution-models}{substitution models} for DNA,
protein, codon, binary and morphological alignments. If you do not know
which model is appropriate for your data, you can use ModelFinder to
determine the best-fit model:

\begin{lstlisting}
#for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -m MFP

#for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -m TESTNEW
\end{lstlisting}

\lstinline!-m! is the option to specify the model name to use during the
analysis. The special \lstinline!MFP! key word stands for
\emph{ModelFinder Plus}, which tells IQ-TREE to perform ModelFinder and
the remaining analysis using the selected model. ModelFinder computes
the log-likelihoods of an initial parsimony tree for many different
models and the \emph{Akaike information criterion} (AIC),
\emph{corrected Akaike information criterion} (AICc), and the
\emph{Bayesian information criterion} (BIC). Then ModelFinder chooses
the model that minimizes the BIC score (you can also change to AIC or
AICc by adding the option \lstinline!-AIC! or \lstinline!-AICc!,
respectively).

\begin{quote}
\textbf{TIP}: Starting with version 1.5.4, \lstinline!-m MFP! is the
default behavior. Thus, this run is equivalent to
\lstinline!iqtree -s example.phy!.
\end{quote}

Here, IQ-TREE will write an additional file:

\begin{itemize}
\tightlist
\item
  \lstinline!example.phy.model!: log-likelihoods for all models tested.
  It serves as a checkpoint file to recover an interrupted model
  selection.
\end{itemize}

If you now look at \lstinline!example.phy.iqtree! you will see that
IQ-TREE selected \lstinline!TIM2+I+G4! as the best-fit model for this
example data. Thus, for additional analyses you do not have to perform
the model test again and can use the selected model:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G
\end{lstlisting}

Sometimes you only want to find the best-fit model without doing tree
reconstruction, then run:

\begin{lstlisting}
#for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -m MF

#for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -m TESTNEWONLY
\end{lstlisting}

\begin{quote}
\textbf{Why ModelFinder at all?}

ModelFinder has several advantages compared to existing approaches like
jModelTest and ProtTest:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  ModelFinder is up to 100 times faster than jModelTest/ProtTest.
\item
  jModelTest/ProtTest provides the invariable (\lstinline!+I!) and Gamma
  rate (\lstinline!+G!) heterogeneity across sites, but there is no
  reason to believe that evolution follows a Gamma distribution.
  ModelFinder additionally considers the
  \protect\hyperlink{rate-heterogeneity-across-sites}{FreeRate
  heterogeneity model (\lstinline!+R!)}, which relaxes the assumption of
  Gamma distribution, where the site rates and proportions are
  \emph{free-to-vary} and inferred independently from the data.
  Moreover, \lstinline!+R! allows to automatically determine the number
  of rate categories, which is impossible with \lstinline!+G!. This can
  be important especially for phylogenomic data, where the default 4
  rate categories may ``underfit'' the data.
\item
  ModelFinder works transparently with tree inference in IQ-TREE, thus
  combining both steps in just one single run! This eliminates the need
  for a separate software for DNA (jModelTest) and another for protein
  sequences (ProtTest).
\item
  Apart from DNA and protein sequences, ModelFinder also works with
  codon, binary and morphological sequences.
\item
  ModelFinder can also find best partitioning scheme just like
  PartitionFinder
  (\href{http://dx.doi.org/10.1093/molbev/mss020}{Lanfear et al.,
  2012}). See \protect\hyperlink{advanced-tutorial}{advanced tutorial
  for more details}.
\end{enumerate}

If you still want to resembles jModelTest/ProtTest, then use option
\lstinline!-m TEST! or \lstinline!-m TESTONLY! instead.
\end{quote}

By default, the maximum number of categories is limitted to 10 due to
computational reasons. If your sequence alignment is long enough, then
you can increase this upper limit with the \lstinline!cmax! option:

\begin{lstlisting}
#for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -m MF -cmax 15

#for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -m TESTNEWONLY -cmax 15
\end{lstlisting}

will test \lstinline!+R2! to \lstinline!+R15! instead of at most
\lstinline!+R10!.

To reduce computational burden, one can use the option \lstinline!-mset!
to restrict the testing procedure to a subset of base models instead of
testing the entire set of all available models. For example,
\lstinline!-mset WAG,LG! will test only models like \lstinline!WAG+...!
or \lstinline!LG+...!. Another useful option in this respect is
\lstinline!-msub! for AA data sets. With \lstinline!-msub nuclear! only
general AA models are included, whereas with \lstinline!-msub viral!
only AA models for viruses are included.

If you have enough computational resource, you can perform a thorough
and more accurate analysis that invokes a full tree search for each
model considered via the \lstinline!-mtree! option:

\begin{lstlisting}
#for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -m MF -mtree

#for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -m TESTNEWONLY -mtree
\end{lstlisting}

\section{Using codon models}\label{using-codon-models}

IQ-TREE supports a number of \protect\hyperlink{codon-models}{codon
models}. You need to input a protein-coding DNA alignment and specify
codon data by option \lstinline!-st CODON! (Otherwise, IQ-TREE applies
DNA model because it detects that your alignment has DNA sequences):

\begin{lstlisting}
iqtree -s coding_gene.phy -st CODON 
\end{lstlisting}

If your alignment length is not divisible by 3, IQ-TREE will stop with
an error message. IQ-TREE will group sites 1,2,3 into codon site 1;
sites 4,5,6 to codon site 2; etc. Moreover, any codon, which has at
least one gap/unknown/ambiguous nucleotide, will be treated as unknown
codon character.

Note that the above command assumes the standard genetic code. If your
sequences follow `The Invertebrate Mitochondrial Code' (see
\protect\hyperlink{codon-models}{the full list of supported genetic code
here}), then run:

\begin{lstlisting}
iqtree -s coding_gene.phy -st CODON5 
\end{lstlisting}

Note that ModelFinder works for codon alignments. IQ-TREE version
\textgreater{}= 1.5.4 will automatically invokes ModelFinder to find the
best-fit codon model. For version \textless{}= 1.5.3, use option
\lstinline!-m TESTNEW! (ModelFinder and tree inference) or
\lstinline!-m TESTNEWONLY! (ModelFinder only).

\section{Binary, morphological and SNP
data}\label{binary-morphological-and-snp-data}

IQ-TREE supports discrete morphological alignments by
\lstinline!-st MORPH! option:

\begin{lstlisting}
iqtree -s morphology.phy -st MORPH
\end{lstlisting}

IQ-TREE implements to two morphological ML models:
\protect\hyperlink{binary-and-morphological-models}{MK and ORDERED}.
Morphological data typically do not have constant (uninformative) sites.
In such cases, you should apply
\protect\hyperlink{ascertainment-bias-correction}{ascertainment bias
correction} model by e.g.:

\begin{lstlisting}
iqtree -s morphology.phy -st MORPH -m MK+ASC
\end{lstlisting}

You can again select the best-fit binary/morphological model:

\begin{lstlisting}
#for IQ-TREE version >= 1.5.4:
iqtree -s morphology.phy -st MORPH

#for IQ-TREE version <= 1.5.3:
iqtree -s morphology.phy -st MORPH -m TESTNEW
\end{lstlisting}

For SNP data (DNA) that typically do not contain constant sites, you can
explicitly tell the model to include ascertainment bias correction:

\begin{lstlisting}
iqtree -s SNP_data.phy -m GTR+ASC
\end{lstlisting}

You can explicitly tell model testing to only include \lstinline!+ASC!
model with:

\begin{lstlisting}
#for IQ-TREE version >= 1.5.4:
iqtree -s SNP_data.phy -m MFP+ASC

#for IQ-TREE version <= 1.5.3:
iqtree -s SNP_data.phy -m TESTNEW+ASC
\end{lstlisting}

\hypertarget{assessing-branch-supports-with-ultrafast-bootstrap-approximation}{\section{Assessing
branch supports with ultrafast bootstrap
approximation}\label{assessing-branch-supports-with-ultrafast-bootstrap-approximation}}

To overcome the computational burden required by the nonparametric
bootstrap, IQ-TREE introduces an ultrafast bootstrap approximation
(UFBoot) (\href{http://dx.doi.org/10.1093/molbev/mst024}{Minh et al.,
2013}) that is orders of magnitude faster than the standard procedure
and provides relatively unbiased branch support values. To run UFBoot,
use the option \lstinline!-bb!:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -bb 1000
\end{lstlisting}

\lstinline!-bb! specifies the number of bootstrap replicates where 1000
is the minimum number recommended. The section
\lstinline!MAXIMUM LIKELIHOOD TREE! in \lstinline!example.phy.iqtree!
shows a textual representation of the maximum likelihood tree with
branch support values in percentage. The NEWICK format of the tree is
printed to the file \lstinline!example.phy.treefile!. In addition,
IQ-TREE writes the following files:

\begin{itemize}
\tightlist
\item
  \lstinline!example.phy.contree!: the consensus tree with assigned
  branch supports where branch lengths are optimized on the original
  alignment.
\item
  \lstinline!example.phy.splits!: support values in percentage for all
  splits (bipartitions), computed as the occurence frequencies in the
  bootstrap trees. This file is in ``star-dot'' format.
\item
  \lstinline!example.phy.splits.nex!: has the same information as
  \lstinline!example.phy.splits! but in NEXUS format, which can be
  viewed with the program SplitsTree.
\end{itemize}

\begin{quote}
\textbf{NOTE}: UFBoot support values have a different interpretation to
the standard bootstrap. Refer to
\protect\hyperlink{how-do-i-interpret-ultrafast-bootstrap-ufboot-support-values}{FAQ:
UFBoot support values interpretation} for more information.
\end{quote}

\section{Assessing branch supports with standard nonparametric
bootstrap}\label{assessing-branch-supports-with-standard-nonparametric-bootstrap}

The standard nonparametric bootstrap is invoked by the \lstinline!-b!
option:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -b 100
\end{lstlisting}

\lstinline!-b! specifies the number of bootstrap replicates where 100 is
the minimum recommended number. The output files are similar to those
produced by the UFBoot procedure.

\hypertarget{assessing-branch-supports-with-single-branch-tests}{\section{Assessing
branch supports with single branch
tests}\label{assessing-branch-supports-with-single-branch-tests}}

IQ-TREE provides an implementation of the SH-like approximate likelihood
ratio test (\href{http://dx.doi.org/10.1093/sysbio/syq010}{Guindon et
al., 2010}). To perform this test, run:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -alrt 1000
\end{lstlisting}

\lstinline!-alrt! specifies the number of bootstrap replicates for
SH-aLRT where 1000 is the minimum number recommended.

IQ-TREE also supports other tests such as the aBayes test
(\href{http://dx.doi.org/10.1093/sysbio/syr041}{Anisimova et al., 2011})
and the local bootstrap test
(\href{http://dx.doi.org/10.1007/BF02498640}{Adachi and Hasegawa,
1996}). See \protect\hyperlink{single-branch-tests}{single branch tests}
for more details.

You can also perform both SH-aLRT and the ultrafast bootstrap within one
single run:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -alrt 1000 -bb 1000
\end{lstlisting}

The branches of the resulting \lstinline!.treefile! will be assigned
with both SH-aLRT and UFBoot support values, which are readable by any
tree viewer program like FigTree, Dendroscope or ETE. You can also look
at the textual tree figure in \lstinline!.iqtree! file:

\begin{lstlisting}
NOTE: Tree is UNROOTED although outgroup taxon 'LngfishAu' is drawn at root
Numbers in parentheses are SH-aLRT support (%) / ultrafast bootstrap support (%)

+-------------LngfishAu
|
|       +--------------LngfishSA
+-------| (100/100)
|       +------------LngfishAf
|
|      +--------------------Frog
+------| (99.8/100)
       |                     +-----------------Turtle
       |                  +--| (85/72)
       |                  |  |    +------------------------Crocodile
       |                  |  +----| (96.5/97)
       |                  |       +------------------Bird
       |               +--| (39/51)
       |               |  +---------------------------Sphenodon
       |         +-----| (98.2/99)
       |         |     +-------------------------------Lizard
       +---------| (100/100)
                 |                   +--------------Human
                 |                +--| (92.3/93)
                 |                |  |  +------Seal
                 |                |  +--| (68.3/75)
                 |                |     |  +-----Cow
                 |                |     +--| (99.7/100)
                 |                |        +-------Whale
                 |           +----| (99.1/100)
                 |           |    |         +---Mouse
                 |           |    +---------| (100/100)
                 |           |              +------Rat
                 +-----------| (100/100)
                             |  +--------------Platypus
                             +--| (93/98)
                                +-----------Opossum
\end{lstlisting}

From this figure, the branching patterns within reptiles are poorly
supported (e.g. \lstinline!Sphenodon! with SH-aLRT: 39\%, UFBoot: 51\%
and \lstinline!Turtle! with SH-aLRT: 85\%, UFBoot: 72\%) as well as the
phylogenetic position of \lstinline!Seal! within mammals (SH-aLRT:
68.3\%, UFBoot: 75\%). Other branches appear to be well supported.

\hypertarget{utilizing-multi-core-cpus}{\section{Utilizing multi-core
CPUs}\label{utilizing-multi-core-cpus}}

A specialized version of IQ-TREE (\lstinline!iqtree-omp!) can utilize
multiple CPU cores to speed up the analysis. To obtain this version
please refer to the \protect\hyperlink{getting-started}{quick starting
guide}. A complement option \lstinline!-nt! allows specifying the number
of CPU cores to use. For example:

\begin{lstlisting}
iqtree-omp -s example.phy -m TIM2+I+G -nt 2
\end{lstlisting}

Here, IQ-TREE will use 2 CPU cores to perform the analysis.

Note that the parallel efficiency is only good for long alignments. A
good practice is to use \lstinline!-nt AUTO! to determine the best
number of cores:

\begin{lstlisting}
iqtree-omp -s example.phy -m TIM2+I+G -nt AUTO
\end{lstlisting}

Then while running IQ-TREE may print something like this on to the
screen:

\begin{lstlisting}
Measuring multi-threading efficiency up to 8 CPU cores
Threads: 1 / Time: 8.001 sec / Speedup: 1.000 / Efficiency: 100% / LogL: -22217
Threads: 2 / Time: 4.346 sec / Speedup: 1.841 / Efficiency: 92% / LogL: -22217
Threads: 3 / Time: 3.381 sec / Speedup: 2.367 / Efficiency: 79% / LogL: -22217
Threads: 4 / Time: 4.385 sec / Speedup: 1.825 / Efficiency: 46% / LogL: -22217
BEST NUMBER OF THREADS: 3
\end{lstlisting}

Therefore, I would only use 3 cores for this example data. For later
analysis with your same data set, you can stick to the determined
number.

\section{Where to go from here?}\label{where-to-go-from-here-1}

Once confident enough you can go on with a
\textbf{\protect\hyperlink{advanced-tutorial}{more advanced tutorial}},
which covers topics like phylogenomic (multi-gene) analyses using
partition models or mixture models.

\hypertarget{advanced-tutorial}{\chapter{Advanced
tutorial}\label{advanced-tutorial}}

Recommended for experienced users to explore more features.

To get started, please read the
\protect\hyperlink{beginners-tutorial}{Beginner's Tutorial} first if not
done so yet.

\hypertarget{partitioned-analysis-for-multi-gene-alignments}{\section{Partitioned
analysis for multi-gene
alignments}\label{partitioned-analysis-for-multi-gene-alignments}}

In the partition model, you can specify a substitution model for each
gene/character set. IQ-TREE will then estimate the model parameters
separately for every partition. Moreover, IQ-TREE provides edge-linked
or edge-unlinked branch lengths between partitions:

\begin{itemize}
\tightlist
\item
  \lstinline!-q partition_file!: all partitions share the same set of
  branch lengths (like \lstinline!-q! option of RAxML).
\item
  \lstinline!-spp partition_file!: like above but allowing each
  partition to have its own evolution rate.
\item
  \lstinline!-sp partition_file!: each partition has its own set of
  branch lengths (like combination of \lstinline!-q! and \lstinline!-M!
  options in RAxML) to account for, e.g. \emph{heterotachy}
  (\href{http://mbe.oxfordjournals.org/content/19/1/1.full}{Lopez et
  al., 2002}).
\end{itemize}

\begin{quote}
\textbf{NOTE}: \lstinline!-spp! is recommended for typical analysis.
\lstinline!-q! is unrealistic and \lstinline!-sp! is very
parameter-rich. One can also perform all three analyses and compare
e.g.~the BIC scores to determine the best-fit partition model.
\end{quote}

IQ-TREE supports RAxML-style and NEXUS partition input file. The
RAxML-style partition file may look like:

\begin{lstlisting}
DNA, part1 = 1-100
DNA, part2 = 101-384
\end{lstlisting}

If your partition file is called \lstinline!example.partitions!, the
partition analysis can be run with:

\begin{lstlisting}
iqtree -s example.phy -q example.partitions -m GTR+I+G
\end{lstlisting}

Note that using RAxML-style partition file, all partitions will use the
same rate heterogeneity model given in \lstinline!-m! option
(\lstinline!+I+G! in this example). If you want to specify, say,
\lstinline!+G! for the first partition and \lstinline!+I+G! for the
second partition, then you need to create the more flexible NEXUS
partition file. This file contains a \lstinline!SETS! block with
\lstinline!CharSet! and \lstinline!CharPartition! commands to specify
individual genes and the partition, respectively. For example:

\begin{lstlisting}
#nexus
begin sets;
    charset part1 = 1-100;
    charset part2 = 101-384;
    charpartition mine = HKY+G:part1, GTR+I+G:part2;
end;
\end{lstlisting}

If your NEXUS file is called \lstinline!example.nex!, then you can use
the option \lstinline!-spp! to input the file as following:

\begin{lstlisting}
iqtree -s example.phy -spp example.nex
\end{lstlisting}

Here, IQ-TREE partitions the alignment \lstinline!example.phy! into 2
sub-alignments named \lstinline!part1! and \lstinline!part2! containing
sites (columns) 1-100 and 101-384, respectively. Moreover, IQ-TREE
applies the subtitution models \lstinline!HKY+G! and \lstinline!GTR+I+G!
to \lstinline!part1! and \lstinline!part2!, respectively. Substitution
model parameters and trees with branch lengths can be found in the
result file \lstinline!example.nex.iqtree!.

Moreover, the \lstinline!CharSet! command allows to specify
non-consecutive sites with e.g.:

\begin{lstlisting}
charset part1 = 1-100 200-384;
\end{lstlisting}

That means, \lstinline!part1! contains sites 1-100 and 200-384 of the
alignment. Another example is:

\begin{lstlisting}
charset part1 = 1-100\3;
\end{lstlisting}

for extracting sites 1,4,7,\ldots{},100 from the alignment. This is
useful for getting codon positions from the protein-coding alignment.

\hypertarget{partitioned-analysis-with-mixed-data}{\section{Partitioned
analysis with mixed data}\label{partitioned-analysis-with-mixed-data}}

IQ-TREE also allows combining sub-alignments from different alignment
files, which is helpful if you want to combine mixed data (e.g.~DNA and
protein) in a single analysis. Here is an example for mixing DNA,
protein and codon models:

\begin{lstlisting}
#nexus
begin sets;
    charset part1 = dna.phy: 1-100 201-300;
    charset part2 = dna.phy: 101-200;
    charset part3 = prot.phy: 1-400;
    charset part4 = prot.phy: 401-600;
    charset part5 = codon.phy:CODON, *;
    charpartition mine = HKY:part1, GTR+G:part2, LG+G:part3, WAG+I+G:part4, GY:part5;
end;
\end{lstlisting}

Here, \lstinline!part1! and \lstinline!part2! contain sub-alignments
from alignment file \lstinline!dna.phy!, whereas \lstinline!part3! and
\lstinline!part4! are loaded from alignment file \lstinline!prot.phy!
and \lstinline!part5! from \lstinline!codon.phy!. The \lstinline!:! is
needed to separate the alignment file name and site specification. Note
that, for convenience \lstinline!*! in \lstinline!part5! specification
means that \lstinline!part5! corresponds to the entire alignment
\lstinline!codon.phy!.

\begin{quote}
\textbf{TIP}: For \lstinline!part5! the \lstinline!CODON! keyword is
specified so that IQ-TREE will apply a codon model. Moreover, this
implicitly assumes the standard genetic code. If you want to use another
genetic code, append \lstinline!CODON! with the
\protect\hyperlink{codon-models}{code ID described here}
\end{quote}

Because the alignment file names are now specified in this NEXUS file,
you can omit the \lstinline!-s! option:

\begin{lstlisting}
iqtree -sp example.nex
\end{lstlisting}

Note that \lstinline!aln.phy! and \lstinline!prot.phy! does not need to
contain the same set of sequences. For instance, if some sequence occurs
in \lstinline!aln.phy! but not in \lstinline!prot.phy!, IQ-TREE will
treat the corresponding parts of sequence in \lstinline!prot.phy! as
missing data. For your convenience IQ-TREE writes the concatenated
alignment into the file \lstinline!example.nex.conaln!.

\section{Choosing the right partitioning
scheme}\label{choosing-the-right-partitioning-scheme}

ModelFinder implements a greedy strategy
(\href{http://dx.doi.org/10.1093/molbev/mss020}{Lanfear et al., 2012})
that starts with the full partition model and subsequentially merges two
genes until the model fit does not increase any further:

\begin{lstlisting}
# for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -spp example.nex -m MFP+MERGE

# for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -spp example.nex -m TESTNEWMERGE
\end{lstlisting}

Note that this command considers the FreeRate heterogeneity model (see
\protect\hyperlink{choosing-the-right-substitution-model}{model
selection tutorial}). If you want to resemble PartitionFinder by just
considering the invariable site and Gamma rate heterogeneity (thus
saving computation times), then run:

\begin{lstlisting}
iqtree -s example.phy -spp example.nex -m TESTMERGE
\end{lstlisting}

After ModelFinder found the best partition, IQ-TREE will immediately
start the tree reconstruction under the best-fit partition model.
Sometimes you only want to find the best-fit partition model without
doing tree reconstruction, then run:

\begin{lstlisting}
# for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -spp example.nex -m MF+MERGE

# for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -spp example.nex -m TESTNEWMERGEONLY

# to resemble PartitionFinder and save time:
iqtree -s example.phy -spp example.nex -m TESTMERGEONLY
\end{lstlisting}

To reduce the computational burden IQ-TREE implements the \emph{relaxed
hierarchical clustering algorithm}
(\href{http://dx.doi.org/10.1186/1471-2148-14-82}{Lanfear et al.,
2014}), which is invoked via \lstinline!-rcluster! option:

\begin{lstlisting}
# for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -spp example.nex -m MF+MERGE -rcluster 10

# for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -spp example.nex -m TESTNEWMERGEONLY -rcluster 10
\end{lstlisting}

to only examine the top 10\% partition merging schemes (similar to the
\lstinline!--rcluster-percent 10! option in PartitionFinder).

\section{Ultrafast bootstrapping with partition
model}\label{ultrafast-bootstrapping-with-partition-model}

IQ-TREE can perform the ultrafast bootstrap with partition models by
e.g.,

\begin{lstlisting}
iqtree -s example.phy -spp example.nex -bb 1000
\end{lstlisting}

Here, IQ-TREE will resample the sites \emph{within} subsets of the
partitions (i.e., the bootstrap replicates are generated per subset
separately and then concatenated together). The same holds true if you
do the standard nonparametric bootstrap.

IQ-TREE supports the gene-resampling strategy:

\begin{lstlisting}
iqtree -s example.phy -spp example.nex -bb 1000 -bspec GENE
\end{lstlisting}

to resample genes instead of sites. Moreover, IQ-TREE allows an even
more complicated strategy: resampling genes and sites within resampled
genes, which may reduce false positives of the standard bootstrap
resampling (\href{http://dx.doi.org/10.1002/jez.b.21026}{Gadagkar et
al., 2005}):

\begin{lstlisting}
iqtree -s example.phy -spp example.nex -bb 1000 -bspec GENESITE
\end{lstlisting}

\section{Constrained tree search}\label{constrained-tree-search}

Starting with version 1.5.0, IQ-TREE supports constrained tree search
via \lstinline!-g! option, so that the resulting tree must obey a
constraint tree topology. The constraint tree can be multifurcating and
need not to contain all species. To illustrate, let's return to the
\protect\hyperlink{first-running-example}{first running example}, where
we want to force Human grouping with Seal whereas Cow with Whale. If you
use the following constraint tree (NEWICK format):

\begin{lstlisting}
((Human,Seal),(Cow,Whale));
\end{lstlisting}

Save this to a file \lstinline!example.constr0! and run:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -g example.constr0 -pre example.constr0
\end{lstlisting}

(We use a prefix in order not to overwrite output files of the previous
run). The resulting part of the tree extracted from
\lstinline!example.constr0.iqtree! looks exactly like a normal
unconstrained tree search:

\begin{lstlisting}
        +--------------Human
     +--|
     |  |  +------Seal
     |  +--|
     |     |  +-----Cow
     |     +--|
     |        +-------Whale
+----|
|    |         +---Mouse
|    +---------|
|              +------Rat
\end{lstlisting}

This is the correct behavior: although Human and Seal are not
monophyletic, this tree indeed satisfies the constraint, because the
induced subtree separates (Human,Seal) from (Cow,Whale). This comes from
the fact that the tree is \emph{unrooted}. If you want them to be sister
groups, then you need to include \emph{outgroup} taxa into the
constraint tree. For example:

\begin{lstlisting}
((Human,Seal),(Cow,Whale),Mouse);
\end{lstlisting}

Save this to \lstinline!example.constr1! and run:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -g example.constr1 -pre example.constr1
\end{lstlisting}

The resulting part of the tree is then:

\begin{lstlisting}
           +---------------Human
        +--|
        |  +------Seal
     +--|
     |  |  +-----Cow
     |  +--|
     |     +-------Whale
+----|
|    |         +---Mouse
|    +---------|
|              +------Rat
\end{lstlisting}

which shows the desired effect.

\section{Tree topology tests}\label{tree-topology-tests}

IQ-TREE can compute log-likelihoods of a set of trees passed via the
\lstinline!-z! option:

\begin{lstlisting}
iqtree -s example.phy -z example.treels -m GTR+G
\end{lstlisting}

assuming that \lstinline!example.treels! is an existing file containing
a set of trees in NEWICK format. IQ-TREE first reconstructs an ML tree.
Then, it will compute the log-likelihood of the trees in
\lstinline!example.treels! based on the estimated parameters done for
the ML tree. \lstinline!example.phy.iqtree! will have a section called
\lstinline!USER TREES! that lists the tree IDs and the corresponding
log-likelihoods. The trees with optimized branch lengths can be found in
\lstinline!example.phy.treels.trees! If you only want to evaluate the
trees without reconstructing the ML tree, you can run:

\begin{lstlisting}
iqtree -s example.phy -z example.treels -n 0
\end{lstlisting}

Here, IQ-TREE performs a very quick tree reconstruction using only 1
iteration and uses that tree to estimate the model parameters, which are
normally accurate enough for our purpose.

IQ-TREE also supports several tree topology tests using the RELL
approximation (\href{http://dx.doi.org/10.1007/BF02109483}{Kishino et
al., 1990}). This includes bootstrap proportion (BP), Kishino-Hasegawa
test (\href{http://dx.doi.org/10.1007/BF02100115}{Kishino and Hasegawa,
1989}), Shimodaira-Hasegawa test
(\href{http://dx.doi.org/10.1093/oxfordjournals.molbev.a026201}{Shimodaira
and Hasegawa, 1999}), expected likelihood weights
(\href{http://dx.doi.org/10.1098/rspb.2001.1862}{Strimmer and Rambaut,
2002}):

\begin{lstlisting}
iqtree -s example.phy -z example.treels -n 1 -zb 1000
\end{lstlisting}

Here, \lstinline!-zb! specifies the number of RELL replicates, where
1000 is the recommended minimum number. The \lstinline!USER TREES!
section of \lstinline!example.phy.iqtree! will list the results of BP,
KH, SH, and ELW methods.

If you also want to perform the weighted KH and weighted SH tests,
simply add \lstinline!-zw! option:

\begin{lstlisting}
iqtree -s example.phy -z example.treels -n 1 -zb 1000 -zw
\end{lstlisting}

Starting with version 1.4.0 IQ-TREE supports approximately unbiased (AU)
test (\href{http://dx.doi.org/10.1080/10635150290069913}{Shimodaira,
2002}) via \lstinline!-au! option:

\begin{lstlisting}
iqtree -s example.phy -z example.treels -n 1 -zb 1000 -zw -au
\end{lstlisting}

This will perform all above tests plus the AU test.

Finally, note that IQ-TREE will automatically detect duplicated tree
topologies and omit them during the evaluation.

\section{Testing constrained tree}\label{testing-constrained-tree}

We now illustrate an example to use the AU test (see above) to test
trees from unconstrained versus constrained search, which is helpful to
know if a constrained search is sensible or not. Thus:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  Perform an unconstrained search:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -pre example.unconstr
\end{lstlisting}
\item
  Perform a constrained search, where \lstinline!example.constr1! file
  contains: \lstinline!((Human,Seal),(Cow,Whale),Mouse);!:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -g example.constr1 -pre example.constr1
\end{lstlisting}
\item
  Perform another constrained search, where \lstinline!example.constr2!
  file contains \lstinline!((Human,Cow,Whale),Seal,Mouse);!:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -g example.constr2 -pre example.constr2
\end{lstlisting}
\item
  Perform the last constrained search, where \lstinline!example.constr3!
  file contains \lstinline!((Human,Mouse),(Cow,Rat),Opossum);!:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -g example.constr3 -pre example.constr3
\end{lstlisting}
\item
  Concatenate all trees into a file:

\begin{lstlisting}
# for Linux or macOS
cat example.unconstr.treefile example.constr1.treefile example.constr2.treefile example.constr3.treefile > example.treels

# for Windows
type example.unconstr.treefile example.constr1.treefile example.constr2.treefile example.constr3.treefile > example.treels
\end{lstlisting}
\item
  Test the set of trees:

\begin{lstlisting}
iqtree -s example.phy -m TIM2+I+G -z example.treels -n 0 -zb 1000 -au
\end{lstlisting}
\end{enumerate}

Now look at the resulting \lstinline!.iqtree! file:

\begin{lstlisting}
USER TREES
----------

See example.phy.trees for trees with branch lengths.

Tree      logL    deltaL  bp-RELL    p-KH     p-SH    c-ELW     p-AU
-------------------------------------------------------------------------
  1   -21152.617   0.000  0.7110 + 0.7400 + 1.0000 + 0.6954 + 0.7939 + 
  2   -21156.802   4.185  0.2220 + 0.2600 + 0.5910 + 0.2288 + 0.3079 + 
  3   -21158.579   5.962  0.0670 + 0.1330 + 0.5130 + 0.0758 + 0.1452 + 
  4   -21339.596 186.980  0.0000 - 0.0000 - 0.0000 - 0.0000 - 0.0000 - 

deltaL  : logL difference from the maximal logl in the set.
bp-RELL : bootstrap proportion using RELL method (Kishino et al. 1990).
p-KH    : p-value of one sided Kishino-Hasegawa test (1989).
p-SH    : p-value of Shimodaira-Hasegawa test (2000).
c-ELW   : Expected Likelihood Weight (Strimmer & Rambaut 2002).
p-AU    : p-value of approximately unbiased (AU) test (Shimodaira, 2002).

Plus signs denote the 95% confidence sets.
Minus signs denote significant exclusion.
All tests performed 1000 resamplings using the RELL method.
\end{lstlisting}

One sees that the AU test does not reject the first 3 trees (denoted by
\lstinline!+! sign below the \lstinline!p-AU! column), whereas the last
tree is significantly excluded (\lstinline!-! sign). All other tests
also agree with this. Therefore, groupings of \lstinline!(Human,Mouse)!
and \lstinline!(Cow,Rat)! do not make sense. Whereas the phylogenetic
position of \lstinline!Seal! based on 3 first trees is still
undecidable. This is in agreement with the SH-aLRT and ultrafast
bootstrap supports
\protect\hyperlink{assessing-branch-supports-with-single-branch-tests}{done
in the Tutorial}.

\begin{quote}
\textbf{NOTE}:

\begin{itemize}
\tightlist
\item
  The KH, SH and AU tests return p-values (as denoted with prefix
  \lstinline!p-!), thus a tree is rejected if its p-value \textless{}
  0.05 (marked with a \lstinline!-! sign).
\item
  bp-RELL and c-ELW return posterior weights which \emph{are not
  p-value}. The weights sum up to 1 across the trees tested.
\item
  The KH test (\href{http://dx.doi.org/10.1007/BF02100115}{Kishino and
  Hasegawa, 1989}) was designed to test 2 trees and thus has no
  correction for multiple testing. The SH test
  (\href{http://dx.doi.org/10.1093/oxfordjournals.molbev.a026201}{Shimodaira
  and Hasegawa, 1999}) was designed to fix this problem.
\item
  However, the SH test becomes too conservative (i.e., rejecting fewer
  trees than expected) when testing many trees. The AU test was designed
  to fix this problem and thus recommended as replacement for both KH
  and SH tests.
\end{itemize}
\end{quote}

\section{Consensus construction and bootstrap value
assignment}\label{consensus-construction-and-bootstrap-value-assignment}

IQ-TREE can construct an extended majority-rule consensus tree from a
set of trees written in NEWICK or NEXUS format (e.g., produced by
MrBayes):

\begin{lstlisting}
iqtree -con mytrees
\end{lstlisting}

To build a majority-rule consensus tree, simply set the minimum support
threshold to 0.5:

\begin{lstlisting}
iqtree -con mytrees -minsup 0.5
\end{lstlisting}

If you want to specify a burn-in (the number of beginning trees to
ignore from the trees file), use \lstinline!-bi! option:

\begin{lstlisting}
iqtree -con mytrees -minsup 0.5 -bi 100
\end{lstlisting}

to skip the first 100 trees in the file.

IQ-TREE can also compute a consensus network and print it into a NEXUS
file by:

\begin{lstlisting}
iqtree -net mytrees
\end{lstlisting}

Finally, a useful feature is to read in an input tree and a set of
trees, then IQ-TREE can assign the support value onto the input tree
(number of times each branch in the input tree occurs in the set of
trees). This option is useful if you want to compute the support values
for an ML tree based on alternative topologies.

\begin{lstlisting}
iqtree -sup input_tree set_of_trees
\end{lstlisting}

\section{User-defined substitution
models}\label{user-defined-substitution-models}

Users can specify any DNA model using a 6-letter code that defines which
rates should be equal. For example, \lstinline!010010! corresponds to
the HKY model and \lstinline!012345! to the GTR model. In fact, IQ-TREE
uses this specification internally to simplify the coding. The 6-letter
code is specified via the \lstinline!-m! option, e.g.:

\begin{lstlisting}
iqtree -s example.phy -m 010010+G
\end{lstlisting}

Moreover, with the \lstinline!-m! option one can input a file which
contains the 6 rates (A-C, A-G, A-T, C-G, C-T, G-T) and 4 base
frequencies (A, C, G, T). For example:

\begin{lstlisting}
iqtree -s example.phy -m mymodel+G
\end{lstlisting}

where \lstinline!mymodel! is a file containing the 10 entries described
above, in the correct order. The entries can be seperated by either
empty space(s) or newline character. One can even specify the rates
within \lstinline!-m! option by e.g.:

\begin{lstlisting}
iqtree -s example.phy -m 'TN{2.0,3.0}+G8{0.5}+I{0.15}'
\end{lstlisting}

That means, we use Tamura-Nei model with fixed transition-transversion
rate ratio of 2.0 and purine/pyrimidine rate ratio of 3.0. Moreover, we
use 8-category Gamma-distributed site rates with the shape parameter
(alpha) equal to 0.5 and a proportion of invariable sites p-inv=0.15.

By default IQ-TREE computes empirical state frequencies from the
alignment by counting, but one can also estimate the frequencies by
maximum-likelihood with \lstinline!+Fo! in the model name:

\begin{lstlisting}
iqtree -s example.phy -m GTR+G+Fo
\end{lstlisting}

For amino-acid alignments, IQ-TREE use the empirical frequencies
specified in the model. If you want frequencies as counted from the
alignment, use \lstinline!+F!, for example:

\begin{lstlisting}
iqtree -s myprotein_alignment -m WAG+G+F
\end{lstlisting}

Note that all model specifications above can be used in the partition
model NEXUS file.

\section{Inferring site-specific
rates}\label{inferring-site-specific-rates}

IQ-TREE allows to infer site-specific evolutionary rates if a
\protect\hyperlink{rate-heterogeneity-across-sites}{site-rate
heterogeneity model such as Gamma or FreeRate} is specified. Here,
IQ-TREE will estimate model parameters and then apply an empirical
Bayesian approach to assign site-rates as the mean over rate categories,
weighted by the posterior probability of the site falling into each
category. This approach is provided in IQ-TREE because such empirical
Bayesian approach was shown to be most accurate
(\href{https://doi.org/10.1093/molbev/msh194}{Mayrose et al., 2004}). An
example run:

\begin{lstlisting}
iqtree -s example.phy -m GTR+G -wsr -n 0
\end{lstlisting}

\lstinline!-wsr! option stands for writing site rates and the number of
search iterations is set to 0, such that model parameters are quickly
estimated from an initial parsimony tree. IQ-TREE will write an output
file \lstinline!example.phy.rate! that looks like:

\begin{lstlisting}
Site    Rate    Category        Categorized_rate
1       0.26625 2       0.24393
2       0.99345 3       0.81124
3       2.69275 4       2.91367
4       0.25822 2       0.24393
5       0.25822 2       0.24393
6       0.42589 2       0.24393
7       0.30194 2       0.24393
8       0.72790 3       0.81124
9       0.25822 2       0.24393
10      0.09177 1       0.03116
\end{lstlisting}

The 1st column is site index of the alignment (starting from 1), the 2nd
column \lstinline!Rate! shows the mean site-specific rate as explained
above, and the 3rd and 4th columns show the category index and rate of
the Gamma rate category with the highest probability for this site (1
for slow and 4 for fast rate).

For better site-rate estimates it is recommended to use more than the
default 4 rate categories
(\href{https://doi.org/10.1093/molbev/msh194}{Mayrose et al., 2004}).
Moreover, one should use a more reasonable tree rather than the
parsimony tree. For example:

\begin{lstlisting}
iqtree -s example.phy -m GTR+G16 -te ml.treefile -wsr 
\end{lstlisting}

where \lstinline!-te! is the option to input a fixed tree topology and
\lstinline!ml.treefile! is the ML tree reconstructed previously.

Moreover, we recommend to apply the FreeRate model whenever it fits the
data better than the Gamma rate model. This is because the Gamma model
constrains the rates to come from a Gamma distribution and thus the
highest rate may not be \emph{high enough} to accomodate the most
fast-evolving sites in the alignment. On the contrary, the FreeRate
model allows the rates to freely vary. Moreover, FreeRate allows to
automatically determine the best number of rate categories, a feature
missing in the Gamma model. The following command:

\begin{lstlisting}
# for IQ-TREE version >= 1.5.4:
iqtree -s example.phy -te ml.treefile -wsr 

# for IQ-TREE version <= 1.5.3:
iqtree -s example.phy -m TESTNEW -te ml.treefile -wsr 
\end{lstlisting}

will apply ModelFinder to find the best fit model and then infer the
site-specific rates based on a given tree file within a single run! If
you omit \lstinline!-te! option, then IQ-TREE will reconstruct an ML
tree and use it to infer site-specific rates.

\section{Where to go from here?}\label{where-to-go-from-here-2}

See \protect\hyperlink{command-reference}{Command Reference} for a
complete list of all options available in IQ-TREE.

\hypertarget{command-reference}{\chapter{Command
reference}\label{command-reference}}

Commprehensive documentation of command-line options.

IQ-TREE is invoked from the command-line with e.g.:

\begin{lstlisting}
iqtree -s <alignment> [OPTIONS]
\end{lstlisting}

assuming that IQ-TREE can be run by simply entering \lstinline!iqtree!.
If not, please change \lstinline!iqtree! to the actual path of the
executable or read the \protect\hyperlink{getting-started}{Quick start
guide}.

\section{General options}\label{general-options}

General options are mainly intended for specifying input and output
files:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.15\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.79\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-h! or \lstinline!-?!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Print help usage.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-s!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify input alignment file in PHYLIP, FASTA, NEXUS, CLUSTAL or MSF
format.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-st!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify sequence type as either of \lstinline!DNA!, \lstinline!AA!,
\lstinline!BIN!, \lstinline!MORPH!, \lstinline!CODON! or
\lstinline!NT2AA! for DNA, amino-acid, binary, morphological, codon or
DNA-to-AA-translated sequences. This is only necessary if IQ-TREE did
not detect the sequence type correctly. Note that \lstinline!-st CODON!
is always necessary when using codon models (otherwise, IQ-TREE applies
DNA models) and you also need to specify a
\protect\hyperlink{codon-models}{genetic code like this} if differed
from the standard genetic code. \lstinline!-st NT2AA! tells IQ-TREE to
translate protein-coding DNA into AA sequences and then subsequent
analysis will work on the AA sequences. You can also use a genetic code
like \lstinline!-st NT2AA5! for the Invertebrate Mitochondrial Code (see
\protect\hyperlink{codon-models}{genetic code table}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-t!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify a file containing starting tree for tree search. The special
option \lstinline!-t BIONJ! starts tree search from BIONJ tree and
\lstinline!-t RANDOM! starts tree search from completely random tree.
\emph{DEFAULT: 100 parsimony trees + BIONJ tree}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-te!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Like \lstinline!-t! but fixing user tree. That means, no tree search is
performed and IQ-TREE computes the log-likelihood of the fixed user
tree.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-o!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify an outgroup taxon name to root the tree. The output tree in
\lstinline!.treefile! will be rooted accordingly. \emph{DEFAULT: first
taxon in alignment}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-pre!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify a prefix for all output files. \emph{DEFAULT: either alignment
file name (\lstinline!-s!) or partition file name (\lstinline!-q!,
\lstinline!-spp! or \lstinline!-sp!)}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-nt!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify the number of CPU cores for \lstinline!iqtree-omp! version. A
special option \lstinline!-nt AUTO! will tell IQ-TREE to automatically
determine the best number of cores given the current data and
computer.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-seed!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify a random number seed to reproduce a previous run. This is
normally used for debugging purposes. \emph{DEFAULT: based on current
machine clock}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-v!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Turn on verbose mode for printing more messages to screen. This is
normally used for debugging purposes. \emph{DFAULT: OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-quiet!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Silent mode, suppress printing to the screen. Note that \lstinline!.log!
file is still written.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-keep-ident!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Keep identical sequences in the alignment. Bu default: IQ-TREE will
remove them during the analysis and add them in the end.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-safe!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Turn on safe numerical mode to avoid numerical underflow for large data
sets with many sequences (typically in the order of thousands). This
mode is automatically turned on when having more than 2000
sequences.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-mem!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify maximal RAM usage, for example, \lstinline!-mem 64G! to use at
most 64 GB of RAM. By default, IQ-TREE will try to not to exceed the
computer RAM size.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\subsection{Example usages:}\label{example-usages}

\begin{itemize}
\item
  Reconstruct a maximum-likelihood tree given a sequence alignment file
  \lstinline!data.phy!:

\begin{lstlisting}
iqtree -s data.phy 
\end{lstlisting}
\item
  Reconstruct a maximum-likelihood tree using 4 CPU cores and at most 8
  GB RAM:

\begin{lstlisting}
iqtree-omp -s data.phy -nt 4 -mem 8G
\end{lstlisting}
\item
  Like above and also write all output to \lstinline!myrun.*! files:

\begin{lstlisting}
iqtree-omp -s data.phy -nt 4 -mem 8G -pre myrun
\end{lstlisting}
\end{itemize}

\hypertarget{checkpointing-to-resume-stopped-run}{\section{Checkpointing
to resume stopped run}\label{checkpointing-to-resume-stopped-run}}

Starting with version 1.4.0 IQ-TREE supports checkpointing: If an
IQ-TREE run was interrupted for some reason, rerunning it with the same
command line and input data will automatically resume the analysis from
the last stopped point. The previous log file will then be appended. If
a run successfully finished, IQ-TREE will deny to rerun and issue an
error message. A few options that control checkpointing behavior:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-redo!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Redo the entire analysis no matter if it was stopped or successful.
WARNING: This option will overwrite all existing output files.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-cptime!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify the minimum checkpoint time interval in seconds (default:
20s)\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{NOTE}: IQ-TREE writes a checkpoint file with name suffix
\lstinline!.ckp.gz! in gzip format. Do not modify this file. If you
delete this file, all checkpointing information will be lost!
\end{quote}

\section{Likelihood mapping analysis}\label{likelihood-mapping-analysis}

Starting with version 1.4.0, IQ-TREE implements the likelihood mapping
approach (\href{http://www.pnas.org/content/94/13/6815.long}{Strimmer
and von Haeseler, 1997}) to assess the phylogenetic information of an
input alignment. The detailed results will be printed to
\lstinline!.iqtree! report file. The likelihood mapping plots will be
printed to \lstinline!.lmap.svg! and \lstinline!.lmap.eps! files.

Compared with the original implementation in TREE-PUZZLE, IQ-TREE is
much faster and supports many more substitution models (including
partition and mixture models).

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.13\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.81\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
\lstinline!-lmap!\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
Specify the number of quartets to be randomly drawn. If you specify
\lstinline!-lmap ALL!, all unique quartets will be drawn, instead.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
\lstinline!-lmclust!\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
Specify a NEXUS file containing taxon clusters (see below for example)
for quartet mapping analysis.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
\lstinline!-wql!\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
Write quartet log-likelihoods into \lstinline!.lmap.quartetlh! file
(typically not needed).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
\lstinline!-n 0!\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
Skip subsequent tree search, useful when you only want to assess the
phylogenetic information of the alignment.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{TIP}: The number of quartets specified via \lstinline!-lmap! is
recommended to be at least 25 times the number of sequences in the
alignment, such that each sequence is covered \textasciitilde{}100 times
in the set of quartets drawn.
\end{quote}

An example NEXUS cluster file (where A, B, C, etc. are sequence names):

\begin{lstlisting}
#NEXUS
begin sets;
    taxset Cluster1 = A B C;
    taxset Cluster2 = D E;
    taxset Cluster3 = F G H I;
    taxset Cluster4 = J;
    taxset IGNORED = X;
end;
\end{lstlisting}

Here, \lstinline!Cluster1! to \lstinline!Cluster4! are four user-defined
clusters of sequences. Note that users can give any names to the
clusters instead of \lstinline!Cluster1!, etc. If a cluster is named
\lstinline!ignored! or \lstinline!IGNORED! the sequences included will
be ignored in the likelihood mapping analysis.

If you provide a cluster file it has to contain between 1 and 4 clusters
(plus an optional \lstinline!IGNORED! or \lstinline!ignored! cluster),
which will tell IQ-TREE to perform an unclustered (default without a
cluster file) or a clustered analysis with 2, 3 or 4 groups,
respectively.

The names given to the clusters in the cluster file will be used to
label the corners of the triangle diagrams.

\subsection{Example usages:}\label{example-usages-1}

\begin{itemize}
\item
  Perform solely likelihood mapping analysis (ignoring tree search) with
  2000 quartets for an alignment \lstinline!data.phy! with model being
  automatically selected:

\begin{lstlisting}
iqtree -s data.phy -lmap 2000 -n 0 -m TEST
\end{lstlisting}
\end{itemize}

\section{Automatic model selection}\label{automatic-model-selection}

The default model (e.g., \lstinline!HKY+F! for DNA, \lstinline!LG! for
protein data) may not fit well to the data. Therefore, IQ-TREE allows to
automatically determine the best-fit model via a series of
\lstinline!-m TEST...! option:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.21\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.73\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TESTONLY!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Perform standard model selection like jModelTest (for DNA) and ProtTest
(for protein). Moreover, IQ-TREE also works for codon, binary and
morphogical data.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TEST!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Like \lstinline!-m TESTONLY! but immediately followed by tree
reconstruction using the best-fit model found. So this performs both
model selection and tree inference within a single run.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TESTNEWONLY! or \lstinline!-m MF!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Perform an extended model selection that additionally includes FreeRate
model compared with \lstinline!-m TESTONLY!. \emph{Recommended as
replacement for \lstinline!-m TESTONLY!}. Note that \lstinline!LG4X! is
a FreeRate model, but by default is not included because it is also a
protein mixture model. To include it, use \lstinline!-madd! option (see
table below).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TESTNEW! or \lstinline!-m MFP!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Like \lstinline!-m MF! but immediately followed by tree reconstruction
using the best-fit model found.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TESTMERGEONLY!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Select best-fit partitioning scheme like PartitionFinder.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TESTMERGE!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Like \lstinline!-m TESTMERGEONLY! but immediately followed by tree
reconstruction using the best partitioning scheme found.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TESTNEWMERGEONLY! or \lstinline!-m MF+MERGE!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Like \lstinline!-m TESTMERGEONLY! but additionally includes FreeRate
model.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
\lstinline!-m TESTNEWMERGE! or \lstinline!-m MFP+MERGE!\strut
\end{minipage} & \begin{minipage}[t]{0.73\columnwidth}\raggedright\strut
Like \lstinline!-m MF+MERGE! but immediately followed by tree
reconstruction using the best partitioning scheme found.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{TIP}: During model section run, IQ-TREE will write a file with
suffix \lstinline!.model! that stores information of all models tested
so far. Thus, if IQ-TREE is interrupted for whatever reason, restarting
the run will load this file to reuse the computation. Thus, this file
acts like a checkpoint to resume the model selection.
\end{quote}

Several parameters can be set to e.g.~reduce computations:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.14\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.80\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-rcluster!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify the percentage for the relaxed clustering algorithm
(\href{http://dx.doi.org/10.1186/1471-2148-14-82}{Lanfear et al.,
2014}). This is similar to \lstinline!--rcluster-percent! option of
PartitionFinder. For example, with \lstinline!-rcluster 10! only the top
10\% partition schemes are considered to save computations.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-mset!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify the name of a program (\lstinline!raxml!, \lstinline!phyml! or
\lstinline!mrbayes!) to restrict to only those models supported by the
specified program. Alternatively, one can specify a comma-separated list
of base models. For example, \lstinline!-mset WAG,LG,JTT! will restrict
model selection to WAG, LG, and JTT instead of all 18 AA models to save
computations.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-msub!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify either \lstinline!nuclear!, \lstinline!mitochondrial!,
\lstinline!chloroplast! or \lstinline!viral! to restrict to those AA
models designed for specified source.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-mfreq!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify a comma-separated list of frequency types for model selection.
\emph{DEFAULT: \lstinline!-mfreq FU,F! for protein models (FU = AA
frequencies given by the protein matrix, F = empirical AA frequencies
from the data), \lstinline!-mfreq ,F1x4,F3x4,F! for codon models}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-mrate!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify a comma-separated list of rate heterogeneity types for model
selection. \emph{DEFAULT: \lstinline!-mrate E,I,G,I+G! for standard
procedure, \lstinline!-mrate E,I,G,I+G,R! for new selection
procedure}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-cmin!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify minimum number of categories for FreeRate model. \emph{DEFAULT:
2}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-cmax!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify maximum number of categories for FreeRate model. It is
recommended to increase if alignment is long enough. \emph{DEFAULT:
10}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!–merit!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify either \lstinline!AIC!, \lstinline!AICc! or \lstinline!BIC! for
the optimality criterion to apply for new procedure. \emph{DEFAULT: all
three criteria are considered}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-mtree!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Turn on full tree search for each model considered, to obtain more
accurate result. Only recommended if enough computational resources are
available. \emph{DEFAULT: fixed starting tree}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-mredo!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Ignore \lstinline!.model! file computed earlier. \emph{DEFAULT:
\lstinline!.model! file (if exists) is loaded to reuse previous
computations}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-madd!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify a comma-separated list of mixture models to additionally
consider for model selection. For example, \lstinline!-madd LG4M,LG4X!
to additionally include these two
\protect\hyperlink{protein-models}{protein mixture models}.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
\lstinline!-mdef!\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Specify a \protect\hyperlink{nexus-model-file}{NEXUS model file} to
define new models.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{NOTE}: Some of the above options require a comma-separated list,
which should not contain any empty space!
\end{quote}

\subsection{Example usages:}\label{example-usages-2}

\begin{itemize}
\item
  Select best-fit model for alignment \lstinline!data.phy! based on
  Bayesian information criterion (BIC):

\begin{lstlisting}
iqtree -s data.phy -m TESTONLY
\end{lstlisting}
\item
  Select best-fit model for a protein alignment \lstinline!prot.phy!
  using the new testing procedure and only consider WAG, LG and JTT
  matrix to save time:

\begin{lstlisting}
iqtree -s prot.phy -m MF -mset WAG,LG,JTT
\end{lstlisting}
\item
  Find the best partitioning scheme for alignment \lstinline!data.phy!
  and partition file \lstinline!partition.nex! with a relaxed clustering
  at 10\% to save time:

\begin{lstlisting}
iqtree -s data.phy -spp partition.nex -m TESTMERGEONLY -rcluster 10
\end{lstlisting}
\end{itemize}

\section{Specifying substitution
models}\label{specifying-substitution-models}

\lstinline!-m! is a powerful option to specify substitution models,
state frequency and rate heterogeneity type. The general syntax is:

\begin{lstlisting}
-m MODEL+FreqType+RateType
\end{lstlisting}

where \lstinline!MODEL! is a model name, \lstinline!+FreqType!
(optional) is the frequency type and \lstinline!+RateType! (optional) is
the rate heterogeneity type.

The following \lstinline!MODEL!s are available:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.13\columnwidth}\raggedright\strut
DataType\strut
\end{minipage} & \begin{minipage}[b]{0.81\columnwidth}\raggedright\strut
Model names\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
DNA\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
JC/JC69, F81, K2P/K80, HKY/HKY85, TN/TrN/TN93, TNe, K3P/K81, K81u, TPM2,
TPM2u, TPM3, TPM3u, TIM, TIMe, TIM2, TIM2e, TIM3, TIM3e, TVM, TVMe, SYM,
GTR and 6-digit specification. See \protect\hyperlink{dna-models}{DNA
models} for more details.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
Protein\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
BLOSUM62, cpREV, Dayhoff, DCMut, FLU, HIVb, HIVw, JTT, JTTDCMut, LG,
mtART, mtMAM, mtREV, mtZOA, Poisson, PMB, rtREV, VT, WAG.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
Protein\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
Mixture models: C10, \ldots{}, C60 (CAT model)
(\href{http://dx.doi.org/10.1093/molbev/msh112}{Lartillot and Philippe,
2004}), EX2, EX3, EHO, UL2, UL3, EX\_EHO, LG4M, LG4X, CF4. See
\protect\hyperlink{protein-models}{Protein models} for more
details.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
Codon\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
MG, MGK, MG1KTS, MG1KTV, MG2K, GY, GY1KTS, GY1KTV, GY2K, ECMK07/KOSI07,
ECMrest, ECMS05/SCHN05 and combined empirical-mechanistic models. See
\protect\hyperlink{codon-models}{Codon models} for more details.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
Binary\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
JC2, GTR2. See
\protect\hyperlink{binary-and-morphological-models}{Binary and
morphological models} for more details.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\raggedright\strut
Morphology\strut
\end{minipage} & \begin{minipage}[t]{0.81\columnwidth}\raggedright\strut
MK, ORDERED. See
\protect\hyperlink{binary-and-morphological-models}{Binary and
morphological models} for more details.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

The following \lstinline!FreqType!s are supported:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
FreqType\strut
\end{minipage} & \begin{minipage}[b]{0.83\columnwidth}\raggedright\strut
Meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+F!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Empirical state frequency observed from the data.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+FO!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
State frequency optimized by maximum-likelihood from the data. Note that
this is with letter-O and not digit-0.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+FQ!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Equal state frequency.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+F1x4!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
See \protect\hyperlink{codon-frequencies}{Codon frequencies}.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+F3x4!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
See \protect\hyperlink{codon-frequencies}{Codon frequencies}.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

Further options:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.83\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-mwopt!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Turn on optimizing weights of mixture models. Note that for models like
\lstinline!LG+C20+F+G! this mode is automatically turned on, but not for
\lstinline!LG+C20+G!.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\subsection{Example usages:}\label{example-usages-3}

\begin{itemize}
\item
  Infer an ML tree for a DNA alignment \lstinline!dna.phy! under GTR+I+G
  model:

\begin{lstlisting}
iqtree -s dna.phy -m GTR+I+G
\end{lstlisting}
\item
  Infer an ML tree for a protein alignment \lstinline!prot.phy! under
  LG+F+G model:

\begin{lstlisting}
iqtree -s prot.phy -m LG+F+G
\end{lstlisting}
\item
  Infer an ML tree for a protein alignment \lstinline!prot.phy! under
  profile mixture model LG+C10+F+G:

\begin{lstlisting}
iqtree -s prot.phy -m LG+C10+F+G
\end{lstlisting}
\end{itemize}

\section{Rate heterogeneity}\label{rate-heterogeneity}

The following \lstinline!RateType!s are supported:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
RateType\strut
\end{minipage} & \begin{minipage}[b]{0.83\columnwidth}\raggedright\strut
Meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+I!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Allowing for a proportion of invariable sites.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+G!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Discrete Gamma model (\href{http://dx.doi.org/10.1007/BF00160154}{Yang,
1994}) with default 4 rate categories. The number of categories can be
changed with e.g. \lstinline!+G8!.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+I+G!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Invariable site plus discrete Gamma model
(\href{http://mbe.oxfordjournals.org/content/12/4/546.abstract}{Gu et
al., 1995}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+R!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
FreeRate model
(\href{http://www.genetics.org/content/139/2/993.abstract}{Yang, 1995};
\href{http://dx.doi.org/10.1093/molbev/mss140}{Soubrier et al., 2012})
that generalizes \lstinline!+G! by relaxing the assumption of
Gamma-distributed rates. The number of categories can be specified with
e.g. \lstinline!+R6!. \emph{DEFAULT: 4 categories}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!+I+R!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
invariable site plus FreeRate model.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

See \protect\hyperlink{rate-heterogeneity-across-sites}{Rate
heterogeneity across sites} for more details.

Further options:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.15\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.79\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-a!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify the Gamma shape parameter (default: estimate)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-gmedian!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Perform the \emph{median} approximation for Gamma rate heterogeneity
instead of the default \emph{mean} approximation
(\href{http://dx.doi.org/10.1007/BF00160154}{Yang, 1994})\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-i!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Specify the proportion of invariable sites (default: estimate)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!--opt-gamma-inv!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Perform more thorough estimation for \lstinline!+I+G! model
parameters\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.15\columnwidth}\raggedright\strut
\lstinline!-wsr!\strut
\end{minipage} & \begin{minipage}[t]{0.79\columnwidth}\raggedright\strut
Write per-site rates to \lstinline!.rate! file\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

Optionally, one can specify
\protect\hyperlink{ascertainment-bias-correction}{Ascertainment bias
correction} by appending \lstinline!+ASC! to the model string.
\protect\hyperlink{mixture-models}{Advanced mixture models} can also be
specified via \lstinline!MIX{...}! and \lstinline!FMIX{...}! syntax.
Option \lstinline!-mwopt! can be used to turn on optimizing weights of
mixture models.

\section{Partition model options}\label{partition-model-options}

Partition models are used for phylogenomic data with multiple genes. You
first have to prepare \protect\hyperlink{partition-file-format}{a
partition file in NEXUS or RAxML-style format}. Then use the following
options to input the partition file:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.10\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.84\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut
\lstinline!-q!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Specify partition file for edge-equal
\protect\hyperlink{partition-models}{partition model}. That means, all
partitions share the same set of branch lengths (like \lstinline!-q!
option of RAxML).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut
\lstinline!-spp!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Like \lstinline!-q! but allowing partitions to have different
evolutionary speeds
(\protect\hyperlink{partition-models}{edge-proportional partition
model}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut
\lstinline!-sp!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Specify partition file for
\protect\hyperlink{partition-models}{edge-unlinked partition model}.
That means, each partition has its own set of branch lengths (like
\lstinline!-M! option of RAxML). This is the most parameter-rich
partition model to accomodate \emph{heterotachy}.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\section{Site-specific frequency model
options}\label{site-specific-frequency-model-options}

The site-specific frequency model is used to substantially reduce the
time and memory requirement compared with full profile mixture models
\lstinline!C10! to \lstinline!C60!. For full details see
\protect\hyperlink{site-specific-frequency-models}{site-specific
frequency model}. To use this model you have to specify a profile
mixture model with e.g. \lstinline!-m LG+C20+F+G! together with a guide
tree or a site frequency file:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.84\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-ft!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Specify a guide tree (in Newick format) to infer site frequency
profiles.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-fs!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Specify a site frequency file, e.g.~the \lstinline!.sitefreq! file
obtained from \lstinline!-ft! run. This will save memory used for the
first phase of the analysis.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-fmax!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Switch to posterior maximum mode for obtaining site-specific profiles.
Default: posterior mean.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\section{Tree search parameters}\label{tree-search-parameters}

The new IQ-TREE search algorithm
(\href{http://dx.doi.org/10.1093/molbev/msu300}{Nguyen et al., 2015})
has several parameters that can be changed with:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-ninit!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify number of initial parsimony trees. \emph{DEFAULT: 100}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-ntop!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify number of top parsimony trees of initial ones for further
search. \emph{DEFAULT: 20}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-nbest!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify number of top candidate trees to maintain during tree search.
\emph{DEFAULT: 5}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-nstop!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify number of unsuccessful iterations to stop. \emph{DEFAULT:
100}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-n!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify number of iterations to stop. This option overrides
\lstinline!-nstop! criterion.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-sprrad!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify radius for subtree prunning and regrafting parsimony search.
\emph{DEFAULT: 6}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-pers!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify perturbation strength (between 0 and 1) for randomized nearest
neighbor interchange (NNI). \emph{DEFAULT: 0.5}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-allnni!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Turn on more thorough and slower NNI search. It means that IQ-TREE will
consider all possible NNIs instead of only those in the vicinity of
previously applied NNIs. \emph{DEFAULT: OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-djc!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Avoid computing ML pairwise distances and BIONJ tree.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-g!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify a topological constraint tree file in NEWICK format. The
constraint tree can be a multifurcating tree and need not to include all
taxa.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{NOTE}: While the default parameters were empirically determined
to work well under our extensive benchmark
(\href{http://dx.doi.org/10.1093/molbev/msu300}{Nguyen et al., 2015}),
it might not hold true for all data sets. If in doubt that tree search
is still stuck in local optima, one should repeat analysis with at least
10 IQ-TREE runs. Moreover, our experience showed that \lstinline!-pers!
and \lstinline!-nstop! are the most relevant options to change in such
case. For example, data sets with many short sequences should be
analyzed with smaller perturbation strength (e.g. \lstinline!-pers 0.2!)
and larger number of stop iterations (e.g. \lstinline!-nstop 500!).
\end{quote}

\subsection{Example usages:}\label{example-usages-4}

\begin{itemize}
\item
  Infer an ML tree for an alignment \lstinline!data.phy! with increased
  stopping iteration of 500 and reduced perturbation strength of 0.2:

\begin{lstlisting}
iqtree -s data.phy -m TEST -nstop 500 -pers 0.2
\end{lstlisting}
\item
  Infer an ML tree for an alignment \lstinline!data.phy! obeying a
  topological constraint tree \lstinline!constraint.tree!:

\begin{lstlisting}
iqtree -s data.phy -m TEST -g constraint.tree
\end{lstlisting}
\end{itemize}

\section{Ultrafast bootstrap
parameters}\label{ultrafast-bootstrap-parameters}

The ultrafast bootstrap (UFBoot) approximation
(\href{http://dx.doi.org/10.1093/molbev/mst024}{Minh et al., 2013}) has
several parameters that can be changed with:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.83\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-bb!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Specify number of bootstrap replicates (\textgreater{}=1000).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-wbt!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Turn on writing bootstrap trees to \lstinline!.ufboot! file.
\emph{DEFAULT: OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-wbtl!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Like \lstinline!-wbt! but bootstrap trees written with branch lengths.
\emph{DEFAULT: OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-nm!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Specify maximum number of iterations to stop. \emph{DEFAULT: 1000}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-bcor!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Specify minimum correlation coefficient for UFBoot convergence
criterion. \emph{DEFAULT: 0.99}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-nstep!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Specify iteration interval checking for UFBoot convergence.
\emph{DEFAULT: every 100 iterations}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-beps!\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Specify a small epsilon to break tie in RELL evaluation for bootstrap
trees. \emph{DEFAULT: 0.5}\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\subsection{Example usages:}\label{example-usages-5}

\begin{itemize}
\item
  Select best-fit model, infer an ML tree and perform ultrafast
  bootstrap with 1000 replicates:

\begin{lstlisting}
iqtree -s data.phy -m TEST -bb 1000
\end{lstlisting}
\item
  Reconstruct ML and perform ultrafast bootstrap (5000 replicates) under
  a partition model file \lstinline!partition.nex!:

\begin{lstlisting}
iqtree -s data.phy -spp partition.nex -m TEST -bb 5000
\end{lstlisting}
\end{itemize}

\section{Nonparametric bootstrap}\label{nonparametric-bootstrap}

The slow standard nonparametric bootstrap
(\href{http://dx.doi.org/10.2307/2408678}{Felsenstein, 1985}) can be run
with:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.10\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.84\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut
\lstinline!-b!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Specify number of bootstrap replicates (recommended \textgreater{}=100).
This will perform both bootstrap and analysis on original alignment and
provide a consensus tree.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut
\lstinline!-bc!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Like \lstinline!-b! but omit analysis on original alignment.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut
\lstinline!-bo!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Like \lstinline!-b! but only perform bootstrap analysis (no analysis on
original alignment and no consensus tree).\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\hypertarget{single-branch-tests}{\section{Single branch
tests}\label{single-branch-tests}}

The following single branch tests are faster than all bootstrap analysis
and recommended for extremely large data sets (e.g.,
\textgreater{}10,000 taxa):

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-alrt!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify number of replicates (\textgreater{}=1000) to perform SH-like
approximate likelihood ratio test (SH-aLRT)
(\href{http://dx.doi.org/10.1093/sysbio/syq010}{Guindon et al., 2010}).
If number of replicates is set to 0 (\lstinline!-alrt 0!), then the
parametric aLRT test
(\href{http://dx.doi.org/10.1080/10635150600755453}{Anisimova and
Gascuel 2006}) is performed, instead of SH-aLRT.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-abayes!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Perform approximate Bayes test
(\href{http://dx.doi.org/10.1093/sysbio/syr041}{Anisimova et al.,
2011}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-lbp!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify number of replicates (\textgreater{}=1000) to perform fast local
bootstrap probability method
(\href{http://dx.doi.org/10.1007/BF02498640}{Adachi and Hasegawa,
1996}).\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{TIP}: One can combine all these tests (also including UFBoot
\lstinline!-bb! option) within a single IQ-TREE run. Each branch in the
resulting tree will be assigned several support values separated by
slash (\lstinline!/!), where the order of support values is stated in
the \lstinline!.iqtree! report file.
\end{quote}

\subsection{Example usages:}\label{example-usages-6}

\begin{itemize}
\item
  Infer an ML tree and perform SH-aLRT test as well as ultrafast
  bootstrap with 1000 replicates:

\begin{lstlisting}
iqtree -s data.phy -m TEST -alrt 1000 -bb 1000
\end{lstlisting}
\end{itemize}

\section{Tree topology tests}\label{tree-topology-tests-1}

IQ-TREE provides a number of tests for significant topological
differences between trees:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.09\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.85\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
\lstinline!-z!\strut
\end{minipage} & \begin{minipage}[t]{0.85\columnwidth}\raggedright\strut
Specify a file containing a set of trees. IQ-TREE will compute the
log-likelihoods of all trees.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
\lstinline!-zb!\strut
\end{minipage} & \begin{minipage}[t]{0.85\columnwidth}\raggedright\strut
Specify the number of RELL
(\href{http://dx.doi.org/10.1007/BF02109483}{Kishino et al., 1990})
replicates (\textgreater{}=1000) to perform several tree topology tests
for all trees passed via \lstinline!-z!. The tests include bootstrap
proportion (BP), KH test
(\href{http://dx.doi.org/10.1007/BF02100115}{Kishino and Hasegawa,
1989}), SH test
(\href{http://dx.doi.org/10.1093/oxfordjournals.molbev.a026201}{Shimodaira
and Hasegawa, 1999}) and expected likelihood weights (ELW)
(\href{http://dx.doi.org/10.1098/rspb.2001.1862}{Strimmer and Rambaut,
2002}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
\lstinline!-zw!\strut
\end{minipage} & \begin{minipage}[t]{0.85\columnwidth}\raggedright\strut
Used together with \lstinline!-zb! to additionally perform the
weighted-KH and weighted-SH tests.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
\lstinline!-au!\strut
\end{minipage} & \begin{minipage}[t]{0.85\columnwidth}\raggedright\strut
Used together with \lstinline!-zb! to additionally perform the
approximately unbiased (AU) test
(\href{http://dx.doi.org/10.1080/10635150290069913}{Shimodaira, 2002}).
Note that you have to specify the number of replicates for the AU test
via \lstinline!-zb!.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
\lstinline!-n 0!\strut
\end{minipage} & \begin{minipage}[t]{0.85\columnwidth}\raggedright\strut
Only estimate model parameters on an initial parsimony tree and ignore a
full tree search to save time.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
\lstinline!-te!\strut
\end{minipage} & \begin{minipage}[t]{0.85\columnwidth}\raggedright\strut
Specify a fixed user tree to estimate model parameters. Thus it behaves
like \lstinline!-n 0! but uses a user-defined tree instead of parsimony
tree.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{NOTE}: The AU test implementation in IQ-TREE is much more
efficient than the original CONSEL by supporting SSE, AVX and multicore
parallelization. Moreover, it is more appropriate than CONSEL for
partition analysis by bootstrap resampling sites \emph{within}
partitions, whereas CONSEL is not partition-aware.
\end{quote}

\subsection{Example usages:}\label{example-usages-7}

\begin{itemize}
\item
  Given alignment \lstinline!data.phy!, test a set of trees in
  \lstinline!data.trees! using AU test with 10,000 replicates:

\begin{lstlisting}
iqtree -s data.phy -m GTR+G -n 0 -z data.trees -zb 10000 -au 
\end{lstlisting}
\item
  Same above but for a partitioned data \lstinline!partition.nex! and
  additionally performing weighted test:

\begin{lstlisting}
iqtree -s data.phy -spp partition.nex -n 0 -z data.trees -zb 10000 -au -zw
\end{lstlisting}
\end{itemize}

\section{Constructing consensus tree}\label{constructing-consensus-tree}

IQ-TREE provides a fast implementation of consensus tree construction
for post analysis:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-t!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify a file containing a set of trees.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-con!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Compute consensus tree of the trees passed via \lstinline!-t!. Resulting
consensus tree is written to \lstinline!.contree! file.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-net!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Compute consensus network of the trees passed via \lstinline!-t!.
Resulting consensus network is written to \lstinline!.nex! file.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-minsup!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify a minimum threshold (between 0 and 1) to keep branches in the
consensus tree. \lstinline!-minsup 0.5! means to compute majority-rule
consensus tree. \emph{DEFAULT: 0 to compute extended majority-rule
consensus.}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-bi!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify a burn-in, which is the number of beginning trees passed via
\lstinline!-t! to discard before consensus construction. This is useful
e.g.~when summarizing trees from MrBayes analysis.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-sup!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify an input ``target'' tree file. That means, support values are
first extracted from the trees passed via \lstinline!-t!, and then
mapped onto the target tree. Resulting tree with assigned support values
is written to \lstinline!.suptree! file. This option is useful to map
and compare support values from different approaches onto a single
tree.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-suptag!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify name of a node in \lstinline!-sup! target tree. The
corresponding node of \lstinline!.suptree! will then be assigned with
IDs of trees where this node appears. Special option
\lstinline!-suptag ALL! will assign such IDs for all nodes of the target
tree.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\section{Computing Robinson-Foulds
distance}\label{computing-robinson-foulds-distance}

IQ-TREE provides a fast implementation of Robinson-Foulds (RF) distance
computation between trees:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-t!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify a file containing a set of trees.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-rf!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify a second set of trees. IQ-TREE computes all pairwise RF
distances between two tree sets passed via \lstinline!-t! and
\lstinline!-rf!\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-rf_all!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Compute all-to-all RF distances between all trees passed via
\lstinline!-t!\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-rf_adj!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Compute RF distances between adjacent trees passed via
\lstinline!-t!\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\subsection{Example usages:}\label{example-usages-8}

\begin{itemize}
\item
  Compute the pairwise RF distances between 2 sets of trees:

\begin{lstlisting}
iqtree -rf tree_set1 tree_set2
\end{lstlisting}
\item
  Compute the all-to-all RF distances within a set of trees:

\begin{lstlisting}
iqtree -rf_all tree_set
\end{lstlisting}
\end{itemize}

\section{Generating random trees}\label{generating-random-trees}

IQ-TREE provides several random tree generation models:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.84\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-r!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Specify number of taxa. IQ-TREE will create a random tree under
Yule-Harding model with specified number of taxa\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-ru!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Like \lstinline!-r!, but a random tree is created under uniform
model.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-rcat!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Like \lstinline!-r!, but a random caterpillar tree is created.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-rbal!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Like \lstinline!-r!, but a random balanced tree is created.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-rcsg!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Like \lstinline!-r!, bur a random circular split network is
created.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
\lstinline!-rlen!\strut
\end{minipage} & \begin{minipage}[t]{0.84\columnwidth}\raggedright\strut
Specify three numbers: minimum, mean and maximum branch lengths of the
random tree. \emph{DEFAULT: \lstinline!-rlen 0.001 0.1 0.999!}\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\subsection{Example usages:}\label{example-usages-9}

\begin{itemize}
\item
  Generate a 100-taxon random tree into the file \lstinline!100.tree!
  under the Yule Harding model:

\begin{lstlisting}
iqtree -r 100 100.tree 
\end{lstlisting}
\item
  Generate 100-taxon random tree with mean branch lengths of 0.2 and
  branch lengths are between 0.05 and 0.3:

\begin{lstlisting}
iqtree -r 100 -rlen 0.05 0.2 0.3 100.tree 
\end{lstlisting}
\item
  Generate a random tree under uniform model:

\begin{lstlisting}
iqtree -ru 100 100.tree 
\end{lstlisting}
\item
  Generate a random tree where taxon labels follow an alignment:

\begin{lstlisting}
iqtree -s example.phy -r 17 example.random.tree 
\end{lstlisting}
\end{itemize}

Note that, you still need to specify the \lstinline!-r! option being
equal to the number of taxa in the alignment.

\section{Miscellaneous options}\label{miscellaneous-options}

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Option\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Usage and meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-wt!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Turn on writing all locally optimal trees into \lstinline!.treels! file.
\emph{DEFAULT: OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-fixbr!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Turn on fixing branch lengths of tree passed via \lstinline!-t! or
\lstinline!-te!. This is useful to evaluate the log-likelihood of an
input tree with fixed tolopogy and branch lengths. \emph{DEFAULT:
OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-wsl!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Turn on writing site log-likelihoods to \lstinline!.sitelh! file in
\href{http://www.tree-puzzle.de}{TREE-PUZZLE} format. Such file can then
be passed on to
\href{http://www.sigmath.es.osaka-u.ac.jp/shimo-lab/prog/consel/}{CONSEL}
for further tree tests. \emph{DEFAULT: OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-wslg!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Turn on writing site log-likelihoods per rate category. \emph{DEFAULT:
OFF}\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
\lstinline!-fconst!\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Specify a list of comma-separated integer numbers. The number of entries
should be equal to the number of states in the model (e.g.~4 for DNA and
20 for protein). IQ-TREE will then add a number of constant sites
accordingly. For example, \lstinline!-fconst 10,20,15,40! will add 10
constant sites of all A, 20 constant sites of all C, 15 constant sites
of all G and 40 constant sites of all T into the alignment.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\hypertarget{substitution-models}{\chapter{Substitution
models}\label{substitution-models}}

All common substitution models and usages.

IQ-TREE supports a wide range of substitution models, including advanced
partition and mixture models. This guide gives a detailed information of
all available models.

\begin{quote}
\textbf{TIP}: If you do not know which model to use, simply run IQ-TREE
with the standard model selection (\lstinline!-m TEST! option) or the
new ModelFinder (\lstinline!-m MFP!). It automatically determines
best-fit model for your data.
\end{quote}

\hypertarget{dna-models}{\section{DNA models}\label{dna-models}}

\subsection{Base substitution rates}\label{base-substitution-rates}

IQ-TREE includes all common DNA models (ordered by complexity):

\begin{longtable}[]{@{}llll@{}}
\toprule
\begin{minipage}[b]{0.14\columnwidth}\raggedright\strut
Model\strut
\end{minipage} & \begin{minipage}[b]{0.05\columnwidth}\raggedright\strut
df\strut
\end{minipage} & \begin{minipage}[b]{0.61\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage} & \begin{minipage}[b]{0.09\columnwidth}\raggedright\strut
Code\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
JC or JC69\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
0\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Equal substitution rates and equal base frequencies
(\href{http://doi.org/10.1016/B978-1-4832-3211-9.50009-7}{Jukes and
Cantor, 1969}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
000000\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
F81\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
3\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Equal rates but unequal base freq.
(\href{http://dx.doi.org/10.1007\%2FBF01734359}{Felsenstein,
1981}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
000000\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
K80 or K2P\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
1\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Unequal transition/transversion rates and equal base freq.
(\href{http://dx.doi.org/10.1007\%2FBF01731581}{Kimura, 1980}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
010010\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
HKY or HKY85\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
4\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Unequal transition/transversion rates and unequal base freq.
(\href{https://dx.doi.org/10.1007\%2FBF02101694}{Hasegawa, Kishino and
Yano, 1985}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
010010\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TN or TN93\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
5\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!HKY! but unequal purine/pyrimidine rates
(\href{http://mbe.oxfordjournals.org/cgi/content/abstract/10/3/512}{Tamura
and Nei, 1993}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
010020\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TNe\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
2\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!TN! but equal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
010020\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
K81 or K3P\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
2\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Three substitution types model and equal base freq.
(\href{http://dx.doi.org/10.1073/pnas.78.1.454}{Kimura, 1981}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
012210\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
K81u\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
5\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!K81! but unequal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
012210\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TPM2\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
2\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
AC=AT, AG=CT, CG=GT and equal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
121020\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TPM2u\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
5\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!TPM2! but unequal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
121020\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TPM3\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
2\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
AC=CG, AG=CT, AT=GT and equal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
120120\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TPM3u\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
5\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!TPM3! but unequal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
120120\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TIM\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
6\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Transition model, AC=GT, AT=CG and unequal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
012230\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TIMe\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
3\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!TIM! but equal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
012230\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TIM2\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
6\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
AC=AT, CG=GT and unequal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
121030\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TIM2e\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
3\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!TIM2! but equal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
121030\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TIM3\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
6\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
AC=CG, AT=GT and unequal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
120130\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TIM3e\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
3\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!TIM3! but equal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
120130\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TVM\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
7\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Transversion model, AG=CT and unequal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
412310\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
TVMe\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
4\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Like \lstinline!TVM! but equal base freq.\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
412310\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
SYM\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
5\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
Symmetric model with unequal rates and equal base freq.
(\href{http://dx.doi.org/10.1007/BF00160155}{Zharkihk, 1994}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
123450\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
GTR\strut
\end{minipage} & \begin{minipage}[t]{0.05\columnwidth}\raggedright\strut
8\strut
\end{minipage} & \begin{minipage}[t]{0.61\columnwidth}\raggedright\strut
General time reversible model with unequal rates and unequal base freq.
(\href{http://www.damtp.cam.ac.uk/user/st321/CV_\&_Publications_files/STpapers-pdf/T86.pdf}{Tavare,
1986}).\strut
\end{minipage} & \begin{minipage}[t]{0.09\columnwidth}\raggedright\strut
123450\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

The last column \lstinline!Code! is a 6-digit code definining the
equality constraints for 6 \emph{relative} substitution rates: A-C, A-G,
A-T, C-G, C-T and G-T. \lstinline!010010! means that A-G rate is equal
to C-T rate (corresponding to \lstinline!1! in the code) and the
remaining four substitution rates are equal (corresponding to
\lstinline!0! in the code). Thus, \lstinline!010010! is equivalent to
K80 or HKY model (depending on whether base frequencies are equal or
not). \lstinline!123450! is equivalent to GTR or SYM model as there is
no restriction defined by such 6-digit code.

Moreover, IQ-TREE supports arbitrarily restricted DNA model via a
6-digit code, e.g.~with option \lstinline!-m 120120+G!.

\begin{quote}
\textbf{NOTE}: The last digit in this code must always be \lstinline!0!.
It corresponds to G-T rate which is always equal to 1.0 for convenience
because the rates are relative.
\end{quote}

If users want to fix model parameters, append the model name with a
curly bracket \lstinline!{!, followed by the comma-separated rate
parameters, and a closing curly bracket \lstinline!}!. For example,
\lstinline!GTR{1.0,2.0,1.5,3.7,2.8}! specifies 6 substitution rates
A-C=1.0, A-G=2.0, A-T=1.5, C-G=3.7, C-T=2.8 and G-T=1.0.

Another example is for model \lstinline!TIM2! that has the 6-digit code
\lstinline!121030!. Thus, \lstinline!TIM2{4.39,5.30,12.1}! means that
A-C=A-T=4.39 (coded \lstinline!1!), A-G=5.30 (coded \lstinline!2!),
C-T=12.1 (coded \lstinline!3!) and C-G=G-T=1.0 (coded \lstinline!0!).
This is, in turn, equivalent to specifying
\lstinline!GTR{4.39,5.30,4.39,1.0,12.1}!.

\subsection{Base frequencies}\label{base-frequencies}

Users can specify three different kinds of base frequencies:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
FreqType\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+F\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Empirical base frequencies. This is the default if the model has unequal
base freq.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+FQ\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Equal base frequencies.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+FO\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Optimized base frequencies by maximum-likelihood.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

For example, \lstinline!GTR+FO! optimizes base frequencies by ML whereas
\lstinline!GTR+F! (default) counts base frequencies directly from the
alignment.

Finally, users can fix base frequencies with e.g.
\lstinline!GTR+F{0.1,0.2,0.3,0.4}! to fix the corresponding frequencies
of A, C, G and T (must sum up to 1.0).

\hypertarget{protein-models}{\section{Protein
models}\label{protein-models}}

\subsection{Amino-acid exchange rate
matrices}\label{amino-acid-exchange-rate-matrices}

IQ-TREE supports all common empirical amino-acid exchange rate matrices
(alphabetical order):

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
Model\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
BLOSUM62\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
BLOcks SUbstitution Matrix
(\href{https://dx.doi.org/10.1073\%2Fpnas.89.22.10915}{Henikoff and
Henikoff, 1992}). Note that \lstinline!BLOSUM62! is not recommended as
it was designed mainly for sequence alignments.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
cpREV\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
chloroplast matrix
(\href{http://dx.doi.org/10.1007/s002399910038}{Adachi et al.,
2000}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
Dayhoff\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
General matrix
(\href{http://compbio.berkeley.edu/class/c246/Reading/dayhoff-1978-apss.pdf}{Dayhoff
et al., 1978}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
DCMut\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Revised \lstinline!Dayhoff! matrix
(\href{http://dx.doi.org/10.1093/molbev/msi005}{Kosiol and Goldman,
2005}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
FLU\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Influenza virus (\href{http://dx.doi.org/10.1186/1471-2148-10-99}{Dang
et al., 2010}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
HIVb\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
HIV matrix (\href{http://dx.doi.org/10.1186/1471-2148-10-99}{Dang et
al., 2010}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
HIVw\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
HIV matrix (\href{http://dx.doi.org/10.1186/1471-2148-10-99}{Dang et
al., 2010}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
JTT\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
General matrix
(\href{https://dx.doi.org/10.1093\%2Fbioinformatics\%2F8.3.275}{Jones et
al., 1992}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
JTTDCMut\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Revised \lstinline!JTT! matrix
(\href{http://dx.doi.org/10.1093/molbev/msi005}{Kosiol and Goldman,
2005}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
LG\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
General matrix (\href{http://dx.doi.org/10.1093/molbev/msn067}{Le and
Gascuel, 2008}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
mtART\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Mitochondrial Arthropoda
(\href{http://dx.doi.org/10.1093/molbev/msl136}{Abascal et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
mtMAM\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Mitochondrial Mammalia
(\href{http://mbe.oxfordjournals.org/content/15/12/1600.abstract}{Yang
et al., 1998}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
mtREV\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Mitochondrial Verterbrate
(\href{http://dx.doi.org/10.1007/BF02498640}{Adachi and Hasegawa,
1996}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
mtZOA\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Mitochondrial Metazoa (Animals)
(\href{http://dx.doi.org/10.1016/j.ympev.2009.01.011}{Rota-Stabelli et
al., 2009}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
Poisson\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Equal amino-acid exchange rates and frequencies.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
PMB\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Probability Matrix from Blocks, revised \lstinline!BLOSUM! matrix
(\href{http://dx.doi.org/10.1089/106652703322756195}{Veerassamy et al.,
2004}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
rtREV\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Retrovirus (\href{http://dx.doi.org/10.1007/s00239-001-2304-y}{Dimmic et
al., 2002}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
VT\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
General matrix
(\href{http://dx.doi.org/10.1089/10665270050514918}{Mueller and Vingron,
2000}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
WAG\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
General matrix
(\href{http://dx.doi.org/10.1093/oxfordjournals.molbev.a003851}{Whelan
and Goldman, 2001}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
GTR20\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
General time reversible models with 190 rate parameters. \emph{WARNING:
Be careful when using this parameter-rich model as parameter estimates
might not be stable, especially when not having enough phylogenetic
information (e.g.~not long enough alignments). }\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\hypertarget{protein-mixture-models}{\subsection{Protein mixture
models}\label{protein-mixture-models}}

IQ-TREE also supports a series of protein mixture models:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.14\columnwidth}\raggedright\strut
Model\strut
\end{minipage} & \begin{minipage}[b]{0.80\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
C10 to C60\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
10, 20, 30, 40, 50, 60-profile mixture models
(\href{http://dx.doi.org/10.1093/bioinformatics/btn445}{Le et al.,
2008a}) as variants of the CAT model
(\href{http://dx.doi.org/10.1093/molbev/msh112}{Lartillot and Philippe,
2004}) for ML. Note that these models assume \lstinline!Poisson! AA
replacement and implicitly include a
\protect\hyperlink{rate-heterogeneity-across-sites}{Gamma rate
heterogeneity among sites}.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
EX2\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Two-matrix model for exposed/buried AA sites
(\href{http://dx.doi.org/10.1098/rstb.2008.0180}{Le et al.,
2008b}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
EX3\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Three-matrix model for highly exposed/intermediate/buried AA sites
(\href{http://dx.doi.org/10.1098/rstb.2008.0180}{Le et al.,
2008b}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
EHO\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Three-matrix model for extended/helix/other sites
(\href{http://dx.doi.org/10.1098/rstb.2008.0180}{Le et al.,
2008b}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
UL2, UL3\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Unsupervised-learning variants of \lstinline!EX2! and \lstinline!EX3!,
respectively.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
EX\_EHO\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Six-matrix model combining \lstinline!EX2! and \lstinline!EHO!
(\href{http://dx.doi.org/10.1093/sysbio/syq002}{Le and Gascuel,
2010}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
LG4M\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Four-matrix model fused with
\protect\hyperlink{rate-heterogeneity-across-sites}{Gamma rate
heterogeneity} (\href{http://dx.doi.org/10.1093/molbev/mss112}{Le et
al., 2012}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
LG4X\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Four-matrix model fused with
\protect\hyperlink{rate-heterogeneity-across-sites}{FreeRate
heterogeneity} (\href{http://dx.doi.org/10.1093/molbev/mss112}{Le et
al., 2012}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.14\columnwidth}\raggedright\strut
CF4\strut
\end{minipage} & \begin{minipage}[t]{0.80\columnwidth}\raggedright\strut
Five-profile mixture model
(\href{http://dx.doi.org/10.1186/1471-2148-8-331}{Wang et al.,
2008}).\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

One can even combine a protein matrix with a profile mixture model like:

\begin{itemize}
\tightlist
\item
  \lstinline!LG+C20!: Applying \lstinline!LG! matrix instead of
  \lstinline!Poisson! for all 20 classes of AA profiles and a Gamma rate
  heterogeneity.
\item
  \lstinline!LG+C20+F!: Applying \lstinline!LG! matrix for 20 classes
  plus the 21th class of empirical AA profile (counted from the current
  data) and Gamma rate heterogeneity.
\item
  \lstinline!JTT+CF4+G!: Applying \lstinline!JTT! matrix for all 5
  classes of AA profiles and Gamma rate heteorogeneity.
\end{itemize}

Moreover, one can override the Gamma rate by FreeRate heterogeneity:

\begin{itemize}
\tightlist
\item
  \lstinline!LG+C20+R4!: Like \lstinline!LG+C20! but replace Gamma by
  FreeRate heterogeneity.
\end{itemize}

\subsection{User-defined empirical protein
models}\label{user-defined-empirical-protein-models}

If the matrix name does not match any of the above listed models,
IQ-TREE assumes that it is a file containing AA exchange rates and
frequencies in PAML format. It contains the lower diagonal part of the
matrix and 20 AA frequencies, e.g.:

\begin{lstlisting}
0.425093 
0.276818 0.751878 
0.395144 0.123954 5.076149 
2.489084 0.534551 0.528768 0.062556 
0.969894 2.807908 1.695752 0.523386 0.084808 
1.038545 0.363970 0.541712 5.243870 0.003499 4.128591 
2.066040 0.390192 1.437645 0.844926 0.569265 0.267959 0.348847 
0.358858 2.426601 4.509238 0.927114 0.640543 4.813505 0.423881 0.311484 
0.149830 0.126991 0.191503 0.010690 0.320627 0.072854 0.044265 0.008705 0.108882 
0.395337 0.301848 0.068427 0.015076 0.594007 0.582457 0.069673 0.044261 0.366317 4.145067 
0.536518 6.326067 2.145078 0.282959 0.013266 3.234294 1.807177 0.296636 0.697264 0.159069 0.137500 
1.124035 0.484133 0.371004 0.025548 0.893680 1.672569 0.173735 0.139538 0.442472 4.273607 6.312358 0.656604 
0.253701 0.052722 0.089525 0.017416 1.105251 0.035855 0.018811 0.089586 0.682139 1.112727 2.592692 0.023918 1.798853 
1.177651 0.332533 0.161787 0.394456 0.075382 0.624294 0.419409 0.196961 0.508851 0.078281 0.249060 0.390322 0.099849 0.094464 
4.727182 0.858151 4.008358 1.240275 2.784478 1.223828 0.611973 1.739990 0.990012 0.064105 0.182287 0.748683 0.346960 0.361819 1.338132 
2.139501 0.578987 2.000679 0.425860 1.143480 1.080136 0.604545 0.129836 0.584262 1.033739 0.302936 1.136863 2.020366 0.165001 0.571468 6.472279 
0.180717 0.593607 0.045376 0.029890 0.670128 0.236199 0.077852 0.268491 0.597054 0.111660 0.619632 0.049906 0.696175 2.457121 0.095131 0.248862 0.140825 
0.218959 0.314440 0.612025 0.135107 1.165532 0.257336 0.120037 0.054679 5.306834 0.232523 0.299648 0.131932 0.481306 7.803902 0.089613 0.400547 0.245841 3.151815 
2.547870 0.170887 0.083688 0.037967 1.959291 0.210332 0.245034 0.076701 0.119013 10.649107 1.702745 0.185202 1.898718 0.654683 0.296501 0.098369 2.188158 0.189510 0.249313 

0.079066 0.055941 0.041977 0.053052 0.012937 0.040767 0.071586 0.057337 0.022355 0.062157 0.099081 0.064600 0.022951 0.042302 0.044040 0.061197 0.053287 0.012066 0.034155 0.069147 
\end{lstlisting}

(This is an example of an LG matrix taken from
\href{http://abacus.gene.ucl.ac.uk/software/paml.html}{PAML package}).
Note that the amino-acid order in this file is:

\begin{lstlisting}
 A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V
Ala Arg Asn Asp Cys Gln Glu Gly His Ile Leu Lys Met Phe Pro Ser Thr Trp Tyr Val
\end{lstlisting}

\subsection{Amino-acid frequencies}\label{amino-acid-frequencies}

By default, AA frequencies are given by the model. Users can change this
with:

\begin{longtable}[]{@{}ll@{}}
\toprule
FreqType & Explanation\tabularnewline
\midrule
\endhead
+F & empirical AA frequencies from the data.\tabularnewline
+FO & ML optimized AA frequencies from the data.\tabularnewline
+FQ & Equal AA frequencies.\tabularnewline
\bottomrule
\end{longtable}

Users can also specify AA frequencies with, e.g.:

\begin{lstlisting}
+F{0.079066,0.055941,0.041977,0.053052,0.012937,0.040767,0.071586,0.057337,0.022355,0.062157,0.099081,0.064600,0.022951,0.042302,0.044040,0.061197,0.053287,0.012066,0.034155,0.069147}
\end{lstlisting}

(Example corresponds to the AA frequencies of the LG matrix).

\hypertarget{codon-models}{\section{Codon models}\label{codon-models}}

To apply a codon model one should use the option \lstinline!-st CODON!
to tell IQ-TREE that the alignment contains protein coding sequences
(otherwise, IQ-TREE thinks that it contains DNA sequences and will apply
DNA models). This implicitly applies the standard genetic code. You can
change to an other genetic code by appending the appropriate ID to the
\lstinline!CODON! keyword:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
Code\strut
\end{minipage} & \begin{minipage}[b]{0.83\columnwidth}\raggedright\strut
Genetic code meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON1\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Standard Code (same as \lstinline!-st CODON!)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON2\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Vertebrate Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON3\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Yeast Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON4\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Mold, Protozoan, and Coelenterate Mitochondrial Code and the
Mycoplasma/Spiroplasma Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON5\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Invertebrate Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON6\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Ciliate, Dasycladacean and Hexamita Nuclear Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON9\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Echinoderm and Flatworm Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON10\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Euplotid Nuclear Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON11\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Bacterial, Archaeal and Plant Plastid Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON12\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Alternative Yeast Nuclear Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON13\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Ascidian Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON14\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
The Alternative Flatworm Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON16\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Chlorophycean Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON21\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Trematode Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON22\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Scenedesmus obliquus Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON23\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Thraustochytrium Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON24\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Pterobranchia Mitochondrial Code\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
CODON25\strut
\end{minipage} & \begin{minipage}[t]{0.83\columnwidth}\raggedright\strut
Candidate Division SR1 and Gracilibacteria Code\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

(The IDs follow the specification at
\url{http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi}).

\subsection{Codon substitution rates}\label{codon-substitution-rates}

IQ-TREE supports several codon models:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.19\columnwidth}\raggedright\strut
Model\strut
\end{minipage} & \begin{minipage}[b]{0.75\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
MG\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Nonsynonymous/synonymous (dn/ds) rate ratio
(\href{http://mbe.oxfordjournals.org/content/11/5/715.abstract}{Muse and
Gaut, 1994}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
MGK\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Like \lstinline!MG! with additional transition/transversion (ts/tv) rate
ratio.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
MG1KTS or MGKAP2\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Like \lstinline!MG! with a transition rate
(\href{http://dx.doi.org/10.1093/molbev/msm064}{Kosiol et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
MG1KTV or MGKAP3\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Like \lstinline!MG! with a transversion rate
(\href{http://dx.doi.org/10.1093/molbev/msm064}{Kosiol et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
MG2K or MGKAP4\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Like \lstinline!MG! with a transition rate and a transversion rate
(\href{http://dx.doi.org/10.1093/molbev/msm064}{Kosiol et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
GY\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Nonsynonymous/synonymous and transition/transversion rate ratios
(\href{http://mbe.oxfordjournals.org/content/11/5/725.abstract}{Goldman
and Yang, 1994}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
GY1KTS or GYKAP2\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Like \lstinline!GY! with a transition rate
(\href{http://dx.doi.org/10.1093/molbev/msm064}{Kosiol et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
GY1KTV or GYKAP3\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Like \lstinline!GY! with a transversion rate
(\href{http://dx.doi.org/10.1093/molbev/msm064}{Kosiol et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
GY2K or GYKAP4\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Like \lstinline!GY! with a transition rate and a transversion rate
(\href{http://dx.doi.org/10.1093/molbev/msm064}{Kosiol et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
ECMK07 or KOSI07\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Empirical codon model
(\href{http://dx.doi.org/10.1093/molbev/msm064}{Kosiol et al.,
2007}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
ECMrest\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Restricted version of \lstinline!ECMK07! that allows only one nucleotide
exchange.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.19\columnwidth}\raggedright\strut
ECMS05 or SCHN05\strut
\end{minipage} & \begin{minipage}[t]{0.75\columnwidth}\raggedright\strut
Empirical codon model
(\href{http://dx.doi.org/10.1186/1471-2105-6-134}{Schneider et al.,
2005}).\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

The last three models (\lstinline!ECMK07!, \lstinline!ECMrest! or
\lstinline!ECMS05!) are called \emph{empirical} codon models, whereas
the others are called \emph{mechanistic} codon models.

Moreover, IQ-TREE supports combined empirical-mechanistic codon models
using an underscore separator (\lstinline!_!). For example:

\begin{itemize}
\tightlist
\item
  \lstinline!ECMK07_GY2K!: The combined \lstinline!ECMK07! and
  \lstinline!GY2K! model, with the rate entries being multiplication of
  the two corresponding rate matrices.
\end{itemize}

Thus, there can be many such combinations.

If the model name does not match any of the above listed models, IQ-TREE
assumes that it is a file containing codon exchange rates and
frequencies in PAML format. It contains the lower diagonal part of the
matrix and codon frequencies. For an example, see
\url{http://www.ebi.ac.uk/goldman/ECM/}.

\begin{quote}
\textbf{NOTE}: Branch lengths under codon models are interpreted as
number of nucleotide substitutions per codon site. Thus, they are
typically 3 times longer than under DNA models.
\end{quote}

\hypertarget{codon-frequencies}{\subsection{Codon
frequencies}\label{codon-frequencies}}

IQ-TREE supports the following codon frequencies:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
FreqType\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+F\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Empirical codon frequencies counted from the data.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+FQ\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Equal codon frequencies.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+F1X4\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Unequal nucleotide frequencies but equal nt frequencies over three codon
positions.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+F3X4\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
Unequal nucleotide frequencies and unequal nt frequencies over three
codon positions.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

If not specified, the default codon frequency will be \lstinline!+F3X4!
for \lstinline!MG!-type models, \lstinline!+F! for \lstinline!GY!-type
models and given by the model for empirical codon models.

\hypertarget{binary-and-morphological-models}{\section{Binary and
morphological models}\label{binary-and-morphological-models}}

The binary alignments should contain state \lstinline!0! and
\lstinline!1!, whereas for morphological data, the valid states are
\lstinline!0! to \lstinline!9! and \lstinline!A! to \lstinline!Z!.

\begin{longtable}[]{@{}ll@{}}
\toprule
Model & Explanation\tabularnewline
\midrule
\endhead
JC2 & Jukes-Cantor type model for binary data.\tabularnewline
GTR2 & General time reversible model for binary data.\tabularnewline
MK & Jukes-Cantor type model for morphological data.\tabularnewline
ORDERED & Allowing exchange of neighboring states only.\tabularnewline
\bottomrule
\end{longtable}

Except for \lstinline!GTR2! that has unequal state frequencies, all
other models have equal state frequencies.

\begin{quote}
\textbf{TIP}: If morphological alignments do not contain constant sites
(typically the case), then
\protect\hyperlink{ascertainment-bias-correction}{an ascertainment bias
correction model (\lstinline!+ASC!)} should be applied to correct the
branch lengths for the absence of constant sites.
\end{quote}

\hypertarget{ascertainment-bias-correction}{\section{Ascertainment bias
correction}\label{ascertainment-bias-correction}}

An ascertainment bias correction (\lstinline!+ASC!) model
(\href{http://dx.doi.org/10.1080/106351501753462876}{Lewis, 2001})
should be applied if the alignment does not contain constant sites (such
as morphological or SNPs data). For example:

\begin{itemize}
\tightlist
\item
  \lstinline!MK+ASC!: For morphological data.
\item
  \lstinline!GTR+ASC!: For SNPs data.
\end{itemize}

\lstinline!+ASC! will correct the likelihood conditioned on variable
sites. Without \lstinline!+ASC!, the branch lengths might be
overestimated.

\hypertarget{rate-heterogeneity-across-sites}{\section{Rate
heterogeneity across sites}\label{rate-heterogeneity-across-sites}}

IQ-TREE supports all common rate heterogeneity across sites models:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
RateType\strut
\end{minipage} & \begin{minipage}[b]{0.82\columnwidth}\raggedright\strut
Explanation\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+I\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
allowing for a proportion of invariable sites.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+G\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
discrete Gamma model (\href{http://dx.doi.org/10.1007/BF00160154}{Yang,
1994}) with default 4 rate categories. The number of categories can be
changed with e.g. \lstinline!+G8!.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+I+G\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
invariable site plus discrete Gamma model
(\href{http://mbe.oxfordjournals.org/content/12/4/546.abstract}{Gu et
al., 1995}).\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+R\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
FreeRate model
(\href{http://www.genetics.org/content/139/2/993.abstract}{Yang, 1995};
\href{http://dx.doi.org/10.1093/molbev/mss140}{Soubrier et al., 2012})
that generalizes the \lstinline!+G! model by relaxing the assumption of
Gamma-distributed rates. The number of categories can be specified with
e.g. \lstinline!+R6! (default 4 categories if not specified). The
FreeRate model typically fits data better than the \lstinline!+G! model
and is recommended for analysis of large data sets.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
+I+R\strut
\end{minipage} & \begin{minipage}[t]{0.82\columnwidth}\raggedright\strut
invariable site plus FreeRate model.\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\begin{quote}
\textbf{TIP}: The new ModelFinder (\lstinline!-m MFP! option) tests the
FreeRate model, whereas the standard procedure (\lstinline!-m TEST!)
does not.
\end{quote}

Users can fix the parameters of the model. For example,
\lstinline!+I{0.2}! will fix the proportion of invariable sites (pinvar)
to 0.2; \lstinline!+G{0.9}! will fix the Gamma shape parameter (alpha)
to 0.9; \lstinline!+I{0.2}+G{0.9}! will fix both pinvar and alpha. To
fix the FreeRate model parameters, use the syntax
\lstinline!+Rk{w1,r1,...,wk,rk}! (replacing \lstinline!k! with the
number of categories). Here, \lstinline!w1, ..., wk! are the weights and
\lstinline!r1, ..., rk! the rates for each category.

\begin{quote}
\textbf{NOTE}: For the \lstinline!+G! model IQ-TREE implements the
\emph{mean} approximation approach
(\href{http://dx.doi.org/10.1007/BF00160154}{Yang, 1994}). The same is
done in RAxML and PhyML. However, some programs like TREE-PUZZLE
implement the \emph{median} approximation approach, which makes the
resulting log-likelihood not comparable. IQ-TREE can change to this
approach via the \lstinline!-gmedian! option.
\end{quote}

\hypertarget{complex-models}{\chapter{Complex
models}\label{complex-models}}

Complex models such as partition and mixture models.

This document gives detailed descriptions of complex maximum-likelihood
models available in IQ-TREE. It is assumed that you know the
\protect\hyperlink{substitution-models}{basic substitution models}
already.

\hypertarget{partition-models}{\section{Partition
models}\label{partition-models}}

Partition models are intended for phylogenomic (e.g., multi-gene)
alignments, which allow each partition to have its own substitution
models and evolutionary rates. IQ-TREE supports three types of partition
models:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
  \emph{Edge-equal} partition model with equal branch lengths: All
  partitions share the same set of branch lengths.
\item
  \emph{Edge-proportional} partition model with proportional branch
  lengths: Like above but each partition has its own partition specific
  rate, that rescales all its branch lengths. This model accomodates
  different evolutionary rates between partitions (e.g.~between 1st,
  2nd, and 3rd codon positions).
\item
  \emph{Edge-unlinked} partition model: Each partition has its own set
  of branch lengths. This is the most parameter-rich partition model,
  that accounts for e.g., \emph{heterotachy}
  (\href{http://mbe.oxfordjournals.org/content/19/1/1.full}{Lopez et
  al., 2002}).
\end{enumerate}

\begin{quote}
\textbf{TIP}: The edge-equal partition model is typically unrealistic as
it does not account for different evolutionary speeds between
partitions, whereas the edge-unlinked partition model can be overfitting
if there are many short partitions. Therefore, the edge-proportional
partition model is recommended for a typical analysis.
\end{quote}

\hypertarget{partition-file-format}{\subsection{Partition file
format}\label{partition-file-format}}

To apply partition models users must first prepare a partition file in
RAxML-style or NEXUS format. The RAxML-style is defined by the RAxML
software and may look like:

\begin{lstlisting}
DNA, part1 = 1-100
DNA, part2 = 101-384
\end{lstlisting}

This means two DNA partitions of an alignment, where one groups aligment
sites \lstinline!1-100! into \lstinline!part1! and \lstinline!101-384!
into \lstinline!part2!.

The NEXUS format is more complex but more powerful. For example, the
above partition scheme may look like:

\begin{lstlisting}
#nexus
begin sets;
    charset part1 = 1-100;
    charset part2 = 101-384;
    charpartition mine = HKY+G:part1, GTR+I+G:part2;
end;
\end{lstlisting}

The first line contains the keyword \lstinline!#nexus! to indicate a
NEXUS file. It has a \lstinline!sets! block, which contains two
character sets (\lstinline!charset! command) named \lstinline!part1! and
\lstinline!part2!. Furthermore, with the \lstinline!charpartition!
command we set the model \lstinline!HKY+G! for \lstinline!part1! and
\lstinline!GTR+I+G! for \lstinline!part2!. This is not possible with the
RAxML-style format (i.e., one cannot specify \lstinline!+G! rate model
for one partition and \lstinline!+I+G! rate model for the other
partition).

\begin{quote}
\textbf{TIP}: IQ-TREE fully supports mixed rate heterogeneity types
types between partitions (see above example).
\end{quote}

One can also specify non-consecutive sites of a partition, e.g.~under
RAxML-style format:

\begin{lstlisting}
DNA, part1 = 1-100, 250-384
DNA, part2 = 101-249\3, 102-249\3
DNA, part3 = 103-249\3
\end{lstlisting}

or under NEXUS format:

\begin{lstlisting}
#nexus
begin sets;
    charset part1 = 1-100 250-384;
    charset part2 = 101-249\3 102-249\3;
    charset part3 = 103-249\3;
end;
\end{lstlisting}

This means, \lstinline!part2! contains sites 101, 102, 104, 105, 107,
\ldots{}, 246, 248, 249; whereas \lstinline!part3! contains sites 103,
106, \ldots{}, 247. This is useful to specify partitions corresponding
to 1st, 2nd and 3rd codon positions.

Moreover, the NEXUS file allows each partition to come from a separate
alignment file (not possible under RAxML-style format) with e.g.:

\begin{lstlisting}
#nexus
begin sets;
    charset part1 = aln1.phy: 1-100\3 201-300;
    charset part2 = aln1.phy: 101-200;
    charset part3 = aln2.phy: *;
    charpartition mine = HKY:part1, GTR+G:part2, WAG+I+G:part3;
end;
\end{lstlisting}

Here, \lstinline!part1! and \lstinline!part2! correspond to
sub-alignments of \lstinline!aln1.phy! file and \lstinline!part3! is the
entire alignment file \lstinline!aln2.phy!. Note that
\lstinline!aln2.phy! is a protein alignment in this example.

\begin{quote}
\textbf{TIP}: IQ-TREE fully supports mixed data types between
partitions.
\end{quote}

If you want to specify codon model for a partition, use the
\lstinline!CODON! keyword (otherwise, the partition may be detected as
DNA):

\begin{lstlisting}
#nexus
begin sets;
    charset part1 = aln1.phy:CODON, 1-300;
    charset part2 = aln1.phy: 301-400;
    charset part3 = aln2.phy: *;
    charpartition mine = GY:part1, GTR+G:part2, WAG+I+G:part3;
end;
\end{lstlisting}

Note that this assumes \lstinline!part1! has standard genetic code. If
not, append \lstinline!CODON! with \protect\hyperlink{codon-models}{the
right genetic code ID}.

\subsection{Partitioned analysis}\label{partitioned-analysis}

Having prepared a partition file, one is ready to start a partitioned
analysis with \lstinline!-q! (edge-equal), \lstinline!-spp!
(edge-proportional) or \lstinline!-sp! (edge-unlinked) option. See
\protect\hyperlink{partitioned-analysis-for-multi-gene-alignments}{this
tutorial} for more details.

\hypertarget{mixture-models}{\section{Mixture
models}\label{mixture-models}}

\subsection{What is the difference between partition and mixture
models?}\label{what-is-the-difference-between-partition-and-mixture-models}

Mixture models, like partition models, allow more than one substitution
model along the sequences. However, while a partition model assigns each
alignment site a given specific model, mixture models do not need this
information: it will compute for each site its probability of belonging
to each of the mixture classes (also called categories or components).
Since the site-to-class assignment is not known, the site likelihood
under mixture models is the weighted sum of site likelihoods per mixture
class.

For example, the
\protect\hyperlink{rate-heterogeneity-across-sites}{discrete Gamma rate
heterogeneity} is a simple type of mixture model, which have several
rate categories with equal probability. IQ-TREE also supports a number
of \protect\hyperlink{protein-mixture-models}{predefined protein mixture
models} such as the profile mixture models \lstinline!C10! to
\lstinline!C60! (The ML variants of Bayesian \lstinline!CAT! models).

Here, we discuss several possibilities to define new mixture models in
IQ-TREE.

\subsection{Defining mixture models}\label{defining-mixture-models}

To start with, the following command:

\begin{lstlisting}
iqtree -s example.phy -m "MIX{JC,HKY}"
\end{lstlisting}

is a valid analysis. Here, we specify a mixture model (via
\lstinline!MIX! keyword in the model string) with two components
(\lstinline!JC! and \lstinline!HKY! model) given in curly bracket and
comma separator. IQ-TREE will then estimate the parameters of both
mixture components as well as their weights: the proportion of sites
belonging to each component.

\begin{quote}
\textbf{NOTE}: Do not forget the double-quotes around model string!
Otherwise, the Terminal/Console might not recognize the model string
properly.
\end{quote}

Mixture models can be combined with rate heterogeneity, e.g.:

\begin{lstlisting}
iqtree -s example.phy -m "MIX{JC,HKY}+G4"
\end{lstlisting}

Here, we specify two models and four Gamma rate categories. Effectively
it means that there are 8 mixture components! Each site has a
probability belonging to either \lstinline!JC! or \lstinline!HKY! and to
one of the four rate categories.

\subsection{Profile mixture models}\label{profile-mixture-models}

Sometimes one only wants to model the changes in nucleotide or
amino-acid frequencies along the sequences while keeping the
substitution rate matrix the same. This can be specified in IQ-TREE via
\lstinline!FMIX{...}! model syntax. For convenience the mixture
components can be defined in a NEXUS file like this (example corresponds
to \protect\hyperlink{protein-mixture-models}{the CF4 model} of
(\href{http://dx.doi.org/10.1186/1471-2148-8-331}{Wang et al., 2008})):

\begin{lstlisting}
#nexus
begin models;
    frequency Fclass1 = 0.02549352 0.01296012 0.005545202 0.006005566 0.01002193 0.01112289 0.008811948 0.001796161 0.004312188 0.2108274 0.2730413 0.01335451 0.07862202 0.03859909 0.005058205 0.008209453 0.03210019 0.002668138 0.01379098 0.2376598;
    frequency Fclass2 = 0.09596966 0.008786096 0.02805857 0.01880183 0.005026264 0.006454635 0.01582725 0.7215719 0.003379354 0.002257725 0.003013483 0.01343441 0.001511657 0.002107865 0.006751404 0.04798539 0.01141559 0.000523736 0.002188483 0.004934972;
    frequency Fclass3 = 0.01726065 0.005467988 0.01092937 0.3627871 0.001046402 0.01984758 0.5149206 0.004145081 0.002563289 0.002955213 0.005286931 0.01558693 0.002693098 0.002075771 0.003006167 0.01263069 0.01082144 0.000253451 0.001144787 0.004573568;
    frequency Fclass4 = 0.1263139 0.09564027 0.07050061 0.03316681 0.02095119 0.05473468 0.02790523 0.009007538 0.03441334 0.005855319 0.008061884 0.1078084 0.009019514 0.05018693 0.07948 0.09447839 0.09258897 0.01390669 0.05367769 0.01230413;

    frequency CF4model = FMIX{empirical,Fclass1,Fclass2,Fclass3,Fclass4};
end;
\end{lstlisting}

Here, the NEXUS file contains a \lstinline!models! block to define new
models. More explicitly, we define four AA profiles \lstinline!Fclass1!
to \lstinline!Fclass4! (each containing 20 AA frequencies). Then, the
frequency mixture is defined with

\begin{lstlisting}
FMIX{empirical,Fclass1,Fclass2,Fclass3,Fclass4}
\end{lstlisting}

That means, we have five components: the first corresponds to empirical
AA frequencies to be inferred from the data and the remaining four
components are specified in this NEXUS file. Please save this to a file,
say, \lstinline!mymodels.nex!. One can now start the analysis with:

\begin{lstlisting}
iqtree -s some_protein.aln -mdef mymodels.nex -m JTT+CF4model+G
\end{lstlisting}

The \lstinline!-mdef! option specifies the NEXUS file containing
user-defined models. Here, the \lstinline!JTT! matrix is applied for all
alignment sites and one varies the AA profiles along the alignment. One
can use the NEXUS syntax to define all other profile mixture models such
as \lstinline!C10! to \lstinline!C60!.

\hypertarget{nexus-model-file}{\subsection{NEXUS model
file}\label{nexus-model-file}}

In fact, IQ-TREE uses this NEXUS model file internally to define all
\protect\hyperlink{protein-mixture-models}{protein mixture models}. In
addition to defining state frequencies, one can specify the entire model
with rate matrix and state frequencies together. For example, the LG4M
model (\href{http://dx.doi.org/10.1093/molbev/mss112}{Le et al., 2012})
can be defined by:

\begin{lstlisting}
#nexus
begin models;
    model LG4M1 =
        0.269343
        0.254612 0.150988
        0.236821 0.031863 0.659648
        ....;
    ....
    model LG4M4 = ....;
    
    model LG4M = MIX{LG4M1,LG4M2,LG4M3,LG4M4}*G4;
end;
\end{lstlisting}

Here, we first define the four matrices \lstinline!LG4M1!,
\lstinline!LG4M2!, \lstinline!LG4M3! and \lstinline!LG4M4! in PAML
format (see \protect\hyperlink{protein-models}{protein models}). Then
\lstinline!LG4M! is defined as mixture model with these four components
\emph{fused} with Gamma rate heterogeneity (via \lstinline!*G4! syntax
instead of \lstinline!+G4!). This means that, in total, we have 4
mixture components instead of 16. The first component \lstinline!LG4M1!
is rescaled by the rate of the lowest Gamma rate category. The fourth
component \lstinline!LG4M4! corresponds to the highest rate.

Note that both \lstinline!frequency! and \lstinline!model! commands can
be embedded into a single model file.

\hypertarget{site-specific-frequency-models}{\section{Site-specific
frequency models}\label{site-specific-frequency-models}}

Starting with version 1.5.0, IQ-TREE provides a new posterior mean site
frequency (PMSF) model as a rapid approximation to the time and memory
consuming profile mixture models \lstinline!C10! to \lstinline!C60!
(\href{http://dx.doi.org/10.1093/bioinformatics/btn445}{Le et al.,
2008a}; a variant of PhyloBayes' \lstinline!CAT! model). The PMSF are
the amino-acid profiles for each alignment site computed from an input
mixture model and a guide tree. The PMSF model is much faster and
requires much less RAM than \lstinline!C10! to \lstinline!C60! (see
table below), regardless of the number of mixture classes. Our extensive
simulations and empirical phylogenomic data analyses demonstrate that
the PMSF models can effectively ameliorate long branch attraction
artefacts.

If you use this model in a publication please cite:

\begin{quote}
\textbf{Wang, H.C., Susko, S, Minh B.Q and Roger A.J.} (2016) Modeling
Site Heterogeneity with Posterior Mean Site Frequency Profiles
Accelerates Accurate Phylogenomic Estimation. \emph{Submitted}.
\end{quote}

Here is an example of computation time and RAM usage for an Obazoa data
set (68 sequences, 43615 amino-acid sites) from
\href{http://dx.doi.org/10.1098/rspb.2013.1755}{Brown et al. (2013)}
using 16 CPU cores:

\begin{longtable}[]{@{}lrrr@{}}
\toprule
Models & CPU time & Wall-clock time & RAM usage\tabularnewline
\midrule
\endhead
\lstinline!LG+F+G! & 43h:38m:23s & 3h:37m:23s & 1.8 GB\tabularnewline
\lstinline!LG+C20+F+G! & 584h:25m:29s & 46h:39m:06s & 38.8
GB\tabularnewline
\lstinline!LG+C60+F+G! & 1502h:25m:31s & 125h:15m:29s & 112.8
GB\tabularnewline
\lstinline!LG+PMSF+G! & 73h:30m:37s & 5h:7m:27s & 2.2 GB\tabularnewline
\bottomrule
\end{longtable}

\subsection{Example usages}\label{example-usages-10}

To use the PMSF model you have to provide a \emph{guide tree}, which,
for example, can be obtained by a quicker analysis under the simpler
\lstinline!LG+F+G! model. The guide tree can then be specified via
\lstinline!-ft! option, for example:

\begin{lstlisting}
iqtree -s <alignment> -m LG+C20+F+G -ft <guide_tree>
\end{lstlisting}

Here, IQ-TREE will perform two phases. In the first phase, IQ-TREE
estimates mixture model parameters given the guide tree and then infers
the site-specific frequency profile (printed to \lstinline!.sitefreq!
file). In the second phase, IQ-TREE will conduct typical analysis using
the inferred frequency model instead of the mixture model to save RAM
and running time. Note that without \lstinline!-ft! option, IQ-TREE will
conduct the analysis under the specified mixture model.

The PMSF model allows one, for the first time, to conduct nonparametric
bootstrap under such complex models, for example (with 100 bootstrap
replicates):

\begin{lstlisting}
iqtree -s <alignment> -m LG+C20+F+G -ft <guide_tree> -b 100
\end{lstlisting}

Please note that the first phase still consumes as much RAM as the
mixture model. To overcome this, you can perform the first phase in a
high-memory server and the second phase in a normal PC as follows:

\begin{lstlisting}
iqtree -s <alignment> -m LG+C20+F+G -ft <guide_tree> -n 0
\end{lstlisting}

This will stop the analysis after the first phase and also write a
\lstinline!.sitefreq! file. You can now copy this \lstinline!.sitefreq!
file to another low-memory machine and run with the same alignment:

\begin{lstlisting}
iqtree -s <alignment> -m LG+C20+F+G -fs <file.sitefreq> -b 100
\end{lstlisting}

This will omit the first phase and thus need much less RAM.

Finally, note that for long (phylogenomic) alignments you can utilize
the multicore IQ-TREE version to further save the computing times with,
say, 24 cores by:

\begin{lstlisting}
iqtree-omp -nt 24 -s <alignment> -m LG+C20+F+G -fs <file.sitefreq>
\end{lstlisting}

Here is the list of relevant command line options:

\begin{longtable}[]{@{}ll@{}}
\toprule
Option & Usage and meaning\tabularnewline
\midrule
\endhead
\lstinline!-ft! & Specify a guide tree tree to infer site frequency
model\tabularnewline
\lstinline!-fs! & Specify a site frequency model file\tabularnewline
\lstinline!-fmax! & Switch to posterior maximum instead of posterior
mean approximation\tabularnewline
\bottomrule
\end{longtable}

\section{Heterotachy models}\label{heterotachy-models}

Heterotachy (or Single Topology Heterotachy - STH) model is a mixture
model composing of several site-classes, each having a separate set of
branch lengths and model parameters. Thus, it is a complex model
naturally accounting for heterotachous evolution
(\href{http://mbe.oxfordjournals.org/content/19/1/1.full}{Lopez, Casane,
and Philippe, 2002}), which was shown to mislead conventional maximum
likelihood and Bayesian inference
(\href{http://dx.doi.org/10.1038/nature02917}{Kolaczkowski and Thornton,
2004}). Our extensive simulations showed that an implementation of
heterotachy models in IQ-TREE obtained almost 100\% accuracy for
heterotachously evolved sequences.

One can think of the heterotachy model as an \emph{edge-unlinked mixture
model}, which will infer the probabilities of each alignment site
belonging to each mixture class. This is in contrast to an
\protect\hyperlink{partition-models}{edge-unlinked partition model},
which requires the appropriate partitioning of the data in advance, an
ambitious assumption and a potential source of error for biological
datasets in practice.

\subsection{Download}\label{download}

IQ-TREE Heterotachy binaries are available for Windows, Mac OS X, and
Linux:

\url{https://github.com/Cibiv/IQ-TREE/releases/tag/v1.4.3-heterotachy}

Source code is also downloadable from the above link.

\subsection{Quick usages}\label{quick-usages}

The STH model with \lstinline!k! mixture classes is executed by adding
\lstinline!+Hk! to the model option (\lstinline!-m!). For example if one
wants to fit a STH4 model in conjunction with the \lstinline!GTR! model
of DNA evolution to sequences contained in \lstinline!data.fst!, one
would use the following command:

\begin{lstlisting}
iqtree -s data.fst -m GTR+H4
\end{lstlisting}

By default the above command will infer one set of empirical base
frequencies and apply those to all classes. If one wishes to infer
separate base frequencies for each class then the \lstinline!+FO! option
is required:

\begin{lstlisting}
iqtree -s data.fst -m GTR+FO+H4
\end{lstlisting}

The \lstinline!-wspm! option will generate a \lstinline!.siteprob!
output file. This contains the probability of each site belonging to
each class:

\begin{lstlisting}
iqtree -s data.fst -m GTR+FO+H4 -wspm
\end{lstlisting}

The \lstinline!-nni-eval! option controls the level to which IQ-TREE
optimizes branch lengths when evaluating alternative topologies. A low
value saves computation time but increases the probability of not
finding the best topology. Higher values evaluate alternate tree
topologies more thoroughly at the cost of extra computation time:

\begin{lstlisting}
iqtree -s data.fst -m GTR+FO+H4 -wspm -nni-eval 20
\end{lstlisting}

\hypertarget{polymorphism-aware-models}{\chapter{Polymorphism-aware
models}\label{polymorphism-aware-models}}

\textbf{Po}lymorphism-aware phylogenetic \textbf{Mo}dels (PoMo) related
documentation.

The \textbf{Po}lymorphism-aware phylogenetic \textbf{Mo}del (PoMo) tries
to use population data (site frequency data) to improve phylogenetic
inference. Thereby it builds on top of DNA substitution models and
naturally accounts for incomplete lineage sorting. In order to run PoMo,
you need more sequences per species (ideally about ten chromosomes) so
that information about the site frequency spectrum is available.

The binary of IQ-TREE with PoMo can be
\href{https://github.com/Cibiv/IQ-TREE/releases/tag/v1.4.3-pomo}{downloaded}
or \href{https://github.com/Cibiv/IQ-TREE/tree/v1.4.3-pomo}{built from
source}. Please confirm that your version of IQ-TREE supports PoMo.

\begin{lstlisting}
iqtree

>> IQ-TREE PoMo version 1.4.3-pomo for Linux 64-bit built Jul  6 2016
>> ...
\end{lstlisting}

\begin{quote}
\textbf{TIP}: For a quick overview of all PoMo related options in
IQ-TREE, run the command \lstinline!iqtree -h! and scroll to the heading
\lstinline!POLYMORPHISM AWARE MODELS (PoMo)!.
\end{quote}

If you use PoMo, please cite
\href{http://dx.doi.org/10.1016/j.jtbi.2016.07.042}{Schrempf et al.,
2016}:

\begin{lstlisting}
Dominik Schrempf, Bui Quang Minh, Nicola De Maio, Arndt von
Haeseler, and Carolin Kosiol (2016) Reversible polymorphism-aware
phylogenetic models and their application to tree inference.
J. Theor. Biol., 407, 362–370.
http://doi.org/10.1016/j.jtbi.2016.07.042.
\end{lstlisting}

\section{Counts files}\label{counts-files}

The input of PoMo is allele frequency data. Especially, when populations
have many individuals it is preferable to count the number of bases at
each position. This decreases file size and speeds up the parser.

Counts files contain:

\begin{itemize}
\item
  One headerline that specifies the file as counts file and states the
  number of populations as well as the number of sites (separated by
  white space).
\item
  A second headerline with white space separated headers: CRHOM
  (chromosome), POS (position) and sequence names.
\item
  Many lines with counts of A, C, G and T bases and their respective
  positions.
\end{itemize}

Comments:

\begin{itemize}
\tightlist
\item
  Lines starting with \# before the first headerline are treated as
  comments.
\end{itemize}

A toy example:

\begin{lstlisting}
COUNTSFILE  NPOP 5   NSITES N
CHROM  POS  Sheep    BlackSheep  RedSheep  Wolf     RedWolf
1      1    0,0,1,0  0,0,1,0     0,0,1,0   0,0,5,0  0,0,0,1
1      2    0,0,0,1  0,0,0,1     0,0,0,1   0,0,0,5  0,0,0,1
.
.
.
9      8373 0,0,0,1  1,0,0,0     0,1,0,0   0,1,4,0  0,0,1,0
.
.
.
Y      9999 0,0,0,1  0,1,0,0     0,1,0,0   0,5,0,0  0,0,1,0
\end{lstlisting}

The download also includes an example counts file called
\href{https://github.com/Cibiv/IQ-TREE/blob/PoMo/example/example.cf}{\lstinline!example.cf!}.
This file is a subset of the
\href{https://github.com/pomo-dev/data/tree/master/SystBiol2015}{great
ape data} that has been analyzed in one of our publications. It includes
twelve great ape population with one to 23 inividuals each (two to 56
chromosomes).

\subsection{Conversion scripts}\label{conversion-scripts}

If you do not want to create counts files with your own scripts, you can
use one of the scripts that we provide. For detailed instructions,
please refer to the \href{https://github.com/pomo-dev/cflib}{GitHub
repository of the counts file library \lstinline!cflib!}.

\section{First running example}\label{first-running-example-1}

You can now start to reconstruct a maximum-likelihood tree from this
alignment by entering (assuming that you are now in the same folder with
\lstinline!example.cf!):

\begin{lstlisting}
iqtree -s example.cf
\end{lstlisting}

\lstinline!-s! is the option to specify the name of the alignment file.
At the end of the run IQ-TREE writes the same output files as in the
standard version (see \protect\hyperlink{beginners-tutorial}{tutorial}).

\begin{itemize}
\tightlist
\item
  \lstinline!example.cf.iqtree!: the main report file that is
  self-readable. You should look at this file to see the computational
  results. It also contains a textual representation of the final tree.
\item
  \lstinline!example.cf.treefile!: the ML tree in NEWICK format, which
  can be visualized by any supported tree viewer programs like FigTree
  or iTOL.
\item
  \lstinline!example.cf.log!: log file of the entire run (also printed
  on the screen). To report bugs, please send this log file and the
  original alignment file to the authors.
\end{itemize}

The default prefix of all output files is the alignment file name.
However, you can always change the prefix using the \lstinline!-pre!
option, e.g.:

\begin{lstlisting}
iqtree -s example.cf -pre myprefix
\end{lstlisting}

This prevents output files to be overwritten when you perform multiple
analyses on the same alignment within the same folder.

\section{Substitution models}\label{substitution-models-1}

By default, PoMo runs with the HKY model. Different DNA substitution
models can be selected with the \lstinline!-m! option. E.g., to select
the GTR model, run IQ-TREE with:

\begin{lstlisting}
iqtree -s example.cf -m GTR
\end{lstlisting}

If a counts file is given as input file, the PoMo model will be
automatically chosen. You can also explicitly specify to run the
(reversible) PoMo model with:

\begin{lstlisting}
iqtree -s example.cf -m GTR+rP
\end{lstlisting}

The frequency type can also be selected With \lstinline!-m!. The default
is to empirically estimate allele frequencies. To estimate the allele
frequencies together with the rate parameters, use:

\begin{lstlisting}
iqtree -s example.cf -m GTR+rP+FO
\end{lstlisting}

\begin{quote}
\textbf{TIP}: For a quick overview of all available models in IQ-TREE,
run the command \lstinline!iqtree -h! and scroll to the heading
\lstinline!POLYMORPHISM AWARE MODELS (PoMo)!.
\end{quote}

\hypertarget{virtual-population-size}{\section{Virtual population
size}\label{virtual-population-size}}

PoMo models the evolution of populations by means of a virtual
population of constant size N, which defaults to nine (for details, see
\href{http://dx.doi.org/10.1016/j.jtbi.2016.07.042}{Schrempf et al.,
2016}). The optimal choice of N depends on the data. If only very few
chromosomes have been sequenced per population (e.g., two to four), N
should be lowered to five. If enough data is available and calculations
are not too time consuming, we advise to increase N up to a maximum of
19. This can be done with the sequence type option \lstinline!-st!. You
can choose odd values from three to 19 as well as two and ten. E.g., to
set N to 19:

\begin{lstlisting}
iqtree -s example.cf -st CF19
\end{lstlisting}

Odd values of N allows the usage of the fast AVX instruction set. This
results in a considerable decrease of runtime.

\section{Sampling method}\label{sampling-method}

For advanced users. PoMo offers two different methods to read in the
data (\href{http://dx.doi.org/10.1016/j.jtbi.2016.07.042}{Schrempf et
al., 2016}). Briefly, each species and site are treated as follows

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  \emph{Weighted} (default): assign the likelihood of each PoMo state to
  its probability of leading to the observed data, assuming it is
  binomially sampled.
\item
  \emph{Sampled}: randomly draw N samples with replacement from the
  given data and set the PoMo state to the chosen one;
\end{enumerate}

Again, the sequence type option \lstinline!-st! can be used to change
the input method.

\begin{itemize}
\item
  To use the \emph{sampled} input method (\lstinline!R! for random):

\begin{lstlisting}
iqtree -s example.cf -st CR
\end{lstlisting}
\item
  To use the \emph{weighted} input method (default behavior;
  \lstinline!CF! for counts file):

\begin{lstlisting}
iqtree -s example.cf -st CF
\end{lstlisting}
\end{itemize}

\section{Bootstrap branch support}\label{bootstrap-branch-support}

To overcome the computational burden required by the non-parametric
bootstrap, IQ-TREE introduces an ultra fast bootstrap approximation
(UFBoot) that is orders of magnitude faster than the standard procedure
and provides relatively unbiased branch support values. To run UFBoot,
use the option \lstinline!-bb!, e.g., for 1000 replicates:

\begin{lstlisting}
iqtree -s example.cf -bb 1000
\end{lstlisting}

The standard non-parametric bootstrap is invoked by the \lstinline!-b!
option, e.g., for 100 replicates:

\begin{lstlisting}
iqtree -s example.cf -b 100
\end{lstlisting}

For a detailed description, please refer to the
\protect\hyperlink{assessing-branch-supports-with-ultrafast-bootstrap-approximation}{bootstrap
tutorial}.

\section{Interpretation of branch
lengths}\label{interpretation-of-branch-lengths}

PoMo estimates the branch length in number of mutations and frequency
shifts (drift) per site. The number of drift events compared to the
number of mutations becomes higher if the
\protect\hyperlink{virtual-population-size}{virtual population size} is
increased. To get the branch length measured in number of substitutions
per site which enables a comparison to the branch length estimated by
standard DNA substitution models, it has to be divided by N\^{}2. PoMo
also outputs the total tree length measured in number of substitution
per site in \lstinline!example.cf.iqtree!. An example of the relevant
section:

\begin{lstlisting}
NOTE: The branch lengths of PoMo measure mutations and frequency shifts.
To compare PoMo branch lengths to DNA substitution models use the tree length
measured in substitutions per site.

Total tree length (sum of branch lengths)
 - measured in number of mutations and frequency shifts per site: 0.71200751
 - measured in number of substitutions per site (divided by N^2): 0.00879022
Sum of internal branch lengths
- measured in mutations and frequency shifts per site: 0.01767814 (2.48285810% of tree length)
- measured in substitutions per site: 0.01767814 (2.48285810% of tree length)
\end{lstlisting}

\hypertarget{compilation-guide}{\chapter{Compilation
guide}\label{compilation-guide}}

For advanced users to compile IQ-TREE source code.

\section{General requirements}\label{general-requirements}

\begin{itemize}
\tightlist
\item
  Make sure that a C++ compiler is installed. IQ-TREE was successfully
  built with GCC (version 4.8 at least), Clang, MS Visual Studio and
  Intel C++ compiler.
\item
  Install \href{http://www.cmake.org}{CMake} if not yet available in
  your system.
\item
  \emph{(Optional)} If you want to compile the multicore version, make
  sure that the OpenMP library was installed. This should typically be
  the case with \lstinline!gcc! under Linux.
\item
  \emph{(Optional)} Install \href{https://git-scm.com}{git} if you want
  to clone source code from
  \href{https://github.com/Cibiv/IQ-TREE}{IQ-TREE GitHub repository}.
\end{itemize}

\section{Downloading source code}\label{downloading-source-code}

Choose the source code (\lstinline!zip! or \lstinline!tar.gz!) of the
IQ-TREE release you want to use from:

\url{https://github.com/Cibiv/IQ-TREE/releases/}

Alternatively, if you have \lstinline!git! installed, you can also clone
the source code from GitHub with:

\begin{lstlisting}
git clone https://github.com/Cibiv/IQ-TREE.git
\end{lstlisting}

Please find below separate compilation guide fors
\protect\hyperlink{compiling-under-linux}{Linux},
\protect\hyperlink{compiling-under-mac-os-x}{Mac OS X}, and
\protect\hyperlink{compiling-under-windows}{Windows} as well as for
\protect\hyperlink{compiling-32-bit-version}{32-bit version} or for
\protect\hyperlink{compiling-mpi-version}{MPI version}.

\hypertarget{compiling-under-linux}{\section{Compiling under
Linux}\label{compiling-under-linux}}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  Open a Terminal.
\item
  Change to the source code folder:

\begin{lstlisting}
cd PATH_TO_EXTRACTED_SOURCE_CODE
\end{lstlisting}
\item
  Create a subfolder, say, \lstinline!build! and go into this subfolder:

\begin{lstlisting}
mkdir build
cd build
\end{lstlisting}
\item
  Configure source code with CMake:

\begin{lstlisting}
cmake ..
\end{lstlisting}

  To build the multicore version please add
  \lstinline!-DIQTREE_FLAGS=omp! to the cmake command:

\begin{lstlisting}
cmake -DIQTREE_FLAGS=omp ..
\end{lstlisting}
\item
  Compile source code with \lstinline!make!:

\begin{lstlisting}
make
\end{lstlisting}

  You can speed up the compilation by specifying the number of CPU cores
  to use with \lstinline!make! by e.g.:

\begin{lstlisting}
make -j4
\end{lstlisting}

  to use 4 cores instead of the default 1 core.
\end{enumerate}

This creates an executable \lstinline!iqtree! or \lstinline!iqtree-omp!.
It can be copied to your system search path so that IQ-TREE can be
called from the Terminal simply with the command line
\lstinline!iqtree!.

\begin{quote}
\textbf{TIP}: The above guide typically compiles IQ-TREE with
\lstinline!gcc!. If you have Clang installed and want to compile with
Clang, the compilation will be similar to Mac OS X like below.
\end{quote}

\hypertarget{compiling-under-mac-os-x}{\section{Compiling under Mac OS
X}\label{compiling-under-mac-os-x}}

\begin{itemize}
\tightlist
\item
  Make sure that Clang compiler is installed, which is typically the
  case if you installed Xcode and the associated command line tools.
\item
  Find the path to the CMake executable, which is typically
  \lstinline!/Applications/CMake.app/Contents/bin/cmake!. For later
  convenience, please create a symbolic link \lstinline!cmake! to this
  cmake executable, so that cmake can be invoked from the Terminal by
  simply entering \lstinline!cmake!.
\end{itemize}

The steps to compile IQ-TREE are similar to Linux (see above), except
that you need to specify \lstinline!clang! as compiler when configuring
source code with CMake (step 4):

\begin{lstlisting}
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
\end{lstlisting}

(please change \lstinline!cmake! to absolute path like
\lstinline!/Applications/CMake.app/Contents/bin/cmake!).

To compile the multicore version, the default installed Clang
unfortunately does not support OpenMP (which might change in the near
future). However, the latest Clang 3.7 supports OpenMP, which can be
downloaded from \url{http://clang.llvm.org}. After that you can run
CMake with:

\begin{lstlisting}
cmake -DIQTREE_FLAGS=omp -DCMAKE_C_COMPILER=clang-3.7 -DCMAKE_CXX_COMPILER=clang++-3.7 ..
\end{lstlisting}

(assuming that \lstinline!clang-3.7! and \lstinline!clang++-3.7! points
to the installed Clang 3.7).

\hypertarget{compiling-under-windows}{\section{Compiling under
Windows}\label{compiling-under-windows}}

\begin{itemize}
\tightlist
\item
  Please first install TDM-GCC (a GCC version for Windows) from
  \url{http://tdm-gcc.tdragon.net}.
\item
  Then install Clang for Windows from \url{http://clang.llvm.org}.
\end{itemize}

\begin{quote}
\textbf{WARNING}: Although IQ-TREE can also be built with TDM-GCC, the
executable does not run properly due to stack alignment issue and the
\lstinline!libgomp! library causes downgraded performance for the OpenMP
version. Thus, it is recommended to compile IQ-TREE with Clang.
\end{quote}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  Open Command Prompt.
\item
  Change to the source code folder:

\begin{lstlisting}
cd PATH_TO_EXTRACTED_SOURCE_CODE
\end{lstlisting}

  Please note that Windows uses back-slash (\lstinline!\!) instead of
  slash (\lstinline!/!) as path name separator.
\item
  Create a subfolder, say, \lstinline!build! and go into this subfolder:

\begin{lstlisting}
mkdir build
cd build
\end{lstlisting}
\item
  Configure source code with CMake:

\begin{lstlisting}
cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS=--target=x86_64-pc-windows-gnu -DCMAKE_CXX_FLAGS=--target=x86_64-pc-windows-gnu -DCMAKE_MAKE_PROGRAM=mingw32-make ..
\end{lstlisting}

  To build the multicore version please add
  \lstinline!-DIQTREE_FLAGS=omp! to the cmake command. Note that the
  make program shipped with TDM-GCC is called \lstinline!mingw32-make!,
  thus needed to specify like above. You can also copy
  \lstinline!mingw32-make! to \lstinline!make! to simplify this step.
\item
  Compile source code with:

\begin{lstlisting}
mingw32-make
\end{lstlisting}

  or

\begin{lstlisting}
mingw32-make -j4
\end{lstlisting}

  to use 4 cores for compilation instead of only 1.
\end{enumerate}

\hypertarget{compiling-32-bit-version}{\section{Compiling 32-bit
version}\label{compiling-32-bit-version}}

\begin{quote}
\textbf{NOTE}: Typically a 64-bit IQ-TREE version is built and
recommended! The 32-bit version has several restriction like maximal RAM
usage of 2GB and no AVX support, thus not suitable to analyze large data
sets.
\end{quote}

To compile the 32-bit version instead, simply add \lstinline!m32! into
\lstinline!IQTREE_FLAGS! of the cmake command:

\begin{lstlisting}
cmake -DIQTREE_FLAGS=m32 .. 
\end{lstlisting}

To build the 32-bit multicore version, run:

\begin{lstlisting}
cmake -DIQTREE_FLAGS=omp-m32 ..
\end{lstlisting}

For Windows you need to change Clang target with:

\begin{lstlisting}
cmake -G "Unix Makefiles" -DCMAKE_C_FLAGS=--target=i686-pc-windows-gnu -DCMAKE_CXX_FLAGS=--target=i686-pc-windows-gnu -DCMAKE_MAKE_PROGRAM=mingw32-make ..
\end{lstlisting}

\hypertarget{compiling-mpi-version}{\section{Compiling MPI
version}\label{compiling-mpi-version}}

\textbf{Requirements}:

\begin{itemize}
\item
  Download source code of IQ-TREE version 1.5.1 or later.
\item
  Install an MPI library (e.g., \href{http://open-mpi.org/}{OpenMPI}) if
  not available in your system. For Mac OS X, the easiest is to install
  \href{http://brew.sh}{Homebrew package manager}, and then install
  OpenMPI library from the command line with:

\begin{lstlisting}
brew install openmpi
\end{lstlisting}
\end{itemize}

Then simply run \lstinline!CMake! and \lstinline!make! by:

\begin{lstlisting}
cmake -DIQTREE_FLAGS=mpi ..
make -j4
\end{lstlisting}

IQ-TREE will automatically detect and setup the MPI paths and library.
Alternatively, you can also use the MPI C/C++ compiler wrappers
(typically named \lstinline!mpicc! and \lstinline!mpicxx!), for example:

\begin{lstlisting}
cmake -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx ..
make -j4
\end{lstlisting}

The executable is named \lstinline!iqtree-mpi!. One can then run
\lstinline!mpirun! to start the MPI version with e.g.~2 processes:

\begin{lstlisting}
mpirun -np 2 iqtree-mpi -s alignment ...
\end{lstlisting}

If you want to compile the hybrid MPI/OpenMP version, simply run:

\begin{lstlisting}
cmake -DIQTREE_FLAGS=omp-mpi ..
make -j4
\end{lstlisting}

The resulting executable is then named \lstinline!iqtree-omp-mpi!. This
can be used to start an MPI run with e.g.~4 processes and 2 cores each
(i.e., a total of 8 cores will be used):

\begin{lstlisting}
mpirun -np 4 iqtree-omp-mpi -nt 2 -s alignment ...
\end{lstlisting}

\begin{quote}
\textbf{NOTE}: Please be aware that \href{http://openmp.org/}{OpenMP}
and \href{http://open-mpi.org/}{OpenMPI} are different! OpenMP is the
standard to implement shared-memory multithreading program, that we use
to provide the multicore IQ-TREE version \lstinline!iqtree-omp!. Whereas
OpenMPI is a message passing interface (MPI) library for distributed
memory parallel system, that is used to compile \lstinline!iqtree-mpi!.
Thus, \textbf{one cannot run \lstinline!iqtree-omp! with
\lstinline!mpirun!!}
\end{quote}

\hypertarget{frequently-asked-questions}{\chapter{Frequently asked
questions}\label{frequently-asked-questions}}

For common questions and answers.

\section{How do I get help?}\label{how-do-i-get-help}

If you have questions please follow the steps below:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
  Continue to read the FAQ below, which may answer your questions
  already.
\item
  If not, read the documentation \url{http://www.iqtree.org/doc}.
\item
  If you still could not find the answer, search the
  \href{https://groups.google.com/d/forum/iqtree}{IQ-TREE Google group}.
  There is a ``Search for topics'' box at the top of the Google group
  web page.
\item
  Finally, if no answer is found, post a question to the IQ-TREE group.
  The average response time is one to two working days.
\end{enumerate}

\begin{quote}
For other feedback and feature request, please post a topic to the
\href{https://groups.google.com/d/forum/iqtree}{IQ-TREE Google group}.
We welcome all suggestions to further improve IQ-TREE! For feature
request, please also explain why you think such a new feature would be
useful or how can it help for your work.
\end{quote}

\section{How do I report bug?}\label{how-do-i-report-bug}

For bug report, please send the following information to the
\href{https://groups.google.com/d/forum/iqtree}{IQ-TREE Google group}:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  A description of the behaviour, which you think might be unexpected or
  caused by a bug.
\item
  The first 10 lines and last 10 lines of the \lstinline!.log! file.
\item
  (If possible) the assertion message printed on the screen, which may
  look like this:

\begin{lstlisting}
iqtree-omp: ....cpp:140: ...: Assertion '...' failed.
\end{lstlisting}
\end{enumerate}

The development team will get back to you and may ask for the full
\lstinline!.log! file and input data files for debugging purpose, if
necessary. In such case please \textbf{only send your data files
directly to the developers for confidential reason}! Keep in mind that
everyone can see all emails sent to the group!

\hypertarget{how-do-i-interpret-ultrafast-bootstrap-ufboot-support-values}{\section{How
do I interpret ultrafast bootstrap (UFBoot) support
values?}\label{how-do-i-interpret-ultrafast-bootstrap-ufboot-support-values}}

The ultrafast bootstrap (UFBoot) feature (\lstinline!-bb! option) was
published in (\href{http://dx.doi.org/10.1093/molbev/mst024}{Minh et
al., 2013}). One of the main conclusions is, that UFBoot support values
are more unbiased: 95\% support correspond roughly to a probability of
95\% that a clade is true. So this has a different meaning than the
normal bootstrap supports (where you start to believe in the clade if it
has \textgreater{}80\% BS support). For UFBoot, you should only start to
believe in a clade if its support is \textgreater{}= 95\%. Thus, the
interpretations are different and you should not compare BS\% with
UFBoot\% directly.

Moreover, it is recommended to also perform the SH-aLRT test
(\href{http://dx.doi.org/10.1093/sysbio/syq010}{Guindon et al., 2010})
by adding \lstinline!-alrt 1000! into the IQ-TREE command line. Each
branch will then be assigned with SH-aLRT and UFBoot supports. One would
typically start to rely on the clade if its SH-aLRT \textgreater{}= 80\%
and UFboot \textgreater{}= 95\%.

\section{How does IQ-TREE treat gap/missing/ambiguous
characters?}\label{how-does-iq-tree-treat-gapmissingambiguous-characters}

Gaps (\lstinline!-!) and missing characters (\lstinline!?! or
\lstinline!N! for DNA alignments) are treated in the same way as
\lstinline!unknown! characters, which represent no information. The same
treatment holds for many other ML software (e.g., RAxML, PhyML). More
explicitly, for a site (column) of an alignment containing
\lstinline!AC-AG-A! (i.e.~A for sequence 1, C for sequence 2,
\lstinline!-! for sequence 3, and so on), the site-likelihood of a tree
T is equal to the site-likelihood of the subtree of T restricted to
those sequences containing non-gap characters (\lstinline!ACAGA!).

Ambiguous characters that represent more than one character are also
supported: each represented character will have equal likelihood. For
DNA the following ambigous nucleotides are supported according to
\href{https://en.wikipedia.org/wiki/Nucleic_acid_notation}{IUPAC
nomenclature}:

\begin{longtable}[]{@{}ll@{}}
\toprule
\begin{minipage}[b]{0.16\columnwidth}\raggedright\strut
Nucleotide\strut
\end{minipage} & \begin{minipage}[b]{0.78\columnwidth}\raggedright\strut
Meaning\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
R\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
A or G (purine)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
Y\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
C or T (pyrimidine)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
W\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
A or T (weak)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
S\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
G or C (strong)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
M\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
A or C (amino)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
K\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
G or T (keto)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
B\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
C, G or T (next letter after A)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
H\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
A, C or T (next letter after G)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
D\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
A, G or T (next letter after C)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
V\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
A, G or C (next letter after T)\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
?, -, ., \textasciitilde{}, O, N, X\strut
\end{minipage} & \begin{minipage}[t]{0.78\columnwidth}\raggedright\strut
A, G, C or T (unknown; all 4 nucleotides are equally likely)\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

For protein the following ambiguous amino-acids are supported:

\begin{longtable}[]{@{}ll@{}}
\toprule
Amino-acid & Meaning\tabularnewline
\midrule
\endhead
B & N or D\tabularnewline
Z & Q or E\tabularnewline
J & I or L\tabularnewline
U & unknown AA (although it is the 21st AA)\tabularnewline
?, -, ., \textasciitilde{}, * or X & unknown AA (all 20 AAs are equally
likely)\tabularnewline
\bottomrule
\end{longtable}

\section{Can I mix DNA and protein data in a partitioned
analysis?}\label{can-i-mix-dna-and-protein-data-in-a-partitioned-analysis}

Yes! You can specify this via a NEXUS partition file. In fact, you can
mix any data types supported in IQ-TREE, including also codon, binary
and morphological data. To do so, each data type should be stored in a
separate alignment file (see also
\protect\hyperlink{partitioned-analysis-with-mixed-data}{Partitioned
analysis with mixed data}). As an example, assuming \lstinline!dna.phy!
is a DNA alignment and and \lstinline!prot.phy! is a protein alignment.
Then a partition file mixing two types of data can be specified as
follows:

\begin{lstlisting}
#nexus
begin sets;
    charset part1 = dna.phy: 1-100 201-300;
    charset part2 = dna.phy: 101-200;
    charset part3 = prot.phy: 1-150;
    charset part4 = prot.phy: 151-400;
    charpartition mine = HKY:part1, GTR+G:part2, WAG+I+G:part3, LG+G:part4;
end;
\end{lstlisting}

\begin{quote}
\textbf{NOTE}: The site count for each alignment should start from 1,
and \textbf{not} continue from the last position of a previous alignment
(e.g., see \lstinline!part3! and \lstinline!part4! declared above).
\end{quote}

\section{What is the interpretation of branch lengths when mixing codon
and DNA
data?}\label{what-is-the-interpretation-of-branch-lengths-when-mixing-codon-and-dna-data}

When mixing codon and DNA data in a partitioned analysis, the branch
lengths are interpreted as the number of nucleotide substitutions per
nucleotide site! This is different from having only codon data, where
branch lengths are the number of nucleotide substitutions per codon site
(thus typically 3 times longer than under DNA models).

Note that if you mix codon, DNA and protein data, the branch lengths are
then the number of character substitutions per site, where character is
either nucleotide or amino-acid.

\section{What is the purpose of composition
test?}\label{what-is-the-purpose-of-composition-test}

At the beginning of each run, IQ-TREE performs a composition chi-square
test for every sequence in the alignment. The purpose is to test for
homogeneity of character composition (e.g., nucleotide for DNA,
amino-acid for protein sequences). A sequence is denoted
\lstinline!failed! if its character composition significantly deviates
from the average composition of the alignment.

More specifically, for each sequence, compute:

\begin{lstlisting}
chi2 = \sum_{i=1}^k (O_i - E_i)^2 / E_i
\end{lstlisting}

where k is the size of the alphabet (e.g.~4 for DNA, 20 for amino acids)
and the values 1 to k correspond uniquely to one of the characters. O\_i
is the character frequency in the sequence tested. E\_i is the overall
character frequency from the entire alignment.

Whether the character composition deviates significantly from the
overall composition is done by testing the chi2 value using the
chi2-distribution with k-1 degrees of freedom (df=3 for DNA or df=19 for
amino acids). By and large it is a normal Chi\^{}2 test.

This test should be regarded as an \emph{explorative tool} which might
help to nail down problems in a dataset. One would typically not remove
failing sequences by default. But if the tree shows unexpected topology
the test might point in direction of the origin of the problem.

Furthermore, please keep in mind, this test is performed at the very
beginning, where IQ-TREE does not know anything about the models yet.
That means:

\begin{itemize}
\tightlist
\item
  If you have partitioned (multi-gene) data, it might be more reasonable
  to test this separately for each partition in a partition analysis.
  Here, one might want to be able to decide whether some partitions
  should better be discarded if it is hard to find a composition
  representing the sequences in the partition. Or on the other hand if a
  sequence fails for many partitions and show very unexpected
  phylogenetic topologies, try without it.
\item
  If you have (phylogenomic) protein data, you can also try several
  \protect\hyperlink{protein-mixture-models}{protein mixture models},
  which account for different amino-acid compositions along the
  sequences, for example, the \lstinline!C10! to \lstinline!C60! profile
  mixture models.
\item
  Finally, it is recommended to always check the alignment (something
  one should always do anyway), especially if they have been collected
  and produced automatically.
\end{itemize}

\hypertarget{what-is-the-good-number-of-cpu-cores-to-use}{\section{What
is the good number of CPU cores to
use?}\label{what-is-the-good-number-of-cpu-cores-to-use}}

Starting with version 1.5.1, you can use option \lstinline!-nt AUTO! to
automatically determine the best number of threads for your current data
and computer.

If you want to know more details: IQ-TREE can utilize multicore machines
to speed up the analysis via \lstinline!-nt! option. However, it does
not mean that using more cores will always result in less running time:
if your alignment is short, using too many cores may even slow down the
analysis. This is because IQ-TREE parallelizes the likelihood
computation along the alignment. Thus, the parallel efficiency is only
increased with longer alignments.

\section{How do I save time for standard
bootstrap?}\label{how-do-i-save-time-for-standard-bootstrap}

The standard bootstrap is rather slow and may take weeks/months for
large data sets. One way to speed up is to use the multicore version.
However, this only works well for long alignments (see
\protect\hyperlink{what-is-the-good-number-of-cpu-cores-to-use}{What is
the good number of CPU cores to use?}). Another way is to use many
machines or a computing cluster and split the computation among the
machines. To illustrate, you want to perform 100 bootstrap replicates
and have 5 PCs, each has 4 CPU cores. Then you can:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
  Perform 5 independent bootstrap runs (each with 20 replicates) on the
  5 machines with 5 prefix outputs (such that output files are not
  overwritten). For example:

\begin{lstlisting}
iqtree-omp -nt 4 -s input_alignment -bo 20 ... -pre boot1
iqtree-omp -nt 4 -s input_alignment -bo 20 ... -pre boot2
iqtree-omp -nt 4 -s input_alignment -bo 20 ... -pre boot3
iqtree-omp -nt 4 -s input_alignment -bo 20 ... -pre boot4
iqtree-omp -nt 4 -s input_alignment -bo 20 ... -pre boot5
\end{lstlisting}

  Note that if you have access to a computing cluster, you may want to
  submit these jobs onto the cluster queue in parallel and with even
  more fined grained parallelization (e.g.~one replicate per job).
\item
  Once all 5 runs finished, combine the 5 \lstinline!.boottrees! file
  into one file (e.g.~by \lstinline!cat! command under Linux):

\begin{lstlisting}
cat boot*.boottrees > alltrees
\end{lstlisting}
\item
  Construct a consensus tree from the combined bootstrap trees:

\begin{lstlisting}
iqtree -con -t alltrees
\end{lstlisting}

  The consensus tree is then written to \lstinline!.contree! file.
\item
  You can also perform the analysis on the original alignment:

\begin{lstlisting}
iqtree-omp -nt 4 -s input_alignment ...
\end{lstlisting}

  and map the support values onto the obtained ML tree:

\begin{lstlisting}
iqtree -sup input_alignment.treefile -t alltrees 
\end{lstlisting}

  The ML tree with assigned bootstrap supports is written to
  \lstinline!.suptree! file.
\end{enumerate}

\section{Why does IQ-TREE complain about the use of +ASC
model?}\label{why-does-iq-tree-complain-about-the-use-of-asc-model}

When using ascertainment bias correction (ASC) model, sometimes you may
get an error message:

\lstinline!ERROR: Invaid use of +ASC because of ... invariant sites in the alignment!

or when performing model testing:

\lstinline!Skipped since +ASC is not applicable!

This is because your alignment contains \emph{invariant} sites
(columns), which violate the mathematical condition of the model. The
invariant sites can be:

\begin{itemize}
\tightlist
\item
  Constant sites: containing a single character state over all
  sequences. For example, all sequences show an \lstinline!A! (Adenine)
  at a particular site in a DNA alignment.
\item
  Partially constant sites: containing a single character, gap or
  unknown character. For example, at a particular site some sequences
  show a \lstinline!G! (Guanine), some sequences have \lstinline!-!
  (gap) and the other have \lstinline!N!.
\item
  Ambiguously constant sites: For example, some sequences show a
  \lstinline!C! (Cytosine), some show a \lstinline!Y! (meaning
  \lstinline!C! or \lstinline!T!) and some show a \lstinline!-! (gap).
\end{itemize}

All these sites must be removed from the alignment before a +ASC model
can be applied.

\begin{quote}
\textbf{TIP}: Starting with IQ-TREE version 1.5.0, an output alignment
file with suffix \lstinline!.varsites! is written in such cases, which
contain only variable sites from the input alignment. The
\lstinline!.varsites! alignment can then be used with the +ASC model.
\end{quote}
