bioinformatics/beast2:2.7.8
Version sha256.04d7d4eb42aa40fac3bf63f544854c6b1700a7eb7004bf4b9abb8d5ff38a19f0
Image size: 119.5 MB
For more on pulling from the registry, see the ilifu documentation.
First, once: add the registry and make it your default
singularity remote add --no-login idia-registry https://sregistry.idia.ac.za
singularity remote use idia-registry
If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.
Log in, for a private collection
singularity remote login idia-registry
Paste a token from your token page when asked. Public collections need no login.
Pull the container
singularity pull library://bioinformatics/beast2:2.7.8
Shell into the container
singularity shell library://bioinformatics/beast2:2.7.8
Run the container
singularity run library://bioinformatics/beast2:2.7.8
First, once: add the registry and make it your default
apptainer remote add --no-login idia-registry https://sregistry.idia.ac.za
apptainer remote use idia-registry
If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.
Log in, for a private collection
apptainer remote login idia-registry
Paste a token from your token page when asked. Public collections need no login.
Pull the container
apptainer pull library://bioinformatics/beast2:2.7.8
Shell into the container
apptainer shell library://bioinformatics/beast2:2.7.8
Run the container
apptainer run library://bioinformatics/beast2:2.7.8
BEAST 2 2.7.8 by Remco Bouckaert, Alexei Drummond and the BEAST 2 development team at the
Centre for Computational Evolution, University of Auckland (https://www.beast2.org,
https://github.com/CompEvol/beast2).
This image packages the unmodified upstream release: the BEAST v2.7.7 Linux bundle, with its
own Java 17 + JavaFX runtime, plus the BEAST.base and BEAST.app 2.7.8 packages, which is how
upstream distributes 2.7.8. IDIA builds and maintains the image only; please report BEAST bugs
upstream at https://github.com/CompEvol/beast2/issues (or the beast-users group,
https://groups.google.com/g/beast-users). Problems with the image itself go to
support@ilifu.ac.za.
BEAST 2 is free software under the GNU Lesser General Public License, version 2.1 or later
(LGPL-2.1-or-later; the source headers say "version 2 ... or any later version");
the licence text is in /opt/beast/LICENSE.txt and the sources are the *.src.jar files under
/opt/beast/lib. The bundled Azul Zulu Java runtime and OpenJFX are GPL-2.0 with the
Classpath Exception; see /opt/beast/jre/legal and /opt/beast/jre/OPENJFX_LICENSE. The Java
runtime is the one upstream bundles with 2.7.7 (Azul Zulu 17.0.3, April 2022). If you use
BEAST 2 in published work, please cite it as upstream asks (https://www.beast2.org/citation/):
Bouckaert R, Vaughan TG, Barido-Sottani J, et al. "BEAST 2.5: An advanced software platform
for Bayesian evolutionary analysis." PLoS Computational Biology 15(4): e1006650 (2019).
Cite any add-on packages you use as well.
Usage:
singularity run beast2_2.7.8.sif -seed 42 -threads 4 analysis.xml
singularity run --app treeannotator beast2_2.7.8.sif -burnin 10 run.trees mcc.tree
singularity run --app logcombiner beast2_2.7.8.sif -b 10 -log run1.log run2.log -o all.log
singularity run --app loganalyser beast2_2.7.8.sif run.log
singularity run --app packagemanager beast2_2.7.8.sif -add BEAST_CLASSIC
singularity exec beast2_2.7.8.sif beast -help
Apps: beast, treeannotator, logcombiner, loganalyser, applauncher, packagemanager.
BEAST needs no reference data. It reads an XML analysis (make it with BEAUti on your own
computer) and writes its logs to the working directory, so work in a directory the container
can see ($HOME and the current directory are bound by default; add --bind for others).
This image is command-line only. The GUIs (BEAUti, DensiTree, and the dialogs the tools open
when run with no arguments) need desktop libraries the image doesn't include. BEAGLE isn't
included either, so BEAST uses its built-in Java likelihood code. To use your own BEAGLE
build, bind it and set SINGULARITYENV_BEAGLE_LIB to its directory.
Settings (set them on the host as SINGULARITYENV_<name>):
BEAST_MAX_HEAP Java maximum heap, as upstream's -Xmx (default 8g). Keep it below your
job's memory limit.
BEAST_PACKAGE_DIR Where add-on packages are installed and loaded from (default
$HOME/.beast/2.7.8). This is NOT upstream's default ~/.beast/2.7, so
packages for another BEAST 2.7 install, and its cached package path,
don't get mixed in. Install add-ons again here with packagemanager.
BEAST_JAVA_OPTS Extra JVM options, separated by spaces.
BEAST_PACKAGE_PATH Extra package directories, separated by colons (read by BEAST itself).
"beast -version" reports the launcher as "BEAST v2.7.7" and then lists
"BEAST.base v2.7.8" and "BEAST.app v2.7.8": the 2.7.8 release has no new launcher.
Upstream's own launch scripts are in /opt/beast/bin, but they use ~/.beast/2.7 and a fixed
8 GB heap; the commands on the PATH are IDIA's wrappers around the same Java classes.
This image has 6 apps. Pick one to see how to use it.
singularity run --app applauncher library://bioinformatics/beast2:2.7.8
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Help
Lists and runs the command-line apps that BEAST 2 packages provide. -list shows them; to
run one, give its class name or description, then its arguments. With no arguments it
opens a GUI, which this image can't show.
singularity run --app applauncher beast2_2.7.8.sif -list
Docs: https://www.beast2.org/2019/09/26/command-line-tricks.html
Runs
exec /usr/local/bin/applauncher "$@"
singularity run --app beast library://bioinformatics/beast2:2.7.8
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Help
Runs a BEAST 2 analysis: Bayesian MCMC on an XML file made with BEAUti. Logs and trees go
to the working directory; -resume continues a stopped run from its .state file, and
-overwrite replaces existing logs (without either, BEAST asks before overwriting). The Java
heap is 8g unless you set SINGULARITYENV_BEAST_MAX_HEAP (see the image's help).
singularity run --app beast beast2_2.7.8.sif -seed 42 -threads 4 analysis.xml
Docs: https://www.beast2.org/2021/03/31/command-line-options.html
Runs
exec /usr/local/bin/beast "$@"
singularity run --app loganalyser library://bioinformatics/beast2:2.7.8
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Help
Prints summary statistics for every column of a BEAST trace log: mean, stderr, stddev,
median, 95% HPD interval, ACT and ESS. -b is the burn-in percentage (default 10), and
-oneline prints one line per file when you give several logs. The image runs it through
AppLauncher, so installed add-on packages are loaded first.
singularity run --app loganalyser beast2_2.7.8.sif -b 10 run.log
Docs: https://www.beast2.org/2019/09/26/command-line-tricks.html
Runs
exec /usr/local/bin/loganalyser "$@"
singularity run --app logcombiner library://bioinformatics/beast2:2.7.8
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Help
Combines the trace (.log) or tree (.trees) files of independent runs of the same analysis
into one, dropping a burn-in from each. -b is the burn-in percentage per file (default
10), and -resample N keeps only states that are multiples of N. Without -o it writes to
stdout; "logcombiner -help" lists every option.
singularity run --app logcombiner beast2_2.7.8.sif -b 10 -log run1.trees -log run2.trees -o combined.trees
Docs: https://www.beast2.org/2019/09/26/command-line-tricks.html
Runs
exec /usr/local/bin/logcombiner "$@"
singularity run --app packagemanager library://bioinformatics/beast2:2.7.8
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Help
Lists, installs and removes BEAST 2 add-on packages from the command line (-list, -add,
-del; -version picks a version). Packages go into BEAST_PACKAGE_DIR, $HOME/.beast/2.7.8
by default, where beast then finds them. It downloads from the package repository, so it
needs internet access; -useAppDir can't work, as the image is read-only.
singularity run --app packagemanager beast2_2.7.8.sif -add BEAST_CLASSIC
Docs: https://www.beast2.org/managing-packages/
Runs
exec /usr/local/bin/packagemanager "$@"
singularity run --app treeannotator library://bioinformatics/beast2:2.7.8
This works once you've added the registry as a remote (see the CLI tab). Add the app's arguments after the command. With Apptainer, start it with apptainer instead.
Help
Summarises the posterior trees from a BEAST run as one tree: by default the maximum clade
credibility tree with common-ancestor node heights (-topology MCC -height CA); -height
median and -topology MSCC are alternatives. -burnin is the percentage of trees to discard
(default 10).
singularity run --app treeannotator beast2_2.7.8.sif -burnin 10 -height median run.trees mcc.tree
Docs: https://www.beast2.org/treeannotator/
Runs
exec /usr/local/bin/treeannotator "$@"
Bootstrap: docker
From: debian:13-slim
Stage: build
%post
# BEAST 2.7.8 is a package-only release: upstream's install is the 2.7.7 bundle (which
# ships its own Java 17 + JavaFX runtime) with the BEAST.base and BEAST.app packages
# updated to 2.7.8.
BUNDLE_VERSION=2.7.7
BEAST_VERSION=2.7.8
BUNDLE_SHA256=a866f3e5da4ef890a042f01849e32322aa0a8e16e3e1cb2c59f823de2611781a
BASE_SHA256=c18e33dd3cbe126050a0881c658c0051495bcee0496384c5157006605b727f46
APP_SHA256=89088b592e635d47b735d5557d938d8a8d80965a9609466e6f3c42b4aba85001
RELEASES=https://github.com/CompEvol/beast2/releases/download
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl unzip
mkdir -p /tmp/beast2
cd /tmp/beast2 || exit 1
curl -fsSL -o bundle.tgz "${RELEASES}/v${BUNDLE_VERSION}/BEAST.v${BUNDLE_VERSION}.Linux.x86.tgz"
curl -fsSL -o base.zip "${RELEASES}/v${BEAST_VERSION}/BEAST.base.package.v${BEAST_VERSION}.zip"
curl -fsSL -o app.zip "${RELEASES}/v${BEAST_VERSION}/BEAST.app.package.v${BEAST_VERSION}.zip"
printf '%s %s\n%s %s\n%s %s\n' \
"${BUNDLE_SHA256}" bundle.tgz \
"${BASE_SHA256}" base.zip \
"${APP_SHA256}" app.zip | sha256sum -c -
tar -xzf bundle.tgz --no-same-owner -C /opt
test -x /opt/beast/jre/bin/java || exit 1
# A read-only system package directory: the wrappers point beast.system.package.dir at it,
# so BEAST finds the 2.7.8 packages even when the user's package directory isn't writable.
for package in base app; do
mkdir -p "/opt/beast/packages/BEAST.${package}"
unzip -q "${package}.zip" -d "/opt/beast/packages/BEAST.${package}"
grep -q "name=.BEAST.${package}. version=.${BEAST_VERSION}." \
"/opt/beast/packages/BEAST.${package}/version.xml" || exit 1
done
# On first run the launcher copies lib/packages into the user's package directory, so put
# the 2.7.8 jars there too, plus the 2.7.8 examples and BEAUti templates.
for package in base app; do
package_dir="/opt/beast/packages/BEAST.${package}"
cp "${package_dir}/lib/BEAST.${package}.jar" "${package_dir}/BEAST.${package}.src.jar" \
/opt/beast/lib/packages/
cp "${package_dir}/version.xml" "/opt/beast/lib/packages/BEAST.${package}.version.xml"
done
# NOTE: this stores the 2.7.8 jars twice (packages/ and lib/packages, about 7 MB), and the
# launcher copies a third set into the user dir, so "beast -version" lists BEAST.base and
# BEAST.app twice. The copies are identical, so loading works. Keeping lib/packages at
# 2.7.7 instead would make the launcher copy the old jars into the user dir, which is worse.
cp /opt/beast/packages/BEAST.app/examples/*.xml /opt/beast/examples/
cp /opt/beast/packages/BEAST.app/fxtemplates/* /opt/beast/fxtemplates/
# NOTE: the GUI-only native libraries in jre/ (JavaFX WebKit, GStreamer, media, GTK glass,
# prism, awt_xawt; about 85 MB), lib/DensiTree.jar and bin/beauti and bin/densitree are kept
# although they can't load here: the image ships upstream's bundle unmodified, and
# BeastMain imports JavaFX classes, so pruning the JRE risks breaking the command-line tools.
cd / || exit 1
rm -rf /tmp/beast2
Bootstrap: docker
From: debian:13-slim
Stage: final
%files from build
/opt/beast /opt/beast
%labels
Maintainer IDIA <support@ilifu.ac.za>
Version 2.7.8
Source https://github.com/CompEvol/beast2
License LGPL-2.1-or-later
Authors Remco Bouckaert, Alexei Drummond and the BEAST 2 development team (Centre for Computational Evolution, University of Auckland)
%help
BEAST 2 2.7.8 by Remco Bouckaert, Alexei Drummond and the BEAST 2 development team at the
Centre for Computational Evolution, University of Auckland (https://www.beast2.org,
https://github.com/CompEvol/beast2).
This image packages the unmodified upstream release: the BEAST v2.7.7 Linux bundle, with its
own Java 17 + JavaFX runtime, plus the BEAST.base and BEAST.app 2.7.8 packages, which is how
upstream distributes 2.7.8. IDIA builds and maintains the image only; please report BEAST bugs
upstream at https://github.com/CompEvol/beast2/issues (or the beast-users group,
https://groups.google.com/g/beast-users). Problems with the image itself go to
support@ilifu.ac.za.
BEAST 2 is free software under the GNU Lesser General Public License, version 2.1 or later
(LGPL-2.1-or-later; the source headers say "version 2 ... or any later version");
the licence text is in /opt/beast/LICENSE.txt and the sources are the *.src.jar files under
/opt/beast/lib. The bundled Azul Zulu Java runtime and OpenJFX are GPL-2.0 with the
Classpath Exception; see /opt/beast/jre/legal and /opt/beast/jre/OPENJFX_LICENSE. The Java
runtime is the one upstream bundles with 2.7.7 (Azul Zulu 17.0.3, April 2022). If you use
BEAST 2 in published work, please cite it as upstream asks (https://www.beast2.org/citation/):
Bouckaert R, Vaughan TG, Barido-Sottani J, et al. "BEAST 2.5: An advanced software platform
for Bayesian evolutionary analysis." PLoS Computational Biology 15(4): e1006650 (2019).
Cite any add-on packages you use as well.
Usage:
singularity run beast2_2.7.8.sif -seed 42 -threads 4 analysis.xml
singularity run --app treeannotator beast2_2.7.8.sif -burnin 10 run.trees mcc.tree
singularity run --app logcombiner beast2_2.7.8.sif -b 10 -log run1.log run2.log -o all.log
singularity run --app loganalyser beast2_2.7.8.sif run.log
singularity run --app packagemanager beast2_2.7.8.sif -add BEAST_CLASSIC
singularity exec beast2_2.7.8.sif beast -help
Apps: beast, treeannotator, logcombiner, loganalyser, applauncher, packagemanager.
BEAST needs no reference data. It reads an XML analysis (make it with BEAUti on your own
computer) and writes its logs to the working directory, so work in a directory the container
can see ($HOME and the current directory are bound by default; add --bind for others).
This image is command-line only. The GUIs (BEAUti, DensiTree, and the dialogs the tools open
when run with no arguments) need desktop libraries the image doesn't include. BEAGLE isn't
included either, so BEAST uses its built-in Java likelihood code. To use your own BEAGLE
build, bind it and set SINGULARITYENV_BEAGLE_LIB to its directory.
Settings (set them on the host as SINGULARITYENV_<name>):
BEAST_MAX_HEAP Java maximum heap, as upstream's -Xmx (default 8g). Keep it below your
job's memory limit.
BEAST_PACKAGE_DIR Where add-on packages are installed and loaded from (default
$HOME/.beast/2.7.8). This is NOT upstream's default ~/.beast/2.7, so
packages for another BEAST 2.7 install, and its cached package path,
don't get mixed in. Install add-ons again here with packagemanager.
BEAST_JAVA_OPTS Extra JVM options, separated by spaces.
BEAST_PACKAGE_PATH Extra package directories, separated by colons (read by BEAST itself).
"beast -version" reports the launcher as "BEAST v2.7.7" and then lists
"BEAST.base v2.7.8" and "BEAST.app v2.7.8": the 2.7.8 release has no new launcher.
Upstream's own launch scripts are in /opt/beast/bin, but they use ~/.beast/2.7 and a fixed
8 GB heap; the commands on the PATH are IDIA's wrappers around the same Java classes.
%post
# Upstream's bin/ scripts hard-code -Xmx8g and the user package directory. These wrappers
# run the same launcher classes with the same JVM options, but make those settable.
mkdir -p /opt/beast/idia
cat > /opt/beast/idia/beast2-java <<'EOF'
#!/bin/sh
# Usage: beast2-java <launcher class> [arguments...]
main_class=$1
shift
: "${BEAST_PACKAGE_DIR:=${HOME:-/tmp}/.beast/2.7.8}"
library_path=/usr/local/lib
if [ -n "${BEAGLE_LIB:-}" ]; then
library_path="${BEAGLE_LIB}:${library_path}"
fi
if [ -n "${LD_LIBRARY_PATH:-}" ]; then
library_path="${LD_LIBRARY_PATH}:${library_path}"
fi
# BEAST_JAVA_OPTS holds several options, so it is split on spaces on purpose.
# shellcheck disable=SC2086
exec /opt/beast/jre/bin/java -Dlauncher.wait.for.exit=true -Xss256m \
-Xmx"${BEAST_MAX_HEAP:-8g}" -Djava.awt.headless=true -Duser.language=en \
-Djava.library.path="${library_path}" \
-Dbeast.user.package.dir="${BEAST_PACKAGE_DIR}" \
-Dbeast.system.package.dir=/opt/beast/packages \
${BEAST_JAVA_OPTS:-} -cp /opt/beast/lib/launcher.jar "${main_class}" "$@"
EOF
chmod 755 /opt/beast/idia/beast2-java
write_wrapper() {
printf '#!/bin/sh\nexec /opt/beast/idia/beast2-java %s "$@"\n' "$2" > "/usr/local/bin/$1"
chmod 755 "/usr/local/bin/$1"
}
write_wrapper beast beast.pkgmgmt.launcher.BeastLauncher
write_wrapper treeannotator beast.pkgmgmt.launcher.TreeAnnotatorLauncher
write_wrapper logcombiner beast.pkgmgmt.launcher.LogCombinerLauncher
write_wrapper loganalyser 'beast.pkgmgmt.launcher.AppLauncherLauncher beastfx.app.tools.LogAnalyser'
write_wrapper applauncher beast.pkgmgmt.launcher.AppLauncherLauncher
write_wrapper packagemanager beast.pkgmgmt.PackageManager
%runscript
exec /usr/local/bin/beast "$@"
%apprun beast
exec /usr/local/bin/beast "$@"
%apphelp beast
Runs a BEAST 2 analysis: Bayesian MCMC on an XML file made with BEAUti. Logs and trees go
to the working directory; -resume continues a stopped run from its .state file, and
-overwrite replaces existing logs (without either, BEAST asks before overwriting). The Java
heap is 8g unless you set SINGULARITYENV_BEAST_MAX_HEAP (see the image's help).
singularity run --app beast beast2_2.7.8.sif -seed 42 -threads 4 analysis.xml
Docs: https://www.beast2.org/2021/03/31/command-line-options.html
%apprun treeannotator
exec /usr/local/bin/treeannotator "$@"
%apphelp treeannotator
Summarises the posterior trees from a BEAST run as one tree: by default the maximum clade
credibility tree with common-ancestor node heights (-topology MCC -height CA); -height
median and -topology MSCC are alternatives. -burnin is the percentage of trees to discard
(default 10).
singularity run --app treeannotator beast2_2.7.8.sif -burnin 10 -height median run.trees mcc.tree
Docs: https://www.beast2.org/treeannotator/
%apprun logcombiner
exec /usr/local/bin/logcombiner "$@"
%apphelp logcombiner
Combines the trace (.log) or tree (.trees) files of independent runs of the same analysis
into one, dropping a burn-in from each. -b is the burn-in percentage per file (default
10), and -resample N keeps only states that are multiples of N. Without -o it writes to
stdout; "logcombiner -help" lists every option.
singularity run --app logcombiner beast2_2.7.8.sif -b 10 -log run1.trees -log run2.trees -o combined.trees
Docs: https://www.beast2.org/2019/09/26/command-line-tricks.html
%apprun loganalyser
exec /usr/local/bin/loganalyser "$@"
%apphelp loganalyser
Prints summary statistics for every column of a BEAST trace log: mean, stderr, stddev,
median, 95% HPD interval, ACT and ESS. -b is the burn-in percentage (default 10), and
-oneline prints one line per file when you give several logs. The image runs it through
AppLauncher, so installed add-on packages are loaded first.
singularity run --app loganalyser beast2_2.7.8.sif -b 10 run.log
Docs: https://www.beast2.org/2019/09/26/command-line-tricks.html
%apprun applauncher
exec /usr/local/bin/applauncher "$@"
%apphelp applauncher
Lists and runs the command-line apps that BEAST 2 packages provide. -list shows them; to
run one, give its class name or description, then its arguments. With no arguments it
opens a GUI, which this image can't show.
singularity run --app applauncher beast2_2.7.8.sif -list
Docs: https://www.beast2.org/2019/09/26/command-line-tricks.html
%apprun packagemanager
exec /usr/local/bin/packagemanager "$@"
%apphelp packagemanager
Lists, installs and removes BEAST 2 add-on packages from the command line (-list, -add,
-del; -version picks a version). Packages go into BEAST_PACKAGE_DIR, $HOME/.beast/2.7.8
by default, where beast then finds them. It downloads from the package repository, so it
needs internet access; -useAppDir can't work, as the image is read-only.
singularity run --app packagemanager beast2_2.7.8.sif -add BEAST_CLASSIC
Docs: https://www.beast2.org/managing-packages/
%test
expected_version=2.7.8
test_dir=$( mktemp -d ) || exit 1
BEAST_PACKAGE_DIR="${test_dir}/packages"
export BEAST_PACKAGE_DIR
version_output=$( /usr/local/bin/beast -version ) || exit 1
echo "${version_output}"
echo "${version_output}" | grep -q "BEAST.base v${expected_version}" || exit 1
echo "${version_output}" | grep -q "BEAST.app v${expected_version}" || exit 1
if echo "${version_output}" | grep -Eq 'BEAST\.(base|app) v2\.7\.7'; then
echo "an old 2.7.7 package was loaded"
exit 1
fi
# A short real MCMC run on an upstream example, then the summary tools on its output.
# BEAST and TreeAnnotator exit 0 even after some errors, so check their output.
cd "${test_dir}" || exit 1
sed 's/chainLength="5000000" preBurnin="50000"/chainLength="20000" preBurnin="0"/' \
/opt/beast/examples/testJukesCantorShort.xml > short.xml
grep -q 'chainLength="20000"' short.xml || exit 1
/usr/local/bin/beast -seed 1 -overwrite short.xml > beast.out 2>&1 || { cat beast.out; exit 1; }
grep -q 'Done!' beast.out || { cat beast.out; exit 1; }
test -s test.1.log || exit 1
test -s test.1.trees || exit 1
/usr/local/bin/loganalyser test.1.log > analyser.out 2>&1 || { cat analyser.out; exit 1; }
grep -q 'treeLikelihood' analyser.out || { cat analyser.out; exit 1; }
/usr/local/bin/logcombiner -b 10 -log test.1.log test.1.log -o combined.log > combiner.out 2>&1 \
|| { cat combiner.out; exit 1; }
test -s combined.log || { cat combiner.out; exit 1; }
/usr/local/bin/treeannotator -burnin 10 test.1.trees mcc.tree > annotator.out 2>&1 \
|| { cat annotator.out; exit 1; }
head -n 1 mcc.tree | grep -qi 'nexus' || { cat annotator.out; exit 1; }
test -s /opt/beast/LICENSE.txt || exit 1
cd / || exit 1
rm -rf "${test_dir}"
Download bioinformatics-beast2_2.7.8.def
#!/bin/sh
exec /usr/local/bin/beast "$@"
#!/bin/sh
expected_version=2.7.8
test_dir=$( mktemp -d ) || exit 1
BEAST_PACKAGE_DIR="${test_dir}/packages"
export BEAST_PACKAGE_DIR
version_output=$( /usr/local/bin/beast -version ) || exit 1
echo "${version_output}"
echo "${version_output}" | grep -q "BEAST.base v${expected_version}" || exit 1
echo "${version_output}" | grep -q "BEAST.app v${expected_version}" || exit 1
if echo "${version_output}" | grep -Eq 'BEAST\.(base|app) v2\.7\.7'; then
echo "an old 2.7.7 package was loaded"
exit 1
fi
# A short real MCMC run on an upstream example, then the summary tools on its output.
# BEAST and TreeAnnotator exit 0 even after some errors, so check their output.
cd "${test_dir}" || exit 1
sed 's/chainLength="5000000" preBurnin="50000"/chainLength="20000" preBurnin="0"/' \
/opt/beast/examples/testJukesCantorShort.xml > short.xml
grep -q 'chainLength="20000"' short.xml || exit 1
/usr/local/bin/beast -seed 1 -overwrite short.xml > beast.out 2>&1 || { cat beast.out; exit 1; }
grep -q 'Done!' beast.out || { cat beast.out; exit 1; }
test -s test.1.log || exit 1
test -s test.1.trees || exit 1
/usr/local/bin/loganalyser test.1.log > analyser.out 2>&1 || { cat analyser.out; exit 1; }
grep -q 'treeLikelihood' analyser.out || { cat analyser.out; exit 1; }
/usr/local/bin/logcombiner -b 10 -log test.1.log test.1.log -o combined.log > combiner.out 2>&1 \
|| { cat combiner.out; exit 1; }
test -s combined.log || { cat combiner.out; exit 1; }
/usr/local/bin/treeannotator -burnin 10 test.1.trees mcc.tree > annotator.out 2>&1 \
|| { cat annotator.out; exit 1; }
head -n 1 mcc.tree | grep -qi 'nexus' || { cat annotator.out; exit 1; }
test -s /opt/beast/LICENSE.txt || exit 1
cd / || exit 1
rm -rf "${test_dir}"
# /.singularity.d/env/10-docker2singularity.sh
#!/bin/sh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"