#Created by Kurt Galbreath (kurt.galbreath@wwu.edu); copyright 2009 #this script creates a batch file for PAUP that will read in a set of data files and associated tree files from a garli batch analysis, calculate LL scores under two different models, and store the scores in a file #It was originally written for an effort to test the performance of two different nucleotide models for a given dataset #it takes matrixname (the base matrix name for each simulation) and nreps (the number of matrices) as arguments #garliLscorebat(nreps=5, matrixname='CephA_princepsmono_') garliLscorebat <- function(nreps, matrixname, nst1=2, nst2=2, rclass1='(a b c d e f)', rclass2='(a b c d e f)', rates1='gamma', rates2='sitespec', ncat=4, pinvar1=0, pinvar2=0){ cat('set criterion=like warnreset=no;', file=paste(matrixname, "lscorebatch.txt", sep=''), '\n', append=F) for (i in 1:nreps){ cat('execute ', paste(matrixname, i-1, '.nex', sep=''), ';', file=paste(matrixname, "lscorebatch.txt", sep=''), '\n', append=T, sep='') cat('gett file=', paste(matrixname, i-1, '.garli.best.tre', sep='') , ';', file=paste(matrixname, "lscorebatch.txt", sep=''), '\n', append=T, sep='') cat('charpartition codons = firstpos:1-.\\3, secondpos:2-.\\3, thirdpos:3-.\\3;', file=paste(matrixname, "lscorebatch.txt", sep=''), '\n', append=T) cat('lscore 1 / tratio=estimate rmatrix=estimate basefreq=estimate shape=estimate siterates=partition:codons nst=', nst1, 'rclass=', rclass1, 'rates=', rates1, 'ncat=', ncat, 'pinvar=', pinvar1, 'scorefile=', paste(matrixname, '.scores.txt', sep=''), 'append=yes', ';', file=paste(matrixname, "lscorebatch.txt", sep=''), '\n', append=T) cat('lscore 1 / tratio=estimate rmatrix=estimate basefreq=estimate shape=estimate siterates=partition:codons nst=', nst2, 'rclass=', rclass2, 'rates=', rates2, 'ncat=', ncat, 'pinvar=', pinvar2, 'scorefile=', paste(matrixname, '.scores.txt', sep=''), 'append=yes', ';', file=paste(matrixname, "lscorebatch.txt", sep=''), '\n', append=T) } }