Learn R Programming

shipunov (version 1.17.1)

MrBayes: Calls MrBayes

Description

A slight improvement of 'ips::mrbayes()'

Usage

MrBayes(x, file="", nst=6, rates="invgamma", ngammacat=4, nruns=2, ngen=1e+06,
 printfreq=100, samplefreq=10, nchains=4, savebrlens="yes", temp=0.2, burnin=10,
 contype="allcompat", run=FALSE, simple=TRUE, exec="mb-mpi", method="dna")

Arguments

x

The object to process (must be 'DNAbin' class)

file

A character string, giving the name of the MrBayes input file

nst

An integer giving the number of rates in the model of sequence evolution

rates

A character string; allowed are "equal", "gamma", "propinv", "invgamma", and "adgamma"; the default is "equal"

ngammacat

An integer; the number rate categories for the discretized Gamma distribution; the default is '4'

nruns

An integer; the number of runs

ngen

An integer; the number of states of the MCMC

printfreq

An integer; the interval between states of the MCMC to be printed on the screen

samplefreq

An integer; the interval between states of the MCMC to be sampled

nchains

An integer; number of Metropolis coupled MCMCs in each run

savebrlens

Logical; shall branch lengths be saved

temp

Heating parameter

burnin

An integer; the number of samples from the MCMC to be discarded prior to further analysis

contype

A character string; the type of consensus tree calculated from the posterior distribution of trees

either "halfcompat" (majority-rule consensus tree) or "allcombat" (strict consensus tree)

run

Logical; 'run = FALSE' will only print the NEXUS file, 'run = TRUE' will also start the MCMC runs, if the 'path' argument is correctly specified

simple

New option: if TRUE (default), then outputs tree in the format readable by functions from 'ape' package

exec

New option: name of UNIX executable (to allow multi-threaded version)

method

New option: either "dna", or "mixed" to handle mixed or purely morphologic data (see below)

Author

Alexey Shipunov

Details

MrBayes() is an improvement of ips::mrbayes() and ips::mrbayes.mixed(). Please see its documentation for clarity and other options.

Comparing with 'ips' sources, MrBayes() has some code alterations and three more options. It also both views and saves output (works only on UNIX).

If 'method="mixed"', the function requires character matrix as input where missing data are labeled with "N", morphological columns encoded as 0/1 and placed after nucleotide columns (which might be absent).

See Also

ips::mrbayes

Examples

Run this code
require(ips)
data(ips.cox1)
x <- ips.cox1[, 100:140]

if (FALSE) {
## requires MrBayes program installation
MrBayes(x, file="cox1", ngen=100, run=TRUE)

str(plantago)
plantago[is.na(plantago)] <- "N"
row.names(plantago) <- gsub(" ", "_", row.names(plantago))
## requires MrBayes program installation
tr <- MrBayes(plantago, file="plantago", method="mixed", burnin=5000, run=TRUE) # makes many files
tr <- tr[[1]]
tr <- root(tr, outgroup="Plantago_maritima", resolve.root=TRUE)
tr$node.label <- suppressWarnings(round(as.numeric(tr$node.label)*100)) # warning is OK
tr$node.label[tr$node.label == "NA"] <- ""
plot(tr)
nodelabels(tr$node.label, frame="none", bg="transparent", adj=-0.1)
add.scale.bar()
}

Run the code above in your browser using DataLab