knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

Run BAMM through outsider in R

Build Status

Bayesian Analysis of Macroevolutionary Mixtures: multimodel inference on speciation and trait evolution.

Install and look up help

library(outsider)
module_install(repo = "DomBennett/om..bamm")
#module_help(repo = "DomBennett/om..bamm")

A detailed example

The example below is taken from the "Quickstart" guide to BAMM

# ------
# Import
# ------
library(outsider)
bamm <- module_import(fname = 'bamm', repo = "DomBennett/om..bamm")

# ----
# Data
# ----
# create temp directory to contain test input and output data
wd <- file.path(tempdir(), 'testing_bamm')
if(!dir.exists(wd)) {
  dir.create(wd)
}
# download modified template control file for a "speciation-extinction"
# analysis of whales
url <- 'https://raw.githubusercontent.com/DomBennett/om..bamm/master/test_data/whale_diversification.txt'
control_file <- file.path(wd, 'whale_diversification.txt')
download.file(url = url, destfile = control_file)
# download a tree whales
url <- 'https://raw.githubusercontent.com/DomBennett/om..bamm/master/test_data/whaletree.tre'
download.file(url = url, destfile = file.path(wd, 'whaletree.tre'))

# --------
# Run BAMM
# --------
# run bamm in R by specifying the control file and the directory containing the
# whale tree
bamm(control_file = control_file, indir = wd, outdir = wd)

# ------
# Verify
# ------
# Double check the output, all resulting files are stored in outdir
list.files(wd)
# peek into the mcmc_out.txt
print(read.csv(file.path(wd, 'mcmc_out.txt')))
# delete temp dir
if ('wd' %in% ls() && dir.exists(wd)) {
 unlink(x = wd, recursive = TRUE, force = TRUE) 
}
module_uninstall(repo = "DomBennett/om..bamm")

Key arguments

The bamm function in R has three arguments:

Links

Find out more by visiting the BAMM documentation website.

Please cite


An outsider module

Learn more at outsider website. Want to build your own module? Check out outsider.devtools website.



DomBennett/om..bamm..2.5.0 documentation built on Jan. 19, 2020, 9:52 p.m.