BEAST
In this section:
Description
According to the BEAST documentation, BEAST (Bayesian Evolutionary Analysis Sampling Trees) is a cross-platform program for Bayesian analysis of molecular sequences using MCMC, focused on phylogenies with molecular clock dating.
Available Versions
beast/1.8.4
beast/1.10.4
beast/2.4.7 (default)
Job Submission with BEAST 1.x
submit_beast1.sh
#!/bin/bash
#SBATCH -J beast1
#SBATCH -N 1
#SBATCH -c 28
#SBATCH -t 5-00:00:00
#SBATCH --mem=32G
export INPUT="input.xml"
export OUTPUT="*.log *.ops *.trees"
module load beast/1.10.4
# Using all available threads
job-nanny beast -beagle_instances $SLURM_CPUS_PER_TASK \
-threads $SLURM_CPUS_PER_TASK \
-beagle_multipartition on input.xml
Job Submission with BEAST 2
submit_beast2.sh
#!/bin/bash
#SBATCH -J beast2
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 7-00:00:00
#SBATCH --mem=64G
export INPUT="input.xml"
export OUTPUT="*.log *.ops *.trees"
module load beast/2.4.7
# BEAST 2 uses Java
job-nanny java -jar $BEAST_DIR/lib/beast.jar -threads $SLURM_CPUS_PER_TASK input.xml
Job Submission with BEAGLE (acceleration)
BEAGLE is a library for accelerating phylogenetic calculations, available in recent versions of BEAST.
submit_beast_beagle.sh
#!/bin/bash
#SBATCH -J beast_beagle
#SBATCH -N 1
#SBATCH -c 28
#SBATCH -t 5-00:00:00
#SBATCH --mem=32G
export INPUT="input.xml"
export OUTPUT="*.log *.ops *.trees"
module load beast/1.10.4
job-nanny beast -beagle -beagle_GPU -beagle_instances $SLURM_CPUS_PER_TASK \
-threads $SLURM_CPUS_PER_TASK -beagle_multipartition on input.xml
Job Array for Multiple Runs
To perform multiple independent runs (for example, to check convergence):
submit_beast_array.sh
#!/bin/bash
#SBATCH -J beast_array
#SBATCH --array=1-10
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 5-00:00:00
#SBATCH --mem=32G
#SBATCH --output=beast_%A_%a.out
export INPUT="input.xml"
export OUTPUT="run_${SLURM_ARRAY_TASK_ID}/"
module load beast/2.4.7
# Create directory for this run
mkdir -p run_${SLURM_ARRAY_TASK_ID}
cp input.xml run_${SLURM_ARRAY_TASK_ID}/
cd run_${SLURM_ARRAY_TASK_ID}
job-nanny java -jar $BEAST_DIR/lib/beast.jar -seed $SLURM_ARRAY_TASK_ID input.xml
Example XML File
example.xml
<?xml version="1.0" encoding="UTF-8"?>
<beast>
<taxa id="taxa">
<taxon id="seq1"/>
<taxon id="seq2"/>
<taxon id="seq3"/>
</taxa>
<alignment id="alignment" dataType="nucleotide">
<sequence>
<taxon idref="seq1"/>
ATCGATCGATCG...
</sequence>
<!-- more sequences -->
</alignment>
<run id="mcmc" chainLength="10000000">
<state>
<tree name="tree" id="tree"/>
<parameter name="kappa" id="kappa" value="2.0"/>
</state>
<distribution id="posterior">
<distribution id="likelihood" spec="TreeLikelihood">
<data idref="alignment"/>
<tree idref="tree"/>
<siteModel id="siteModel">
<substModel id="substModel" spec="HKY">
<kappa idref="kappa"/>
</substModel>
</siteModel>
</distribution>
</distribution>
<operator id="kappaScaler" spec="ScaleOperator" scaleFactor="0.5" weight="1">
<parameter idref="kappa"/>
</operator>
<logger id="tracelog" fileName="output.log">
<log idref="kappa"/>
<log idref="posterior"/>
</logger>
</run>
</beast>
Analysis Tools
The BEAST package includes tools for analyzing results:
# Tracer - convergence analysis
tracer output.log
# TreeAnnotator - tree summary
treeannotator -heights mean -burnin 1000 trees.tree annotated.tree
# LogCombiner - combine multiple runs
logcombiner -burnin 1000 -log output1.log -log output2.log -o combined.log
References
BEAST documentation: http://beast.community/
Tutorials: http://beast.community/tutorials
See also
RAxML - Maximum likelihood alternative
ExaBayes - Bayesian alternative
Running Simulations - How to submit jobs