#Created by Kurt Galbreath (kurt.galbreath@wwu.edu); copyright 2009 #This script tacks the charset commands for partitioning of codon sites onto the end of a set of files (e.g., nexus files) #nreps<- the number of files that need to be modified #matrixname<-the base name for a the nexus file replicates (e.g., 'CephA_bayestree_HKY.SS_') nexusCodonSetAppend<- function(nreps, matrixname){ for (i in 1:nreps){ write('begin sets;', file=(paste(matrixname, (i-1), '.nex', sep='')), append=T) write(' charset first = 1-.\\3;', file=(paste(matrixname, (i-1), '.nex', sep='')), append=T) write(' charset second = 2-.\\3;', file=(paste(matrixname, (i-1), '.nex', sep='')), append=T) write(' charset third = 3-.\\3;', file=(paste(matrixname, (i-1), '.nex', sep='')), append=T) write(' charpartition codons = first:first, second:second, third:third;', file=(paste(matrixname, (i-1), '.nex', sep='')), append=T) write('end;', file=(paste(matrixname, (i-1), '.nex', sep='')), append=T) } }