### Install Example Data Files Source: https://github.com/iqtree/iqtree3/blob/master/CMakeLists.txt Installs example data files (.nex, .phy, .cf) from the 'example' directory to the root of the installation destination. ```cmake install (FILES "${PROJECT_SOURCE_DIR}/example/models.nex" DESTINATION .) install (FILES "${PROJECT_SOURCE_DIR}/example/example.phy" DESTINATION .) install (FILES "${PROJECT_SOURCE_DIR}/example/example.nex" DESTINATION .) install (FILES "${PROJECT_SOURCE_DIR}/example/example.cf" DESTINATION .) ``` -------------------------------- ### Run IQ-TREE Example (Windows) Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Execute a basic IQ-TREE analysis with an example alignment file on Windows. ```bash bin\iqtree -s example.phy ``` -------------------------------- ### Install IQ-TREE 3 Executables Source: https://github.com/iqtree/iqtree3/blob/master/CMakeLists.txt Installs the main 'iqtree3' executable and 'iqtree3-aa' if enabled, to the 'bin' directory. Also installs the 'click' variants of these executables on Windows. ```cmake install (TARGETS iqtree3 DESTINATION bin) if (USE_CMAPLE_AA STREQUAL "ON") install (TARGETS iqtree3-aa DESTINATION bin) endif() if (WIN32) install (FILES "${BINARY_DIR}/iqtree3${EXE_SUFFIX}-click.exe" DESTINATION bin) if (USE_CMAPLE_AA STREQUAL "ON") install (FILES "${BINARY_DIR}/iqtree3-aa${EXE_SUFFIX}-click.exe" DESTINATION bin) endif() endif() ``` -------------------------------- ### General Install Settings Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/CMakeLists.txt Defines the installation directories for include files and libraries. The library installation directory is dynamically set based on the LIB_SUFFIX variable. ```cmake set(INCLUDE_INSTALL_ROOT_DIR include) set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_ROOT_DIR}/yaml-cpp) set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}") set(_INSTALL_DESTINATIONS RUNTIME DESTINATION bin LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) ### ### Library ### ``` -------------------------------- ### Install IQ-TREE on FreeBSD Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Use this command to install IQ-TREE on FreeBSD systems. ```bash pkg install iqtree ``` -------------------------------- ### Run IQ-TREE Example (Mac OS X) Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Execute a basic IQ-TREE analysis with an example alignment file on Mac OS X. ```bash bin/iqtree -s example.phy ``` -------------------------------- ### Install IQ-TREE2, ASTRAL-III, and R Packages Source: https://github.com/iqtree/iqtree3/wiki/recipes/concordance-vector Sets up a conda environment and installs necessary software and R packages for estimating concordance vectors. Ensure you have conda installed and configured. ```bash conda create --name concordance conda activate concordance conda install -c bioconda iqtree astral-tree conda install -c conda-forge r-base r-tidyverse r-boot r-ape r-ggtext ``` -------------------------------- ### Install IQ-TREE with Homebrew Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Install IQ-TREE version 3 using Homebrew on macOS or Linux. ```bash brew install brewsci/bio/iqtree3 ``` -------------------------------- ### NEXUS Partition File Example Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Example of a NEXUS partition file defining character sets and partitions with specific substitution models. ```nexus #nexus begin sets; charset part1 = 1-100; charset part2 = 101-384; charpartition mine = HKY+G:part1, GTR+I+G:part2; end; ``` -------------------------------- ### Basic CMakeLists.txt Setup Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/util/CMakeLists.txt Sets the minimum CMake version required and adds source files for a target. Use this to define the build environment for your project. ```cmake cmake_minimum_required(VERSION 3.5) add_sources(parse.cpp) add_executable(parse parse.cpp) target_link_libraries(parse yaml-cpp) ``` -------------------------------- ### Install IQ-TREE with Anaconda Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Install IQ-TREE using the bioconda channel with Anaconda. ```bash conda install -c bioconda iqtree ``` -------------------------------- ### Install IQ-TREE on Debian Linux Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Use this command to install IQ-TREE on Debian-based Linux distributions. ```bash sudo apt-get install iqtree ``` -------------------------------- ### Define Installation Directories Source: https://github.com/iqtree/iqtree3/blob/master/zlib-1.2.7/CMakeLists.txt Configures cache variables for installation directories for executables, libraries, headers, man pages, and pkgconfig files. ```cmake set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") ``` -------------------------------- ### Install Pkgconfig File on UNIX Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/CMakeLists.txt Configures and installs the yaml-cpp.pc file for pkgconfig on UNIX-like systems when YAML_CPP_INSTALL is enabled. ```cmake if(UNIX) set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc) configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY) install(FILES ${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) endif() ``` -------------------------------- ### Run IQ-TREE with PMSF model and guide tree Source: https://github.com/iqtree/iqtree3/wiki/Complex-Models Use this command to run IQ-TREE with a PMSF model, specifying a guide tree obtained from a simpler model analysis. ```bash iqtree -s -m LG+C20+F+G -ft ``` -------------------------------- ### Setup Clang-Tidy Source: https://github.com/iqtree/iqtree3/blob/master/terraphast/CMakeLists.txt Finds the clang-tidy executable and sets up a command line for it, including specific checks and the fix option. This is used for static analysis of the code. ```cmake find_program(CLANG_TIDY_PATH NAMES "clang-tidy") if(NOT CLANG_TIDY_PATH) message(STATUS "clang-tidy not found.") else() message(STATUS "clang-tidy found: ${CLANG_TIDY_PATH}") set(CLANG_TIDY_COMMANDLINE "${CLANG_TIDY_PATH}" "-checks=llvm-namespace-comment -fix") endif() ``` -------------------------------- ### Install yaml-cpp Target and Headers Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/CMakeLists.txt Installs the yaml-cpp target and its header files when YAML_CPP_INSTALL is enabled. ```cmake install(TARGETS yaml-cpp EXPORT yaml-cpp-targets ${_INSTALL_DESTINATIONS}) install( DIRECTORY ${header_directory} DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.h" ) ``` -------------------------------- ### Running IQ-TREE with a Specified Number of CPU Cores Source: https://github.com/iqtree/iqtree3/wiki/workshop/molevol2018 This example demonstrates how to use the -nt option to specify the number of CPU cores for IQ-TREE analysis. It's recommended for long alignments to speed up computation. ```bash iqtree -s example.phy -m TIM2+I+G -nt 2 ``` -------------------------------- ### IQ-TREE Command Line for Phylogenetic Placement Source: https://github.com/iqtree/iqtree3/wiki/recipes/phylogenetic-placement This example shows a typical command-line invocation for IQ-TREE, likely used for phylogenetic placement. It includes options for tree building and outputting results. ```bash # IQ-TREE command line example # This is a placeholder for an actual command. The provided text only contains a tree visualization and scale bar, not a runnable command. # Example: iqtree -s alignment.fasta -pre output -bb 1000 -alrt 1000 ``` -------------------------------- ### Install Catch Dependency Source: https://github.com/iqtree/iqtree3/blob/master/terraphast/documentation/Dependencies.md This command installs the Catch dependency, which is required for the project. Ensure it is in the default include path. ```bash catch ``` -------------------------------- ### Install IQ-TREE 2 and AMAS using Conda Source: https://github.com/iqtree/iqtree3/wiki/recipes/Simulating-concatenated-alignments-with-multiple-trees Set up a fresh environment and install IQ-TREE 2 and AMAS for simulating alignments. ```bash # set up a fresh environment and activate it conda create --name simaln conda activate simaln # install what we need for this recipe conda install -c bioconda iqtree amas ``` -------------------------------- ### Install OpenMPI on macOS using Homebrew Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide Install the OpenMPI library on macOS using the Homebrew package manager. This is a prerequisite for compiling the MPI version of IQ-TREE. ```bash brew install openmpi ``` -------------------------------- ### Automatic CPU Core Detection for IQ-TREE Source: https://github.com/iqtree/iqtree3/wiki/workshop/molevol2018 This example shows how to use '-nt AUTO' to let IQ-TREE automatically determine the optimal number of CPU cores for the analysis, optimizing performance and efficiency. ```bash iqtree -s example.phy -m TIM2+I+G -nt AUTO ``` -------------------------------- ### Run IQ-TREE with PMSF model, guide tree, and bootstrap Source: https://github.com/iqtree/iqtree3/wiki/Complex-Models Perform nonparametric bootstrap analysis under complex models like PMSF by providing a guide tree and specifying the number of bootstrap replicates. ```bash iqtree -s -m LG+C20+F+G -ft -b 100 ``` -------------------------------- ### Perform Constrained Search (Example 2) Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Performs a phylogenetic search with a different topological constraint defined in `example.constr2`. Use `--prefix` for IQ-TREE v3+ or `-pre` for v1.x. ```bash iqtree -s example.phy -m TIM2+I+G -g example.constr2 --prefix example.constr2 # for version 1.x change --prefix to -pre ``` -------------------------------- ### zpipe Usage Example Source: https://github.com/iqtree/iqtree3/blob/master/zlib-1.2.7/examples/zlib_how.html This snippet shows the command-line usage for the zpipe utility, which is a simple example program for zlib. It indicates how to specify decompression with the -d flag. ```c #define SET_BINARY_MODE(file) } /* otherwise, report usage */ else { fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr); return 1; } } ``` -------------------------------- ### zlib Usage Example Header Source: https://github.com/iqtree/iqtree3/blob/master/zlib-1.2.7/examples/zlib_how.html This snippet includes the necessary header files for zlib operations and standard I/O functions. It is essential for using zlib's compression and decompression capabilities. ```c #include #include #include #include "zlib.h" ``` -------------------------------- ### Start zlib Compression Loop Source: https://github.com/iqtree/iqtree3/blob/master/zlib-1.2.7/examples/zlib_how.html Begins the main compression loop, which continues until the end of the input file is reached. This loop contains the primary call to the `deflate` function. ```c /* compress until end of file */ do { ``` -------------------------------- ### Perform Constrained Search (Example 3) Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Performs a phylogenetic search with a third topological constraint defined in `example.constr3`. Use `--prefix` for IQ-TREE v3+ or `-pre` for v1.x. ```bash iqtree -s example.phy -m TIM2+I+G -g example.constr3 --prefix example.constr3 # for version 1.x change --prefix to -pre ``` -------------------------------- ### Simulate alignment and build example tree Source: https://github.com/iqtree/iqtree3/wiki/recipes/phylogenetic-placement This script simulates an alignment, checks sequence names, replaces specific names to simulate new sequences, prunes them from a tree, and then runs IQ-TREE to add them back. It requires Unix environment and newick_utils. ```bash # simulate an alignment of 20 sequences (set the seed for reproducibility only) iqtree3 --alisim sequences -t RANDOM{yh/20} -seed 438579088 -af fasta -m JC # check the names grep '>' sequences.fa # replace names of 3 of them to be 'NEW_N' sed -i -e 's/T18/NEW_1/g' sequences.fa sed -i -e 's/T19/NEW_2/g' sequences.fa sed -i -e 's/T20/NEW_3/g' sequences.fa # check the names again grep '>' sequences.fa # prune the NEW_N sequences from the tree using newick_utils nw_prune sequences.treefile T18 T19 T20 > existing_tree.nex # check that you have the files you need ls -lh # run IQ-TREE to add NEW_N seqs back iqtree -g existing_tree.nex -s sequences.fa -pre seqs_added -seed 438579088 # optional: do a global re-optimisation of the tree, using previous tree as start iqtree -s sequences.fa -t seqs_added.treefile -pre re_optimised -seed 438579088 ``` -------------------------------- ### Basic Gentrius Analysis with Presence-Absence Matrix Source: https://github.com/iqtree/iqtree3/blob/master/terrace/README.md Use this command to start a Gentrius analysis using a phylogenetic tree file and a species per locus presence-absence matrix. ```bash iqtree2 -gentrius -pr_ab_matrix ``` -------------------------------- ### Show All Available Options Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Display a help message listing all available command-line options for IQ-TREE. ```bash iqtree -h ``` -------------------------------- ### General Compilation Settings and Platform Specifics Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/CMakeLists.txt Sets up general compilation flags and platform-specific configurations for Windows DLLs and installation prefixes. It also handles architecture settings for Apple and iPhone builds. ```cmake set(yaml_c_flags ${CMAKE_C_FLAGS}) set(yaml_cxx_flags ${CMAKE_CXX_FLAGS}) if(BUILD_SHARED_LIBS) set(LABEL_SUFFIX "shared") else() set(LABEL_SUFFIX "static") endif() if(APPLE) if(APPLE_UNIVERSAL_BIN) set(CMAKE_OSX_ARCHITECTURES ppc;i386) endif() endif() if(IPHONE) set(CMAKE_OSX_SYSROOT "iphoneos4.2") set(CMAKE_OSX_ARCHITECTURES "armv6;armv7") endif() if(WIN32) if(BUILD_SHARED_LIBS) add_definitions(-D${PROJECT_NAME}_DLL) # use or build Windows DLL endif() if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "C:/") endif() endif() ``` -------------------------------- ### Install zlibstatic Library Source: https://github.com/iqtree/iqtree3/blob/master/zlib-1.2.7/CMakeLists.txt Installs the zlibstatic library to the appropriate runtime, archive, and library directories based on predefined installation variables. This is conditional on SKIP_INSTALL_LIBRARIES and SKIP_INSTALL_ALL not being set. ```cmake if (NOT SKIP_INSTALL_LIBRARIES) set(SKIP_INSTALL_LIBRARIES "1") endif() if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) #install(TARGETS zlib zlibstatic # RUNTIME DESTINATION "${INSTALL_BIN_DIR}" # ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" # LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) install(TARGETS zlibstatic RUNTIME DESTINATION "${INSTALL_BIN_DIR}" ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) endif() ``` -------------------------------- ### Create Build Directory and Navigate Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide Create a separate directory for building the project to keep the source tree clean, and then change into this new directory. ```bash mkdir build cd build ``` -------------------------------- ### Simulating with Root Sequence Frequencies and Custom Model Source: https://github.com/iqtree/iqtree3/wiki/AliSim This example demonstrates simulating an alignment where the root sequence is generated with user-specified state frequencies and a custom model. Subsequent nodes use the specified model and frequencies, while other branches default to the Juke-Cantor model. ```text (A:0.1,(B:0.1,C:0.2),(D:0.3,E:0.1):0.2):0.3[&model=GTR,freqs=0.2/0.3/0.1/0.4]; ``` -------------------------------- ### Topology-Unlinked Partition Model Example Source: https://github.com/iqtree/iqtree3/wiki/AliSim Prepare a Newick file with multiple trees, one for each partition, allowing independent topologies and branch lengths. This is useful when gene trees differ significantly. ```newick (A:0.1,(B:0.26,C:0.15):0.1,D:0.05); (A:0.2,B:0.1,C:0.3); (A:0.05,B:0.03,(C:0.21,D:0.22):0.21); ((A:0.24,B:0.14):0.19,C:0.07,D:0.1); ((A:0.1,C:0.1):0.04,B:0.4,D:0.5); ``` -------------------------------- ### Running IQ-TREE with Partition File Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Initiate IQ-TREE using a NEXUS file that defines partition schemes. For IQ-TREE version 1.x, use -spp instead of -p. ```bash iqtree -p example.nex # for version 1.x change -p to -spp ``` -------------------------------- ### Ultrafast Bootstrap with Partition Model (Site Resampling) Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Perform ultrafast bootstrapping with partition models, resampling sites within partitions. For IQ-TREE version 1.x, use -spp, -bb, and -bsam. ```bash iqtree -s example.phy -p example.nex -B 1000 # for version 1.x change -p to -spp and -B to -bb ``` -------------------------------- ### Determine Install Cmake Directory Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/CMakeLists.txt Sets the installation directory for CMake configuration files based on the operating system. ```cmake if(WIN32 AND NOT CYGWIN) set(INSTALL_CMAKE_DIR CMake) else() set(INSTALL_CMAKE_DIR ${LIB_INSTALL_DIR}/cmake/yaml-cpp) endif() ``` -------------------------------- ### Install CMake Configuration Files and Exported Targets Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/CMakeLists.txt Installs the CMake configuration files and exported targets when YAML_CPP_INSTALL is enabled. ```cmake install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev) install(EXPORT yaml-cpp-targets DESTINATION ${INSTALL_CMAKE_DIR}) ``` -------------------------------- ### Configure 32-bit IQ-TREE build on Windows Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide For Windows, when building the 32-bit version, specify the i686 target architecture and use MinGW Makefiles. ```bash cmake -G "MinGW Makefiles" -DCMAKE_C_FLAGS=--target=i686-pc-windows-gnu -DCMAKE_CXX_FLAGS=--target=i686-pc-windows-gnu -DCMAKE_MAKE_PROGRAM=mingw32-make .. ``` -------------------------------- ### Running IQ-TREE with Tip Dates for Time Tree Reconstruction Source: https://github.com/iqtree/iqtree3/wiki/Dating This command initiates IQ-TREE to perform model selection, ML tree inference, and time tree construction using tip dates. It requires the sequence alignment file and the prepared date file. ```bash iqtree -s ALN_FILE --date DATE_FILE ``` -------------------------------- ### Install DLLs for Non-Single-Threaded Builds on Windows Source: https://github.com/iqtree/iqtree3/blob/master/CMakeLists.txt Installs pthread and libiomp5md DLLs to the 'bin' directory on Windows for non-single-threaded builds, specifically when using MSVC or Clang. ```cmake if (WIN32) if (NOT IQTREE_FLAGS MATCHES "single" AND MSVC) install(FILES "${PROJECT_SOURCE_DIR}/lib/pthreadVC2.dll" DESTINATION bin) install(FILES "${PROJECT_SOURCE_DIR}/lib/libiomp5md.dll" DESTINATION bin) endif() if (NOT IQTREE_FLAGS MATCHES "single" AND CLANG) install(FILES "${PROJECT_SOURCE_DIR}/lib/libiomp5md.dll" DESTINATION bin) endif() endif() ``` -------------------------------- ### Configure 32-bit multicore IQ-TREE build Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide To build the 32-bit multicore version, include both 'omp' and 'm32' in the IQTREE_FLAGS. ```bash cmake -DIQTREE_FLAGS=omp-m32 .. ``` -------------------------------- ### Run IQ-TREE 2 from command line Source: https://github.com/iqtree/iqtree3/wiki/workshop/molevol2022 Invokes the IQ-TREE 2 executable from the command line. Ensure the IQ-TREE binary is in your system's PATH. ```bash iqtree2 ``` -------------------------------- ### Create Static Library on Unix Systems Source: https://github.com/iqtree/iqtree3/blob/master/CMakeLists.txt Creates a static library 'libiqtree.a' on Unix systems by unifying static libraries and then removing a potentially conflicting 'libiqtree3.a'. It uses a helper script for library unification. ```cmake elseif(UNIX) add_custom_command( TARGET iqtree3 POST_BUILD COMMAND mkdir all_libs COMMAND ln -s ${STATIC_LIBS} all_libs COMMAND ${PROJECT_SOURCE_DIR}/test_scripts/unify-static-libs.sh libiqtree.a all_libs COMMAND rm -rf all_libs COMMAND rm libiqtree3.a VERBATIM) ``` -------------------------------- ### NEXUS Cluster File Example Source: https://github.com/iqtree/iqtree3/wiki/Command-Reference An example of a NEXUS file format for defining taxon clusters for likelihood mapping analysis. Sequences are grouped into named sets. ```nexus #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; ``` -------------------------------- ### Example Simulated Alignment Output Source: https://github.com/iqtree/iqtree3/wiki/AliSim This is an example of the output format for a simulated multiple sequence alignment, showing the number of sequences, number of sites, and the aligned sequences. ```text 4 1000 A AAATTTGGTCCTGTGATTCAGCAGTGAT... B CTTCCACACCCCAGGACTCAGCAGTGAT... C CTACCACACCCCAGGACTCAGCAGTAAT... D CTACCACACCCCAGGAAACAGCAGTGAT... ``` -------------------------------- ### Run second phase of PMSF model analysis using .sitefreq file Source: https://github.com/iqtree/iqtree3/wiki/Complex-Models Run the second phase of the PMSF model analysis on a low-memory machine by providing the alignment and the pre-computed .sitefreq file. ```bash iqtree -s -m LG+C20+F+G -fs -b 100 ``` -------------------------------- ### Configure IQ-TREE with MPI compiler wrappers Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide Alternatively, configure the build by explicitly specifying the MPI C and C++ compiler wrappers. ```bash cmake -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx .. make -j4 ``` -------------------------------- ### Example Amino Acid Substitution Matrix (Q.plant) Source: https://github.com/iqtree/iqtree3/wiki/Estimating-amino-acid-substitution-models This is an example of the extracted Q.plant file, which contains the lower diagonal part of the AA exchange rates matrix and 20 AA frequencies in PAML format. ```text 0.120955 0.048462 0.458565 0.436023 0.037551 4.799928 0.470505 1.707355 0.338537 0.000100 0.261114 3.736017 0.605443 0.147890 0.286279 0.837596 0.016734 0.388965 5.815020 0.000100 4.138646 1.939708 1.199364 0.911021 1.413132 0.681747 0.419571 0.886564 ``` -------------------------------- ### Global re-optimization of a tree Source: https://github.com/iqtree/iqtree3/wiki/recipes/phylogenetic-placement Re-optimize an existing tree without constraints using the -t option to set the starting tree and -s for the alignment. This command starts from the best available tree estimate and further optimizes it. ```bash iqtree -s sequences.fa -t sequences.treefile -pre reoptimised ``` -------------------------------- ### Ancestral State Reconstruction Example Source: https://github.com/iqtree/iqtree3/wiki/Command-Reference Example command to perform ancestral state reconstruction using the JC+G model and ASR. The output file contains detailed information about ancestral states and their probabilities for each node and site. ```bash iqtree -s example.phy -m JC+G -asr ``` ```text # Ancestral state reconstruction for all nodes in example.phy.treefile # This file can be read in MS Excel or in R with command: # tab=read.table('example.phy.state',header=TRUE) # Columns are tab-separated with following meaning: # Node: Node name in the tree # Site: Alignment site ID # State: Most likely state assignment # p_X: Posterior probability for state X (empirical Bayesian method) Node Site State p_A p_C p_G p_T Node2 1 C 0.00004 0.99992 0.00002 0.00002 Node2 2 A 0.92378 0.00578 0.00577 0.06468 Node2 3 A 0.95469 0.02634 0.00675 0.01222 Node2 4 C 0.00002 0.99992 0.00002 0.00004 ... ``` -------------------------------- ### Running IQ-TREE with RAxML/NEXUS Partitions Source: https://github.com/iqtree/iqtree3/wiki/Dating Executes IQ-TREE using a specified partition file and a single model for all partitions. ```bash iqtree -s example.phy -Q example.nex -m GTR+G4 -te example_tree.nwk --dating mcmctree ``` -------------------------------- ### Adding CMaple Subdirectory Source: https://github.com/iqtree/iqtree3/blob/master/CMakeLists.txt Adds the 'cmaple' subdirectory to the build if USE_CMAPLE is ON. It also forces the installation of googletest to be OFF. ```cmake if (USE_CMAPLE STREQUAL "ON") SET(INSTALL_CMAPLE OFF CACHE BOOL "Disable installation of googletest" FORCE) add_subdirectory(cmaple) endif() ``` -------------------------------- ### Compile IQ-TREE with Make Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide Compile the source code using the 'make' command. The '-j' option utilizes all available CPU cores to speed up the compilation process. ```bash make -j ``` -------------------------------- ### Basic Gentrius Analysis with Subtree Set Source: https://github.com/iqtree/iqtree3/blob/master/terrace/README.md Start a Gentrius analysis by providing a file containing a set of subtrees. ```bash iqtree2 -gentrius ``` -------------------------------- ### Example Assertion Failure Message Source: https://github.com/iqtree/iqtree3/wiki/Frequently-Asked-Questions When reporting a bug, provide the assertion message if it appears on the screen. This helps developers pinpoint the issue. ```text iqtree: ....cpp:140: ...: Assertion '...' failed. ``` -------------------------------- ### Set Target Include Directories Source: https://github.com/iqtree/iqtree3/blob/master/yaml-cpp/CMakeLists.txt Configures include directories for the yaml-cpp target, differentiating between build and install interfaces, and private build includes. ```cmake target_include_directories(yaml-cpp PUBLIC $ $ PRIVATE $) ``` -------------------------------- ### Simulating with Edge-Proportional Partitions Source: https://github.com/iqtree/iqtree3/wiki/AliSim Initiate simulation using the '--alisim partition' command with the '-p' option for edge-proportional models. This ensures gene-specific rates are applied. ```bash iqtree3 --alisim partition -p multi_genes.nex -t tree.nwk ``` -------------------------------- ### Partitioned Analysis with RAxML-style File Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Run a partitioned analysis using a RAxML-style partition file. All partitions will use the same rate heterogeneity model specified in the -m option. ```bash iqtree -s example.phy -p example.partitions -m GTR+I+G # for version 1.x change -p to -spp ``` -------------------------------- ### Constraint Tree Topology Example Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial A sample constraint tree in NEWICK format, defining topological relationships between species for constrained tree searches. ```newick ((Human,Seal),(Cow,Whale)); ``` -------------------------------- ### Starting the Deflate Loop Source: https://github.com/iqtree/iqtree3/blob/master/zlib-1.2.7/examples/zlib_how.html Initiates the do-while loop for processing input data with the deflate function until the output buffer is full or compression is finished. ```c /* run deflate() on input until output buffer not full, finish compression if all of source has been read in */ do { ``` -------------------------------- ### Configure IQ-TREE with CMake Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide Use CMake to configure the build process. This command should be run from the build directory, pointing to the source directory with '..'. ```bash cmake .. ``` -------------------------------- ### MCMCtree Control File Configuration Source: https://github.com/iqtree/iqtree3/wiki/Dating Example configuration for an MCMCtree control file, specifying parameters for MCMC runs, data types, and evolutionary models. ```plaintext seed = -1 * The computer’s current time is used when seed < 0. seqfile = example.dummy.phy * A dummy alignment only allow to run MCMCtree treefile = example.rooted.nwk * Rooted newick tree with annotated fossil/tip dates mcmcfile = example.mcmctree.log * MCMC log of parameters that can be examined in Tracer outfile = example.mcmctree.out * Output of the summarized results of MCMCtree ckpfile = example..mcmctree.ckp * Checkpoint file of MCMCtree lessianfile = example.mcmctree.hessian * File with gradient and hessian matrix checkpoint = 1 * 0: nothing; 1 : save; 2: resume ndata = 1 * number of partitions seqtype = 0 * 0 : nucleotides; 1: codons; 2: AAs (not required if the approximate likelihood method is used) usedata = 2 * 0: sampling from priors with no data; 1: exact slow likelihood; 2: approximate likelihood clock = 2 * 1: global clock with equal rates; 2: independent rates; 3: correlated rates RootAge = <1.0 * safe constraint on root age, used if no fossil for root in the rooted tree file. BDparas = 1,1,0.5 * birth-rate, death rate, sampling priors for sampling times finetune = 1: 0.1 0.1 0.1 0.01 .5 * auto (0 or 1) : times, musigma2, rates, mixing, paras, FossilErr print = 1 * 1: normal output; 2: verbose output *** These parameters are used for multi-loci partitioned data (ndata > 1), see dos Reis et al.(2013) ``` -------------------------------- ### Find Best Partition Model Only (PartitionFinder Equivalent) Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Find the best partition model efficiently, mimicking PartitionFinder's approach. For IQ-TREE version 1.x, use -spp instead of -p. ```bash iqtree -s example.phy -p example.nex -m TESTMERGEONLY # for version 1.x change -p to -spp ``` -------------------------------- ### Symmetry Test Results Format Source: https://github.com/iqtree/iqtree3/wiki/Assessing-Phylogenetic-Assumptions Example structure of the .symtest.csv file generated by IQ-TREE, detailing results from matched-pair tests of symmetry for alignment partitions. ```csv # Matched-pair tests of symmetry # This file can be read in MS Excel or in R with command: # dat=read.csv('example.nex.symtest.csv',comment.char='#') # Columns are comma-separated with following meanings: # Name: Partition name # SymSig: Number of significant sequence pairs by test of symmetry # SymNon: Number of non-significant sequence pairs by test of symmetry # SymPval: P-value for maximum test of symmetry # MarSig: Number of significant sequence pairs by test of marginal symmetry # MarNon: Number of non-significant sequence pairs by test of marginal symmetry # MarPval: P-value for maximum test of marginal symmetry # IntSig: Number of significant sequence pairs by test of internal symmetry # IntNon: Number of non-significant sequence pairs by test of internal symmetry ``` -------------------------------- ### Configure zlib.pc and zconf.h Source: https://github.com/iqtree/iqtree3/blob/master/zlib-1.2.7/CMakeLists.txt Configures the 'zlib.pc' pkgconfig file and the 'zconf.h' header file using CMake's configure_file command with '@ONLY' variable substitution. ```cmake set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) ``` -------------------------------- ### Run UFBoot with IQ-TREE Source: https://github.com/iqtree/iqtree3/wiki/Tutorial Use the -B option to specify the number of bootstrap replicates for UFBoot. 1000 is the minimum recommended number. For IQ-TREE version 1.x, use -bb instead of -B. ```bash iqtree -s example.phy -m TIM2+I+G -B 1000 # for version 1.x change -B to -bb ``` -------------------------------- ### Combining ECMK07 and GY2K Models Source: https://github.com/iqtree/iqtree3/wiki/Substitution-Models Example of a combined empirical-mechanistic codon model where rate entries are a multiplication of corresponding rate matrices from ECMK07 and GY2K models. ```text ECMK07_GY2K ``` -------------------------------- ### Find Best Partition Scheme, Tree Inference, and Bootstrap Source: https://github.com/iqtree/iqtree3/wiki/Quickstart Find the best partition scheme, followed by tree inference and ultrafast bootstrap with 1000 replicates. For version 1.x, change -B to -bb. ```bash iqtree -s example.phy -p example.nex -m MFP+MERGE -B 1000 # for version 1.x change -B to -bb ``` -------------------------------- ### Specify Empirical Amino-Acid Frequencies Source: https://github.com/iqtree/iqtree3/wiki/Substitution-Models Use the +F option to specify empirical amino-acid frequencies from the data. This example shows how to provide a custom list of frequencies. ```bash +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} ``` -------------------------------- ### Increase maximum categories for model testing Source: https://github.com/iqtree/iqtree3/wiki/Tutorial Increase the maximum number of categories tested for models, useful for longer sequence alignments. This example tests up to +R15. ```bash iqtree -s example.phy -m MF -cmax 15 ``` -------------------------------- ### NEXUS Partition File with Non-Consecutive Sites Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Example of a NEXUS partition file defining a character set with non-consecutive sites, useful for extracting codon positions. ```nexus #nexus begin sets; charset part1 = 1-100 200-384; charset part1 = 1-100\3; end; ``` -------------------------------- ### Estimate Linked Exchangeabilities Source: https://github.com/iqtree/iqtree3/wiki/Command-Reference Use this command to estimate linked exchangeabilities for a protein alignment under a specified model and guide tree, initializing optimization from existing exchangeabilities. ```bash iqtree -s prot.phy -m GTR20+C60+G --link-exchange --init-exchange LG -te guide.treefile ``` -------------------------------- ### Infer ML Tree with Partition Model and Ultrafast Bootstrap Source: https://github.com/iqtree/iqtree3/wiki/Command-Reference Reconstruct an ML tree and perform ultrafast bootstrap (5000 replicates) using a partition model file. ```bash iqtree -s data.phy -spp partition.nex -m TEST -bb 5000 ``` -------------------------------- ### Constrained Tree Search with IQ-TREE Source: https://github.com/iqtree/iqtree3/wiki/Advanced-Tutorial Applies a constraint to guide the tree search. Use `--prefix` (or `-pre` for v1.x) to specify an output file prefix. ```bash iqtree -s example.phy -m TIM2+I+G -g example.constr1 --prefix example.constr1 # for version 1.x change --prefix to -pre ``` -------------------------------- ### Specify OpenMP paths for macOS compilation Source: https://github.com/iqtree/iqtree3/wiki/Compilation-Guide If OpenMP include or library files are not found, set these environment variables before running CMake. Adjust the paths to your OpenMP installation. ```bash export LDFLAGS="-L/opt/homebrew/opt/libomp/lib" export CPPFLAGS="-I/opt/homebrew/opt/libomp/include" cmake -DCMAKE_CXX_FLAGS="$LDFLAGS $CPPFLAGS" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. ``` -------------------------------- ### Basic IQ-TREE Invocation Source: https://github.com/iqtree/iqtree3/wiki/Command-Reference This is the fundamental command structure for running IQ-TREE. Replace `` with the path to your sequence alignment file. Options can be appended as needed. ```bash iqtree -s [OPTIONS] ``` -------------------------------- ### Simulating DNA Alignment with Jukes-Cantor Model Source: https://github.com/iqtree/iqtree3/wiki/AliSim Example of simulating a DNA alignment using the Jukes-Cantor model and a provided Newick tree file. The output is saved to 'alignment.phy'. ```bash iqtree3 --alisim alignment -m "JC" -t tree.nwk ```