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
- Open the BEAUti application.
- Go to the Partitions tab.
- Click the “+” button in the lower left corner or use the shortcut
Cmd + Oto select your sequence file (e.g., .fasta, .nexus). - 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
- Go to the Site Model tab.
- Select a substitution model for each partition. Click the “Substitution Model” dropdown menu, for example, select HKY.
- 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
- Go to the Clock Model tab.
- Select the clock type according to the analysis purpose. For analyses with time calibration points, Relaxed Clock Log Normal is often chosen.
- The prior for the Clock Rate will be set in the next step under “Priors”.
Step 4: Set the tree prior
- Go to the Trees tab.
- 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
- Go to the Priors tab. This lists all the parameters for which priors need to be set.
- Click the drop-down menu to the right of each parameter and select an appropriate distribution. For example:
- clockRate: Can be set to a
GammaorLog Normaldistribution, 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
Uniformdistribution). - 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 ModelorMRCA Prior, and specify the time distribution (e.g.,Normal,Log Normal).
- clockRate: Can be set to a
Step 6: Configure the MCMC run parameters
- Go to the MCMC tab.
- 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.
- Click the Generate XML button or use the shortcut
Cmd + Sto save the configuration file as an .xml file.
2.2 Step 2: Run BEAST Analysis
- Open the Terminal application.
- Use the
cdcommand to navigate to the directory where the .xml configuration file is stored. For example:cd ~/Desktop/beast_analysis - Enter the run command. The basic format is:
beast -threads 4 your_config.xml-threads 4means using 4 CPU threads to speed up computation (adjust according to your Mac’s core count).
- 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
- Open the Tracer application.
- Click the “+” button in the upper left corner or use
Cmd + Oto import the .log file generated by the BEAST run. - 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).
- 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
- Open the TreeAnnotator application.
- 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.
- Click the Run button.
Action 2: Use FigTree to beautify and annotate the tree
- Open the FigTree application.
- Use
Cmd + Oto open the .tre file generated by TreeAnnotator. - 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.
- Use
Cmd + Eto 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.xmlcan 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:
- 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.
- Use the `-threads` parameter to specify more CPU threads.
- In the Site Model in BEAUti, try reducing the number of Gamma categories (e.g., from 8 to 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:
- Increase the MCMC Chain Length and run for a longer time.
- Adjust the prior distributions and avoid using priors that are too vague or unreasonable.
- Try reparameterizing the parameters (e.g., using logarithmic or logit transformations for some parameters).
- Run multiple chains, check whether they converge to the same posterior distribution, and then combine them.








