Skip to content

Docs CSC now features an automatic Finnish translation. Click here for more information.

Warning!

Puhti and Mahti computing services have been decommissioned and no new jobs are accepted or executed on its compute nodes. Puhti and Mahti login nodes and storage services are planned to remain available until 15 October 2026. Clean up unnecessary files and move any data you need to keep by 31 August 2026. See the Roihu data migration guide for instructions on transferring your data to Roihu.

MrBayes

MrBayes is a program for Bayesian inference on phylogenies.

License

Free to use and open source under GNU GPLv3.

Available

  • Roihu: 3.2.7a, via the bio-apps module.

Usage

MrBayes is part of the bio-apps collection on Roihu. Load the bio-apps module tree and then the MrBayes module:

module load bio-apps/v202603
module load mrbayes/3.2.7a

After loading the module, the serial (i.e. single processor) version starts with the command:

mb

Parallel version starts with the command:

mb-mpi 

When using the parallel version, you should note that MrBayes assigns one chain to one core, so for optimal performance you should use as many cores as the total number of chains in your job. If, for example, you have specified nchains=4, nruns=2 you should use 4 * 2 = 8 cores.

Batch jobs

Running MrBayes analysis might take considerable amount of CPU time and memory. It is, therefore, recommended running it through the batch job system on Roihu. Shorter test runs can be run in interactive mode using sinteractive. The serial version is recommended for interactive use.

To run a batch job you need to:

  1. Write a MrBayes command file (here mb_com.nex) or include a MrBayes command block in your .nex file. For details, see Chapter 5.5.1 of the MrBayes manual.
  2. Write a batch job script (here mb_batch)
  3. Make sure you have all your input files (here primates.nex)
  4. Submit your job into the queue

MrBayes command file should include the commands you would type in MrBayes in interactive mode. This example runs the analysis mentioned in Chapter 2 of the MrBayes 3.2 manual.

begin mrbayes;
    set autoclose=yes nowarn=yes;
    execute primates.nex;
    lset nst=6 rates=invgamma;
    mcmc nchains=4 nruns=2 ngen=20000 samplefreq=100 printfreq=100 diagnfreq=1000;
    sump;
    sumt;
end;

Below is an example batch job script for Roihu using 8 cores. We are using 8 cores since our example uses nchains=4, nruns=2, so 4 * 2 = 8.

#!/bin/bash
#SBATCH --account=<project>
#SBATCH --job-name=my_mrbjob
#SBATCH --error=my_mrbjob_err%j
#SBATCH --output=my_mrbjob_out%j
#SBATCH --partition=small
#SBATCH --time=01:00:00
#SBATCH --ntasks=8
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=4000

module load bio-apps/v202603
module load mrbayes/3.2.7a

srun mb-mpi mb_com.nex >log.txt

To submit the job:

sbatch mb_batch 

See creating a batch job script for Roihu for more information about running batch jobs.

Support

CSC Service Desk

More information