BEAST for Mac: A Detailed User Guide

Source: 爱上MAC  |  Software download link: BEAST for Mac

BEAST (Bayesian Evolutionary Analysis by Sampling Trees) is a powerful cross-platform software for Bayesian evolutionary analysis of molecular sequences using Markov chain Monte Carlo (MCMC) methods. It is particularly suited for core research areas in evolutionary biology, including phylogenetic tree estimation, divergence time estimation, and inference of population dynamics history. This document provides a detailed introduction to its core interface, complete workflow, and operational tips on the macOS system.

I. Detailed Explanation of the Core Interface and Workspace

The operation of BEAST mainly relies on two core graphical interface programs: BEAUti (used to set analysis parameters and generate input files) and FigTree (used to visualize analysis results). The main analysis engine BEAST itself is usually run via the command line, but its parameter configuration is completed entirely in BEAUti.

1.1 BEAUti Main Interface

BEAUti is the tool for creating BEAST analysis XML configuration files. Its interface consists of a series of tabs:

  • Partitions: Load and manage sequence data (such as FASTA format), define different data partitions and substitution models.
  • Site Models: Specify parameters such as the nucleotide or amino acid substitution model (e.g., HKY, GTR), Gamma rate heterogeneity, and among-site variation for each partition.
  • Clock Models: Select the molecular clock type. The most commonly used are “Strict Clock” and “Relaxed Clock Log Normal,” the latter of which allows evolutionary rates to vary among branches.
  • Trees: Specify the tree prior. For example, “Coalescent Constant Population” is used for population data, “Yule Process” is used for species-level data, and “Birth-Death Process” is also a commonly used option.
  • Priors: Set prior probability distributions for all model parameters (such as evolutionary rates, population sizes, and divergence times). This is a key step in Bayesian analysis.
  • MCMC (Markov Chain Monte Carlo): Set the run parameters. This includes chain length, sampling frequency (log every), screen output frequency, etc. The final output files (.log, .trees) are also defined here.
  • Tips: Display a brief description of the currently selected parameters.

1.2 Logs and Result Viewing

After BEAST runs, it mainly generates two types of files:

  • .log files: Contain sampling records of all numerical parameters (such as likelihood values, branch lengths, and population sizes) during the MCMC run. They can be opened with Tracer software (one of the BEAST packages) to assess convergence, effective sample size (ESS), and summarize parameter estimates.
  • .trees file: Contains all sampled system发育 trees. You can use TreeAnnotator (one of the BEAST packages) to generate a Maximum Clade Credibility Tree, and then use FigTree for beautification and visualization.

II. Complete Workflow: From Project Creation to Result Export

2.1 Step One: Preparing the Analysis File in BEAUti

Operation 1: Import Sequence Data

  1. Open the BEAUti application.
  2. Go to the Partitions tab.
  3. Click the “+” button in the lower left corner or use the shortcut Cmd + O to select your sequence file (e.g., .fasta, .nexus).
  4. After the data is loaded, you can usually keep the default settings. If the data has multiple partitions (e.g., different genes), you can click “Ungroup” under “Partition” and then “Group” again to define partitions.

Operation 2: Setting the Site Model

  1. Go to the Site Model tab.
  2. Select a substitution model for each partition. Click the “Substitution Model” dropdown menu, for example, select HKY.
  3. You usually need to check Gamma Category Count (e.g., set to 4) to model rate heterogeneity, and check the “Heterogeneous” model (if applicable).

Operation 3: Setting the Clock Model

  1. Go to the Clock Model tab.
  2. Select the clock type according to the analysis purpose. For analyses with time calibration points, Relaxed Clock Log Normal is often chosen.
  3. The prior for the Clock Rate will be set in the next step under “Priors”.

Step 4: Set the tree prior

  1. Go to the Trees tab.
  2. Select an appropriate prior from the “Tree Prior” drop-down menu. For example, for multi-species data, choose the Yule Model or the Birth-Death Model.

Step 5: Set the prior distributions

  1. Go to the Priors tab. This lists all the parameters for which priors need to be set.
  2. Click the drop-down menu to the right of each parameter and select an appropriate distribution. For example:
    • clockRate: Can be set to a Gamma or Log Normal distribution, or set to a fixed value based on known information.
    • treeModel.rootHeight: The root node height. If the data have time stamps, a reasonable prior can be set (e.g., a Uniform distribution).
    • If there are fossils or time calibration points, you need to select the corresponding node on the tree, then click “Add Prior” in the lower left corner, choose Calibrated Yule Model or MRCA Prior, and specify the time distribution (e.g., Normal, Log Normal).

Step 6: Configure the MCMC run parameters

  1. Go to the MCMC tab.
  2. Set the key parameters:
    • Chain Length: The number of MCMC steps. Usually requires millions to tens of millions, depending on the data size and model complexity.
    • Store Every and Log Every: Sampling frequency. Usually set to around Chain Length / 10000 to ensure approximately 10,000 effective samples are obtained.
    • In the “File Name” field, specify the prefix for the output log file and tree file.
  3. Click the Generate XML button or use the shortcut Cmd + S to save the configuration file as an .xml file.

