MrBayes: Difference between revisions
(Added MrBayes examples) |
(Marked this version for translation) |
||
Line 2: | Line 2: | ||
<translate> | <translate> | ||
<!--T:1--> | |||
[https://nbisweden.github.io/MrBayes/ MrBayes] is a program for Bayesian inference and model choice across a wide range of phylogenetic and evolutionary models. MrBayes uses Markov chain Monte Carlo (MCMC) methods to estimate the posterior distribution of model parameters. | [https://nbisweden.github.io/MrBayes/ MrBayes] is a program for Bayesian inference and model choice across a wide range of phylogenetic and evolutionary models. MrBayes uses Markov chain Monte Carlo (MCMC) methods to estimate the posterior distribution of model parameters. | ||
== Finding available modules == | == Finding available modules == <!--T:2--> | ||
{{Command|module spider mrbayes}} | {{Command|module spider mrbayes}} | ||
== Example == | == Example == <!--T:3--> | ||
=== Sequential === | === Sequential === <!--T:4--> | ||
1. Write the submission script | 1. Write the submission script | ||
{{File | {{File | ||
Line 21: | Line 22: | ||
#SBATCH --time=1:00:00 # increase as needed | #SBATCH --time=1:00:00 # increase as needed | ||
<!--T:5--> | |||
module load mrbayes/3.2.7 | module load mrbayes/3.2.7 | ||
<!--T:6--> | |||
cd $SCRATCH | cd $SCRATCH | ||
<!--T:7--> | |||
# Copy one of the example locally on the local storage | # Copy one of the example locally on the local storage | ||
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | ||
<!--T:8--> | |||
# Run using 1 core | # Run using 1 core | ||
mb primates.nex | mb primates.nex | ||
}} | }} | ||
<!--T:9--> | |||
2. Submit the sequential job | 2. Submit the sequential job | ||
{{Command|sbatch submit-mrbayes-seq.sh}} | {{Command|sbatch submit-mrbayes-seq.sh}} | ||
=== Parallel === | === Parallel === <!--T:10--> | ||
MrBayes support running on multi-cores and multi-nodes, and GPU. | MrBayes support running on multi-cores and multi-nodes, and GPU. | ||
==== MPI ==== | ==== MPI ==== <!--T:11--> | ||
1. Write the submission script | 1. Write the submission script | ||
{{File | {{File | ||
Line 50: | Line 56: | ||
#SBATCH --time=1:00:00 # increase as needed | #SBATCH --time=1:00:00 # increase as needed | ||
<!--T:12--> | |||
module load mrbayes/3.2.7 | module load mrbayes/3.2.7 | ||
<!--T:13--> | |||
cd $SCRATCH | cd $SCRATCH | ||
<!--T:14--> | |||
# Copy one of the example locally on the local storage | # Copy one of the example locally on the local storage | ||
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | ||
<!--T:15--> | |||
# Run using $SLURM_NTASKS | # Run using $SLURM_NTASKS | ||
srun mb primates.nex | srun mb primates.nex | ||
}} | }} | ||
<!--T:16--> | |||
2. Submit the sequential job | 2. Submit the sequential job | ||
{{Command|sbatch submit-mrbayes-parallel.sh}} | {{Command|sbatch submit-mrbayes-parallel.sh}} | ||
==== GPU ==== | ==== GPU ==== <!--T:17--> | ||
1. Write the submission script | 1. Write the submission script | ||
{{File | {{File | ||
Line 77: | Line 88: | ||
#SBATCH --time=1:00:00 # increase as needed | #SBATCH --time=1:00:00 # increase as needed | ||
<!--T:18--> | |||
module load gcc cuda/12 mrbayes/3.2.7 | module load gcc cuda/12 mrbayes/3.2.7 | ||
<!--T:19--> | |||
cd $SCRATCH | cd $SCRATCH | ||
<!--T:20--> | |||
# Copy one of the example locally on the local storage | # Copy one of the example locally on the local storage | ||
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | ||
<!--T:21--> | |||
# Run using $SLURM_NTASKS | # Run using $SLURM_NTASKS | ||
srun mb primates.nex | srun mb primates.nex | ||
}} | }} | ||
<!--T:22--> | |||
2. Submit the sequential job | 2. Submit the sequential job | ||
{{Command|sbatch submit-mrbayes-gpu.sh}} | {{Command|sbatch submit-mrbayes-gpu.sh}} | ||
== Checkpointing == | == Checkpointing == <!--T:23--> | ||
For users needing very long runs of MrBayes, it is suggested to break up the work into several small jobs rather than one very long job. Long jobs have a higher probably of being interrupted by maintenance windows or unforeseen problems. Fortunately, MrBayes has a built in mechanism for creating checkpoints, where progress can be saved from one job and continued in a subsequent job. | For users needing very long runs of MrBayes, it is suggested to break up the work into several small jobs rather than one very long job. Long jobs have a higher probably of being interrupted by maintenance windows or unforeseen problems. Fortunately, MrBayes has a built in mechanism for creating checkpoints, where progress can be saved from one job and continued in a subsequent job. | ||
<!--T:24--> | |||
1. Create the first script (job). | 1. Create the first script (job). | ||
{{File | {{File | ||
Line 101: | Line 118: | ||
execute primates.nex; | execute primates.nex; | ||
<!--T:25--> | |||
mcmc ngen=10000000 nruns=2 temp=0.02 mcmcdiag=yes samplefreq=1000 | mcmc ngen=10000000 nruns=2 temp=0.02 mcmcdiag=yes samplefreq=1000 | ||
stoprule=yes stopval=0.005 relburnin=yes burninfrac=0.1 printfreq=1000 | stoprule=yes stopval=0.005 relburnin=yes burninfrac=0.1 printfreq=1000 | ||
Line 106: | Line 124: | ||
}} | }} | ||
<!--T:26--> | |||
2. Create a second script (job). | 2. Create a second script (job). | ||
{{File | {{File | ||
Line 113: | Line 132: | ||
execute primates.nex; | execute primates.nex; | ||
<!--T:27--> | |||
mcmc ngen=20000000 nruns=2 temp=0.02 mcmcdiag=yes samplefreq=1000 | mcmc ngen=20000000 nruns=2 temp=0.02 mcmcdiag=yes samplefreq=1000 | ||
stoprule=yes stopval=0.005 relburnin=yes burninfrac=0.1 printfreq=1000 | stoprule=yes stopval=0.005 relburnin=yes burninfrac=0.1 printfreq=1000 | ||
Line 118: | Line 138: | ||
}} | }} | ||
<!--T:28--> | |||
3. Submit the jobs | 3. Submit the jobs | ||
{{File | {{File | ||
Line 130: | Line 151: | ||
#SBATCH --array=1-2%1 # match the number of sub-jobs, only 1 at a time | #SBATCH --array=1-2%1 # match the number of sub-jobs, only 1 at a time | ||
<!--T:29--> | |||
module load gcc mrbayes/3.2.7 | module load gcc mrbayes/3.2.7 | ||
<!--T:30--> | |||
cd $SCRATCH | cd $SCRATCH | ||
<!--T:31--> | |||
# Copy one of the example locally on the local storage | # Copy one of the example locally on the local storage | ||
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex . | ||
<!--T:32--> | |||
# Run using $SLURM_NTASKS | # Run using $SLURM_NTASKS | ||
srun mb job${SLURM_ARRAY_TASK_ID}.nex | srun mb job${SLURM_ARRAY_TASK_ID}.nex | ||
}} | }} | ||
<!--T:33--> | |||
2. Submit the jobs | 2. Submit the jobs | ||
{{Command|sbatch submit-mrbayes-cp.sh}} | {{Command|sbatch submit-mrbayes-cp.sh}} | ||
</translate> | </translate> |
Revision as of 16:57, 21 June 2024
MrBayes is a program for Bayesian inference and model choice across a wide range of phylogenetic and evolutionary models. MrBayes uses Markov chain Monte Carlo (MCMC) methods to estimate the posterior distribution of model parameters.
Finding available modules[edit]
[name@server ~]$ module spider mrbayes
Example[edit]
Sequential[edit]
1. Write the submission script
#!/bin/bash
#SBATCH --account=def-someuser # replace with your PI account
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=3G # increase as needed
#SBATCH --time=1:00:00 # increase as needed
module load mrbayes/3.2.7
cd $SCRATCH
# Copy one of the example locally on the local storage
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex .
# Run using 1 core
mb primates.nex
2. Submit the sequential job
[name@server ~]$ sbatch submit-mrbayes-seq.sh
Parallel[edit]
MrBayes support running on multi-cores and multi-nodes, and GPU.
MPI[edit]
1. Write the submission script
#!/bin/bash
#SBATCH --account=def-someuser # replace with your PI account
#SBATCH --ntasks=8 # increase as needed
#SBATCH --mem-per-cpu=3G # increase as needed
#SBATCH --time=1:00:00 # increase as needed
module load mrbayes/3.2.7
cd $SCRATCH
# Copy one of the example locally on the local storage
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex .
# Run using $SLURM_NTASKS
srun mb primates.nex
2. Submit the sequential job
[name@server ~]$ sbatch submit-mrbayes-parallel.sh
GPU[edit]
1. Write the submission script
#!/bin/bash
#SBATCH --account=def-someuser # replace with your PI account
#SBATCH --cpus-per-task=1
#SBATCH --gpus=1
#SBATCH --mem-per-cpu=3G # increase as needed
#SBATCH --time=1:00:00 # increase as needed
module load gcc cuda/12 mrbayes/3.2.7
cd $SCRATCH
# Copy one of the example locally on the local storage
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex .
# Run using $SLURM_NTASKS
srun mb primates.nex
2. Submit the sequential job
[name@server ~]$ sbatch submit-mrbayes-gpu.sh
Checkpointing[edit]
For users needing very long runs of MrBayes, it is suggested to break up the work into several small jobs rather than one very long job. Long jobs have a higher probably of being interrupted by maintenance windows or unforeseen problems. Fortunately, MrBayes has a built in mechanism for creating checkpoints, where progress can be saved from one job and continued in a subsequent job.
1. Create the first script (job).
execute primates.nex;
mcmc ngen=10000000 nruns=2 temp=0.02 mcmcdiag=yes samplefreq=1000
stoprule=yes stopval=0.005 relburnin=yes burninfrac=0.1 printfreq=1000
checkfreq=1000;
2. Create a second script (job).
execute primates.nex;
mcmc ngen=20000000 nruns=2 temp=0.02 mcmcdiag=yes samplefreq=1000
stoprule=yes stopval=0.005 relburnin=yes burninfrac=0.1 printfreq=1000
append=yes checkfreq=1000;
3. Submit the jobs
#!/bin/bash
#SBATCH --account=def-someuser # replace with your PI account
#SBATCH --ntasks=8 # increase as needed
#SBATCH --mem-per-cpu=3G # increase as needed
#SBATCH --time=1:00:00 # increase as needed
#SBATCH --array=1-2%1 # match the number of sub-jobs, only 1 at a time
module load gcc mrbayes/3.2.7
cd $SCRATCH
# Copy one of the example locally on the local storage
cp -v $EBROOTMRBAYES/share/examples/mrbayes/primates.nex .
# Run using $SLURM_NTASKS
srun mb job${SLURM_ARRAY_TASK_ID}.nex
2. Submit the jobs
[name@server ~]$ sbatch submit-mrbayes-cp.sh