Analysing Congreve & Lamsdell matrices"

The files required to reproduce these analyses are included in the R package directory on installation, and can be downloaded from GitHub.

If you have RStudio, you can open the R Markdown file used to generate this document (vignettes/Conduct-analyses.Rmd) to run the R scripts that will copy all necessary files and begin analyses on your behalf. You will need to specify some paths for automatic downloading:

# Directory in which to install MrBayes
BAYES_DIR <- "C:/Research/MrBayes"

# Directory in which to conduct parsimony analysis
HOME <- "C:/Research/iw" # Must not end in a trailing '/'

# GitHub remote

Bayesian analysis is a Perl script to execute analysis using Markov models in MrBayes.

The script reads the datasets of Congreve and Lamsdell [-@Congreve2016], appends a MrBayes block to the Nexus files, and executes a MrBayes run, saving the consensus trees and preparing them for analysis in R.

Before running the script:

zipFile <- paste0(BAYES_DIR, '/')
download.file(MRBAYES_RELEASE, destfile=zipFile, method='auto', mode='wb')
unzip(zipFile, c('MrBayes/mrbayes_x64.exe', 'MrBayes/mrbayes_x86.exe'), 
      exdir=BAYES_DIR, junkpaths=TRUE)
tempFile <- tempfile(fileext='.zip')
download.file("", tempFile)
unzip(tempFile, exdir=paste0(BAYES_DIR, '/iw'), junkpaths=TRUE,
      files = paste0('Weights tests/', formatC(1:100, width=3, flag=0), '.txt.nex'))
download.file(paste0(INST_ROOT, "analysis-bayesian/mrbayesblock.nex"), 
              paste0(BAYES_DIR, '/iw/mrbayesblock.nex'))

bayesGenPath <- paste0(BAYES_DIR, '/')
download.file(paste0(INST_ROOT, "analysis-bayesian/"), bayesGenPath)
bayesGen <- readLines(bayesGenPath)
bayesGen[5] <- paste0('$dir = "', BAYES_DIR, '/iw";')
bayesGen[6] <- paste0('$bayes_dir = "', BAYES_DIR, '";')
writeLines(bayesGen, bayesGenPath)

t2nexPath <- paste0(BAYES_DIR, '/')
download.file(paste0(INST_ROOT, "analysis-bayesian/"), t2nexPath)
t2nex <- readLines(t2nexPath)
t2nex[2] <- paste0('$dir = "', BAYES_DIR, '/iw";')
writeLines(t2nex, t2nexPath)

Parsimony analysis is a Perl script to generate most parsimonious trees by parsimony search in TNT.

The script generates TNT scripts to perform parsimony analysis on each of the Congreve and Lamsdell datasets, under equal and implied weights, with and without suboptimal trees. It then executes these scripts and converts the output into a format suitable for analysis in R.

Before running the script, you'll need an installation of Perl. Strawberry Perl works on MS Windows.


sapply(paste0(HOME, '/', c('', 'Matrices', 'Trees')), dir.create)
sapply(paste0(HOME, '/Trees/', c('eq', 'k1', 'k2', 'k3', 'k5', 'kX')), dir.create)
zipFile <- paste0(HOME, '/TNT.ZIP')
# This is the Windows path; use the appropriate path for your operating system
              destfile=zipFile, method='auto', mode='wb')
unzip(zipFile, 'tnt.exe', exdir=HOME)
tnt2nexPath <-  paste0(HOME, '/')
mptgenPath <-  paste0(HOME, '/')

download.file(paste0(INST_ROOT, "analysis-parsimony/"), tnt2nexPath)
tnt2nex <- readLines(tnt2nexPath)
tnt2nex[3] <- paste0('$dir = "', HOME, '/Trees";')
writeLines(tnt2nex, tnt2nexPath)

download.file(paste0(INST_ROOT, "analysis-parsimony/"), mptgenPath)
mptgen <- readLines(mptgenPath)
mptgen[3] <- paste0('$dir = "', HOME, '";')
writeLines(mptgen, mptgenPath)
download.file(paste0(INST_ROOT, "analysis-parsimony/"), 
              paste0(HOME, '/'))
tempFile <- tempfile(fileext='.zip')
download.file("", tempFile)
unzip(tempFile, exdir=paste0(HOME, '/Matrices'))

Analysing output data

Once these analyses have generated the necessary data, these can be analysed using the scripts in []. The results of these analyses are available in the R data objects; to view them, install the package in R and view the help files.


Try the CongreveLamsdell2016 package in your browser

Any scripts or data that you put into this service are public.

CongreveLamsdell2016 documentation built on Jan. 7, 2020, 5:07 p.m.