2.2 Step 2: Run BEAST Analysis

  1. Open the Terminal application.
  2. Use the cd command to navigate to the directory where the .xml configuration file is stored. For example: cd ~/Desktop/beast_analysis
  3. Enter the run command. The basic format is: beast -threads 4 your_config.xml
    • -threads 4 means using 4 CPU threads to speed up computation (adjust according to your Mac’s core count).
  4. Press Enter to execute. Once the analysis begins, the terminal will display the current progress, the time required per million steps, and the estimated remaining time.

Tip: You can drag the .xml file directly onto the BEAST application icon, which will launch the analysis in a new window with a graphical progress bar — more user-friendly than the pure command line.

2.3 Step 3: Evaluate Results with Tracer

  1. Open the Tracer application.
  2. Click the “+” button in the upper left corner or use Cmd + O to import the .log file generated by the BEAST run.
  3. Select a parameter on the left (e.g., `posterior`, `likelihood`, `clockRate`), and the right side will display its trace plot (Trace) and marginal posterior distribution (Marginal Density).
  4. Check key metrics:
    • ESS (Effective Sample Size): Check in the bottom panel. Ideally, the ESS for all important parameters should be greater than 200, indicating sufficient sampling.
    • Trace plot: It should look like a “hairy caterpillar,” stable with no trend, indicating the chain has converged.

2.4 Step 4: Generate and visualize the final phylogenetic tree

Action 1: Use TreeAnnotator to generate a consensus tree

  1. Open the TreeAnnotator application.
  2. Set the parameters:
    • Input Tree File: Select the .trees file output by BEAST.
    • Output File: Specify the output tree file name (e.g., .tre).
    • Burnin percentage: Set the burn-in period (e.g., 10-25%) to exclude initially unconverged samples.
    • Posterior probability limit: Usually keep the default (0.5).
    • Target tree type: Select Maximum clade credibility tree.
    • Node heights: Select Mean heights.
  3. Click the Run button.

Action 2: Use FigTree to beautify and annotate the tree

  1. Open the FigTree application.
  2. Use Cmd + O to open the .tre file generated by TreeAnnotator.
  3. In the left control panel, you can:
    • Check Node Labels and select posterior to display node posterior probabilities.
    • In Branch Labels, you can choose to display other information.
    • In Appearance, adjust the tree shape (rectangular, curved, etc.), colors, and font size.
    • In Scale Axis, display the time scale or branch length scale.
  4. Use Cmd + E to export the final tree as a PDF, SVG, or PNG image.

III. Advanced Tips for Common Features

  • Multithreading and High-Performance Computing: When running BEAST in the terminal, use the `-beagle` and `-threads` parameters to fully leverage the BEAGLE library and multiple CPU cores. For example: beast -beagle -threads 8 your_config.xml can significantly speed up computation.
  • Running Multiple Chains in Parallel and Combining Them: For complex analyses, you can run multiple independent MCMC chains (by changing the `seed` value), then use LogCombiner (a BEAST package tool) to combine the .log and .trees files to achieve better mixing and higher ESS values.
  • Path Sampling and Model Comparison: BEAST supports calculating marginal likelihoods through path sampling or stepping stone sampling, thereby enabling rigorous model selection (such as comparing a strict clock with a relaxed clock). This requires checking the corresponding option in the MCMC tab of BEAUti and setting the path points.
  • Using the Template Feature: After completing a complex model setup in BEAUti, you can save it as a template via File -> Save Template. When analyzing similar data in the future, load it via File -> Load Template, and you only need to replace the sequence data, greatly improving efficiency.

IV. Common Issues and Solutions

Issue 1: BEAST runs very slowly.

  • Solution:
    1. Make sure the BEAGLE library is installed and enabled (the BEAST installation package usually includes it). Add the `-beagle` flag when running commands in the terminal.
    2. Use the `-threads` parameter to specify more CPU threads.
    3. In the Site Model in BEAUti, try reducing the number of Gamma categories (e.g., from 8 to 4).
    4. Check whether the model is overly complex. You can first run a simplified model (e.g., strict clock, simple tree prior) as a test.

Issue 2: The ESS values of parameters shown in Tracer are too low (< 200).

  • Solution:
    1. Increase the MCMC Chain Length and run for a longer time.
    2. Adjust the prior distributions and avoid using priors that are too vague or unreasonable.
    3. Try reparameterizing the parameters (e.g., using logarithmic or logit transformations for some parameters).
    4. Run multiple chains, check whether they converge to the same posterior distribution, and then combine them.

Issue 3: BEAST reports an error when running, saying “Initial likelihood calculation failed”.

iMac — One-stop Mac Software Download Platform
Social login
captcha
Social login