7 * Dept. Integrative Biology
8 * University of California, Berkeley
9 * Berkeley, CA 94720-3140
13 * Swedish Museum of Natural History
15 * SE-10405 Stockholm, SWEDEN
16 * fredrik.ronquist@nrm.se
18 * With important contributions by
20 * Paul van der Mark (paulvdm@sc.fsu.edu)
21 * Maxim Teslenko (maxim.teslenko@nrm.se)
23 * and by many users (run 'acknowledgments' to see more info)
25 * This program is free software; you can redistribute it and/or
26 * modify it under the terms of the GNU General Public License
27 * as published by the Free Software Foundation; either version 2
28 * of the License, or (at your option) any later version.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details (www.gnu.org).
44 #if defined(__MWERKS__)
48 const char* const svnRevisionCommandC = "$Rev: 1072 $"; /* Revision keyword which is expended/updated by svn on each commit/update */
50 #define NUMCOMMANDS 62 /* The total number of commands in the program */
51 #define NUMPARAMS 276 /* The total number of parameters */
52 #define PARAM(i, s, f, l) p->string = s; \
59 /* Debugging options */
61 #undef ECHO_PROCESSED_COMMANDS
63 /* Local function prototypes */
64 int AddNameSet(NameSet **nameSetList, int numNameSets, char **nameSet, int numNames);
65 int AddToSet (int i, int j, int k, int id);
66 int AllocCharacters (void);
67 int AllocMatrix (void);
69 char ChangeCase (char c);
70 int CharacterCode (char ch, int *charCode, int chType);
71 int CharacterNumber (int charCode, int chType);
72 int CheckInitialPartitions (void);
73 int Dex (TreeNode *p);
75 int DoAcknowledgments (void);
76 int DoBeginParm (char *parmName, char *tkn);
78 int DoBreaksParm (char *parmName, char *tkn);
79 int DoCalibrate (void);
80 int DoCalibrateParm (char *parmName, char *tkn);
82 int DoCharsetParm (char *parmName, char *tkn);
83 int DoCharStat (void);
84 int DoCitations (void);
85 int DoConstraint (void);
86 int DoConstraintParm (char *parmName, char *tkn);
88 int DoCtypeParm (char *parmName, char *tkn);
90 int DoDeleteParm (char *parmName, char *tkn);
91 int DoDimensions (void);
92 int DoDimensionsParm (char *parmName, char *tkn);
93 int DoDisclaimer (void);
94 int DoEndBlock (void);
95 int DoExecuteParm (char *parmName, char *tkn);
97 int DoExcludeParm (char *parmName, char *tkn);
99 int DoFormatParm (char *parmName, char *tkn);
101 int DoHelpParm (char *parmName, char *tkn);
102 int DoInclude (void);
103 int DoIncludeParm (char *parmName, char *tkn);
105 int DoLogParm (char *parmName, char *tkn);
107 int DoManualParm (char *parmName, char *tkn);
109 int DoMatrixParm (char *parmName, char *tkn);
110 int DoNexusParm (char *parmName, char *tkn);
111 int DoOutgroup (void);
112 int DoOutgroupParm (char *parmName, char *tkn);
114 int DoPairsParm (char *parmName, char *tkn);
115 int DoPartition (void);
116 int DoPartitionParm (char *parmName, char *tkn);
117 int DoRestore (void);
118 int DoRestoreParm (char *parmName, char *tkn);
120 int DoSetParm (char *parmName, char *tkn);
121 int DoShowBeagle (void);
122 int DoShowMatrix (void);
123 int DoShowUserTrees (void);
124 int DoSpeciespartition (void);
125 int DoSpeciespartitionParm (char *parmName, char *tkn);
126 int DoTaxaset (void);
127 int DoTaxasetParm (char *parmName, char *tkn);
128 int DoTaxaStat (void);
129 int DoTaxlabels (void);
130 int DoTaxlabelsParm (char *parmName, char *tkn);
131 int DoTranslate (void);
132 int DoTranslateParm (char *parmName, char *tkn);
134 int DoTreeParm (char *parmName, char *tkn);
135 int DoUserTree (void);
136 int DoUserTreeParm (char *parmName, char *tkn);
137 int DoVersion (void);
138 int FindValidParam (char *tk, int *numMatches);
139 int FreeCharacters (void);
140 int FreeMatrix (void);
142 int GetNumPartDivisions (int n);
143 int GetUserHelp (char *helpTkn);
144 int IsAmbig (int charCode, int dType);
145 int IsMissing (int charCode, int dType);
146 int MBResID (char nuc);
147 int NucID (char nuc);
148 void PrintSettings (char *command);
149 void PrintYesNo (int yn, char s[4]);
150 int ProtID (char aa);
151 int SetPartition (int part);
152 int SetSpeciespartition (int part);
153 int SetTaxaFromTranslateTable (void);
154 int StandID (char nuc);
155 void WhatVariableExp (BitsLong exp, char *st);
156 MrBFlt WhichCont (int x);
159 int autoClose; /* autoclose */
160 int autoOverwrite; /* Overwrite or append outputfiles when nowarnings=yes */
161 Calibration *calibrationPtr; /* ptr to calibration being set */
162 CharInformation *charInfo; /* holds critical information about characters */
163 BitsLong **charSet; /* holds information about defined charsets */
164 char **charSetNames; /* holds names of character sets */
165 Comptree comptreeParams; /* holds parameters for comparetree command */
166 char **constraintNames; /* holds names of constraints */
167 int dataType; /* type of data */
168 Calibration defaultCalibration; /* default calibration */
169 BitsLong **definedConstraint; /* bitfields representing taxa sets of defined constraints */
170 BitsLong **definedConstraintTwo; /* bitfields representing second taxa sets of defined constraints (used for PARTIAL constraints) */
171 BitsLong **definedConstraintPruned; /* bitfields representing taxa sets of defined constraints after delited taxa are removed */
172 BitsLong **definedConstraintTwoPruned; /* bitfields representing second taxa sets of defined constraints for PARTIAL constraints after delited*/
173 /* taxa are removed and for NEGATIVE constraint it contains complements of definedConstraintPruned */
174 int echoMB; /* flag used by Manual to prevent echoing */
175 BitsLong expecting; /* variable denoting expected token type */
176 int foundNewLine; /* whether a new line has been found */
177 int inComment; /* flag for whether input stream is commented */
178 int inComparetreeCommand; /* flag set whenever you enter comparetree cmd */
179 int inferAncStates; /* should ancestral states be inferred (y/n) */
180 int inferSiteOmegas; /* should site omegas be inferred (y/n) */
181 int inferSiteRates; /* should site rates be inferred (y/n) */
182 int inMrbayesBlock; /* flag for whether we are in a mrbayes block */
183 int inSumtCommand; /* flag set whenever you enter sumt cmd */
184 int inTreesBlock; /* flag for whether we are in a trees block */
185 int inValidCommand; /* a useful flag set whenever you enter a cmd */
186 int isInAmbig, isInPoly; /* flags whether we are within () or {} */
187 int isTaxsetDef; /* is a taxon set defined */
188 int isTranslateDef; /* is a translation block defined */
189 int isTranslateDiff; /* is translate different from current taxaset? */
190 char logFileName[100]; /* name of the log file */
191 int logToFile; /* should screen output be logged to a file */
192 FILE *logFileFp; /* file pointer to log file */
193 int longIntegerSize; /* size of an unsigned integer */
194 char manFileName[100]; /* name of the file for the command help info */
195 int *matrix; /* matrix containing original data */
196 int matrixHasPoly; /* flag for whether matrix has polymorphisms */
197 int memAllocs[NUM_ALLOCS]; /* allocated memory flags */
198 int mode; /* mode of program (interactive/noninteractive) */
199 Calibration *nodeCalibration; /* holds information about node calibrations */
200 int noWarn; /* no warnings on overwriting files */
201 int numChar; /* number of characters in character matrix */
202 int numCharSets; /* number of character sets */
203 int numComments; /* counts how deeply nested a comment is */
204 int numDefinedConstraints; /* number of constraints defined */
205 int numDefinedPartitions; /* number of partitions defined */
206 int numDefinedSpeciespartitions; /* number of speciespartitions defined */
207 int numNamedTaxa; /* number of named taxa during parsing of cmd */
208 int numOpenExeFiles; /* number of execute files open */
209 int numSpecies; /* number of species in current speciespartition */
210 int numTaxa; /* number of taxa in character matrix */
211 int numTaxaSets; /* number of taxa sets */
212 int numTranslates; /* number of taxa in active translate block */
213 int outGroupNum; /* number of outgroup taxon */
214 ParmInfo paramTable[NUMPARAMS]; /* information on parameters */
215 char **partitionNames; /* hold names of partitions (first is "default") */
216 int **partitionId; /* holds information about defined partitions */
217 int partitionNum; /* index of current partition */
218 Plot plotParams; /* holds parameters for plot command */
219 int precision; /* precision of samples and summary stats */
220 int quitOnError; /* quit on error? */
221 int replaceLogFile; /* should logfile be replace/appended to */
222 int scientific; /* use scientific format for samples ? */
223 char spacer[10]; /* holds blanks for printing indentations */
224 NameSet *speciesNameSets; /* hold species name sets, one for each speciespartition */
225 int **speciespartitionId; /* holds info about defined speciespartitions */
226 char **speciespartitionNames; /* hold names of speciespartitions (first is "default") */
227 int speciespartitionNum; /* index of current speciespartition */
228 Sump sumpParams; /* holds parameters for sump command */
229 Sumt sumtParams; /* holds parameters for sumt command */
230 Sumss sumssParams; /* holds parameters for sumss command */
231 TaxaInformation *taxaInfo; /* holds critical information about taxa */
232 char **taxaNames; /* holds name of taxa */
233 BitsLong **taxaSet; /* holds information about defined taxasets */
234 char **taxaSetNames; /* holds names of taxa sets */
235 int *tempActiveConstraints;/* temporarily holds active constraints size allcated */
236 enum ConstraintType *definedConstraintsType; /* Store type of constraint */
237 int *tempSet; /* temporarily holds defined set */
238 int *tempSetNeg; /* holds bitset of negative set of taxa for partial constraint*/
239 int theAmbigChar; /* int containing ambiguous character */
240 Calibration *tipCalibration; /* holds information about node calibrations */
241 char **transFrom; /* translation block information */
242 char **transTo; /* translation block information */
243 int userBrlensDef; /* are the branch lengths on user tree defined */
245 #if defined (BEAGLE_ENABLED)
246 int tryToUseBEAGLE; /* try to use the BEAGLE library */
247 int beagleScalingScheme; /* BEAGLE dynamic scaling */
248 int beagleScalingFrequency;/* BEAGLE dynamic scaling frequency */
249 long beagleFlags; /* BEAGLE required resource flags */
250 int beagleResourceNumber; /* BEAGLE resource number */
251 int *beagleResource; /* BEAGLE resource choice list */
252 int beagleResourceCount; /* BEAGLE resource choice list length */
253 int beagleInstanceCount; /* total number of BEAGLE instances */
256 #if defined (THREADS_ENABLED)
257 int tryToUseThreads; /* try to use pthreads with BEAGLE library */
260 /* local (to this file) */
261 char *tokenP, token[CMD_STRING_LENGTH], *cmdStr=NULL;
262 Calibration defaultCalibration = {
263 "Unconstrained", /* name */
264 unconstrained, /* prior */
265 { -1.0, -1.0, -1.0 }, /* priorParams */
266 NULL, /* LnPriorProb */
267 NULL, /* LnPriorRatio */
274 /* Information on commands initialization:
276 1 = Command number (cmdNumber)
277 2 = Command name (string)
278 3 = Special command (YES/NO) (specialCmd)
279 4 = Pointer to finishing function (fp)
280 5 = Number of valid parameters (numParms)
281 6 = List of valid parameters (parmList)
282 7 = Expecting (2^TokenType) (expect) (PARAMETER = 4; SEMICOLON = 32; ALPHA = 16384;
283 ALPHA | QUESTIONMARK | DASH | NUMBER | ASTERISK | EXCLAMATIONMARK | PERCENT | WEIRD | SEMICOLON = 11715360;
284 ALPHA | QUESTIONMARK | DASH | NUMBER | ASTERISK | EXCLAMATIONMARK | PERCENT | WEIRD | VERTICALBAR | SEMICOLON | LEFTPAR | RIGHTPAR | LEFTCURL | RIGHTCURL = 649252640;
285 PARAMETER | SEMICOLON = 36; NUMBER | ALPHA = 49152; ALPHA | SEMICOLON = 16416; EQUALSIGN = 8; NUMBER = 32768)
286 8 = Description of the command (cmdDescription)
287 9 = Where should the command be used (cmdUse) (IN_CMD = used from command line or mrbayes block; IN_FILE = used in data block or in tree block)
288 10 = Should the command be shown when "help" is typed (hiding).
290 #1 #2 #3 #4 #5 #6 #7 #8 #9 #10
291 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
292 { 0, "#", NO, NULL, 1, {0}, 4, "", IN_FILE, HIDE },
293 { 1, "About", NO, DoAbout, 0, {-1}, 32, "Describes the program", IN_CMD, SHOW },
294 { 2, "Acknowledgments", NO, DoAcknowledgments, 0, {-1}, 32, "Shows program acknowledgments", IN_CMD, SHOW },
295 { 3, "Begin", NO, NULL, 6, {1,2,3,201,226,227}, 4, "Denotes beginning of block in file", IN_FILE, SHOW },
296 { 4, "Calibrate", NO, DoCalibrate, 1, {119}, 4, "Assigns dates to terminals or interior nodes", IN_CMD, SHOW },
297 { 5, "Charset", NO, DoCharset, 1, {15}, 4, "Assigns a group of sites to a set", IN_CMD, SHOW },
298 { 6, "Charstat", NO, DoCharStat, 0, {-1}, 32, "Shows status of characters", IN_CMD, SHOW },
299 { 7, "Citations", NO, DoCitations, 0, {-1}, 32, "Citation of program, models, and methods", IN_CMD, SHOW },
300 { 8, "Comparetree", NO, DoCompareTree, 7, {127,128,129,130,221,222,223}, 36, "Compares the trees from two tree files", IN_CMD, SHOW },
301 { 9, "Constraint", NO, DoConstraint, 1, {66}, 4, "Defines a constraint on tree topology", IN_CMD, SHOW },
302 { 10, "Ctype", NO, DoCtype, 1, {65}, 4, "Assigns ordering for the characters", IN_CMD, SHOW },
303 { 11, "Databreaks", YES, DoBreaks, 1, {93}, 32768, "Defines data breaks for autodiscrete gamma model", IN_CMD, SHOW },
304 { 12, "Delete", YES, DoDelete, 1, {47}, 49152, "Deletes taxa from the analysis", IN_CMD, SHOW },
305 { 13, "Dimensions", NO, DoDimensions, 2, {4,5}, 4, "Defines size of character matrix", IN_FILE, SHOW },
306 { 14, "Disclaimer", NO, DoDisclaimer, 0, {-1}, 32, "Describes program disclaimer", IN_CMD, SHOW },
307 { 15, "End", NO, DoEndBlock, 0, {-1}, 32, "Denotes end of a block in file", IN_FILE, SHOW },
308 { 16, "Endblock", NO, DoEndBlock, 0, {-1}, 32, "Alternative way of denoting end of a block", IN_FILE, SHOW },
309 { 17, "Exclude", YES, DoExclude, 1, {45}, 49152, "Excludes sites from the analysis", IN_CMD, SHOW },
310 { 18, "Execute", YES, DoExecute, 1, {12}, 16384, "Executes a file", IN_CMD, SHOW },
311 { 19, "Format", NO, DoFormat, 7, {6,7,8,9,10,219,220}, 4, "Defines character format in data block", IN_FILE, SHOW },
312 { 20, "Help", YES, DoHelp, 1, {50}, 16416, "Provides detailed description of commands", IN_CMD, SHOW },
313 { 21, "Include", YES, DoInclude, 1, {46}, 49152, "Includes sites", IN_CMD, SHOW },
314 { 22, "Link", NO, DoLink, 30, {55,56,57,58,59,60,61,62,63,72,73,74,75,76,105,118,193,194,195,196,197,242,243,252,253,255,256,
315 270,273,274}, 4, "Links parameters across character partitions", IN_CMD, SHOW },
316 { 23, "Log", NO, DoLog, 5, {85,86,87,88,89}, 4, "Logs screen output to a file", IN_CMD, SHOW },
317 { 24, "Lset", NO, DoLset, 16, {28,29,30,31,32,33,34,40,51,52,53,90,91,131,188,189}, 4, "Sets the parameters of the likelihood model", IN_CMD, SHOW },
318 { 25, "Manual", NO, DoManual, 1, {126}, 36, "Prints a command reference to a text file", IN_CMD, SHOW },
319 { 26, "Matrix", YES, DoMatrix, 1, {11},649252640, "Defines matrix of characters in data block", IN_FILE, SHOW },
320 { 27, "Mcmc", NO, DoMcmc, 46, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
321 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215}, 36, "Starts Markov chain Monte Carlo analysis", IN_CMD, SHOW },
322 { 28, "Mcmcp", NO, DoMcmcp, 46, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
323 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215}, 4, "Sets parameters of a chain (without starting analysis)", IN_CMD, SHOW },
324 { 29, "Outgroup", YES, DoOutgroup, 1, {78}, 49152, "Changes outgroup taxon", IN_CMD, SHOW },
325 { 30, "Pairs", YES, DoPairs, 1, {92}, 32768, "Defines nucleotide pairs (doublets) for stem models", IN_CMD, SHOW },
326 { 31, "Partition", NO, DoPartition, 1, {16}, 4, "Assigns a character partition", IN_CMD, SHOW },
327 { 32, "Plot", NO, DoPlot, 6, {106,107,108,109,224,225}, 36, "Plots parameters from MCMC analysis", IN_CMD, SHOW },
328 { 33, "Prset", NO, DoPrset, 43, {35,36,37,38,39,41,42,43,44,54,64,67,68,69,70,71,77,100,101,102,103,104,110,111,117,120,121,133,
329 168,172,173,174,183,184,185,218,241,246,247,251,254,269,271,272}, 4, "Sets the priors for the parameters", IN_CMD, SHOW },
330 { 34, "Propset", NO, DoPropset, 1, {186}, 4, "Sets proposal probabilities and tuning parameters", IN_CMD, SHOW },
331 { 35, "Quit", NO, DoQuit, 0, {-1}, 32, "Quits the program", IN_CMD, SHOW },
332 { 36, "Report", NO, DoReport, 9, {122,123,124,125,134,135,136,192,217}, 4, "Controls how model parameters are reported", IN_CMD, SHOW },
333 { 37, "Restore", YES, DoRestore, 1, {48}, 49152, "Restores taxa", IN_CMD, SHOW },
334 { 38, "Set", NO, DoSet, 22, {13,14,94,145,170,171,179,181,182,216,229,233,234,235,236,237,238,239,240,245,268,275}, 4, "Sets run conditions and defines active data partition", IN_CMD, SHOW },
335 { 39, "Showbeagle", NO, DoShowBeagle, 0, {-1}, 32, "Show available BEAGLE resources", IN_CMD, SHOW },
336 { 40, "Showmatrix", NO, DoShowMatrix, 0, {-1}, 32, "Shows current character matrix", IN_CMD, SHOW },
337 { 41, "Showmcmctrees", NO, DoShowMcmcTrees, 0, {-1}, 32, "Shows trees used in mcmc analysis", IN_CMD, SHOW },
338 { 42, "Showmodel", NO, DoShowModel, 0, {-1}, 32, "Shows model settings", IN_CMD, SHOW },
339 { 43, "Showmoves", NO, DoShowMoves, 1, {180}, 36, "Shows moves for current model", IN_CMD, SHOW },
340 { 44, "Showparams", NO, DoShowParams, 0, {-1}, 32, "Shows parameters in current model", IN_CMD, SHOW },
341 { 45, "Showusertrees", NO, DoShowUserTrees, 0, {-1}, 32, "Shows user-defined trees", IN_CMD, SHOW },
342 { 46,"Speciespartition", NO,DoSpeciespartition, 1, {244}, 4, "Defines a partition of tips into species", IN_CMD, SHOW },
343 { 47, "Ss", NO, DoSs, 50, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
344 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215,248,249,250,257}, 36, "Starts stepping-stone sampling", IN_CMD, SHOW },
345 { 48, "Ssp", NO, DoSsp, 50, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
346 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215,248,249,250,257}, 36,"Sets parameters of stepping-stone analysis (without starting)",IN_CMD, SHOW },
347 { 49, "Startvals", NO, DoStartvals, 1, {187}, 4, "Sets starting values of parameters", IN_CMD, SHOW },
348 { 50, "Sump", NO, DoSump, 13, {96,97,137,138,139,140,141,161,162,178,211,212,231}, 36, "Summarizes parameters from MCMC analysis", IN_CMD, SHOW },
349 { 51, "Sumss", NO, DoSumSs, 10, {258,259,260,261,262,263,264,265,266,267}, 36, "Summarizes parameters from stepping-stone analysis", IN_CMD, SHOW },
350 { 52, "Sumt", NO, DoSumt, 21, {80,81,82,95,146,147,163,164,165,167,175,177,204,205,206,207,208,209,210,230,232}, 36, "Summarizes trees from MCMC analysis", IN_CMD, SHOW },
351 { 53, "Taxastat", NO, DoTaxaStat, 0, {-1}, 32, "Shows status of taxa", IN_CMD, SHOW },
352 { 54, "Taxset", NO, DoTaxaset, 1, {49}, 4, "Assigns a group of taxa to a set", IN_CMD, SHOW },
353 { 55, "Taxlabels", YES, DoTaxlabels, 1, {228}, 49152, "Defines taxon labels", IN_FILE, SHOW },
354 { 56, "Translate", YES, DoTranslate, 1, {83}, 49152, "Defines alternative names for taxa", IN_FILE, SHOW },
355 { 57, "Tree", NO, DoTree, 1, {79}, 4, "Defines a tree", IN_FILE, SHOW },
356 { 58, "Unlink", NO, DoUnlink, 30, {55,56,57,58,59,60,61,62,63,72,73,74,75,76,105,118,193,194,195,196,197,242,243,252,253,255,256,
357 270,273,274}, 4, "Unlinks parameters across character partitions", IN_CMD, SHOW },
358 { 59, "Usertree", YES, DoUserTree, 1, {203}, 8, "Defines a single user tree", IN_CMD, HIDE },
359 { 60, "Version", NO, DoVersion, 0, {-1}, 32, "Shows program version", IN_CMD, SHOW },
360 { 61, "Compareref", NO, DoCompRefTree, 7, {127,128,129,130,221,222,223}, 36, "Compares the tree to the reference trees", IN_CMD, HIDE },
361 /* NOTE: If you add a command here, make certain to change NUMCOMMANDS (above, in this file) appropriately! */
362 { 999, NULL, NO, NULL, 0, {-1}, 32, "", IN_CMD, HIDE }
364 int inDataBlock, inForeignBlock, isInterleaved, isFirstMatrixRead, isFirstInterleavedBlock,
365 taxonCount, fromI, toJ, everyK, foundDash, foundSlash, foundFirst, isMixed, whichPartition,
366 isNegative, numDivisions, charOrdering, foundExp, foundColon, isFirstNode, nextAvailableNode,
367 pairId, firstPair, inTaxaBlock, inCharactersBlock, foundEqual;
368 char gapId, missingId, matchId, tempSetName[100], **tempNames;
369 CmdType *commandPtr; /* Points to the commands array entry which corresponds to currently processed command */
370 ParmInfoPtr paramPtr; /* Points to paramTable table array entry which corresponds to currently processed parameter of current command */
371 TreeNode *pPtr, *qPtr;
373 enum ConstraintType consrtainType; /* Used only in processing of constraine command to indicate what is the type of constrain */
376 int AddToGivenSet (int i, int j, int k, int id, int *Set)
382 MrBayesPrint ("%s The id for a temporary set should be greater than 0\n", spacer);
388 else if (i < 0 && j >= 0)
390 else if (i >= 0 && j < 0)
398 MrBayesPrint ("%s Character %d defined more than once\n", spacer, i+1);
404 else if (i >= 0 && j >= 0)
412 MrBayesPrint ("%s Character %d defined more than once\n", spacer, m+1);
427 MrBayesPrint ("%s Character %d defined more than once\n", spacer, m+1);
442 int AddToSet (int i, int j, int k, int id)
444 return AddToGivenSet (i, j, k,id, tempSet);
448 /* AddNameSet: Push a name set onto the end of a list of name sets, with reallocation
449 of list to hold the extra element. The calling function needs to keep track of
450 the counter holding the length of the list. */
451 int AddNameSet (NameSet **nameSetList, int numNameSets, char **nameSet, int numNames)
455 (*nameSetList) = (NameSet*) SafeRealloc ((void*)(*nameSetList), ((size_t)numNameSets+1)*sizeof(NameSet));
457 (*nameSetList)[numNameSets].names = NULL;
458 (*nameSetList)[numNameSets].numNames = numNames;
460 for (i=0; i<numNames; i++)
461 AddString(&((*nameSetList)[numNameSets].names), i, nameSet[i]);
467 /* AddString: Push a string onto the end of a list, with reallocation of list
468 to hold the extra element. The calling function needs to keep track of
469 the counter holding the length of the list. */
470 int AddString (char ***list, int len, char *token)
472 (*list) = (char **) SafeRealloc ((void *)(*list), ((size_t)len+1)*sizeof(char*));
476 (*list)[len] = (char *) SafeCalloc ((strlen(token)+1), sizeof(char));
480 strcpy ((*list)[len], token);
486 int AllocCharacters (void)
490 if (memAllocs[ALLOC_MATRIX] == YES)
492 matrix = (int *) SafeMalloc((size_t)numTaxa * (size_t)numChar * sizeof(int));
495 MrBayesPrint ("%s Problem allocating matrix (%d)\n", spacer, numTaxa * numChar * sizeof(int));
498 for (i=0; i<numTaxa * numChar; i++)
500 memAllocs[ALLOC_MATRIX] = YES;
502 if (memAllocs[ALLOC_CHARINFO] == YES)
504 charInfo = (CharInformation *) SafeMalloc ((size_t)numChar * sizeof(CharInformation));
507 MrBayesPrint ("%s Problem allocating charInfo (%d)\n", spacer, numChar * sizeof(CharInformation));
510 for (i=0; i<numChar; i++)
512 charInfo[i].isExcluded = NO;
513 charInfo[i].numStates = 0;
514 charInfo[i].charType = 0;
515 charInfo[i].isMissAmbig = NO;
516 charInfo[i].ctype = UNORD;
517 charInfo[i].charId = 0;
518 charInfo[i].pairsId = 0;
519 charInfo[i].bigBreakAfter = NO;
521 memAllocs[ALLOC_CHARINFO] = YES;
523 if (memAllocs[ALLOC_CHARSETS] == YES)
528 memAllocs[ALLOC_CHARSETS] = YES; /* safe to do free */
530 if (memAllocs[ALLOC_PARTITIONS] == YES)
532 partitionNames = NULL;
533 partitionId = (int**) SafeMalloc ((size_t)numChar * sizeof(int*));
534 for (i=0; i<numChar; i++)
535 partitionId[i] = (int *) SafeMalloc (sizeof(int));
536 numDefinedPartitions = 0; /* number of defined partitions */
537 memAllocs[ALLOC_PARTITIONS] = YES; /* safe to do free */
539 if (memAllocs[ALLOC_PARTITIONVARS] == YES)
542 tempLinkUnlinkVec = NULL;
544 tempLinkUnlinkVec = NULL;
547 tempLinkUnlink[0] = NULL;
548 for (i=0; i<NUM_LINKED; i++)
551 tempLinkUnlink[i] = NULL;
552 activeParams[i] = NULL;
554 memAllocs[ALLOC_PARTITIONVARS] = YES;
556 if (memAllocs[ALLOC_TMPSET] == NO)
558 if (numChar > numTaxa)
559 tempSetSize = numChar;
561 tempSetSize = numTaxa;
562 tempSet = (int *) SafeRealloc ((void *)tempSet, (size_t)tempSetSize * sizeof(int));
563 tempSetNeg = (int *) SafeRealloc ((void *)tempSetNeg, (size_t)tempSetSize * sizeof(int));
564 if (!tempSet || !tempSetNeg)
566 MrBayesPrint ("%s Problem reallocating tempSet (%d)\n", spacer, tempSetSize * sizeof(int));
570 MrBayesPrint ("%s Allocated matrix\n", spacer);
574 MrBayesPrint ("%s Problem allocating matrix\n", spacer);
580 int AllocMatrix (void)
582 if (memAllocs[ALLOC_TAXA] == NO && AllocTaxa() == ERROR)
585 return (AllocCharacters());
595 MrBayesPrint ("%s Number of taxa not defined\n", spacer);
600 MrBayesPrint ("%s Number of taxa is 0\n", spacer);
604 /* allocate space for taxa */
605 if (memAllocs[ALLOC_TAXA] == YES)
607 taxaNames = NULL; /* This variable is allocated in AddString */
608 taxaInfo = (TaxaInformation *) SafeMalloc ((size_t)numTaxa * sizeof(TaxaInformation));
613 tipCalibration = (Calibration *) SafeMalloc ((size_t)numTaxa * sizeof(Calibration));
620 for (i=0; i<numTaxa; i++)
622 taxaInfo[i].isDeleted = NO;
623 taxaInfo[i].charCount = 0;
625 memAllocs[ALLOC_TAXA] = YES;
628 if (memAllocs[ALLOC_TAXASETS] == YES)
633 memAllocs[ALLOC_TAXASETS] = YES; /* safe to free */
635 /* species partitions; allocate space and set default species partition */
636 if (memAllocs[ALLOC_SPECIESPARTITIONS] == YES)
638 speciespartitionNames = NULL;
639 speciesNameSets = NULL;
640 speciespartitionId = (int**) SafeMalloc ((size_t)numTaxa * sizeof(int*));
641 for (i=0; i<numTaxa; i++)
643 speciespartitionId[i] = (int *) SafeMalloc (sizeof(int));
644 speciespartitionId[i][0] = i + 1; /* 1-based taxon index, do not ask me why */
646 numDefinedSpeciespartitions = 0; /* number of defined species partitions */
647 memAllocs[ALLOC_SPECIESPARTITIONS] = YES; /* safe to do free */
650 if (memAllocs[ALLOC_CONSTRAINTS] == YES)
652 constraintNames = NULL;
653 definedConstraintsType = NULL;
654 definedConstraint = NULL;
655 definedConstraintTwo = NULL;
656 definedConstraintPruned = NULL;
657 definedConstraintTwoPruned = NULL;
658 numDefinedConstraints = 0;
659 tempActiveConstraints = NULL;
660 memAllocs[ALLOC_CONSTRAINTS] = YES; /* safe to free */
662 /* translate table */
668 if (memAllocs[ALLOC_TMPSET] == YES)
670 tempSet = (int *) SafeMalloc ((size_t)numTaxa * sizeof(int));
671 tempSetNeg = (int *) SafeMalloc ((size_t)numTaxa * sizeof(int));
672 if (!tempSet || !tempSetNeg)
674 memAllocs[ALLOC_TMPSET] = YES;
676 /* make sure previous user trees are freed */
677 if (numUserTrees > 0)
679 MrBayesPrint ("%s Previous user trees not freed\n", spacer);
683 MrBayesPrint ("%s Allocated taxon set\n", spacer);
687 MrBayesPrint ("%s Problem allocating taxon set\n", spacer);
693 char ChangeCase (char c)
702 int CharacterCode (char ch, int *charCode, int chType)
704 if (chType == DNA || chType == RNA)
706 if ((*charCode = NucID (ch)) == -1)
708 MrBayesPrint ("%s Unrecognized DNA/RNA character '%c'\n", spacer, ch);
712 else if (chType == PROTEIN)
714 if ((*charCode = ProtID (ch)) == -1)
716 MrBayesPrint ("%s Unrecognized Protein character '%c'\n", spacer, ch);
720 else if (chType == RESTRICTION)
722 if ((*charCode = MBResID (ch)) == -1)
724 MrBayesPrint ("%s Unrecognized Restriction character '%c'\n", spacer, ch);
728 else if (chType == STANDARD)
730 if ((*charCode = StandID (ch)) == -1)
732 MrBayesPrint ("%s Unrecognized Standard character '%c'\n", spacer, ch);
736 else if (chType == CONTINUOUS)
738 MrBayesPrint ("%s CharacterCode function cannot check continuous characters\n", spacer);
742 MrBayesPrint ("%s Unrecognized character type (%d)\n", spacer, chType);
750 int CharacterNumber (int charCode, int chType)
754 if (chType == CONTINUOUS)
764 int CheckInitialPartitions (void)
768 for (i=0; i<numChar; i++)
770 if (partitionId[i][0] <= 0 || partitionId[i][0] > numDivisions)
772 MrBayesPrint ("%s The partition for site %d is incorrect\n", spacer, i+1);
781 int CheckStringValidity (char *s)
783 int i, numUnknownChars, tempNumComments, tempInComment;
788 tempNumComments = numComments;
789 tempInComment = inComment;
793 if (tempInComment == NO)
795 if (!IsIn(s[i],"=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.;:,#()[]?-*/'\\'!%\"&~+^$@|{}`>< "))
797 if (IsWhite(s[i]) == 1 || IsWhite(s[i]) == 2)
803 if (commandPtr == NULL)
805 MrBayesPrint ("%s Unknown character \"%c\" (ASCII code %d)\n", spacer, s[i], s[i]);
806 if (!strcmp(commandPtr->string,"Matrix"))
808 if (foundNewLine == NO)
810 MrBayesPrint ("%s The error is in character %d for taxon %s\n", spacer, taxaInfo[taxonCount-1].charCount+i+1, "???"); /* bug? */
815 MrBayesPrint ("%s The error is in the first taxon name\n", spacer);
818 strcpy(temp, taxaNames[taxonCount]);
819 if (isInterleaved == NO)
820 MrBayesPrint ("%s The error is in the name of the taxon following taxon %s\n", spacer, temp);
823 MrBayesPrint ("%s The error is in the name of the taxon following taxon %s\n", spacer, temp);
824 MrBayesPrint ("%s in one of the interleaved data blocks\n", spacer);
829 else if (!strcmp(commandPtr->string,"Execute"))
831 MrBayesPrint ("%s Assuming irrelevant characters at beginning of file; processing continues\n", spacer);
843 else if (tempInComment == YES)
848 if (tempNumComments == 0)
855 if (numUnknownChars > 0)
862 /* CheckString: This function simply checks a vector of strings for a match against token.
863 Upon return, matchIndex contains the index of the matched string. An
864 ERROR is returned if there are no matches. */
865 int CheckString (char **list, int len, char *token, int *matchIndex)
870 for (i=0; i<len; i++)
872 if (StrCmpCaseInsensitive(token,list[i]) == 0)
883 int Dex (TreeNode *p)
885 return (p == NULL) ? -1 : p->index;
891 MrBayesPrint (" --------------------------------------------------------------------------- \n");
892 MrBayesPrint (" About the program \n");
893 MrBayesPrint (" \n");
894 MrBayesPrint (" MrBayes is a program for the Bayesian estimation of phylogeny. Bayesian \n");
895 MrBayesPrint (" inference of phylogeny is based upon the posterior probability distribution \n");
896 MrBayesPrint (" of trees. Trees are labelled T1, T2, ..., Tn, where n is the number of \n");
897 MrBayesPrint (" possible trees. The posterior probability of the i-th tree is calculated \n");
898 MrBayesPrint (" using Bayes\'s formula as \n");
899 MrBayesPrint (" \n");
900 MrBayesPrint (" Pr[Ti | X] = Pr[X | Ti] X Pr[Ti] / Pr[X] \n");
901 MrBayesPrint (" \n");
902 MrBayesPrint (" where X is a character matrix. Here, \"Pr[Ti | X]\" is the posterior \n");
903 MrBayesPrint (" probability of the i-th tree, \"Pr[X | Ti]\" is the likelihood of the \n");
904 MrBayesPrint (" i-th tree, and \"Pr[Ti]\" is the prior probability of the i-th tree. The \n");
905 MrBayesPrint (" denominator of Bayes\'s formula (\"Pr[X]\") is a normalizing constant that \n");
906 MrBayesPrint (" involves a summation over all possible trees. The likelihood, as described \n");
907 MrBayesPrint (" above, cannot be calculated with knowledge of only the tree\'s topology. You \n");
908 MrBayesPrint (" also need to have information on the lenths of the branches and on the \n");
909 MrBayesPrint (" mechanism of character change. Hence, the likelihood (\"Pr[X | Ti]\") \n");
910 MrBayesPrint (" involves a multidimensional integral over all possible combinations of \n");
911 MrBayesPrint (" branch lengths and substitution model parameters. \n");
912 MrBayesPrint (" \n");
913 MrBayesPrint (" In practice, it is impossible to calculate the posterior probability dist- \n");
914 MrBayesPrint (" ribution of trees analytically. Instead, the posterior probability \n");
915 MrBayesPrint (" of trees must be approximated. MrBayes uses a method called Markov chain \n");
916 MrBayesPrint (" Monte Carlo (MCMC) to approximate the posterior probability of trees. \n");
917 MrBayesPrint (" The object of MCMC is to construct a Markov chain that has as its state \n");
918 MrBayesPrint (" space the parameters of the phylogenetic model and a stationary distribution \n");
919 MrBayesPrint (" that is the posterior probability distribution of trees. MCMC takes valid, \n");
920 MrBayesPrint (" albeit dependent, samples from the posterior probability distribution of \n");
921 MrBayesPrint (" trees. The fraction of the time any tree appears in this sample is a \n");
922 MrBayesPrint (" valid approximation of the posterior probability of the tree. MrBayes keeps \n");
923 MrBayesPrint (" track of all the parameters of the phylogenetic model. The trees (with branch \n");
924 MrBayesPrint (" lengths) that were sampled by the MCMC procedure are saved in one file \n");
925 MrBayesPrint (" (a file with a \".t\" extension) whereas the parameters of the model of \n");
926 MrBayesPrint (" character change are saved in another file (a file with a \".p\" ext- \n");
927 MrBayesPrint (" ension). You can summarize the results in the \".t\" and \".p\" files \n");
928 MrBayesPrint (" using the \"sumt\" and \"sump\" commands, respectively. \n");
929 MrBayesPrint (" \n");
930 MrBayesPrint (" MrBayes was originally written by John Huelsenbeck in August of 2000 and was \n");
931 MrBayesPrint (" intended to be distributed to a small number of people. In March of 2001, \n");
932 MrBayesPrint (" Fredrik Ronquist started making contributions to the program. The contribu- \n");
933 MrBayesPrint (" tions were of such a significant nature that he was made a coauthor of the \n");
934 MrBayesPrint (" program. Version 3 of MrBayes was a fully joint effort, started in the summer \n");
935 MrBayesPrint (" of 2002 when JPH visited Sweden on a grant from the Wenner-Gren Foundations. \n");
936 MrBayesPrint (" Several others have contributed to the MrBayes code since then, most notably \n");
937 MrBayesPrint (" Paul van der Mark and Maxim Teslenko, both postdocs/programmers in Fredrik's \n");
938 MrBayesPrint (" lab. A large number of users and students, too many to list here, have also \n");
939 MrBayesPrint (" contributed importantly to the project (type 'Acknowledgments' for a list of \n");
940 MrBayesPrint (" some of them). \n");
941 MrBayesPrint (" \n");
942 MrBayesPrint (" Since 2003, MrBayes has been distributed from SourceForge. Bugs can be repor- \n");
943 MrBayesPrint (" ted to the MrBayes site on SourceForge or by contacting Maxim Teslenko \n");
944 MrBayesPrint (" (maxim.teslenko@nrm.se) directly. \n");
945 MrBayesPrint (" --------------------------------------------------------------------------- \n");
951 int DoAcknowledgments (void)
953 MrBayesPrint (" --------------------------------------------------------------------------- \n");
954 MrBayesPrint (" Acknowledgments \n");
955 MrBayesPrint (" \n");
956 MrBayesPrint (" JPH and FR would like to thank Gautam Altekar, Andrea Betancourt, Jon \n");
957 MrBayesPrint (" Bollback, Barry Hall, Jimmy McGuire, Rasmus Nielsen, David Swofford, \n");
958 MrBayesPrint (" Johan Nylander, Mikael Thollesson, and Derrick Zwickl for help during the \n");
959 MrBayesPrint (" initial development of this program. Gautam Altekar, especially, was instru- \n");
960 MrBayesPrint (" mental in getting the parallel version of the program working. Important bug- \n");
961 MrBayesPrint (" fixes and additional functionality was contributed by Clemens Lakner, Sebas- \n");
962 MrBayesPrint (" tian Hoehna, Paul Lewis, Mark Holder, Julian Catchen and Bret Larget. Marc \n");
963 MrBayesPrint (" Suchard, Daniel Ayres and Aaron Darling got mrbayes working with beagle and \n");
964 MrBayesPrint (" contributed a lot of related functionality and bug fixes. Aaron Darling was \n");
965 MrBayesPrint (" instrumental in getting the Windows installer set up. Liu Liang and Dennis \n");
966 MrBayesPrint (" Pearl helped integrate MrBayes with BEST. \n");
967 MrBayesPrint (" \n");
968 MrBayesPrint (" Bug fixes and user support was provided by Paul van der Mark (2005-2007) and \n");
969 MrBayesPrint (" from 2010 by Maxim Teslenko (maxim.teslenko@nrm.se). \n");
970 MrBayesPrint (" \n");
971 MrBayesPrint (" Our wives -- Edna Huelsenbeck and Eva Ronquist -- showed extraordinary \n");
972 MrBayesPrint (" patience with us while we spent many late nights programming. \n");
973 MrBayesPrint (" \n");
974 MrBayesPrint (" JPH was supported by NSF grants DEB-007540 and MCB-0075404 and a Wenner- \n");
975 MrBayesPrint (" Gren scholarship while writing this program. FR was supported by grants \n");
976 MrBayesPrint (" from the Swedish Natural Science Research Council and the Swedish Research \n");
977 MrBayesPrint (" Council. \n");
978 MrBayesPrint (" --------------------------------------------------------------------------- \n");
984 int DoBeginParm (char *parmName, char *tkn)
986 if (expecting == Expecting(PARAMETER))
988 /* set Data (inDataBlock) *************************************************************/
989 if (!strcmp(parmName, "Data"))
991 if (FreeModel () == ERROR)
993 if (FreeMatrix () == ERROR)
995 MrBayesPrint (" Reading data block\n");
997 expecting = Expecting(SEMICOLON);
998 strcpy (spacer, " ");
1000 /* set Characters (inCharactersBlock) *************************************************************/
1001 else if (!strcmp(parmName, "Characters"))
1003 if (FreeModel () == ERROR)
1005 if (FreeCharacters () == ERROR)
1007 MrBayesPrint (" Reading characters block\n");
1008 inCharactersBlock = YES;
1009 expecting = Expecting(SEMICOLON);
1010 strcpy (spacer, " ");
1012 /* set Taxa (inTaxaBlock) *************************************************************/
1013 else if (!strcmp(parmName, "Taxa"))
1015 if (FreeModel () == ERROR)
1017 if (FreeMatrix () == ERROR)
1019 MrBayesPrint (" Reading taxa block\n");
1021 expecting = Expecting(SEMICOLON);
1022 strcpy (spacer, " ");
1024 /* set Mrbayes (inMrbayesBlock) *******************************************************/
1025 else if (!strcmp(parmName, "Mrbayes"))
1027 MrBayesPrint (" Reading mrbayes block\n");
1028 inMrbayesBlock = YES;
1029 expecting = Expecting(SEMICOLON);
1030 strcpy (spacer, " ");
1032 /* set Trees (inTreesBlock) *******************************************************/
1033 else if (!strcmp(parmName, "Trees"))
1035 MrBayesPrint (" Reading trees block\n");
1037 expecting = Expecting(SEMICOLON);
1038 strcpy (spacer, " ");
1040 /* set Foreign (inForeignBlock) *******************************************************/
1043 MrBayesPrint (" Skipping \"%s\" block\n", tkn);
1044 inForeignBlock = YES;
1045 expecting = Expecting(SEMICOLON);
1046 strcpy (spacer, "");
1061 for (i=0; i<numChar; i++)
1063 if (charInfo[i].bigBreakAfter == YES)
1072 MrBayesPrint ("%s One data break found after character ", spacer, numBreaks);
1074 MrBayesPrint ("%s %d data breaks found after characters: ", spacer, numBreaks);
1075 for (i=0; i<numChar; i++)
1077 if (charInfo[i].bigBreakAfter == YES)
1079 MrBayesPrint ("%d ", i+1);
1082 MrBayesPrint ("\n");
1085 MrBayesPrint ("%s Successfully defined one break in data\n", spacer);
1087 MrBayesPrint ("%s Successfully defined %d breaks in data\n", spacer, numBreaks);
1091 MrBayesPrint ("%s No breaks in data found\n", spacer);
1098 int DoBreaksParm (char *parmName, char *tkn)
1102 if (defMatrix == NO)
1104 MrBayesPrint ("%s A matrix must be specified before you can define breaks in the data\n", spacer);
1108 if (expecting == Expecting(NUMBER))
1110 sscanf (tkn, "%d", &tempInt);
1111 if (tempInt <= 0 || tempInt > numChar)
1113 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
1114 for (i=0; i<numChar; i++)
1115 charInfo[i].bigBreakAfter = NO;
1118 if (tempInt == numChar)
1120 MrBayesPrint ("%s Character number %d is the last character. MrBayes will define the\n", spacer, tempInt);
1121 MrBayesPrint ("%s break, even though it doesn't make too much sense.\n", spacer);
1125 charInfo[tempInt].bigBreakAfter = YES;
1127 expecting = (Expecting(NUMBER) | Expecting(SEMICOLON));
1131 for (i=0; i<numChar; i++)
1132 charInfo[i].bigBreakAfter = NO;
1137 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
1141 int DoCalibrate (void)
1145 /* show calibration times (for debugging) */
1147 MrBayesPrint ("Taxon ages\n");
1148 for (i=0; i<numTaxa; i++)
1149 MrBayesPrint ("%4d -- %s\n", i+1, tipCalibration[i].name);
1150 MrBayesPrint ("Constraint ages\n");
1151 for (i=0; i<numDefinedConstraints; i++)
1153 if (definedConstraintsType[i] != HARD)
1155 MrBayesPrint ("%4d -- %s\n", i+1, nodeCalibration[i].name);
1159 /* Update model if calibrations enforced */
1160 for (i=0; i<numCurrentDivisions; i++)
1162 if (!strcmp(modelParams[i].nodeAgePr,"Calibrated"))
1164 if (SetUpAnalysis (&globalSeed) == ERROR)
1174 int DoCalibrateParm (char *parmName, char *tkn)
1176 static int isTaxon, paramIndex;
1177 static char nodeName[100], calName[100];
1178 static MrBFlt priorParams[3];
1179 static enum CALPRIOR calPrior;
1181 char s[20], tempStr[100];
1184 if (defMatrix == NO)
1186 MrBayesPrint ("%s A matrix must be specified before you can calibrate nodes\n", spacer);
1190 if (expecting == Expecting(PARAMETER))
1192 if (strcmp(parmName, "Xxxxxxxxxx") != 0)
1194 MrBayesPrint ("%s Unexpected error - Wrong parmName in DoCalibrateParm\n", spacer);
1198 /* find taxon with this name */
1199 calibrationPtr = NULL;
1202 /* first look in constraint names */
1203 if (CheckString (constraintNames, numDefinedConstraints, tkn, &index) != ERROR && definedConstraintsType[index] == HARD)
1205 calibrationPtr = &nodeCalibration[index];
1208 strcpy (nodeName, tkn);
1211 /* then look in terminal taxon names */
1212 if (CheckString (taxaNames, numTaxa, tkn, &index) != ERROR)
1214 calibrationPtr = &tipCalibration[index];
1217 strcpy (nodeName, tkn);
1220 /* return error if not found or ambiguous */
1223 MrBayesPrint ("%s No taxon or hard constraint named ""%s"" found. Note that only hard constraint can be calibrated.\n", spacer, tkn);
1226 else if (howMany > 1)
1228 MrBayesPrint ("%s Both a taxon and a constraint named ""%s"" encountered -- please rename one\n", spacer, tkn);
1232 /* get ready to find the equal sign */
1233 expecting = Expecting(EQUALSIGN);
1236 else if (expecting == Expecting(EQUALSIGN))
1238 /* get ready to find the calibration prior */
1239 expecting = Expecting(ALPHA);
1242 else if (expecting == Expecting(ALPHA))
1244 /* set the calibration prior type */
1245 if (IsArgValid(tkn,tempStr) == NO_ERROR)
1247 if (!strcmp (tempStr, "Unconstrained"))
1248 calPrior = unconstrained;
1249 else if (!strcmp (tempStr, "Fixed"))
1251 else if (!strcmp (tempStr, "Uniform"))
1253 else if (!strcmp (tempStr, "Offsetexponential"))
1254 calPrior = offsetExponential;
1255 else if (!strcmp (tempStr, "Truncatednormal"))
1256 calPrior = truncatedNormal;
1257 else if (!strcmp (tempStr, "Lognormal"))
1258 calPrior = logNormal;
1259 else if (!strcmp (tempStr, "Offsetlognormal"))
1260 calPrior = offsetLogNormal;
1261 else if (!strcmp (tempStr, "Gamma"))
1262 calPrior = standardGamma;
1263 else if (!strcmp (tempStr, "Offsetgamma"))
1264 calPrior = offsetGamma;
1266 if (calPrior == unconstrained)
1268 /* reset the values of the calibration */
1269 MrBayesPrint ("%s Resetting previous calibration for ""%s""\n", spacer, nodeName);
1271 calibrationPtr->prior = defaultCalibration.prior;
1272 calibrationPtr->priorParams[0] = defaultCalibration.priorParams[0];
1273 calibrationPtr->priorParams[1] = defaultCalibration.priorParams[1];
1274 calibrationPtr->priorParams[2] = defaultCalibration.priorParams[2];
1275 calibrationPtr->LnPriorProb = defaultCalibration.LnPriorProb;
1276 calibrationPtr->LnPriorRatio = defaultCalibration.LnPriorRatio;
1277 calibrationPtr->min = defaultCalibration.min;
1278 calibrationPtr->max = defaultCalibration.max;
1279 strcpy(calibrationPtr->name, defaultCalibration.name);
1281 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
1285 strcpy (calName, tempStr);
1287 priorParams[0] = priorParams[1] = priorParams[2] = -1.0;
1288 expecting = Expecting(LEFTPAR);
1293 MrBayesPrint ("%s Invalid calibration prior argument \n", spacer);
1297 else if (expecting == Expecting(LEFTPAR))
1299 strcat (calName, "(");
1300 expecting = Expecting(NUMBER);
1302 else if (expecting == Expecting(NUMBER))
1304 sscanf (tkn, "%lf", &tempD);
1305 if (paramIndex == 0)
1307 if (calPrior == logNormal)
1311 MrBayesPrint ("%s Mean age must be nonnegative\n", spacer);
1312 MrBayesPrint ("%s Parameters of the lognormal distribution used for dating are mean age\n", spacer);
1313 MrBayesPrint ("%s and standard deviation, both specified on the linear scale, not as log values.\n", spacer);
1317 else if (calPrior == standardGamma)
1321 MrBayesPrint ("%s Mean parameter must be positive\n", spacer);
1322 MrBayesPrint ("%s Parameters of the gamma distribution used for dating are mean age and\n", spacer);
1323 MrBayesPrint ("%s standard deviation. In terms of the common shape (alpha) and rate (beta)\n", spacer);
1324 MrBayesPrint ("%s parameterization, the expected mean is alpha/beta and the standard\n", spacer);
1325 MrBayesPrint ("%s deviation is the square root of (alpha / beta^2).\n", spacer);
1329 else if (tempD < 0.0)
1331 if (calPrior == fixed)
1332 MrBayesPrint ("%s Fixed age must be nonnegative\n", spacer);
1333 else if (calPrior == uniform)
1335 MrBayesPrint ("%s Minimum age must be nonnegative\n", spacer);
1336 MrBayesPrint ("%s Parameters of the uniform are minimum age and maximum age.\n", spacer);
1338 else if (calPrior == truncatedNormal)
1340 MrBayesPrint ("%s Offset (minimum or truncation) age must be nonnegative.\n", spacer);
1341 MrBayesPrint ("%s Parameters of the truncated normal distribution are offset (minimum\n", spacer);
1342 MrBayesPrint ("%s or truncation) age, mean age and standard deviation.\n", spacer);
1344 else if (calPrior == offsetGamma)
1346 MrBayesPrint ("%s Offset age must be nonnegative\n", spacer);
1347 MrBayesPrint ("%s Parameters of the offset gamma distribution used for dating are offset age,\n", spacer);
1348 MrBayesPrint ("%s mean age, and standard deviation. In terms of the common shape (alpha) and\n", spacer);
1349 MrBayesPrint ("%s rate (beta) parameterization, the expected mean is alpha/beta and the standard\n", spacer);
1350 MrBayesPrint ("%s deviation is the square root of (alpha / beta^2).\n", spacer);
1352 else if (calPrior == offsetExponential)
1354 MrBayesPrint ("%s Offset age must be nonnegative\n", spacer);
1355 MrBayesPrint ("%s Parameters of the offset exponential are offset age and mean age.\n", spacer);
1357 else if (calPrior == offsetLogNormal)
1359 MrBayesPrint ("%s Offset age must be nonnegative\n", spacer);
1360 MrBayesPrint ("%s Parameters of the offset lognormal distribution are offset age, mean age,\n", spacer);
1361 MrBayesPrint ("%s and standard deviation. All values are specified on the linear scale, not\n", spacer);
1362 MrBayesPrint ("%s as log values.\n", spacer);
1366 priorParams[0] = tempD;
1367 if (calPrior == fixed)
1368 expecting = Expecting(RIGHTPAR);
1370 expecting = Expecting(COMMA);
1372 else if (paramIndex == 1)
1374 if (calPrior == uniform)
1376 if (tempD <= priorParams[0])
1378 MrBayesPrint ("%s Maximum age of uniform distribution must be larger than minimum age\n", spacer);
1382 else if (calPrior == offsetExponential)
1384 if (tempD <= priorParams[0])
1386 MrBayesPrint ("%s Mean age must be larger than offset age.\n", spacer);
1387 MrBayesPrint ("%s MrBayes now uses offset and mean rather than offset and rate\n", spacer);
1388 MrBayesPrint ("%s as the parameters for the offset exponential distribution.\n", spacer);
1392 else if (calPrior == truncatedNormal)
1394 if (tempD <= priorParams[0])
1396 MrBayesPrint ("%s Mean age must be larger than offset (truncation) age.\n", spacer);
1397 MrBayesPrint ("%s Parameters of the truncated normal distribution are offset (minimum\n", spacer);
1398 MrBayesPrint ("%s or truncation) age, mean age and standard deviation\n", spacer);
1402 else if (calPrior == logNormal)
1406 MrBayesPrint ("%s Standard deviation must be positive.\n", spacer);
1407 MrBayesPrint ("%s Parameters of the lognormal distribution used for dating are mean age\n", spacer);
1408 MrBayesPrint ("%s and standard deviation, both specified on the linear scale, not as log values.\n", spacer);
1412 else if (calPrior == offsetLogNormal)
1414 if (tempD <= priorParams[0])
1416 MrBayesPrint ("%s Mean age must be larger than offset age.\n", spacer);
1417 MrBayesPrint ("%s Parameters of the offset lognormal distribution are offset age, mean age,\n", spacer);
1418 MrBayesPrint ("%s and standard deviation. All values are specified on the linear scale, not\n", spacer);
1419 MrBayesPrint ("%s as log values.\n", spacer);
1423 else if (calPrior == standardGamma)
1427 MrBayesPrint ("%s Standard deviation must be positive.\n", spacer);
1428 MrBayesPrint ("%s Parameters of the gamma distribution used for dating are mean age and\n", spacer);
1429 MrBayesPrint ("%s standard deviation. In terms of the common shape (alpha) and rate (beta)\n", spacer);
1430 MrBayesPrint ("%s parameterization, the expected mean is alpha/beta and the standard\n", spacer);
1431 MrBayesPrint ("%s deviation is the square root of (alpha / beta^2).\n", spacer);
1435 else if (calPrior == offsetGamma)
1439 MrBayesPrint ("%s Mean age must be positive.\n", spacer);
1440 MrBayesPrint ("%s Parameters of the offset gamma distribution used for dating are offset age,\n", spacer);
1441 MrBayesPrint ("%s mean age, and standard deviation. In terms of the common shape (alpha) and\n", spacer);
1442 MrBayesPrint ("%s rate (beta) parameterization, the expected mean is alpha/beta and the standard\n", spacer);
1443 MrBayesPrint ("%s deviation is the square root of (alpha / beta^2).\n", spacer);
1448 priorParams[1] = tempD;
1449 if (calPrior == uniform || calPrior == standardGamma || calPrior == logNormal || calPrior == offsetExponential)
1450 expecting = Expecting(RIGHTPAR);
1452 expecting = Expecting(COMMA);
1454 else /* if (paramIndex == 2) */
1456 if (calPrior == offsetGamma)
1460 MrBayesPrint ("%s Standard deviation must be positive.\n", spacer);
1461 MrBayesPrint ("%s Parameters of the offset gamma distribution used for dating are offset age,\n", spacer);
1462 MrBayesPrint ("%s mean age, and standard deviation. In terms of the common shape (alpha) and\n", spacer);
1463 MrBayesPrint ("%s rate (beta) parameterization, the expected mean is alpha/beta and the standard\n", spacer);
1464 MrBayesPrint ("%s deviation is the square root of (alpha / beta^2).\n", spacer);
1468 else if (calPrior == offsetLogNormal)
1472 MrBayesPrint ("%s Standard deviation must be positive.\n", spacer);
1473 MrBayesPrint ("%s Parameters of the offset lognormal distribution are offset age, mean age,\n", spacer);
1474 MrBayesPrint ("%s and standard deviation. All values are specified on the linear scale, not\n", spacer);
1475 MrBayesPrint ("%s as log values.\n", spacer);
1479 priorParams[2] = tempD;
1480 expecting = Expecting(RIGHTPAR);
1482 sprintf (s, "%1.2lf", tempD);
1483 strcat (calName, s);
1485 else if (expecting == Expecting(COMMA))
1487 strcat (calName, ",");
1489 expecting = Expecting(NUMBER);
1491 else if (expecting == Expecting(RIGHTPAR))
1493 strcat (calName, ")");
1495 MrBayesPrint ("%s Setting age of taxon '%s' to %s\n", spacer, nodeName, calName);
1497 MrBayesPrint ("%s Setting age of constraint node '%s' to %s\n", spacer, nodeName, calName);
1499 /* set calibration based on collected values and settings */
1500 strcpy(calibrationPtr->name, calName);
1501 calibrationPtr->priorParams[0] = priorParams[0];
1502 calibrationPtr->priorParams[1] = priorParams[1];
1503 calibrationPtr->priorParams[2] = priorParams[2];
1504 calibrationPtr->prior = calPrior;
1505 if (calPrior == fixed)
1507 calibrationPtr->LnPriorProb = &LnPriorProbFix;
1508 calibrationPtr->LnPriorRatio = &LnProbRatioFix;
1509 calibrationPtr->min = priorParams[0];
1510 calibrationPtr->max = priorParams[0];
1512 else if (calPrior == uniform)
1514 calibrationPtr->LnPriorProb = &LnPriorProbUniform;
1515 calibrationPtr->LnPriorRatio = &LnProbRatioUniform;
1516 calibrationPtr->min = priorParams[0];
1517 calibrationPtr->max = priorParams[1];
1519 else if (calPrior == offsetExponential)
1521 calibrationPtr->LnPriorProb = &LnPriorProbOffsetExponential_Param_Offset_Mean;
1522 calibrationPtr->LnPriorRatio = &LnProbRatioOffsetExponential_Param_Offset_Mean;
1523 calibrationPtr->min = priorParams[0];
1524 calibrationPtr->max = POS_INFINITY;
1526 else if (calPrior == truncatedNormal)
1528 calibrationPtr->LnPriorProb = &LnPriorProbTruncatedNormal_Param_Trunc_Mean_Sd;
1529 calibrationPtr->LnPriorRatio = &LnProbRatioTruncatedNormal_Param_Trunc_Mean_Sd;
1530 calibrationPtr->min = priorParams[0];
1531 calibrationPtr->max = POS_INFINITY;
1533 else if (calPrior == logNormal)
1535 calibrationPtr->LnPriorProb = &LnPriorProbLognormal_Param_Mean_Sd;
1536 calibrationPtr->LnPriorRatio = &LnProbRatioLognormal_Param_Mean_Sd;
1537 calibrationPtr->min = BRLENS_MIN;
1538 calibrationPtr->max = POS_INFINITY;
1540 else if (calPrior == offsetLogNormal)
1542 calibrationPtr->LnPriorProb = &LnPriorProbOffsetLognormal_Param_Offset_Mean_Sd;
1543 calibrationPtr->LnPriorRatio = &LnProbRatioOffsetLognormal_Param_Offset_Mean_Sd;
1544 calibrationPtr->min = BRLENS_MIN + priorParams[0];
1545 calibrationPtr->max = POS_INFINITY;
1547 else if (calPrior == standardGamma)
1549 calibrationPtr->LnPriorProb = &LnPriorProbGamma_Param_Mean_Sd;
1550 calibrationPtr->LnPriorRatio = &LnProbRatioGamma_Param_Mean_Sd;
1551 calibrationPtr->min = BRLENS_MIN;
1552 calibrationPtr->max = POS_INFINITY;
1554 else if (calPrior == offsetGamma)
1556 calibrationPtr->LnPriorProb = &LnPriorProbOffsetGamma_Param_Offset_Mean_Sd;
1557 calibrationPtr->LnPriorRatio = &LnProbRatioOffsetGamma_Param_Offset_Mean_Sd;
1558 calibrationPtr->min = BRLENS_MIN + priorParams[0];
1559 calibrationPtr->max = POS_INFINITY;
1562 /* get ready to find more calibrated nodes or taxa, if present */
1563 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
1572 int DoCharset (void)
1574 /* first add set to tempSet */
1575 if (fromI >= 0 && toJ < 0)
1577 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
1580 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
1582 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
1585 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
1587 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
1591 /* add name to charSetNames */
1592 if (AddString (&charSetNames, numCharSets, tempSetName) == ERROR)
1594 MrBayesPrint ("%s Problem adding charset %s to list\n", spacer, tempSetName);
1599 AddBitfield (&charSet, numCharSets, tempSet, numChar);
1601 /* increment number of char sets */
1608 int DoCharsetParm (char *parmName, char *tkn)
1610 int i, index, tempInt, allDigit;
1612 if (defMatrix == NO)
1614 MrBayesPrint ("%s A matrix must be specified before charsets can be defined\n", spacer);
1618 if (expecting == Expecting(PARAMETER))
1620 if (!strcmp(parmName, "Xxxxxxxxxx"))
1622 /* check that the name of the charset is not a number */
1624 for (i=0; i<(int)strlen(tkn); i++)
1626 if (tkn[i] == '0' || tkn[i] == '1' || tkn[i] == '2' || tkn[i] == '3' || tkn[i] == '4' ||
1627 tkn[i] == '5' || tkn[i] == '6' || tkn[i] == '7' || tkn[i] == '8' || tkn[i] == '9' || tkn[i] == '.')
1632 if (allDigit == YES)
1634 MrBayesPrint ("%s Charset name may not be a number\n", spacer);
1638 /* check size of charset name */
1639 if (strlen(tkn) > 99)
1641 MrBayesPrint ("%s Charset name is too long\n", spacer);
1645 /* check to see if the name has already been used as a charset */
1646 if (numCharSets > 1)
1648 if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
1650 /* if the charset name has not been used, then we should have an ERROR returned */
1651 /* we _want_ to be here */
1656 MrBayesPrint ("%s Charset name has been used previously\n", spacer);
1661 /* add the name to the character set */
1662 strcpy (tempSetName, tkn);
1665 for (i=0; i<numChar; i++)
1668 fromI = toJ = everyK = -1;
1669 foundDash = foundSlash = NO;
1670 MrBayesPrint ("%s Defining charset called '%s'\n", spacer, tkn);
1671 expecting = Expecting(EQUALSIGN);
1676 else if (expecting == Expecting(EQUALSIGN))
1678 expecting = Expecting(ALPHA);
1679 expecting |= Expecting(NUMBER);
1681 else if (expecting == Expecting(ALPHA))
1683 /* We are defining a character set in terms of another (called tkn, here). We should be able
1684 to find tkn in the list of character set names. If we cannot, then we have a problem and
1686 if (numCharSets < 1)
1688 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
1691 if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
1693 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
1696 /* add characters from charset "tkn" to new tempset */
1697 for (i=0; i<numChar; i++)
1699 if (IsBitSet(i,charSet[index]) == YES)
1702 fromI = toJ = everyK = -1;
1704 expecting = Expecting(ALPHA);
1705 expecting |= Expecting(NUMBER);
1706 expecting |= Expecting(SEMICOLON);
1708 else if (expecting == Expecting(NUMBER))
1710 if (strlen(tkn) == 1 && tkn[0] == '.')
1713 sscanf (tkn, "%d", &tempInt);
1714 if (tempInt <= 0 || tempInt > numChar)
1716 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
1720 if (foundDash == YES)
1726 MrBayesPrint ("%s Improperly formatted charset\n", spacer);
1731 else if (foundSlash == YES)
1736 MrBayesPrint ("%s Improperly formatted charset\n", spacer);
1739 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
1743 MrBayesPrint ("%s Improperly formatted charset\n", spacer);
1750 if (fromI >= 0 && toJ < 0)
1752 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
1756 else if (fromI < 0 && toJ < 0)
1760 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
1762 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
1767 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
1769 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
1776 MrBayesPrint ("%s Improperly formatted charset\n", spacer);
1785 expecting = Expecting(ALPHA);
1786 expecting |= Expecting(NUMBER);
1787 expecting |= Expecting(SEMICOLON);
1788 expecting |= Expecting(DASH);
1789 expecting |= Expecting(BACKSLASH);
1791 else if (expecting == Expecting(DASH))
1794 expecting = Expecting(NUMBER);
1796 else if (expecting == Expecting(BACKSLASH))
1799 expecting = Expecting(NUMBER);
1808 int DoCharStat (void)
1813 if (defMatrix == NO)
1815 MrBayesPrint ("%s A character matrix must be defined first\n", spacer);
1819 if (numDefinedPartitions == 1)
1820 MrBayesPrint ("%s 1 character partition defined:\n", spacer, numDefinedPartitions);
1822 MrBayesPrint ("%s %d character partitions defined:\n", spacer, numDefinedPartitions);
1823 for (i=0; i<numDefinedPartitions; i++)
1825 numDivs = GetNumPartDivisions (i);
1827 MrBayesPrint ("%s Partition %d (\"%s\") does not divide the characters\n", spacer, i+1, partitionNames[i]);
1829 MrBayesPrint ("%s Partition %d (\"%s\") divides the characters into %d parts\n", spacer, i+1, partitionNames[i], numDivs);
1831 MrBayesPrint ("%s Current partition is \"%s\"\n", spacer, partitionNames[partitionNum]);
1832 MrBayesPrint ("\n");
1834 /* print out list of characters with information about each */
1835 MrBayesPrint ("%s Showing character status:\n\n", spacer);
1836 MrBayesPrint ("%s Partition(s)\n", spacer);
1837 MrBayesPrint ("%s # Type In/Out Ambiguity Order ", spacer);
1838 for (i=0; i<numDefinedPartitions; i++)
1839 MrBayesPrint (" %2d", i+1);
1840 MrBayesPrint ("\n");
1841 MrBayesPrint ("%s -----------------------------------------------", spacer);
1842 for (i=0; i<numDefinedPartitions; i++)
1843 MrBayesPrint ("---");
1844 MrBayesPrint ("\n");
1845 for (i=0; i<numChar; i++)
1847 MrBayesPrint ("%s %4d -- ", spacer, i+1);
1849 if (charInfo[i].charType == DNA)
1850 MrBayesPrint (" DNA");
1851 else if (charInfo[i].charType == RNA)
1852 MrBayesPrint (" RNA");
1853 else if (charInfo[i].charType == PROTEIN)
1854 MrBayesPrint (" Prot");
1855 else if (charInfo[i].charType == RESTRICTION)
1856 MrBayesPrint (" Rest");
1857 else if (charInfo[i].charType == STANDARD)
1858 MrBayesPrint (" Stand");
1859 else if (charInfo[i].charType == CONTINUOUS)
1860 MrBayesPrint (" Cont");
1862 if (charInfo[i].charType == DNA)
1863 MrBayesPrint (" 4");
1864 else if (charInfo[i].charType == RNA)
1865 MrBayesPrint (" 4");
1866 else if (charInfo[i].charType == PROTEIN)
1867 MrBayesPrint (" 20");
1868 else if (charInfo[i].charType == RESTRICTION)
1869 MrBayesPrint (" 2");
1870 else if (charInfo[i].charType == STANDARD)
1871 MrBayesPrint (" %2d", charInfo[i].numStates);
1872 else if (charInfo[i].charType == CONTINUOUS)
1873 MrBayesPrint (" Inf");
1875 if (charInfo[i].isExcluded == NO)
1876 MrBayesPrint (" Included");
1878 MrBayesPrint (" Excluded");
1880 if (charInfo[i].isMissAmbig == YES)
1881 MrBayesPrint (" MissAmbig");
1883 MrBayesPrint (" None");
1885 if (charInfo[i].ctype == UNORD)
1886 MrBayesPrint (" Unord");
1887 else if (charInfo[i].ctype == ORD)
1888 MrBayesPrint (" Ord");
1889 else if (charInfo[i].ctype == DOLLO)
1890 MrBayesPrint (" Dollo");
1891 else if (charInfo[i].ctype == IRREV)
1892 MrBayesPrint (" Irrev");
1896 for (j=0; j<numDefinedPartitions; j++)
1897 MrBayesPrint (" %2d", partitionId[i][j]);
1899 /* MrBayesPrint ("%4d ", charSet[i]);*/
1901 if (charInfo[i].pairsId > 0)
1903 /* find paired character */
1904 for (j=0; j<numChar; j++)
1906 if (i != j && charInfo[j].pairsId == charInfo[i].pairsId)
1908 MrBayesPrint (" (coupled with %d)", j+1);
1914 MrBayesPrint ("\n");
1916 if (charInfo[i].bigBreakAfter == YES)
1918 MrBayesPrint ("%s ", spacer);
1919 MrBayesPrint (" - - - - - - - - - - - - - - - - - - - - \n");
1922 /* we may want to pause */
1923 if (autoClose == NO)
1925 if ((i+1) % 100 == 0)
1927 MrBayesPrint ("%s Hit return key to continue ", spacer);
1929 if (fgets (tempName, 100, stdin) == NULL)
1931 printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
1941 int DoCitations (void)
1943 MrBayesPrint (" --------------------------------------------------------------------------- \n");
1944 MrBayesPrint (" Citations \n");
1945 MrBayesPrint (" \n");
1946 MrBayesPrint (" If you publish results obtained using MrBayes you may want to cite the \n");
1947 MrBayesPrint (" program using one of these papers: \n");
1948 MrBayesPrint (" \n");
1949 MrBayesPrint (" Huelsenbeck, J. P. and F. Ronquist. 2001. MRBAYES: Bayesian \n");
1950 MrBayesPrint (" inference of phylogeny. Bioinformatics 17:754-755. \n");
1951 MrBayesPrint (" Ronquist, F. and J. P. Huelsenbeck. 2003. MRBAYES 3: Bayesian phylogenetic \n");
1952 MrBayesPrint (" inference under mixed models. Bioinformatics 19:1572-1574. \n");
1953 MrBayesPrint (" Ronquist, F. et al. 2012. MRBAYES 3.2: Efficient Bayesian phylogenetic \n");
1954 MrBayesPrint (" inference and model selection across a large model space. Systematic \n");
1955 MrBayesPrint (" Biology 61 (in press). \n");
1956 MrBayesPrint (" \n");
1957 MrBayesPrint (" If you use the parallel abilities of the program, you may also want to cite \n");
1958 MrBayesPrint (" \n");
1959 MrBayesPrint (" Altekar, G., S. Dwarkadas, J. P. Huelsenbeck, and F. Ronquist. 2004. \n");
1960 MrBayesPrint (" Parallel Metropolis-coupled Markov chain Monte Carlo for Bayesian \n");
1961 MrBayesPrint (" phylogenetic inference. Bioinformatics 20:407-415. \n");
1962 MrBayesPrint (" \n");
1963 MrBayesPrint (" If you use the BEAGLE library, the appropriate citation is \n");
1964 MrBayesPrint (" \n");
1965 MrBayesPrint (" Ayres, D. L., A. Darling, D. J. Zwickl, P. Beerli, M. T. Holder, P. O. \n");
1966 MrBayesPrint (" J. P. Huelsenbeck, F. Ronquist, D. L. Swofford, M. P. Cummings, A. \n");
1967 MrBayesPrint (" Rambaut, and M. A. Suchard. 2012. BEAGLE: an application programming \n");
1968 MrBayesPrint (" interface for statistical phylogenetics. Syst. Biol. 61:170-173. \n");
1969 MrBayesPrint (" \n");
1970 MrBayesPrint (" \n");
1971 MrBayesPrint (" You should also cite other papers for different ideas that are implemented \n");
1972 MrBayesPrint (" in the program. For example, the program performs Bayesian inference of \n");
1973 MrBayesPrint (" phylogeny, an idea that was first proposed in the following papers: \n");
1974 MrBayesPrint (" \n");
1975 MrBayesPrint (" Larget, B., and D. Simon. 1999. Markov chain Monte Carlo \n");
1976 MrBayesPrint (" algorithms for the Bayesian analysis of phylogenetic trees. \n");
1977 MrBayesPrint (" Mol. Biol. Evol. 16:750-759. \n");
1978 MrBayesPrint (" \n");
1979 MrBayesPrint (" Li, S. 1996. Phylogenetic tree construction using Markov chain \n");
1980 MrBayesPrint (" Monte carlo. Ph. D. dissertation, Ohio State University, Columbus. \n");
1981 MrBayesPrint (" \n");
1982 MrBayesPrint (" Mau, B. 1996. Bayesian phylogenetic inference via Markov chain \n");
1983 MrBayesPrint (" Monte carlo methods. Ph. D. dissertation, University of \n");
1984 MrBayesPrint (" Wisconsin, Madison. \n");
1985 MrBayesPrint (" \n");
1986 MrBayesPrint (" Mau, B., and M. Newton. 1997. Phylogenetic inference for binary \n");
1987 MrBayesPrint (" data on dendrograms using Markov chain Monte Carlo. Journal of \n");
1988 MrBayesPrint (" Computational and Graphical Statistics 6:122-131. \n");
1989 MrBayesPrint (" \n");
1990 MrBayesPrint (" Mau, B., M. Newton, and B. Larget. 1999. Bayesian phylogenetic \n");
1991 MrBayesPrint (" inference via Markov chain Monte carlo methods. Biometrics. 55:1-12. \n");
1992 MrBayesPrint (" \n");
1993 MrBayesPrint (" Newton, M., B. Mau, and B. Larget. 1999. Markov chain Monte Carlo \n");
1994 MrBayesPrint (" for the Bayesian analysis of evolutionary trees from aligned \n");
1995 MrBayesPrint (" molecular sequences. In Statistics in molecular biology (F. Seillier- \n");
1996 MrBayesPrint (" Moseiwitch, T. P. Speed, and M. Waterman, eds.). Monograph Series \n");
1997 MrBayesPrint (" of the Institute of Mathematical Statistics. \n");
1998 MrBayesPrint (" \n");
1999 MrBayesPrint (" Rannala, B., and Z. Yang. 1996. Probability distribution of \n");
2000 MrBayesPrint (" molecular evolutionary trees: a new method of phylogenetic \n");
2001 MrBayesPrint (" inference. J. Mol. Evol. 43:304-311. \n");
2002 MrBayesPrint (" \n");
2003 MrBayesPrint (" Yang, Z., and B. Rannala. 1997. Bayesian phylogenetic inference \n");
2004 MrBayesPrint (" using DNA sequences: a Markov chain Monte carlo method. Molecular \n");
2005 MrBayesPrint (" Biology and Evolution. 14:717-724. \n");
2006 MrBayesPrint (" \n");
2007 MrBayesPrint (" \n");
2008 MrBayesPrint (" MrBayes uses Markov chain Monte Carlo (MCMC) to approximate the posterior \n");
2009 MrBayesPrint (" probability of trees. MCMC was developed in the following papers: \n");
2010 MrBayesPrint (" \n");
2011 MrBayesPrint (" Metropolis, N., A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, \n");
2012 MrBayesPrint (" and E. Teller. 1953. Equations of state calculations by fast \n");
2013 MrBayesPrint (" computing machines. J. Chem. Phys. 21:1087-1091. \n");
2014 MrBayesPrint (" \n");
2015 MrBayesPrint (" Hastings, W. K. 1970. Monte Carlo sampling methods using Markov \n");
2016 MrBayesPrint (" chains and their applications. Biometrika 57:97-109. \n");
2017 MrBayesPrint (" \n");
2018 MrBayesPrint (" In particular, MrBayes implements a variant of MCMC that was described by \n");
2019 MrBayesPrint (" Charles Geyer: \n");
2020 MrBayesPrint (" \n");
2021 MrBayesPrint (" Geyer, C. J. 1991. Markov chain Monte Carlo maximum likelihood. \n");
2022 MrBayesPrint (" Pages 156-163 in Computing Science and Statistics: Proceed- \n");
2023 MrBayesPrint (" ings of the 23rd Symposium on the Interface. (E. M. Keramidas, \n");
2024 MrBayesPrint (" ed.). Fairfax Station: Interface Foundation. \n");
2025 MrBayesPrint (" \n");
2026 MrBayesPrint (" \n");
2027 MrBayesPrint (" MrBayes implements a large number of DNA substitution models. These models \n");
2028 MrBayesPrint (" are of three different structures. The \"4by4\" models are the usual \n");
2029 MrBayesPrint (" flavor of phylogenetic models. The \"Doublet\" model was first proposed \n");
2030 MrBayesPrint (" by \n");
2031 MrBayesPrint (" \n");
2032 MrBayesPrint (" Schoniger, M., and A. von Haeseler. 1994. A stochastic model and the \n");
2033 MrBayesPrint (" evolution of autocorrelated DNA sequences. Molecular Phylogenetics \n");
2034 MrBayesPrint (" and Evolution 3:240-247. \n");
2035 MrBayesPrint (" \n");
2036 MrBayesPrint (" The program also implements codon models. Two papers, published back-to-back \n");
2037 MrBayesPrint (" were the first to implement a codon model of DNA substitution in which the \n");
2038 MrBayesPrint (" substitution process is modelled on the codon, not on a site-by-site basis: \n");
2039 MrBayesPrint (" \n");
2040 MrBayesPrint (" Goldman, N., and Z. Yang. 1994. A codon-based model of nucleotide \n");
2041 MrBayesPrint (" substitution for protein coding DNA sequences. Molecular Biology \n");
2042 MrBayesPrint (" and Evolution. 11:725-736. \n");
2043 MrBayesPrint (" \n");
2044 MrBayesPrint (" Muse, S., and B. Gaut. 1994. A likelihood approach for comparing \n");
2045 MrBayesPrint (" synonymous and non-synonymous substitution rates, with application \n");
2046 MrBayesPrint (" to the chloroplast genome. Molecular Biology and Evolution. \n");
2047 MrBayesPrint (" 11:715-724. \n");
2048 MrBayesPrint (" \n");
2049 MrBayesPrint (" The program can be used to detect positively slected amino-acid sites using \n");
2050 MrBayesPrint (" a full hierarchical Bayes analysis. The method is based on the excellent paper\n");
2051 MrBayesPrint (" by Nielsen and Yang: \n");
2052 MrBayesPrint (" \n");
2053 MrBayesPrint (" Nielsen, R., and Z. Yang. 1998. Likelihood models for detecting \n");
2054 MrBayesPrint (" positively selected amino acid sites and applications to the HIV-1 \n");
2055 MrBayesPrint (" envelope gene. Genetics. 148:929-936. \n");
2056 MrBayesPrint (" \n");
2057 MrBayesPrint (" The previous four papers describe three different stuctures for the nuc- \n");
2058 MrBayesPrint (" leotide models implemented in MrBayes--the four-by-four models, the \n");
2059 MrBayesPrint (" 16-by-16 (doublet) models and the 64-by-64 (codon) models. The program \n");
2060 MrBayesPrint (" implements three different substitution models within each model structure. \n");
2061 MrBayesPrint (" These include the nst=1 models: \n");
2062 MrBayesPrint (" \n");
2063 MrBayesPrint (" Jukes, T., and C. Cantor. 1969. Evolution of protein molecules. \n");
2064 MrBayesPrint (" Pages 21-132 in Mammalian Protein Metabolism. (H. Munro, ed.). \n");
2065 MrBayesPrint (" Academic Press, New York. \n");
2066 MrBayesPrint (" \n");
2067 MrBayesPrint (" Felsenstein, J. 1981. Evolutionary trees from DNA sequences: A \n");
2068 MrBayesPrint (" maximum likelihood approach. Journal of Molecular Evolution \n");
2069 MrBayesPrint (" 17:368-376. \n");
2070 MrBayesPrint (" \n");
2071 MrBayesPrint (" the nst=2 models: \n");
2072 MrBayesPrint (" \n");
2073 MrBayesPrint (" Kimura, M. 1980. A simple method for estimating evolutionary rates \n");
2074 MrBayesPrint (" of base substitutions through comparative studies of nucleotide \n");
2075 MrBayesPrint (" sequences. Journal of Molecular Evolution. 16:111-120. \n");
2076 MrBayesPrint (" \n");
2077 MrBayesPrint (" Hasegawa, M., T. Yano, and H. Kishino. 1984. A new molecular clock \n");
2078 MrBayesPrint (" of mitochondrial DNA and the evolution of Hominoids. Proc. \n");
2079 MrBayesPrint (" Japan Acad. Ser. B 60:95-98. \n");
2080 MrBayesPrint (" \n");
2081 MrBayesPrint (" Hasegawa, M., H. Kishino, and T. Yano. 1985. Dating the human-ape \n");
2082 MrBayesPrint (" split by a molecular clock of mitochondrial DNA. Journal of \n");
2083 MrBayesPrint (" Molecular Evolution 22:160-174. \n");
2084 MrBayesPrint (" \n");
2085 MrBayesPrint (" and the the nst=6 models: \n");
2086 MrBayesPrint (" \n");
2087 MrBayesPrint (" Tavare, S. 1986. Some probabilistic and statisical problems on the \n");
2088 MrBayesPrint (" analysis of DNA sequences. Lect. Math. Life Sci. 17:57-86. \n");
2089 MrBayesPrint (" 17:368-376. \n");
2090 MrBayesPrint (" \n");
2091 MrBayesPrint (" \n");
2092 MrBayesPrint (" MrBayes implements a large number of amino-acid models. These include: \n");
2093 MrBayesPrint (" \n");
2094 MrBayesPrint (" Poisson -- \n");
2095 MrBayesPrint (" \n");
2096 MrBayesPrint (" Bishop, M.J., and A.E. Friday. 1987. Tetropad relationships: the \n");
2097 MrBayesPrint (" molecular evidence. Pp. 123-139 in Molecules and morphology in \n");
2098 MrBayesPrint (" evolution: conflict or compromise? (C. Patterson, ed.). Cambridge \n");
2099 MrBayesPrint (" University Press, Cambridge, England. \n");
2100 MrBayesPrint (" \n");
2101 MrBayesPrint (" Jones -- \n");
2102 MrBayesPrint (" \n");
2103 MrBayesPrint (" Jones, D.T., W. R. Taylor, and J. M. Thornton. 1992. The rapid generation \n");
2104 MrBayesPrint (" of mutation data matrices from protein sequences. Comput. Appl. \n");
2105 MrBayesPrint (" Biosci. 8:275-282. \n");
2106 MrBayesPrint (" \n");
2107 MrBayesPrint (" Dayhoff -- \n");
2108 MrBayesPrint (" \n");
2109 MrBayesPrint (" Dayhoff, M.O., R.M. Schwartz, and B.C. Orcutt. 1978. A model of evol- \n");
2110 MrBayesPrint (" utionary change in proteins. Pp. 345-352 in Atlas of protein sequence \n");
2111 MrBayesPrint (" and structure. Vol. 5, Suppl. 3. National Biomedical Research \n");
2112 MrBayesPrint (" Foundation, Washington, D.C. \n");
2113 MrBayesPrint (" \n");
2114 MrBayesPrint (" Mtrev -- \n");
2115 MrBayesPrint (" \n");
2116 MrBayesPrint (" Adachi, J. and M. Hasegawa. 1996. MOLPHY version 2.3: programs for \n");
2117 MrBayesPrint (" molecular phylogenetics based on maximum likelihood. Computer Science \n");
2118 MrBayesPrint (" Monographs of Institute of Statistical Mathematics 28:1-150. \n");
2119 MrBayesPrint (" \n");
2120 MrBayesPrint (" Mtmam -- \n");
2121 MrBayesPrint (" \n");
2122 MrBayesPrint (" Cao, Y., A. Janke, P.J. Waddell, M. Westerman, O. Takenaka, S. Murata, \n");
2123 MrBayesPrint (" N. Okada, S. Paabo, and M. Hasegawa. 1998. Conflict amongst individual \n");
2124 MrBayesPrint (" mitochondrial proteins in resolving the phylogeny of eutherian orders. \n");
2125 MrBayesPrint (" Journal of Molecular Evolution \n");
2126 MrBayesPrint (" \n");
2127 MrBayesPrint (" Yang, Z., R. Nielsen, and M. Hasegawa. 1998. Models of amino acid \n");
2128 MrBayesPrint (" substitution and applications to mitochondrial protein evolution \n");
2129 MrBayesPrint (" Molecular Biology and Evolution 15:1600-1611. \n");
2130 MrBayesPrint (" \n");
2131 MrBayesPrint (" WAG -- \n");
2132 MrBayesPrint (" \n");
2133 MrBayesPrint (" Whelan, S. and Goldman, N. 2001. A general empirical model of protein \n");
2134 MrBayesPrint (" evolution derived from multiple protein families using a maximum- \n");
2135 MrBayesPrint (" likelihood approach. Molecular Biology and Evolution 18:691-699. \n");
2136 MrBayesPrint (" \n");
2137 MrBayesPrint (" Rtrev -- \n");
2138 MrBayesPrint (" \n");
2139 MrBayesPrint (" Dimmic M.W., J.S. Rest, D.P. Mindell, and D. Goldstein. 2002. RArtREV: \n");
2140 MrBayesPrint (" An amino acid substitution matrix for inference of retrovirus and \n");
2141 MrBayesPrint (" reverse transcriptase phylogeny. Journal of Molecular Evolution \n");
2142 MrBayesPrint (" 55: 65-73. \n");
2143 MrBayesPrint (" \n");
2144 MrBayesPrint (" Cprev -- \n");
2145 MrBayesPrint (" \n");
2146 MrBayesPrint (" Adachi, J., P. Waddell, W. Martin, and M. Hasegawa. 2000. Plastid \n");
2147 MrBayesPrint (" genome phylogeny and a model of amino acid substitution for proteins \n");
2148 MrBayesPrint (" encoded by chloroplast DNA. Journal of Molecular Evolution \n");
2149 MrBayesPrint (" 50:348-358. \n");
2150 MrBayesPrint (" \n");
2151 MrBayesPrint (" Blosum -- \n");
2152 MrBayesPrint (" \n");
2153 MrBayesPrint (" Henikoff, S., and J. G. Henikoff. 1992. Amino acid substitution \n");
2154 MrBayesPrint (" matrices from protein blocks. Proc. Natl. Acad. Sci., U.S.A. \n");
2155 MrBayesPrint (" 89:10915-10919. The matrix implemented in MrBayes is Blosum62. \n");
2156 MrBayesPrint (" \n");
2157 MrBayesPrint (" Vt -- \n");
2158 MrBayesPrint (" \n");
2159 MrBayesPrint (" Muller, T., and M. Vingron. 2000. Modeling amino acid replacement. \n");
2160 MrBayesPrint (" Journal of Computational Biology 7:761-776. \n");
2161 MrBayesPrint (" \n");
2162 MrBayesPrint (" LG -- \n");
2163 MrBayesPrint (" \n");
2164 MrBayesPrint (" Le, Si Q. & Gascuel, O. 2008 An improved general amino- acid replacement \n");
2165 MrBayesPrint (" matrix. Mol. Biol. Evol. 25, 1307-1320. \n");
2166 MrBayesPrint (" \n");
2167 MrBayesPrint (" MrBayes implements a simple Jukes-Cantor-like model for restriction sites \n");
2168 MrBayesPrint (" and other binary data. A problem with some of these data is that there is a \n");
2169 MrBayesPrint (" coding bias, such that certain characters are missing from any observable \n");
2170 MrBayesPrint (" data matrix. It is impossible, for instance, to observe restriction sites that\n");
2171 MrBayesPrint (" are absent in all the studied taxa. However, MrBayes corrects for this coding \n");
2172 MrBayesPrint (" bias according to an idea described in \n");
2173 MrBayesPrint (" \n");
2174 MrBayesPrint (" Felsenstein, J. 1992. Phylogenies from restriction sites: A maximum- \n");
2175 MrBayesPrint (" likelihood approach. Evolution 46:159-173. \n");
2176 MrBayesPrint (" \n");
2177 MrBayesPrint (" \n");
2178 MrBayesPrint (" The model used by MrBayes for 'standard' or morphological data is based on \n");
2179 MrBayesPrint (" the ideas originally presented by \n");
2180 MrBayesPrint (" \n");
2181 MrBayesPrint (" Lewis, P. O. 2001. A likelihood approach to estimating phylogeny from \n");
2182 MrBayesPrint (" discrete morphological character data. Systematic Biology 50:913-925. \n");
2183 MrBayesPrint (" \n");
2184 MrBayesPrint (" \n");
2185 MrBayesPrint (" For both DNA sequence and amino-acid data, the program allows rates to \n");
2186 MrBayesPrint (" change under a covarion-like model, first described by Tuffley and Steel \n");
2187 MrBayesPrint (" \n");
2188 MrBayesPrint (" Tuffley, C., and M. Steel. 1998. Modeling the covarion hypothesis \n");
2189 MrBayesPrint (" of nucleotide substitution. Mathematical Biosciences 147:63-91. \n");
2190 MrBayesPrint (" \n");
2191 MrBayesPrint (" and implemented by Huelsenbeck (2002) \n");
2192 MrBayesPrint (" \n");
2193 MrBayesPrint (" Huelsenbeck, J. P. 2002. Testing a covariotide model of DNA sub- \n");
2194 MrBayesPrint (" stitution. Molecular Biology and Evolution 19(5):698-707. \n");
2195 MrBayesPrint (" \n");
2196 MrBayesPrint (" Galtier (2001) implements a different variant of the covarion model in \n");
2197 MrBayesPrint (" a paper that is worth reading: \n");
2198 MrBayesPrint (" \n");
2199 MrBayesPrint (" Galtier, N. 2001. Maximum-likelihood phylogenetic analysis under a \n");
2200 MrBayesPrint (" covarion-like model. Mol. Biol. Evol. 18:866-873. \n");
2201 MrBayesPrint (" \n");
2202 MrBayesPrint (" \n");
2203 MrBayesPrint (" A number of models are available that allow rates to vary \n");
2204 MrBayesPrint (" across the characters. The program implements the proportion \n");
2205 MrBayesPrint (" of invariable sites model and two variants of gamma distributed \n");
2206 MrBayesPrint (" rate variation. Yang\'s (1993) paper is a good one to cite for \n");
2207 MrBayesPrint (" implementing a gamma-distributed rates model. In the 1994 paper he \n");
2208 MrBayesPrint (" provides a way to approximate the continuous gamma distribution: \n");
2209 MrBayesPrint (" \n");
2210 MrBayesPrint (" Yang, Z. 1993. Maximum likelihood estimation of phylogeny from DNA \n");
2211 MrBayesPrint (" sequences when substitution rates differ over sites. Molecular \n");
2212 MrBayesPrint (" Biology and Evolution 10:1396-1401. \n");
2213 MrBayesPrint (" \n");
2214 MrBayesPrint (" Yang, Z. 1994. Maximum likelihood phylogenetic estimation from DNA \n");
2215 MrBayesPrint (" sequences with variable rates over sites: Approximate methods. \n");
2216 MrBayesPrint (" Journal of Molecular Evolution 39:306-314. \n");
2217 MrBayesPrint (" \n");
2218 MrBayesPrint (" The program also implements Yang\'s autocorrelated gamma model. In \n");
2219 MrBayesPrint (" this model, the rate at one site depends to some extent on the rate at \n");
2220 MrBayesPrint (" an adjacent site. The appropriate citation for this model is: \n");
2221 MrBayesPrint (" \n");
2222 MrBayesPrint (" Yang, Z. 1995. A space-time process model for the evolution of \n");
2223 MrBayesPrint (" DNA sequences. Genetics 139:993-1005. \n");
2224 MrBayesPrint (" \n");
2225 MrBayesPrint (" \n");
2226 MrBayesPrint (" The following two papers show how ancestral states on a tree can be recon- \n");
2227 MrBayesPrint (" structed. The Yang et al. paper implements an empirical Bayes approach while \n");
2228 MrBayesPrint (" Huelsenbeck and Bollback use a pure, hierarchical Bayes approach. The method \n");
2229 MrBayesPrint (" used in MrBayes is the latter, since it integrates over uncertainty in model \n");
2230 MrBayesPrint (" parameters. \n");
2231 MrBayesPrint (" \n");
2232 MrBayesPrint (" Yang, Z., S. Kumar, and M. Nei. 1995. A new method of inference of \n");
2233 MrBayesPrint (" ancestral nucleotide and amino acid sequences. Genetics 141:1641 \n");
2234 MrBayesPrint (" 1650. \n");
2235 MrBayesPrint (" \n");
2236 MrBayesPrint (" Huelsenbeck, J. P., and J. P. Bollback. 2001. Empirical and hier- \n");
2237 MrBayesPrint (" archical Bayesian estimation of ancestral states. Systematic \n");
2238 MrBayesPrint (" Biology 50:351-366. \n");
2239 MrBayesPrint (" \n");
2240 MrBayesPrint (" You may also want to consult a more recent review of Bayesian reconstruction \n");
2241 MrBayesPrint (" of ancestral states and character evolution: \n");
2242 MrBayesPrint (" \n");
2243 MrBayesPrint (" Ronquist, F. 2004. Bayesian inference of character evolution. Trends in \n");
2244 MrBayesPrint (" Ecology and Evolution 19: 475-481. \n");
2245 MrBayesPrint (" \n");
2246 MrBayesPrint (" \n");
2247 MrBayesPrint (" MrBayes allows you to analyze gene tree - species tree problems using the \n");
2248 MrBayesPrint (" multi-species coalescent approach originally proposed by Edwards et al: \n");
2249 MrBayesPrint (" \n");
2250 MrBayesPrint (" Edwards, S., L. Liu, and D. Pearl. 2007. High-resolution species trees \n");
2251 MrBayesPrint (" without concatenation. Proc. Natl. Acad. Sci. USA 104: 5936-5941. \n");
2252 MrBayesPrint (" \n");
2253 MrBayesPrint (" \n");
2254 MrBayesPrint (" The program implements an incredibly parameter rich model, first described \n");
2255 MrBayesPrint (" by Tuffley and Steel (1997), that orders trees in the same way as the \n");
2256 MrBayesPrint (" so-called parsimony method of phylogenetic inference. The appropriate \n");
2257 MrBayesPrint (" citation is: \n");
2258 MrBayesPrint (" \n");
2259 MrBayesPrint (" Tuffley, C., and M. Steel. 1997. Links between maximum likelihood \n");
2260 MrBayesPrint (" and maximum parsimony under a simple model of site substitution. \n");
2261 MrBayesPrint (" Bull. Math. Bio. 59:581-607. \n");
2262 MrBayesPrint (" \n");
2263 MrBayesPrint (" \n");
2264 MrBayesPrint (" MrBayes implements three relaxed clock models: the Compound Poisson Process \n");
2265 MrBayesPrint (" (CPP), the Thorne-Kishino 2002 (TK02), and the Independent Gamma Rates (IGR) \n");
2266 MrBayesPrint (" models. The CPP model was first described by Huelsenbeck et al. (2000). It \n");
2267 MrBayesPrint (" is an autocorrelated discrete model of rate variation over time. Instead of \n");
2268 MrBayesPrint (" the modified gamma distribution originally proposed for the rate multipliers, \n");
2269 MrBayesPrint (" MrBayes uses a lognormal distribution. The extensions necessary to sample over\n");
2270 MrBayesPrint (" tree space under this model are original to MrBayes; the original paper only \n");
2271 MrBayesPrint (" considered fixed trees. \n");
2272 MrBayesPrint (" \n");
2273 MrBayesPrint (" The TK02 model was first described by Thorne and Kishino (2002), and is a \n");
2274 MrBayesPrint (" variant of a model presented by them earlier (Thorne et al., 1998). It is an \n");
2275 MrBayesPrint (" autocorrelated continuous model, in which rates vary according to a lognormal \n");
2276 MrBayesPrint (" distribution. Specifically, the rate of a descendant node is assumed to be \n");
2277 MrBayesPrint (" drawn from a lognormal distribution with the mean being the rate of the an- \n");
2278 MrBayesPrint (" cestral node, and the variance being proportional to the length of the branch \n");
2279 MrBayesPrint (" separating the nodes (measured in terms of expected substitutions per site at \n");
2280 MrBayesPrint (" the base rate of the clock). \n");
2281 MrBayesPrint (" \n");
2282 MrBayesPrint (" The final relaxed clock model is the IGR model, in which branch rates are \n");
2283 MrBayesPrint (" modeled as being drawn independently from gamma distributions. The model was \n");
2284 MrBayesPrint (" originally described in the literature as the 'White Noise' model by Lepage \n");
2285 MrBayesPrint (" et al. (2007), but the original MrBayes implementation predates that paper. \n");
2286 MrBayesPrint (" The IGR model is closely related to the uncorrelated gamma model presented \n");
2287 MrBayesPrint (" originally by Drummond et al. (2006), but it is more elegant in that it truly \n");
2288 MrBayesPrint (" lacks time structure. See Lepage et al. (2007) for details. \n");
2289 MrBayesPrint (" \n");
2290 MrBayesPrint (" Huelsenbeck, J. P., B. Larget, and D. Swofford. 2000. A compound Poisson \n");
2291 MrBayesPrint (" process for relaxing the molecular clock. Genetics 154: 1879-1892. \n");
2292 MrBayesPrint (" \n");
2293 MrBayesPrint (" Thorne, J. L., H. Kishino, and I. S. Painter. 1998. Estimating the rate \n");
2294 MrBayesPrint (" of evolution of the rate of molecular evolution. Mol. Biol. Evol. \n");
2295 MrBayesPrint (" 15: 1647-1657. \n");
2296 MrBayesPrint (" \n");
2297 MrBayesPrint (" Thorne, J. L., and H. Kishino. 2002. Divergence time and evolutionary \n");
2298 MrBayesPrint (" rate estimation with multilocus data. Syst. Biol. 51: 689-702. \n");
2299 MrBayesPrint (" \n");
2300 MrBayesPrint (" Drummond, A. J., S. Y. W. Ho, M. J. Phillips, and A. Rambaut. 2006. \n");
2301 MrBayesPrint (" Relaxed phylogenetics and dating with confidence. PLoS Biology \n");
2302 MrBayesPrint (" 4: 699-710. \n");
2303 MrBayesPrint (" \n");
2304 MrBayesPrint (" Lepage, T., D. Bryant, H. Philippe, and N. Lartillot. 2007. A general \n");
2305 MrBayesPrint (" comparison of relaxed molecular clock models. Mol. Biol. Evol. \n");
2306 MrBayesPrint (" 24: 2669-2680. \n");
2307 MrBayesPrint (" \n");
2308 MrBayesPrint (" \n");
2309 MrBayesPrint (" The standard tree proposals used by MrBayes are described by Lakner et al. \n");
2310 MrBayesPrint (" (2008). The parsimony-biased tree proposals are still undescribed, although \n");
2311 MrBayesPrint (" a rough outline of the idea is presented in the same paper. \n");
2312 MrBayesPrint (" \n");
2313 MrBayesPrint (" Lakner, C., P. van der Mark, J. P. Huelsenbeck, B. Larget, and F. Ronquist.\n");
2314 MrBayesPrint (" 2008. Efficiency of Markov chain Monte Carlo tree proposals in Bayesian \n");
2315 MrBayesPrint (" phylogenetics. Syst. Biol. 57: 86-103. \n");
2316 MrBayesPrint (" \n");
2317 MrBayesPrint (" \n");
2318 MrBayesPrint (" The topology convergence diagnostic used by MrBayes, the average standard \n");
2319 MrBayesPrint (" deviation of split frequencies, is described by Lakner et al. (2008). The \n");
2320 MrBayesPrint (" potential scale reduction factor, the diagnostic used by MrBayes for contin- \n");
2321 MrBayesPrint (" uous parameters, was first proposed by Gelman and Rubin (1992). The auto- \n");
2322 MrBayesPrint (" tuning mechanism used in MrBayes is based on a paper by Roberts and Rosenthal \n");
2323 MrBayesPrint (" (2009). \n");
2324 MrBayesPrint (" \n");
2325 MrBayesPrint (" Gelman, A., and D. B. Rubin. 1992. Inference from iterative simulation \n");
2326 MrBayesPrint (" using multiple sequences. Statistical Science 7: 457-472. \n");
2327 MrBayesPrint (" Bull. Math. Bio. 59:581-607. \n");
2328 MrBayesPrint (" \n");
2329 MrBayesPrint (" Lakner, C., P. van der Mark, J. P. Huelsenbeck, B. Larget, and F. Ronquist.\n");
2330 MrBayesPrint (" 2008. Efficiency of Markov chain Monte Carlo tree proposals in Bayesian \n");
2331 MrBayesPrint (" phylogenetics. Syst. Biol. 57: 86-103. \n");
2332 MrBayesPrint (" \n");
2333 MrBayesPrint (" Roberts, G. O., and J. S. Rosenthal. 2009. Examples of adaptive MCMC. Jour-\n");
2334 MrBayesPrint (" nal of Compuational and Graphical Statistics 18: 349-367. \n");
2335 MrBayesPrint (" \n");
2336 MrBayesPrint (" \n");
2337 MrBayesPrint (" The harmonic mean estimator of model likelihoods, used for Bayes factor tes- \n");
2338 MrBayesPrint (" ting, was discussed by Newton and Raftery (1996). The more accurate stepping- \n");
2339 MrBayesPrint (" stone algorithm was first proposed by Xie et al. (2011). The paper by \n");
2340 MrBayesPrint (" Lartillot and Philippe (2006) presents an interesting discussion of the \n");
2341 MrBayesPrint (" shortcomings of the harmonic mean estimator and describes thermodynamic \n");
2342 MrBayesPrint (" integration, a technique that is similar to the stepping-stone algorithm. \n");
2343 MrBayesPrint (" \n");
2344 MrBayesPrint (" Newton, M. A., and A. E. Raftery. 1994. Approcimate Bayesian inference \n");
2345 MrBayesPrint (" with the weighted likelihood bootstrap. J. R. Stat. Soc. B. 56. 3-48. \n");
2346 MrBayesPrint (" \n");
2347 MrBayesPrint (" Lartillot, N., and H. Philippe. 2006. Computing Bayes factors using \n");
2348 MrBayesPrint (" thermodynamic integration. Syst. Biol. 55: 195-207. \n");
2349 MrBayesPrint (" \n");
2350 MrBayesPrint (" Xie, W., P. O. Lewis, Y. Fan, L. Kuo, and M.-H. Chen. 2011. Improving \n");
2351 MrBayesPrint (" marginal likelihood estimation for Bayesian phylogenetic model \n");
2352 MrBayesPrint (" selection. Syst. Biol. 60: 150-160. \n");
2353 MrBayesPrint (" \n");
2354 MrBayesPrint (" \n");
2355 MrBayesPrint (" For unconstrained branch lengths, MrBayes implements the compound Dirichlet \n");
2356 MrBayesPrint (" priors for branch lengths described by Rannala et al. (2012) and Zhang et al. \n");
2357 MrBayesPrint (" (2012). Compared with the i.i.d. exponential and uniform priors for branch \n");
2358 MrBayesPrint (" lengthes in the previous versions of MrBayes, the Dirichlet priors appear more\n");
2359 MrBayesPrint (" reasonable and may avoid the problem of extremely long trees, as discussed by \n");
2360 MrBayesPrint (" Brown et al. (2010) and Marshall (2010). The two-exponential prior on internal\n");
2361 MrBayesPrint (" and external branch lengths described by Yang & Rannala (2005) and Yang (2007)\n");
2362 MrBayesPrint (" is also implemented in this version. \n");
2363 MrBayesPrint (" \n");
2364 MrBayesPrint (" Brown, J. M., S. M. Hedtke, A. R. Lemmon, and E. M. Lemmon. 2010. When \n");
2365 MrBayesPrint (" trees grow too long: investigating the causes of highly inaccurate \n");
2366 MrBayesPrint (" Bayesian branch-length estimates. Syst. Biol. 59:145-161. \n");
2367 MrBayesPrint (" \n");
2368 MrBayesPrint (" Marshall, D. C. 2010. Cryptic failure of partitioned Bayesian phylogenetic \n");
2369 MrBayesPrint (" analyses: lost in the land of long trees. Syst. Biol. 59:108-117. \n");
2370 MrBayesPrint (" \n");
2371 MrBayesPrint (" Rannala, B., T. Zhu, and Z. Yang. 2012. Tail paradox, partial \n");
2372 MrBayesPrint (" identifiability and influential priors in Bayesian branch length \n");
2373 MrBayesPrint (" inference. Mol. Biol. Evol. 29:325-335. \n");
2374 MrBayesPrint (" \n");
2375 MrBayesPrint (" Zhang, C., B. Rannala, and Z. Yang. 2012. Robustness of compound Dirichlet \n");
2376 MrBayesPrint (" priors for Bayesian inference of branch lengths. Syst. Biol. 61:779-784.\n");
2377 MrBayesPrint (" \n");
2378 MrBayesPrint (" Yang, Z. 2007. Fair-balance paradox, star-tree paradox and Bayesian \n");
2379 MrBayesPrint (" phylogenetics. Mol. Biol. Evol. 24:1639-1655. \n");
2380 MrBayesPrint (" \n");
2381 MrBayesPrint (" Yang, Z., and B. Rannala. 2005. Branch-length prior influences Bayesian \n");
2382 MrBayesPrint (" posterior probability of phylogeny. Syst. Biol. 54:455-470. \n");
2383 MrBayesPrint (" \n");
2384 MrBayesPrint (" \n");
2385 MrBayesPrint (" \n");
2386 MrBayesPrint (" --------------------------------------------------------------------------- \n");
2392 int DoConstraint (void)
2397 if (consrtainType == PARTIAL)
2402 /* add set to tempSet */
2403 if (fromI >= 0 && toJ < 0)
2405 if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR)
2408 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
2410 if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR)
2413 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
2415 if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR)
2419 /* check that this is not a stupid constraint */
2421 for (i=0; i<numTaxa; i++)
2422 if (tempSet[i] != 0)
2427 MrBayesPrint ("%s This constraint does not include any taxa and will not be defined\n", spacer);
2431 if (consrtainType == HARD)
2433 if (howMany == numTaxa)
2435 /* We allow this so we can report states from and calibrate root */
2438 } /*end consrtainType == HARD */
2439 else if (consrtainType == PARTIAL)
2443 MrBayesPrint ("%s This partial constraint include only one taxa. It is alwayes satisfied and will not be defined.\n", spacer);
2448 for (i=0; i<numTaxa; i++)
2450 if (tempSetNeg[i] != 0)
2453 if (tempSetNeg[i] == tempSet[i])
2455 MrBayesPrint ("%s Two sets of taxa in partial constraint are not allowed to intersect. Constraint will not be defined\n", spacer);
2462 MrBayesPrint ("%s This partial constraint does not include any taxa in the second set and will not be defined\n", spacer);
2466 else if (consrtainType == NEGATIVE)
2470 MrBayesPrint ("%s Negative constraint should include more than one taxa. Constraint will not be defined\n", spacer);
2475 /* add name to constraintNames */
2476 if (AddString (&constraintNames, numDefinedConstraints, tempSetName) == ERROR)
2478 MrBayesPrint ("%s Problem adding constraint %s to list\n", spacer, tempSetName);
2483 AddBitfield (&definedConstraint, numDefinedConstraints, tempSet, numTaxa);
2484 if (consrtainType == PARTIAL)
2486 AddBitfield (&definedConstraintTwo, numDefinedConstraints, tempSetNeg, numTaxa);
2490 definedConstraintTwo = (BitsLong **) SafeRealloc ((void *)(definedConstraintTwo), ((size_t)numDefinedConstraints+1)*sizeof(BitsLong *));
2491 if (definedConstraintTwo==NULL)
2493 definedConstraintTwo[numDefinedConstraints]=NULL;
2496 /* add a default node calibration */
2497 nodeCalibration = (Calibration *) SafeRealloc ((void *)nodeCalibration, ((size_t)numDefinedConstraints+1)*sizeof(Calibration));
2498 nodeCalibration[numDefinedConstraints].prior = defaultCalibration.prior;
2499 nodeCalibration[numDefinedConstraints].priorParams[0] = defaultCalibration.priorParams[0];
2500 nodeCalibration[numDefinedConstraints].priorParams[1] = defaultCalibration.priorParams[1];
2501 nodeCalibration[numDefinedConstraints].priorParams[2] = defaultCalibration.priorParams[2];
2502 nodeCalibration[numDefinedConstraints].min = defaultCalibration.min;
2503 nodeCalibration[numDefinedConstraints].max = defaultCalibration.max;
2504 nodeCalibration[numDefinedConstraints].LnPriorProb = defaultCalibration.LnPriorProb;
2505 nodeCalibration[numDefinedConstraints].LnPriorRatio = defaultCalibration.LnPriorRatio;
2506 strcpy(nodeCalibration[numDefinedConstraints].name, defaultCalibration.name);
2508 /* increment number of defined constraints */
2509 numDefinedConstraints++;
2511 /* reallocate and initialize space for activeConstraints */
2512 for (i=0; i<numCurrentDivisions; i++)
2514 modelParams[i].activeConstraints = (int *) SafeRealloc((void *)(modelParams[i].activeConstraints), (size_t)numDefinedConstraints*sizeof(int));
2515 modelParams[i].activeConstraints[numDefinedConstraints-1] = NO;
2518 /* reallocate and initialize space for tempActiveConstraints */
2519 tempActiveConstraints = (int *) SafeRealloc((void *)(tempActiveConstraints), (size_t)numDefinedConstraints*sizeof(int));
2520 tempActiveConstraints[numDefinedConstraints-1] = NO;
2522 definedConstraintsType = (enum ConstraintType *) SafeRealloc((void *)(definedConstraintsType), (size_t)numDefinedConstraints*sizeof(enum ConstraintType));
2523 if (definedConstraintsType==NULL)
2525 definedConstraintsType[numDefinedConstraints-1] = consrtainType;
2527 definedConstraintPruned = (BitsLong **) SafeRealloc ((void *)(definedConstraintPruned), (size_t)numDefinedConstraints*sizeof(BitsLong *));
2528 if (definedConstraintPruned==NULL)
2530 definedConstraintPruned[numDefinedConstraints-1]=NULL;
2532 definedConstraintTwoPruned = (BitsLong **) SafeRealloc ((void *)(definedConstraintTwoPruned), (size_t)numDefinedConstraints*sizeof(BitsLong *));
2533 if (definedConstraintTwoPruned==NULL)
2535 definedConstraintTwoPruned[numDefinedConstraints-1]=NULL;
2537 /* show taxset (for debugging) */
2538 // for (i=0; i<numTaxa; i++)
2539 // MrBayesPrint ("%4d %4d\n", i+1, taxaInfo[i].constraints[numDefinedConstraints-1]);
2545 int DoConstraintParm (char *parmName, char *tkn)
2547 int i, index, tempInt;
2549 static int *tempSetCurrent;
2551 if (defMatrix == NO)
2553 MrBayesPrint ("%s A matrix must be specified before constraints can be defined\n", spacer);
2557 if (expecting == Expecting(PARAMETER))
2559 if (!strcmp(parmName, "Xxxxxxxxxx"))
2561 /* check size of constraint name */
2562 if (strlen(tkn) > 99)
2564 MrBayesPrint ("%s Constraint name is too long\n", spacer);
2568 /* check to see if the name has already been used as a constraint */
2569 if (numDefinedConstraints > 0)
2571 if (CheckString (constraintNames, numDefinedConstraints, tkn, &index) == ERROR)
2573 /* an ERROR returned if the constraint name has not been used. we _want_ to be here */
2577 MrBayesPrint ("%s Constraint name '%s' has been used previously\n", spacer, tkn);
2582 /* copy the name to the temporary constraint names string */
2583 strcpy (tempSetName, tkn);
2586 for (i=0; i<numTaxa; i++)
2589 consrtainType = HARD; /* set default constrain type */
2590 tempSetCurrent=tempSet;
2591 fromI = toJ = everyK = -1;
2592 foundDash = foundSlash = NO;
2593 MrBayesPrint ("%s Defining constraint called '%s'\n", spacer, tkn);
2599 expecting = Expecting(ALPHA);
2600 expecting |= Expecting(NUMBER);
2601 expecting |= Expecting(DASH);
2602 expecting |= Expecting(EQUALSIGN);
2607 else if (expecting == Expecting(EQUALSIGN))
2610 expecting = Expecting(ALPHA);
2611 expecting |= Expecting(NUMBER);
2613 else if (expecting == Expecting(LEFTPAR))
2616 expecting = Expecting(NUMBER);
2617 expecting |= Expecting(DASH);
2619 else if (expecting == Expecting(RIGHTPAR))
2623 expecting = Expecting(EQUALSIGN);
2625 else if (expecting == Expecting(DASH))
2627 if (foundExp == YES)
2631 expecting = Expecting(NUMBER);
2633 else if (expecting == Expecting(ALPHA))
2635 if (foundFirst == YES && foundEqual == NO)
2637 /* We are filling in the probability for the constraint. Specifically, we expect exp(number). */
2638 if (IsSame ("Partial", tkn) == SAME)
2640 for (i=0; i<numTaxa; i++)
2643 consrtainType = PARTIAL;
2644 expecting = Expecting(EQUALSIGN);
2645 expecting |= Expecting(ALPHA);
2647 else if (IsSame ("Hard", tkn) == SAME)
2649 consrtainType = HARD;
2650 expecting = Expecting(EQUALSIGN);
2651 expecting |= Expecting(ALPHA);
2653 else if (IsSame ("Negative", tkn) == SAME)
2655 consrtainType = NEGATIVE;
2656 expecting = Expecting(EQUALSIGN);
2657 expecting |= Expecting(ALPHA);
2659 else if (IsSame ("Exp", tkn) == SAME || IsSame ("Exp", tkn) == CONSISTENT_WITH)
2664 expecting = Expecting(LEFTPAR);
2668 MrBayesPrint ("%s Do not understand %s\n", spacer, tkn);
2674 /* We are defining a constraint in terms of a taxon set (called tkn, here) or we are referring to
2675 the taxon name. We should be able to find tkn in the list of taxon set names or in the list
2676 of taxon names. If we cannot, then we have a problem and return an error. */
2677 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
2679 if (numTaxaSets < 1)
2681 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
2684 if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
2686 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
2689 /* add taxa from taxset tkn to new tempSet */
2690 for (i=0; i<numTaxa; i++)
2692 if (IsBitSet(i, taxaSet[index]) == YES)
2694 tempSetCurrent[i] = 1;
2700 tempSetCurrent[index] = 1;
2702 fromI = toJ = everyK = -1;
2704 expecting = Expecting(ALPHA);
2705 expecting |= Expecting(NUMBER);
2706 if (consrtainType != PARTIAL || foundColon == YES)
2707 expecting |= Expecting(SEMICOLON);
2709 expecting |= Expecting(COLON);
2712 else if (expecting == Expecting(NUMBER))
2714 if (foundFirst == YES && foundEqual == NO)
2716 /* We are filling in the probability for the constraint. Specifically, we expect number. */
2717 sscanf (tkn, "%lf", &tempD);
2718 if (foundExp == NO && tempD < 0.0)
2720 MrBayesPrint ("%s The probability of a clade cannot be less than zero\n", spacer, tkn);
2723 if (isNegative == YES || foundDash == YES)
2725 if (foundExp == YES)
2727 expecting = Expecting(RIGHTPAR);
2731 expecting = Expecting(EQUALSIGN);
2738 if (strlen(tkn) == 1 && !strcmp(tkn, "."))
2744 sscanf (tkn, "%d", &tempInt);
2745 if (tempInt <= 0 || tempInt > numTaxa)
2747 MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
2752 if (foundDash == YES)
2758 MrBayesPrint ("%s Improperly formatted constraint\n", spacer);
2763 else if (foundSlash == YES)
2768 MrBayesPrint ("%s Improperly formatted constraint\n", spacer);
2771 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
2775 MrBayesPrint ("%s Improperly formatted constraint\n", spacer);
2782 if (fromI >= 0 && toJ < 0)
2784 if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR)
2788 else if (fromI < 0 && toJ < 0)
2792 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
2794 if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR)
2799 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
2801 if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR)
2808 MrBayesPrint ("%s Improperly formatted constraint\n", spacer);
2815 expecting = Expecting(ALPHA);
2816 expecting |= Expecting(NUMBER);
2817 expecting |= Expecting(DASH);
2818 expecting |= Expecting(BACKSLASH);
2819 if (consrtainType != PARTIAL || foundColon == YES)
2820 expecting |= Expecting(SEMICOLON);
2822 expecting |= Expecting(COLON);
2825 else if (expecting == Expecting(BACKSLASH))
2828 expecting = Expecting(NUMBER);
2830 else if (expecting == Expecting(COLON))
2832 if (foundColon == YES)
2834 MrBayesPrint ("%s Improperly formatted constraint: two colon charactors in constraint command.\n", spacer);
2838 /* add set to tempSet */
2839 if (fromI >= 0 && toJ < 0)
2841 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
2844 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
2846 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
2849 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
2851 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
2854 fromI = toJ = everyK = -1;
2855 foundDash = foundSlash = NO;
2858 tempSetCurrent = tempSetNeg;
2859 expecting = Expecting(ALPHA);
2860 expecting |= Expecting(NUMBER);
2871 int i, foundIllegal, marks[5], numAppliedTo;
2873 /* add set to tempSet */
2874 if (fromI >= 0 && toJ < 0)
2876 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
2879 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
2881 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
2884 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
2886 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
2890 /* merge tempSet with ctype */
2894 for (i=0; i<numChar; i++)
2896 if (tempSet[i] != 0)
2899 if (charOrdering != UNORD)
2901 if (charInfo[i].charType == DNA)
2905 MrBayesPrint ("%s Ctype not applied to DNA states which must be unordered\n", spacer);
2908 else if (charInfo[i].charType == RNA)
2912 MrBayesPrint ("%s Ctype not applied to RNA states which must be unordered\n", spacer);
2915 else if (charInfo[i].charType == PROTEIN)
2919 MrBayesPrint ("%s Ctype not applied to amino acid states which must be unordered\n", spacer);
2922 else if (charInfo[i].charType == RESTRICTION)
2926 MrBayesPrint ("%s Ctype not applied to restriction site states which must be unordered\n", spacer);
2929 else if (charInfo[i].charType == CONTINUOUS)
2933 MrBayesPrint ("%s Ctype not applied to continuous characters\n", spacer);
2937 if (foundIllegal == NO)
2939 charInfo[i].ctype = charOrdering;
2944 if (numAppliedTo > 0)
2946 MrBayesPrint ("%s Ctype was applied to %d standard characters\n", spacer, numAppliedTo);
2950 MrBayesPrint ("%s No standard characters found to apply ctype to\n", spacer);
2954 for (i=0; i<numChar; i++)
2955 MrBayesPrint ("%4d -- %d\n", i, ctype[i]);
2962 int DoCtypeParm (char *parmName, char *tkn)
2964 int i, index, tempInt;
2966 if (defMatrix == NO)
2968 MrBayesPrint ("%s A matrix must be specified before typesets can be defined\n", spacer);
2972 if (expecting == Expecting(PARAMETER))
2974 if (!strcmp(parmName, "Xxxxxxxxxx"))
2976 if (IsSame ("Ordered", tkn) == SAME || IsSame ("Ordered", tkn) == CONSISTENT_WITH)
2978 else if (IsSame ("Unordered", tkn) == SAME || IsSame ("Unordered", tkn) == CONSISTENT_WITH)
2979 charOrdering = UNORD;
2980 else if (IsSame ("Dollo", tkn) == SAME || IsSame ("Dollo", tkn) == CONSISTENT_WITH)
2981 charOrdering = DOLLO;
2982 else if (IsSame ("Irreversible", tkn) == SAME || IsSame ("Irreversible", tkn) == CONSISTENT_WITH)
2983 charOrdering = IRREV;
2986 MrBayesPrint ("%s Do not understand delimiter \"%s\"\n", spacer, tkn);
2991 for (i=0; i<numChar; i++)
2994 fromI = toJ = everyK = -1;
2995 foundDash = foundSlash = NO;
2996 MrBayesPrint ("%s Setting characters to %s\n", spacer, tkn);
2997 expecting = Expecting(COLON);
3002 else if (expecting == Expecting(COLON))
3004 expecting = Expecting(ALPHA) | Expecting(NUMBER);
3006 else if (expecting == Expecting(ALPHA))
3008 /* first, check that we are not trying to put in another character ordering */
3009 if (IsSame ("Ordered", tkn) == SAME || IsSame ("Ordered", tkn) == CONSISTENT_WITH)
3011 MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
3014 else if (IsSame ("Unordered", tkn) == SAME || IsSame ("Unordered", tkn) == CONSISTENT_WITH)
3016 MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
3019 else if (IsSame ("Dollo", tkn) == SAME || IsSame ("Dollo", tkn) == CONSISTENT_WITH)
3021 MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
3024 else if (IsSame ("Irreversible", tkn) == SAME || IsSame ("Irreversible", tkn) == CONSISTENT_WITH)
3026 MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
3030 /* We are defining a type set in terms of another (called tkn, here). We should be able
3031 to find tkn in the list of character set names. If we cannot, then we have a problem and
3033 if (IsSame ("All", tkn) == SAME)
3035 for (i=0; i<numChar; i++)
3037 fromI = toJ = everyK = -1;
3038 expecting = Expecting(SEMICOLON);
3042 if (numCharSets < 1)
3044 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
3047 if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
3049 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
3053 /* add characters from charset tkn to new tempset */
3054 for (i=0; i<numChar; i++)
3056 if (IsBitSet(i, charSet[index]) == YES)
3059 fromI = toJ = everyK = -1;
3060 expecting = Expecting(ALPHA);
3061 expecting |= Expecting(NUMBER);
3062 expecting |= Expecting(SEMICOLON);
3065 else if (expecting == Expecting(NUMBER))
3067 if (strlen(tkn) == 1 && tkn[0] == '.')
3070 sscanf (tkn, "%d", &tempInt);
3071 if (tempInt <= 0 || tempInt > numChar)
3073 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
3077 if (foundDash == YES)
3083 MrBayesPrint ("%s Improperly formatted ctype\n", spacer);
3088 else if (foundSlash == YES)
3093 MrBayesPrint ("%s Improperly formatted ctype\n", spacer);
3096 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
3100 MrBayesPrint ("%s Improperly formatted ctype\n", spacer);
3107 if (fromI >= 0 && toJ < 0)
3109 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3113 else if (fromI < 0 && toJ < 0)
3117 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
3119 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3124 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
3126 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3133 MrBayesPrint ("%s Improperly formatted ctype\n", spacer);
3141 expecting = Expecting(ALPHA);
3142 expecting |= Expecting(NUMBER);
3143 expecting |= Expecting(SEMICOLON);
3144 expecting |= Expecting(DASH);
3145 expecting |= Expecting(BACKSLASH);
3147 else if (expecting == Expecting(DASH))
3150 expecting = Expecting(NUMBER);
3152 else if (expecting == Expecting(BACKSLASH))
3155 expecting = Expecting(NUMBER);
3168 MrBayesPrint ("%s Excluding taxa\n", spacer);
3170 /* add set to tempSet */
3171 if (fromI >= 0 && toJ < 0)
3173 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3176 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
3178 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3181 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
3183 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3187 /* merge tempSet with taxaset */
3189 for (i=0; i<numTaxa; i++)
3191 if (tempSet[i] == 1)
3193 if (taxaInfo[i].isDeleted == YES && alreadyDone == NO)
3195 MrBayesPrint ("%s Some taxa already excluded\n", spacer);
3198 taxaInfo[i].isDeleted = YES;
3203 if (SetUpAnalysis(&globalSeed) == ERROR)
3206 /* show tempSet (for debugging) */
3208 for (i=0; i<numTaxa; i++)
3209 MrBayesPrint ("%4d %4d\n", i+1, tempSet[i]);
3216 int DoDeleteParm (char *parmName, char *tkn)
3218 int i, index, tempInt;
3220 if (defMatrix == NO)
3222 MrBayesPrint ("%s A matrix must be specified before you can delete taxa\n", spacer);
3226 if (foundFirst == NO)
3228 /* this is the first time in */
3229 fromI = toJ = everyK = -1;
3231 for (i=0; i<numTaxa; i++) /* clear tempSet */
3236 if (expecting == Expecting(ALPHA))
3238 if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
3240 for (i=0; i<numTaxa; i++)
3245 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
3247 /* we are using a pre-defined taxa set */
3248 if (numTaxaSets < 1)
3250 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
3253 if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
3255 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
3258 /* add taxa from taxset tkn to new tempSet */
3259 for (i=0; i<numTaxa; i++)
3261 if (IsBitSet (i, taxaSet[index]) == YES)
3267 /* we found the taxon name */
3268 if (fromI >= 0 && toJ < 0)
3270 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3273 else if (fromI >= 0 && toJ >= 0)
3275 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3283 fromI = toJ = everyK = -1;
3285 expecting = Expecting(ALPHA);
3286 expecting |= Expecting(NUMBER);
3287 expecting |= Expecting(SEMICOLON);
3289 else if (expecting == Expecting(NUMBER))
3291 if (strlen(tkn) == 1 && !strcmp(tkn, "."))
3295 sscanf (tkn, "%d", &tempInt);
3296 if (tempInt <= 0 || tempInt > numTaxa)
3298 MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
3303 if (foundDash == YES)
3309 MrBayesPrint ("%s Improperly formatted delete set\n", spacer);
3316 if (fromI >= 0 && toJ < 0)
3318 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3322 else if (fromI < 0 && toJ < 0)
3326 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
3328 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3333 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
3335 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3342 MrBayesPrint ("%s Improperly formatted delete set\n", spacer);
3348 expecting = Expecting(ALPHA);
3349 expecting |= Expecting(NUMBER);
3350 expecting |= Expecting(SEMICOLON);
3351 expecting |= Expecting(DASH);
3353 else if (expecting == Expecting(DASH))
3356 expecting = Expecting(NUMBER);
3362 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
3366 int DoDimensions (void)
3368 if (inDataBlock == NO && inTaxaBlock == NO && inCharactersBlock == NO)
3370 MrBayesPrint ("%s Dimensions can only be defined in a data, characters or taxa block\n", spacer);
3374 /* other problems are detected already when reading in DoDimensionsParm */
3375 if (inDataBlock == YES && (defTaxa == NO || defChars == NO))
3377 MrBayesPrint ("%s Expecting both Ntax and Nchar to be defined in a data block\n", spacer);
3381 /* allocate matrix */
3382 if (inTaxaBlock == YES)
3384 if (AllocTaxa () == ERROR)
3386 MrBayesPrint ("%s Defining new set of %d taxa\n", spacer, numTaxa);
3389 if (inCharactersBlock == YES)
3391 if (AllocMatrix() == ERROR)
3393 MrBayesPrint ("%s Defining new character matrix with %d characters\n", spacer, numChar);
3396 if (inDataBlock == YES)
3398 if (AllocMatrix() == ERROR)
3400 MrBayesPrint ("%s Defining new matrix with %d taxa and %d characters\n", spacer, numTaxa, numChar);
3407 int DoDimensionsParm (char *parmName, char *tkn)
3409 if (expecting == Expecting(PARAMETER))
3411 expecting = Expecting(EQUALSIGN);
3415 /* set Ntax (numTaxa) *****************************************************************/
3416 if (!strcmp(parmName, "Ntax"))
3418 if (inCharactersBlock == YES)
3420 MrBayesPrint ("%s You cannot define ntax in a characters block\n");
3423 if (expecting == Expecting(EQUALSIGN))
3424 expecting = Expecting(NUMBER);
3425 else if (expecting == Expecting(NUMBER))
3427 sscanf (tkn, "%d", &numTaxa);
3429 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
3434 /* set Nchar (numChar) ****************************************************************/
3435 else if (!strcmp(parmName, "Nchar"))
3437 if (inTaxaBlock == YES)
3439 MrBayesPrint ("%s You cannot define nchar in a taxa block\n");
3442 if (expecting == Expecting(EQUALSIGN))
3443 expecting = Expecting(NUMBER);
3444 else if (expecting == Expecting(NUMBER))
3446 sscanf (tkn, "%d", &numChar);
3448 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
3461 int DoDisclaimer (void)
3463 MrBayesPrint (" --------------------------------------------------------------------------- \n");
3464 MrBayesPrint (" Disclaimer \n");
3465 MrBayesPrint (" \n");
3466 MrBayesPrint (" Copyright 2003 by John P. Huelsenbeck and Fredrik Ronquist \n");
3467 MrBayesPrint (" \n");
3468 MrBayesPrint (" This software package is provided \"as is\" and without a warranty of any \n");
3469 MrBayesPrint (" kind. In no event shall the authors be held responsible for any damage \n");
3470 MrBayesPrint (" resulting from the use of this software. The program--including source code, \n");
3471 MrBayesPrint (" example data sets, and executables--is distributed free of charge for \n");
3472 MrBayesPrint (" academic use only. \n");
3473 MrBayesPrint (" --------------------------------------------------------------------------- \n");
3479 int DoEndBlock (void)
3481 if (inMrbayesBlock == YES)
3483 MrBayesPrint (" Exiting mrbayes block\n");
3484 inMrbayesBlock = NO;
3486 else if (inDataBlock == YES)
3488 MrBayesPrint (" Exiting data block\n");
3491 else if (inCharactersBlock == YES)
3493 MrBayesPrint (" Exiting characters block\n");
3494 inCharactersBlock = NO;
3496 else if (inTaxaBlock == YES)
3498 MrBayesPrint (" Exiting taxa block\n");
3499 if (numNamedTaxa < numTaxa)
3501 MrBayesPrint ("%s Leaving taxa block without taxon labels being defined\n", spacer);
3506 else if (inTreesBlock == YES)
3508 MrBayesPrint (" Exiting trees block\n");
3510 ResetTranslateTable();
3512 else if (inForeignBlock == YES)
3514 MrBayesPrint (" Exiting foreign block\n");
3515 inForeignBlock = NO;
3519 MrBayesPrint (" Unknown \"end\" statement\n");
3523 strcpy(spacer,""); /* reset indentation */
3528 int DoExecute (void)
3530 int c, i, rc, cmdLine, lineTerm, longestLineLength, nErrors;
3531 char *s, exeFileName[100];
3533 CmdType *oldCommandPtr;
3534 # if defined (MPI_ENABLED)
3542 strncpy (exeFileName, inputFileName, 98);
3544 if (numOpenExeFiles > 1)
3545 MrBayesPrint ("\n%s Executing file \"%s\"...\n\n", spacer, inputFileName);
3547 MrBayesPrint ("%s Executing file \"%s\"\n", spacer, inputFileName);
3549 /* Save old command ptr */
3550 oldCommandPtr = commandPtr;
3552 /* open binary file */
3553 if ((fp = OpenBinaryFileR(inputFileName)) == NULL)
3556 /* set indentation to 0 */
3557 strcpy (spacer, "");
3559 # if defined (MPI_ENABLED)
3560 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3563 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3571 /* find out what type of line termination is used */
3572 lineTerm = LineTermType (fp);
3573 if (lineTerm == LINETERM_MAC)
3574 MrBayesPrint ("%s Macintosh line termination\n", spacer);
3575 else if (lineTerm == LINETERM_DOS)
3576 MrBayesPrint ("%s DOS line termination\n", spacer);
3577 else if (lineTerm == LINETERM_UNIX)
3578 MrBayesPrint ("%s UNIX line termination\n", spacer);
3581 MrBayesPrint ("%s Unknown line termination\n", spacer);
3584 # if defined (MPI_ENABLED)
3585 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3588 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3596 /* find length of longest line */
3597 longestLineLength = LongestLine (fp);
3598 MrBayesPrint ("%s Longest line length = %d\n", spacer, longestLineLength);
3599 longestLineLength += 50;
3601 /* check that longest line is not longer than CMD_STRING_LENGTH */
3602 if (longestLineLength >= CMD_STRING_LENGTH - 100)
3604 /*MrBayesPrint ("%s A maximum of %d characters is allowed on a single line\n", spacer, CMD_STRING_LENGTH - 100);*/
3605 MrBayesPrint ("%s The longest line of the file %s\n", spacer, inputFileName);
3606 MrBayesPrint ("%s contains at least one line with %d characters.\n", spacer, longestLineLength);
3609 # if defined (MPI_ENABLED)
3610 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3613 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3622 /* allocate a string long enough to hold a line */
3623 s = (char *)SafeMalloc((size_t)longestLineLength * sizeof(char));
3626 MrBayesPrint ("%s Problem allocating string for reading file\n", spacer);
3629 # if defined (MPI_ENABLED)
3630 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3633 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3641 /* close binary file */
3644 /* open text file */
3645 if ((fp = OpenTextFileR(inputFileName)) == NULL)
3649 # if defined (MPI_ENABLED)
3650 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3653 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3661 /* parse file, reading each line in turn */
3662 MrBayesPrint ("%s Parsing file\n", spacer);
3664 inMrbayesBlock = inDataBlock = inForeignBlock = inTreesBlock = NO;
3666 expecting = Expecting(COMMAND);
3670 /* read in a new line into s */
3674 if (c == '\r' || c == '\n' || c == EOF)
3678 } while (s[i-1] != '\n');
3683 /* process string if not empty */
3686 /* check that all characters in the string are valid */
3687 if (CheckStringValidity (s) == ERROR)
3691 # if defined (MPI_ENABLED)
3692 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3695 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3703 /* interpret commands on line */
3704 rc = ParseCommand (s);
3707 # if defined (MPI_ENABLED)
3708 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3711 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3718 if (rc == NO_ERROR_QUIT)
3720 # if defined (MPI_ENABLED)
3721 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3731 MrBayesPrint ("%s Reached end of file\n", spacer);
3733 if (inComment == YES)
3736 # if defined (MPI_ENABLED)
3737 MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
3740 MrBayesPrint ("%s There was an error on at least one processor\n", spacer);
3753 if (numOpenExeFiles > 0)
3755 inMrbayesBlock = YES;
3756 MrBayesPrint ("\n Returning execution to calling file ...\n\n");
3757 strcpy (spacer, " ");
3760 strcpy (spacer, "");
3762 commandPtr = oldCommandPtr;
3771 if (numOpenExeFiles > 0)
3773 inMrbayesBlock = YES;
3774 strcpy (spacer, " ");
3777 strcpy (spacer, "");
3779 commandPtr = oldCommandPtr;
3781 return (NO_ERROR_QUIT);
3784 if (inComment == YES)
3786 MrBayesPrint ("%s ERROR: Reached end of file while in comment.\n", spacer);
3792 MrBayesPrint ("%s The error occurred when reading char. %d on line %d\n", spacer, tokenP-cmdStr-strlen(token)+1, cmdLine);
3793 MrBayesPrint ("%s in the file '%s'\n", spacer, exeFileName);
3798 numOpenExeFiles--; /* we increase the value above even if no file is successfully opened */
3800 /* make sure we exit the block we were reading from correctly */
3801 if (inMrbayesBlock == YES)
3802 inMrbayesBlock = NO;
3803 else if (inDataBlock == YES)
3805 else if (inTreesBlock == YES)
3808 ResetTranslateTable();
3810 else if (inForeignBlock == YES)
3811 inForeignBlock = NO;
3813 /* make sure correct return if we came from mrbayes block in another execute file */
3814 if (numOpenExeFiles > 0)
3816 inMrbayesBlock = YES;
3817 MrBayesPrint ("\n Returning execution to calling file ...\n\n");
3818 strcpy (spacer, " ");
3819 commandPtr = oldCommandPtr;
3823 strcpy (spacer, "");
3825 commandPtr = oldCommandPtr;
3831 int DoExecuteParm (char *parmName, char *tkn)
3835 MrBayesPrint ("%s Maximum allowed length of file name is 99 characters. The given name:\n", spacer);
3836 MrBayesPrint ("%s '%s'\n", spacer,tkn);
3837 MrBayesPrint ("%s has %d characters.\n", spacer,strlen(tkn));
3840 strcpy (inputFileName, tkn);
3842 expecting = Expecting (SEMICOLON);
3845 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
3849 int DoExclude (void)
3853 MrBayesPrint ("%s Excluding character(s)\n", spacer);
3855 /* add set to tempSet */
3856 if (fromI >= 0 && toJ < 0)
3858 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3861 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
3863 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3866 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
3868 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
3872 /* merge tempSet with charset */
3874 for (i=0; i<numChar; i++)
3876 if (tempSet[i] == 1)
3878 if (charInfo[i].isExcluded == YES && alreadyDone == NO)
3880 MrBayesPrint ("%s Some characters already excluded\n", spacer);
3883 charInfo[i].isExcluded = YES;
3889 /* reset analysis to recompress data */
3890 if (SetUpAnalysis(&globalSeed) == ERROR)
3897 int DoExcludeParm (char *parmName, char *tkn)
3899 int i, index, tempInt;
3901 if (defMatrix == NO)
3903 MrBayesPrint ("%s A matrix must be specified before you can exclude characters\n", spacer);
3907 if (foundFirst == NO)
3909 /* this is the first time in */
3910 fromI = toJ = everyK = -1;
3911 foundDash = foundSlash = NO;
3912 for (i=0; i<numChar; i++) /* clear tempSet */
3917 if (expecting == Expecting(ALPHA))
3919 if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
3921 for (i=0; i<numChar; i++)
3924 else if (IsSame ("Missambig", tkn) == SAME || IsSame ("Missambig", tkn) == CONSISTENT_WITH)
3926 for (i=0; i<numChar; i++)
3928 if (charInfo[i].isMissAmbig == YES)
3934 /* we are using a pre-defined character set */
3935 if (numCharSets < 1)
3937 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
3940 if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
3942 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
3945 /* add characters from charset tkn to new tempSet */
3946 for (i=0; i<numChar; i++)
3948 if (IsBitSet(i, charSet[index]) == YES)
3951 fromI = toJ = everyK = -1;
3954 expecting = Expecting(ALPHA);
3955 expecting |= Expecting(NUMBER);
3956 expecting |= Expecting(SEMICOLON);
3958 else if (expecting == Expecting(NUMBER))
3960 if (strlen(tkn) == 1 && tkn[0] == '.')
3963 sscanf (tkn, "%d", &tempInt);
3964 if (tempInt <= 0 || tempInt > numChar)
3966 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
3970 if (foundDash == YES)
3976 MrBayesPrint ("%s Improperly formatted exclude set\n", spacer);
3981 else if (foundSlash == YES)
3986 MrBayesPrint ("%s Improperly formatted exclude set\n", spacer);
3989 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
3993 MrBayesPrint ("%s Improperly formatted exclude set\n", spacer);
4000 if (fromI >= 0 && toJ < 0)
4002 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4006 else if (fromI < 0 && toJ < 0)
4010 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
4012 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4017 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
4019 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4026 MrBayesPrint ("%s Improperly formatted exclude set\n", spacer);
4032 expecting = Expecting(ALPHA);
4033 expecting |= Expecting(NUMBER);
4034 expecting |= Expecting(SEMICOLON);
4035 expecting |= Expecting(DASH);
4036 expecting |= Expecting(BACKSLASH);
4038 else if (expecting == Expecting(DASH))
4041 expecting = Expecting(NUMBER);
4043 else if (expecting == Expecting(BACKSLASH))
4046 expecting = Expecting(NUMBER);
4052 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
4058 if (inDataBlock == NO && inCharactersBlock == NO)
4060 MrBayesPrint ("%s Formats can only be defined in a data or characters block\n", spacer);
4064 return CheckInitialPartitions();
4068 int DoFormatParm (char *parmName, char *tkn)
4073 if (inDataBlock == NO && inCharactersBlock == NO)
4075 MrBayesPrint ("%s Formats can only be defined in a data or characters block\n", spacer);
4078 if (defTaxa == NO || defChars == NO)
4080 MrBayesPrint ("%s The dimensions of the matrix must be defined before the format\n", spacer);
4084 if (expecting == Expecting(PARAMETER))
4086 expecting = Expecting(EQUALSIGN);
4087 if (!strcmp(parmName, "Interleave"))
4089 expecting = Expecting(EQUALSIGN) | Expecting(PARAMETER) | Expecting(SEMICOLON);
4090 isInterleaved = YES;
4095 /* set Datatype (dataType) ************************************************************/
4096 if (!strcmp(parmName, "Datatype"))
4098 if (expecting == Expecting(EQUALSIGN))
4099 expecting = Expecting(ALPHA);
4100 else if (expecting == Expecting(ALPHA))
4102 if (IsArgValid(tkn, tempStr) == NO_ERROR)
4106 if (!strcmp(tempStr, "Dna"))
4108 else if (!strcmp(tempStr, "Rna"))
4110 else if (!strcmp(tempStr, "Protein"))
4112 else if (!strcmp(tempStr, "Restriction"))
4113 dataType = RESTRICTION;
4114 else if (!strcmp(tempStr, "Standard"))
4115 dataType = STANDARD;
4116 else if (!strcmp(tempStr, "Continuous"))
4117 dataType = CONTINUOUS;
4118 else if (!strcmp(tempStr, "Mixed"))
4122 for (i=0; i<numChar; i++)
4124 fromI = toJ = everyK = -1;
4125 foundDash = foundSlash = NO;
4127 MrBayesPrint ("%s Data is Mixed\n", spacer);
4129 if (dataType == MIXED)
4130 expecting = Expecting(LEFTPAR);
4132 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4136 if (!strcmp(tempStr, "Dna"))
4138 else if (!strcmp(tempStr, "Rna"))
4140 else if (!strcmp(tempStr, "Protein"))
4142 else if (!strcmp(tempStr, "Restriction"))
4143 dataType = RESTRICTION;
4144 else if (!strcmp(tempStr, "Standard"))
4145 dataType = STANDARD;
4146 else if (!strcmp(tempStr, "Continuous"))
4147 dataType = CONTINUOUS;
4148 else if (!strcmp(tempStr, "Mixed"))
4150 MrBayesPrint ("%s Cannot have mixed datatype within a mixed datatype\n", spacer);
4153 expecting = Expecting(COLON);
4154 for (i=0; i<numChar; i++)
4156 fromI = toJ = everyK = -1;
4157 foundDash = foundSlash = NO;
4162 for (i=0; i<numChar; i++)
4164 charInfo[i].charType = dataType;
4165 partitionId[i][0] = numDivisions;
4171 MrBayesPrint ("%s Invalid data type argument\n", spacer);
4175 MrBayesPrint ("%s Data is %s\n", spacer, tempStr);
4176 else if (strcmp(tempStr, "Mixed"))
4177 MrBayesPrint ("%s Data for partition %d is %s\n", spacer, numDivisions+1, tempStr);
4179 else if (expecting == Expecting(LEFTPAR))
4181 expecting = Expecting(ALPHA);
4183 else if (expecting == Expecting(COLON))
4185 expecting = Expecting(NUMBER);
4187 else if (expecting == Expecting(NUMBER))
4189 if (strlen(tkn) == 1 && tkn[0] == '.')
4192 sscanf (tkn, "%d", &tempInt);
4193 if (tempInt <= 0 || tempInt > numChar)
4195 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
4199 if (foundDash == YES)
4205 MrBayesPrint ("%s Improperly formatted partition\n", spacer);
4210 else if (foundSlash == YES)
4215 MrBayesPrint ("%s Improperly formatted partition\n", spacer);
4218 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
4222 MrBayesPrint ("%s Improperly formatted partition\n", spacer);
4229 if (fromI >= 0 && toJ < 0)
4231 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4235 else if (fromI < 0 && toJ < 0)
4239 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
4241 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4246 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
4248 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4255 MrBayesPrint ("%s Improperly formatted partition\n", spacer);
4262 expecting = Expecting(NUMBER);
4263 expecting |= Expecting(DASH);
4264 expecting |= Expecting(BACKSLASH);
4265 expecting |= Expecting(COMMA);
4266 expecting |= Expecting(RIGHTPAR);
4268 else if (expecting == Expecting(DASH))
4271 expecting = Expecting(NUMBER);
4273 else if (expecting == Expecting(BACKSLASH))
4276 expecting = Expecting(NUMBER);
4278 else if (expecting == Expecting(COMMA))
4280 /* add set to tempSet */
4281 if (fromI >= 0 && toJ < 0)
4283 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4286 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
4288 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4291 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
4293 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4296 for (i=0; i<numChar; i++)
4298 if (tempSet[i] == numDivisions)
4299 charInfo[i].charType = dataType;
4303 for (i=0; i<numChar; i++)
4305 if (tempSet[i] != 0)
4307 if (partitionId[i][0] == 0)
4309 charInfo[i].charType = dataType;
4310 partitionId[i][0] = numDivisions + 1;
4314 MrBayesPrint ("%s Improperly formatted partition (same character found in multiple partitions)\n", spacer);
4320 /* increment number of partitions */
4322 expecting = Expecting(ALPHA);
4324 else if (expecting == Expecting(RIGHTPAR))
4326 /* add set to tempSet */
4327 if (fromI >= 0 && toJ < 0)
4329 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4332 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
4334 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4337 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
4339 if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
4344 for (i=0; i<numChar; i++)
4346 if (tempSet[i] != 0)
4348 if (partitionId[i][0] == 0)
4350 charInfo[i].charType = dataType;
4351 partitionId[i][0] = numDivisions + 1;
4355 MrBayesPrint ("%s Improperly formatted partition (same character found in multiple partitions)\n", spacer);
4361 /* increment number of partitions */
4366 if (numDivisions > 1)
4367 MrBayesPrint ("%s There are a total of %d default data divisions\n", spacer, numDivisions);
4368 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4373 /* set Interleave (isInterleaved) *****************************************************/
4374 else if (!strcmp(parmName, "Interleave"))
4376 if (expecting == Expecting(EQUALSIGN))
4377 expecting = Expecting(ALPHA);
4378 else if (expecting == Expecting(ALPHA))
4380 if (IsArgValid(tkn, tempStr) == NO_ERROR)
4382 if (!strcmp(tempStr, "Yes"))
4383 isInterleaved = YES;
4389 MrBayesPrint ("%s Invalid argument for interleaved data\n", spacer);
4392 if (isInterleaved == YES)
4393 MrBayesPrint ("%s Data matrix is interleaved\n", spacer);
4395 MrBayesPrint ("%s Data matrix is not interleaved\n", spacer);
4396 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4401 /* set Gap (gapId) ********************************************************************/
4402 else if (!strcmp(parmName, "Gap"))
4404 if (expecting == Expecting(EQUALSIGN))
4406 expecting = Expecting(ALPHA);
4407 expecting |= Expecting(QUESTIONMARK);
4408 expecting |= Expecting(DASH);
4409 expecting |= Expecting(NUMBER);
4410 expecting |= Expecting(ASTERISK);
4411 expecting |= Expecting(EXCLAMATIONMARK);
4412 expecting |= Expecting(PERCENT);
4413 expecting |= Expecting(WEIRD);
4414 expecting |= Expecting(VERTICALBAR);
4416 else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) ||
4417 ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) ||
4418 ((expecting & Expecting(DASH)) == Expecting(DASH)) ||
4419 ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) ||
4420 ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) ||
4421 ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) ||
4422 ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) ||
4423 ((expecting & Expecting(WEIRD)) == Expecting(WEIRD)) ||
4424 ((expecting & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR)))
4426 if (strlen(tkn) == 1)
4428 if (tkn[0] == matchId || tkn[0] == missingId)
4430 MrBayesPrint ("%s Gap character matches matching or missing characters\n", spacer);
4437 MrBayesPrint ("%s Invalid gap argument %s\n", spacer, tkn);
4440 MrBayesPrint ("%s Gaps coded as %s\n", spacer, tkn);
4441 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4446 /* set Missing (missingId) ************************************************************/
4447 else if (!strcmp(parmName, "Missing"))
4449 if (expecting == Expecting(EQUALSIGN))
4451 expecting = Expecting(ALPHA);
4452 expecting |= Expecting(QUESTIONMARK);
4453 expecting |= Expecting(DASH);
4454 expecting |= Expecting(NUMBER);
4455 expecting |= Expecting(ASTERISK);
4456 expecting |= Expecting(EXCLAMATIONMARK);
4457 expecting |= Expecting(PERCENT);
4458 expecting |= Expecting(WEIRD);
4459 expecting |= Expecting(VERTICALBAR);
4461 else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) ||
4462 ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) ||
4463 ((expecting & Expecting(DASH)) == Expecting(DASH)) ||
4464 ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) ||
4465 ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) ||
4466 ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) ||
4467 ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) ||
4468 ((expecting & Expecting(WEIRD)) == Expecting(WEIRD)) ||
4469 ((expecting & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR)))
4471 if (strlen(tkn) == 1)
4473 if (tkn[0] == gapId || tkn[0] == matchId)
4475 MrBayesPrint ("%s Missing character matches matching or gap characters\n", spacer);
4482 MrBayesPrint ("%s Invalid missing argument %s\n", spacer, tkn);
4485 MrBayesPrint ("%s Missing data coded as %s\n", spacer, tkn);
4486 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4491 /* set Matchchar (matchId) ************************************************************/
4492 else if (!strcmp(parmName, "Matchchar"))
4494 if (expecting == Expecting(EQUALSIGN))
4496 expecting = Expecting(ALPHA);
4497 expecting |= Expecting(QUESTIONMARK);
4498 expecting |= Expecting(DASH);
4499 expecting |= Expecting(NUMBER);
4500 expecting |= Expecting(ASTERISK);
4501 expecting |= Expecting(EXCLAMATIONMARK);
4502 expecting |= Expecting(PERCENT);
4503 expecting |= Expecting(WEIRD);
4504 expecting |= Expecting(VERTICALBAR);
4506 else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) ||
4507 ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) ||
4508 ((expecting & Expecting(DASH)) == Expecting(DASH)) ||
4509 ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) ||
4510 ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) ||
4511 ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) ||
4512 ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) ||
4513 ((expecting & Expecting(WEIRD)) == Expecting(WEIRD)) ||
4514 ((expecting & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR)))
4516 if (strlen(tkn) == 1)
4518 if (tkn[0] == gapId || tkn[0] == missingId)
4520 MrBayesPrint ("%s Matching character matches gap or missing characters\n", spacer);
4527 MrBayesPrint ("%s Invalid matchchar argument %s\n", spacer, tkn);
4530 MrBayesPrint ("%s Matching characters coded as %s\n", spacer, tkn);
4531 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4536 /* skip Symbols ***************************************************************/
4537 else if (!strcmp(parmName, "Symbols"))
4539 if (expecting == Expecting(EQUALSIGN))
4541 MrBayesPrint ("%s WARNING: MrBayes does not support 'symbols' specification; default symbols assumed\n", spacer);
4543 expecting = Expecting(ALPHA);
4545 else if (expecting == Expecting(ALPHA))
4547 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4552 /* on Equate return ERROR ***************************************************************/
4553 else if (!strcmp(parmName, "Equate"))
4555 MrBayesPrint ("%s ERROR: MrBayes does not support 'Equate' macros; please remove or comment out\n", spacer);
4568 int i, j, longestDescription;
4571 if (foundFirst == NO)
4573 longestDescription = 0;
4574 for (i=1; i<NUMCOMMANDS; i++)
4577 if ((int)strlen(p->string) > longestDescription)
4578 longestDescription = (int) strlen(p->string);
4581 MrBayesPrint (" --------------------------------------------------------------------------- \n");
4582 MrBayesPrint (" Commands that are available from the command \n");
4583 MrBayesPrint (" line or from a MrBayes block include: \n");
4584 MrBayesPrint (" \n");
4585 for (i=1; i<NUMCOMMANDS; i++)
4588 if (p->cmdUse == IN_CMD && p->hiding == SHOW)
4590 MrBayesPrint (" %s", p->string);
4591 for (j=0; j<longestDescription - (int) strlen(p->string); j++)
4593 MrBayesPrint (" -- %s\n", p->cmdDescription);
4596 MrBayesPrint (" \n");
4597 MrBayesPrint (" Commands that should be in a NEXUS file (data \n");
4598 MrBayesPrint (" block, trees block or taxa block) include: \n");
4599 MrBayesPrint (" \n");
4600 for (i=1; i<NUMCOMMANDS; i++)
4603 if (p->cmdUse == IN_FILE && p->hiding == SHOW)
4605 MrBayesPrint (" %s", p->string);
4606 for (j=0; j<longestDescription - (int) strlen(p->string); j++)
4608 MrBayesPrint (" -- %s\n", p->cmdDescription);
4611 MrBayesPrint (" \n");
4612 MrBayesPrint (" Note that this program supports the use of the shortest unambiguous \n");
4613 MrBayesPrint (" spelling of the above commands (e.g., \"exe\" instead of \"execute\"). \n");
4614 MrBayesPrint (" --------------------------------------------------------------------------- \n");
4622 int DoHelpParm (char *parmName, char *tkn)
4624 int i, j, tkLen, targetLen, numDiff, numMatches;
4625 CmdType *p, *q=NULL;
4627 if (expecting == Expecting(ALPHA))
4630 tkLen = (int) strlen(tkn);
4632 for (i=0; i<NUMCOMMANDS; i++)
4634 targetLen = (int) strlen(p->string);
4635 if (tkLen <= targetLen)
4637 for (j=0, numDiff=0; j<tkLen; j++)
4639 if (ChangeCase(tkn[j]) != ChangeCase(p->string[j]))
4646 if (tkLen == targetLen)
4652 if (numMatches == 0)
4654 MrBayesPrint ("%s Could not find command \"%s\"\n", spacer, tkn);
4657 else if (numMatches == 1)
4659 if (GetUserHelp (q->string) == ERROR)
4661 MrBayesPrint ("%s Problem getting help for command \"%s\"\n", spacer, q->string);
4666 MrBayesPrint ("%s Ambiguous command \"%s\"\n", spacer, tkn);
4670 expecting = Expecting(SEMICOLON);
4677 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
4681 int DoInclude (void)
4685 MrBayesPrint ("%s Including character(s)\n", spacer);
4687 /* add set to tempSet */
4688 if (fromI >= 0 && toJ < 0)
4690 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4693 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
4695 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4698 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
4700 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4704 /* merge tempSet with excludedChars */
4706 for (i=0; i<numChar; i++)
4708 if (tempSet[i] == 1)
4710 if (charInfo[i].isExcluded == NO && alreadyDone == NO)
4712 MrBayesPrint ("%s Some characters already included\n", spacer);
4715 charInfo[i].isExcluded = NO;
4719 /* reset analysis to recompress data */
4720 if (SetUpAnalysis(&globalSeed) == ERROR)
4727 int DoIncludeParm (char *parmName, char *tkn)
4729 int i, index, tempInt;
4731 if (defMatrix == NO)
4733 MrBayesPrint ("%s A matrix must be specified before you can include characters\n", spacer);
4737 if (foundFirst == NO)
4739 /* this is the first time in */
4740 fromI = toJ = everyK = -1;
4741 foundDash = foundSlash = NO;
4742 for (i=0; i<numChar; i++) /* clear tempSet */
4747 if (expecting == Expecting(ALPHA))
4749 if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
4751 for (i=0; i<numChar; i++)
4754 else if (IsSame ("Missambig", tkn) == SAME || IsSame ("Missambig", tkn) == CONSISTENT_WITH)
4756 for (i=0; i<numChar; i++)
4758 if (charInfo[i].isMissAmbig == YES)
4764 /* we are using a pre-defined character set */
4765 if (numCharSets < 1)
4767 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
4770 if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
4772 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
4775 /* add characters from charset tkn to new tempSet */
4776 for (i=0; i<numChar; i++)
4778 if (IsBitSet(i, charSet[index]) == YES)
4781 fromI = toJ = everyK = -1;
4784 expecting = Expecting(ALPHA);
4785 expecting |= Expecting(NUMBER);
4786 expecting |= Expecting(SEMICOLON);
4788 else if (expecting == Expecting(NUMBER))
4790 if (strlen(tkn) == 1 && tkn[0] == '.')
4793 sscanf (tkn, "%d", &tempInt);
4794 if (tempInt <= 0 || tempInt > numChar)
4796 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
4800 if (foundDash == YES)
4806 MrBayesPrint ("%s Improperly formatted include set\n", spacer);
4811 else if (foundSlash == YES)
4816 MrBayesPrint ("%s Improperly formatted include set\n", spacer);
4819 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
4823 MrBayesPrint ("%s Improperly formatted include set\n", spacer);
4830 if (fromI >= 0 && toJ < 0)
4832 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4836 else if (fromI < 0 && toJ < 0)
4840 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
4842 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4847 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
4849 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
4856 MrBayesPrint ("%s Improperly formatted include set\n", spacer);
4862 expecting = Expecting(ALPHA);
4863 expecting |= Expecting(NUMBER);
4864 expecting |= Expecting(SEMICOLON);
4865 expecting |= Expecting(DASH);
4866 expecting |= Expecting(BACKSLASH);
4868 else if (expecting == Expecting(DASH))
4871 expecting = Expecting(NUMBER);
4873 else if (expecting == Expecting(BACKSLASH))
4876 expecting = Expecting(NUMBER);
4882 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
4888 if (logToFile == YES)
4890 SafeFclose (&logFileFp);
4891 if (replaceLogFile == YES)
4893 if ((logFileFp = OpenTextFileW (logFileName)) == NULL)
4901 if ((logFileFp = OpenTextFileA (logFileName)) == NULL)
4907 MrBayesPrint ("%s Logging screen output to file \"%s\"\n", spacer, logFileName);
4911 SafeFclose (&logFileFp);
4912 MrBayesPrint ("%s Terminating log output\n", spacer);
4919 int DoLogParm (char *parmName, char *tkn)
4921 if (expecting == Expecting(PARAMETER))
4923 if (!strcmp(parmName, "Start"))
4925 if (logToFile == YES)
4926 MrBayesPrint ("%s Logging to file is already on\n", spacer, logFileName);
4929 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4931 else if (!strcmp(parmName, "Stop"))
4933 if (logToFile == NO)
4934 MrBayesPrint ("%s Logging to file is already off\n", spacer, logFileName);
4937 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4939 else if (!strcmp(parmName, "Replace"))
4941 replaceLogFile = YES;
4942 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4944 else if (!strcmp(parmName, "Append"))
4946 replaceLogFile = NO;
4947 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4950 expecting = Expecting(EQUALSIGN);
4954 if (!strcmp(parmName, "Filename"))
4956 if (expecting == Expecting(EQUALSIGN))
4958 expecting = Expecting(ALPHA);
4961 else if (expecting == Expecting(ALPHA))
4963 strcpy (logFileName, tkn);
4964 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
4971 MrBayesPrint ("%s Unknown parameter in Log\n", spacer);
4982 int i, j, logSetting;
4987 /* try to open file, return error if present */
4988 if ((fp = OpenTextFileRQuait(manFileName)) != NULL)
4990 MrBayesPrint ("%s File \"%s\" already exists \n", spacer, manFileName);
4995 /* try to open file for writing, return error if not possible */
4996 if ((fp = OpenTextFileW(manFileName)) == NULL)
5000 MrBayesPrint ("%s Producing command reference file \"%s\"\n", spacer, manFileName);
5002 /* temporarily disable normal logging and switch echoing off */
5003 logSetting = logToFile;
5009 /* produce command reference file */
5011 strcpy (title, "Command Reference for MrBayes ver. ");
5012 strcat (title, VERSION_NUMBER);
5014 i = (70 - (int) strlen (title)) / 2;
5015 j = 70 - i - (int) strlen(title);
5017 MrBayesPrint (" \n");
5018 MrBayesPrint (" \n");
5019 MrBayesPrint (" \n");
5020 MrBayesPrint (" \n");
5021 MrBayesPrint (" %*c%s%*c \n", i, ' ', title, j, ' ');
5022 MrBayesPrint (" \n");
5023 MrBayesPrint (" (c) John P. Huelsenbeck, Fredrik Ronquist \n");
5024 MrBayesPrint (" and Maxim Teslenko \n");
5025 MrBayesPrint (" \n");
5028 MrBayesPrint (" \n");
5029 MrBayesPrint (" *************************************************************************** \n");
5030 MrBayesPrint (" * * \n");
5031 MrBayesPrint (" * 1. Command summary * \n");
5032 MrBayesPrint (" * * \n");
5033 MrBayesPrint (" *************************************************************************** \n");
5034 MrBayesPrint (" \n");
5036 if (DoHelp() == ERROR)
5038 MrBayesPrint ("%s Could not produce command reference summary\n", spacer);
5042 /* list of MrBayes commands */
5043 MrBayesPrint (" \n");
5044 MrBayesPrint (" *************************************************************************** \n");
5045 MrBayesPrint (" * * \n");
5046 MrBayesPrint (" * 2. MrBayes commands * \n");
5047 MrBayesPrint (" * * \n");
5048 MrBayesPrint (" *************************************************************************** \n");
5049 MrBayesPrint (" \n");
5050 for (i=1; i<NUMCOMMANDS; i++)
5053 if (p->cmdUse == IN_CMD && p->hiding == SHOW)
5055 if (GetUserHelp(p->string)==ERROR)
5060 /* list of data or tree block commands */
5061 MrBayesPrint (" \n");
5062 MrBayesPrint (" *************************************************************************** \n");
5063 MrBayesPrint (" * * \n");
5064 MrBayesPrint (" * 3. 'Data' or 'tree' block commands (in #NEXUS file) * \n");
5065 MrBayesPrint (" * * \n");
5066 MrBayesPrint (" *************************************************************************** \n");
5067 MrBayesPrint (" \n");
5068 for (i=1; i<NUMCOMMANDS; i++)
5071 if (p->cmdUse == IN_FILE && p->hiding == SHOW)
5073 if (GetUserHelp(p->string) == ERROR)
5078 /* return logging to previous setings and switch echoing on */
5080 logToFile = logSetting;
5084 MrBayesPrint ("%s Successfully produced command reference file \"%s\"\n", spacer, manFileName);
5090 logToFile = logSetting;
5098 int DoManualParm (char *parmName, char *tkn)
5100 if (expecting == Expecting(PARAMETER))
5102 expecting = Expecting(EQUALSIGN);
5106 if (!strcmp(parmName, "Filename"))
5108 if (expecting == Expecting(EQUALSIGN))
5110 expecting = Expecting(ALPHA);
5113 else if (expecting == Expecting(ALPHA))
5115 strcpy (manFileName, tkn);
5116 expecting = Expecting(SEMICOLON);
5123 MrBayesPrint ("%s Unknown parameter in Manual\n", spacer);
5134 int i, j, hasMissingAmbig;
5136 if (taxonCount != numTaxa)
5138 MrBayesPrint ("%s Problem with number of taxa read in (%d taxa read in, while expecting %d)\n", spacer, taxonCount, numTaxa);
5142 for (i=0; i<numTaxa; i++)
5144 if (taxaInfo[i].charCount != numChar)
5146 MrBayesPrint ("%s Problem with number of characters read in (%d expected for taxon %d, %d read in)\n", spacer, numChar, i, taxaInfo[i].charCount);
5152 /* find out which characters have missing or ambiguous states (one time only, so no special function) */
5153 for (i=0; i<numChar; i++)
5155 hasMissingAmbig = NO;
5156 for (j=0; j<numTaxa; j++)
5158 if (IsMissing (matrix[pos(j,i,numChar)], charInfo[i].charType) == YES)
5159 hasMissingAmbig = YES;
5160 if (IsAmbig (matrix[pos(j,i,numChar)], charInfo[i].charType) == YES)
5161 hasMissingAmbig = YES;
5163 if (hasMissingAmbig == YES)
5164 charInfo[i].isMissAmbig = YES;
5167 MrBayesPrint ("%s Successfully read matrix\n", spacer);
5168 if (matrixHasPoly == YES)
5169 MrBayesPrint ("%s Matrix contains polymorphisms, interpreted as ambiguity\n", spacer);
5173 /* add name of default partition */
5174 if (AddString (&partitionNames, 0, "Default") == ERROR)
5176 MrBayesPrint ("%s Problem adding Default name to partition list\n", spacer);
5179 numDefinedPartitions = 1;
5181 if (numDefinedSpeciespartitions == 0) /* the default species partition could have been added already in DoTaxLabels */
5183 /* add default speciespartition name to list of valid speciespartitions */
5184 if (AddString (&speciespartitionNames, 0, "Default") == ERROR)
5186 MrBayesPrint ("%s Problem adding Default speciespartition to list\n", spacer);
5190 /* add default species name set */
5191 AddNameSet(&speciesNameSets, 0, taxaNames, numTaxa);
5193 /* set number of defined speciespartitions to 1 */
5194 numDefinedSpeciespartitions = 1;
5197 if (SetPartition (0) == ERROR)
5200 if (SetSpeciespartition (0) == ERROR)
5203 if (numCurrentDivisions == 1)
5204 MrBayesPrint ("%s Setting default partition (does not divide up characters)\n", spacer);
5206 MrBayesPrint ("%s Setting default partition, dividing characters into %d parts\n", spacer, numCurrentDivisions);
5208 if (SetModelDefaults () == ERROR)
5211 if (SetUpAnalysis (&globalSeed) == ERROR)
5214 /* set default names for some output file names based on processed file */
5215 strcpy (sumtParams.sumtFileName, inputFileName);
5216 strcpy (sumtParams.sumtOutfile, inputFileName);
5217 strcpy (sumpParams.sumpFileName, inputFileName);
5218 strcpy (sumpParams.sumpOutfile, inputFileName);
5219 strcpy (comptreeParams.comptOutfile, inputFileName);
5221 if (chainParams.numRuns == 1)
5223 sprintf (comptreeParams.comptFileName1, "%s.t", inputFileName);
5224 sprintf (comptreeParams.comptFileName2, "%s.t", inputFileName);
5226 else /* if (chainParams.numRuns > 1) */
5228 sprintf (comptreeParams.comptFileName1, "%s.run1.t", inputFileName);
5229 sprintf (comptreeParams.comptFileName2, "%s.run2.t", inputFileName);
5232 if (chainParams.numRuns == 1)
5233 sprintf (plotParams.plotFileName, "%s.p", inputFileName);
5234 else /* if (chainParams.numRuns > 1) */
5235 sprintf (plotParams.plotFileName, "%s.run1.p", inputFileName);
5237 strcpy (chainParams.chainFileName, inputFileName);
5239 if (chainParams.numRuns > 1)
5240 MrBayesPrint ("%s Setting output file names to \"%s.run<i>.<p|t>\"\n", spacer, chainParams.chainFileName);
5242 MrBayesPrint ("%s Setting output file names to \"%s.<p|t>\"\n", spacer, chainParams.chainFileName);
5245 for (i=0; i<numChar; i++)
5248 MrBayesPrint ("%4d -- ", i+1);
5249 for (j=0; j<numTaxa; j++)
5250 MrBayesPrint ("%2d ", matrix[pos(j,i,numChar)]);
5251 MrBayesPrint ("\n");
5259 int DoMatrixParm (char *parmName, char *tkn)
5261 int i, j, charCode=0, index;
5264 expecting = Expecting(ALPHA);
5265 expecting |= Expecting(QUESTIONMARK);
5266 expecting |= Expecting(DASH);
5267 expecting |= Expecting(NUMBER);
5268 expecting |= Expecting(ASTERISK);
5269 expecting |= Expecting(EXCLAMATIONMARK);
5270 expecting |= Expecting(PERCENT);
5271 expecting |= Expecting(WEIRD);
5272 expecting |= Expecting(VERTICALBAR);
5273 expecting |= Expecting(SEMICOLON);
5274 expecting |= Expecting(LEFTPAR);
5275 expecting |= Expecting(RIGHTPAR);
5276 expecting |= Expecting(LEFTCURL);
5277 expecting |= Expecting(RIGHTCURL);
5279 if (defTaxa == NO || defChars == NO)
5281 MrBayesPrint ("%s Number of taxa and characters needs to be defined before matrix is read\n", spacer);
5284 if (inDataBlock == NO && inCharactersBlock == NO)
5286 MrBayesPrint ("%s Must be in data or characters block to read in character matrix\n", spacer);
5290 if (isFirstMatrixRead == YES)
5293 isFirstInterleavedBlock = YES;
5297 isFirstMatrixRead = NO;
5299 /* allow line breaks in non-interleaved matrices */
5300 if (isInterleaved == NO)
5302 if (foundNewLine == YES && taxonCount > 0)
5304 if (taxaInfo[taxonCount-1].charCount < numChar)
5309 if (taxonCount >= numTaxa && foundNewLine == YES)
5311 if (isInterleaved == YES)
5314 isFirstInterleavedBlock = NO;
5318 MrBayesPrint ("%s Too many taxa in matrix\n", spacer);
5323 if (taxaInfo[0].charCount > 4010)
5326 if (foundNewLine == YES)
5328 /* Should be a taxon. */
5329 if (isFirstInterleavedBlock == YES)
5331 /* If this is the first interleaved block, then we need to add the taxon
5332 to the set of taxon names unless there is already a defined taxon set. */
5335 MrBayesPrint ("%s Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, tkn);
5338 if (isTaxsetDef == NO && AddString (&taxaNames, taxonCount, tkn) == ERROR)
5340 MrBayesPrint ("%s Problem adding taxon %s to taxon set\n", spacer, tkn);
5344 MrBayesPrint ("%s Taxon %d -> %s\n", spacer, taxonCount+1, tkn);
5345 else if (numTaxa < 100 && numTaxa >= 10)
5346 MrBayesPrint ("%s Taxon %2d -> %s\n", spacer, taxonCount+1, tkn);
5347 else if (numTaxa < 1000 && numTaxa >= 100)
5348 MrBayesPrint ("%s Taxon %3d -> %s\n", spacer, taxonCount+1, tkn);
5350 MrBayesPrint ("%s Taxon %4d -> %s\n", spacer, taxonCount+1, tkn);
5354 /* If this is not the first interleaved block, then we need to
5355 check to see if taxon name is present and in correct place. */
5356 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
5358 MrBayesPrint ("%s Could not find taxon %s in list of taxa\n", spacer, tkn);
5361 if (index != taxonCount)
5363 MrBayesPrint ("%s Could not find taxon %s in correct position in list of taxa\n", spacer, tkn);
5373 /* Should be a character (either continuous or otherwise). */
5374 if (charInfo[taxaInfo[taxonCount-1].charCount].charType == CONTINUOUS)
5376 /* If we have a CONTINUOUS character, then the entire token should either be
5377 a number or a dash (for a negative sign). */
5378 if (!strcmp(tkn, "-"))
5380 /* Dealing with a negative number. We will multiply the next tkn, which
5381 had better be a number, by -1. */
5386 /* We have a number, we hope. */
5387 if (tkn[0] == matchId)
5389 /* If the token is a matchchar, then things are simple. */
5390 if (taxonCount == 1)
5392 MrBayesPrint ("%s Matching characters cannot be in first taxon\n", spacer);
5395 charCode = matrix[pos(0,taxaInfo[taxonCount-1].charCount,numChar)];
5396 matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount,numChar)] = charCode;
5400 /* Otherwise, we have a number. Check that it is a valid number first... */
5401 if (!IsIn(tkn[0],"0123456789."))
5403 MrBayesPrint ("%s Expecting a number for the continuous character\n", spacer);
5406 /* ... and then put the character into the matrix. Note that matrix
5407 is defined as an integer, but we may have floating precision continuous
5408 characters. To get around this, we multiply the value of the character
5409 by 1000 before putting it into matrix. We will divide by 1000 later on
5410 when/if we use the characters. */
5411 sscanf (tkn, "%lf", &charValue);
5412 charValue *= 1000.0;
5413 if (isNegative == YES)
5418 /*MrBayesPrint ("%d \n", (int)charValue);*/
5419 matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = (int)charValue;
5425 /* Otherwise, we are dealing with a run-of-the-mill character, and we
5426 cannot expect the entire token to contain only a single character. We
5427 must, therefore, go through the token character-by-character. */
5429 while (tkn[i] != '\0')
5431 /*MrBayesPrint ("%c", tkn[i]);*/
5432 if (tkn[i] == matchId)
5434 if (taxonCount == 1)
5436 MrBayesPrint ("%s Matching characters cannot be in first taxon\n", spacer);
5439 charCode = matrix[pos(0,taxaInfo[taxonCount-1].charCount,numChar)];
5440 matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode;
5444 if ((tkn[i] == ')' && isInAmbig == YES) || (tkn[i] == '}' && isInPoly == YES))
5446 isInAmbig = isInPoly = NO;
5447 charCode = theAmbigChar;
5448 j = CharacterNumber (charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType);
5449 if (j > charInfo[taxaInfo[taxonCount-1].charCount].numStates)
5450 charInfo[taxaInfo[taxonCount-1].charCount].numStates = j;
5451 matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode;
5454 else if ((tkn[i] == '(' && isInAmbig == YES) || (tkn[i] == '{' && isInPoly == YES))
5456 if (isInAmbig == YES)
5457 MrBayesPrint ("%s Found an inappropriate \"(\"\n", spacer);
5459 MrBayesPrint ("%s Found an inappropriate \"{\"\n", spacer);
5462 else if (isInAmbig == YES || isInPoly == YES)
5465 expecting |= Expecting (COMMA);
5468 if (CharacterCode(tkn[i], &charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType) == ERROR)
5470 if (charCode == MISSING || charCode == GAP)
5472 theAmbigChar |= charCode;
5473 expecting ^= Expecting (COMMA);
5476 else if (tkn[i] == '{' && isInPoly == NO && isInAmbig == NO)
5479 matrixHasPoly = YES;
5482 else if (tkn[i] == '(' && isInPoly == NO && isInAmbig == NO)
5487 else if (tkn[i] == '(' && isInPoly == NO && isInAmbig == NO)
5494 if (CharacterCode(tkn[i], &charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType) == ERROR)
5496 MrBayesPrint ("%s Error while reading character position %d (charCode %d)\n", spacer, taxaInfo[taxonCount-1].charCount+1, charCode);
5499 if (charCode != MISSING && charCode != GAP)
5501 j = CharacterNumber (charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType);
5502 if (j > charInfo[taxaInfo[taxonCount-1].charCount].numStates)
5503 charInfo[taxaInfo[taxonCount-1].charCount].numStates = j;
5505 matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode;
5514 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
5522 int DoNexusParm (char *parmName, char *tkn)
5524 if (!strcmp(parmName, "NEXUS"))
5526 MrBayesPrint ("%s Expecting NEXUS formatted file\n", spacer);
5527 expecting = Expecting(COMMAND);
5531 MrBayesPrint ("%s Found %s\n", spacer, tkn);
5539 int DoOutgroup (void)
5541 MrBayesPrint ("%s Setting outgroup to taxon \"%s\"\n", spacer, taxaNames[outGroupNum]);
5546 int DoOutgroupParm (char *parmName, char *tkn)
5550 if (expecting == Expecting(ALPHA))
5552 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
5554 MrBayesPrint ("%s Could not find taxon %s in list of taxa\n", spacer, tkn);
5557 outGroupNum = index;
5559 expecting = Expecting(SEMICOLON);
5561 else if (expecting == Expecting(NUMBER))
5563 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
5565 /* OK, as we expect, the taxon is not a digit. So, now we assume that
5566 the user is assigning the outgroup by its number */
5567 sscanf (tkn, "%d", &tempInt);
5568 if (tempInt < 1 || tempInt > numTaxa)
5570 MrBayesPrint ("%s Taxon number %d is out of range\n", spacer, tempInt);
5573 outGroupNum = tempInt - 1;
5577 outGroupNum = index;
5580 expecting = Expecting(SEMICOLON);
5586 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
5592 MrBayesPrint ("\n");
5593 MrBayesPrint ("%s Successfully defined character pairings\n", spacer);
5602 int DoPairsParm (char *parmName, char *tkn)
5606 if (defMatrix == NO)
5608 MrBayesPrint ("%s A matrix must be specified before you can define pairs of characters\n", spacer);
5612 if (defPairs == YES)
5614 MrBayesPrint ("%s Character pairs have been previously defined \n", spacer);
5615 MrBayesPrint ("%s Now overwriting old pairings\n", spacer);
5616 for (i=0; i<numChar; i++)
5617 charInfo[i].pairsId = 0;
5621 if (foundFirst == NO)
5623 /* this is the first time in */
5627 MrBayesPrint ("%s Defining character pairings:\n\n", spacer);
5628 MrBayesPrint ("%s Pair -- First Second \n", spacer);
5631 if (expecting == Expecting(NUMBER))
5633 sscanf (tkn, "%d", &tempInt);
5634 if (tempInt <= 0 || tempInt > numChar)
5636 MrBayesPrint ("\n");
5637 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
5638 for (i=0; i<numChar; i++)
5639 charInfo[i].pairsId = 0;
5644 if (charInfo[tempInt].pairsId != 0)
5646 MrBayesPrint ("\n");
5647 MrBayesPrint ("%s Character number %d has already been included in a pairing\n", spacer, tempInt+1);
5648 for (i=0; i<numChar; i++)
5649 charInfo[i].pairsId = 0;
5652 if (charInfo[tempInt].charType != DNA && charInfo[tempInt].charType != RNA)
5654 MrBayesPrint ("\n");
5655 MrBayesPrint ("%s Pairings may only include nucleotide data\n", spacer);
5656 if (charInfo[tempInt].charType == PROTEIN)
5657 MrBayesPrint ("%s Character %d is an amino acid character\n", spacer, tempInt+1);
5658 else if (charInfo[tempInt].charType == RESTRICTION)
5659 MrBayesPrint ("%s Character %d is a restriction site character\n", spacer, tempInt+1);
5660 else if (charInfo[tempInt].charType == STANDARD)
5661 MrBayesPrint ("%s Character %d is a \"standard\" character\n", spacer, tempInt+1);
5662 else if (charInfo[tempInt].charType == CONTINUOUS)
5663 MrBayesPrint ("%s Character %d is a continuously varying character\n", spacer, tempInt+1);
5664 for (i=0; i<numChar; i++)
5665 charInfo[i].pairsId = 0;
5669 charInfo[tempInt].pairsId = pairId;
5671 if (firstPair == YES)
5673 MrBayesPrint ("%s %4d -- %5d ", spacer, pairId, tempInt+1);
5674 expecting = Expecting(COLON);
5679 MrBayesPrint ("%5d\n", tempInt+1);
5680 expecting = (Expecting(COMMA) | Expecting(SEMICOLON));
5684 else if (expecting == Expecting(COMMA))
5687 expecting = Expecting(NUMBER);
5689 else if (expecting == Expecting(COLON))
5691 expecting = Expecting(NUMBER);
5695 for (i=0; i<numChar; i++)
5696 charInfo[i].pairsId = 0;
5701 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
5705 int DoPartition (void)
5709 /* add set to tempSet */
5711 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
5714 /* check that all characters are included */
5715 for (i=0; i<numChar; i++)
5717 /* MrBayesPrint ("%4d %4d \n", i, tempSet[i]); */
5718 if (tempSet[i] == 0)
5720 MrBayesPrint ("%s Character %d not included in partition\n", spacer, i+1);
5726 /* check how many partitions were found against how many were expected */
5727 if (whichPartition != numDivisions - 1)
5729 MrBayesPrint ("%s Did not find correct number of partitions (expecting %d, found %d)\n", spacer, numDivisions, whichPartition + 1);
5733 partTypes = (int *) SafeCalloc (numDivisions, sizeof(int));
5737 /* make certain that the partition labels go from 1 - numDivisions, inclusive */
5738 for (i=0; i<numChar; i++)
5739 partTypes[tempSet[i] - 1] = -1; //partTypes is temporary used here not as an indicator of partition type
5740 for (i=0; i<numDivisions; i++)
5742 if (partTypes[i] == 0)
5744 MrBayesPrint ("%s Could not find a single character for division %d\n", spacer, i+1);
5749 /* check if partition overruns data types */
5750 for (i=0; i<numChar; i++)
5752 if (partTypes[ tempSet[i]-1 ] == -1)
5753 partTypes[ tempSet[i]-1 ] = charInfo[i].charType;
5756 if (partTypes[ tempSet[i]-1 ] != charInfo[i].charType)
5758 MrBayesPrint ("%s There are two different data types for partition division %d\n", spacer, tempSet[i]);
5766 /* add name to list of valid partitions */
5767 if (AddString (&partitionNames, numDefinedPartitions, tempSetName) == ERROR)
5769 MrBayesPrint ("%s Problem adding partition %s to list\n", spacer, tempSetName);
5773 /* add new partition */
5774 for (i=0; i<numChar; i++) {
5775 partitionId[i] = (int *) SafeRealloc ((void *)(partitionId[i]), ((size_t)numDefinedPartitions + 1) * sizeof(int));
5776 if (!partitionId[i])
5780 /* set new partition */
5781 for (i=0; i<numChar; i++)
5782 partitionId[i][numDefinedPartitions] = tempSet[i];
5784 /* increment number of defined partitions */
5785 numDefinedPartitions++;
5791 int DoPartitionParm (char *parmName, char *tkn)
5793 int i, index, tempInt;
5795 if (defMatrix == NO)
5797 MrBayesPrint ("%s A matrix must be specified before partitions can be defined\n", spacer);
5801 if (expecting == Expecting(PARAMETER))
5803 /* set Partition () ******************************************************************/
5804 if (!strcmp(parmName, "Xxxxxxxxxx"))
5806 /* check size of partition name */
5807 if (strlen(tkn) > 99)
5809 MrBayesPrint ("%s Partition name is too long. Max 100 characters\n", spacer);
5813 /* check to see if the name has already been used as a partition */
5814 if (numDefinedPartitions > 1)
5816 if (CheckString (partitionNames, numDefinedPartitions, tkn, &index) == ERROR)
5818 /* if the partition name has not been used, then we should have an ERROR returned */
5819 /* we _want_ to be here */
5824 MrBayesPrint ("%s Partition name '%s' has been used previously\n", spacer, tkn);
5829 /* add the name temporarily to tempSetName */
5830 strcpy (tempSetName, tkn);
5833 for (i=0; i<numChar; i++)
5836 fromI = toJ = everyK = -1;
5837 foundDash = foundSlash = NO;
5841 MrBayesPrint ("%s Defining partition called '%s'\n", spacer, tkn);
5842 expecting = Expecting(EQUALSIGN);
5847 else if (expecting == Expecting(EQUALSIGN))
5849 expecting = Expecting(NUMBER);
5851 else if (expecting == Expecting(ALPHA))
5853 /* We are defining a partition in terms of a character set (called tkn, here). We should be able
5854 to find tkn in the list of character set names. If we cannot, then we have a problem and
5856 if (numCharSets < 1)
5858 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
5861 if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
5863 MrBayesPrint ("%s Could not find a character set called '%s'\n", spacer, tkn);
5866 /* add characters from charset tkn to new tempSet */
5867 for (i=0; i<numChar; i++)
5869 if (IsBitSet (i, charSet[index]) == YES)
5870 tempSet[i] = whichPartition + 1;
5872 fromI = toJ = everyK = -1;
5874 expecting = Expecting(ALPHA);
5875 expecting |= Expecting(NUMBER);
5876 expecting |= Expecting(SEMICOLON);
5877 expecting |= Expecting(COMMA);
5879 else if (expecting == Expecting(NUMBER))
5881 if (foundFirst == NO)
5883 sscanf (tkn, "%d", &tempInt);
5884 numDivisions = tempInt;
5885 expecting = Expecting(COLON);
5890 if (strlen(tkn) == 1 && tkn[0] == '.')
5893 sscanf (tkn, "%d", &tempInt);
5894 if (tempInt <= 0 || tempInt > numChar)
5896 MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
5900 if (foundDash == YES)
5906 MrBayesPrint ("%s Improperly formatted partition\n", spacer);
5911 else if (foundSlash == YES)
5916 MrBayesPrint ("%s Improperly formatted charset\n", spacer);
5919 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
5923 MrBayesPrint ("%s Improperly formatted charset\n", spacer);
5930 if (fromI >= 0 && toJ < 0)
5932 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
5936 else if (fromI < 0 && toJ < 0)
5940 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
5942 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
5947 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
5949 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
5956 MrBayesPrint ("%s Improperly formatted charset\n", spacer);
5963 expecting = Expecting(ALPHA);
5964 expecting |= Expecting(NUMBER);
5965 expecting |= Expecting(SEMICOLON);
5966 expecting |= Expecting(DASH);
5967 expecting |= Expecting(BACKSLASH);
5968 expecting |= Expecting(COMMA);
5971 else if (expecting == Expecting(COMMA))
5973 /* add set to tempSet */
5975 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
5978 fromI = toJ = everyK = -1;
5979 foundDash = foundSlash = NO;
5981 if (whichPartition > numDivisions)
5983 MrBayesPrint ("%s Too many partitions of the data (expecting %d)\n", spacer, numDivisions);
5986 expecting = Expecting(NUMBER);
5987 expecting |= Expecting(ALPHA);
5989 else if (expecting == Expecting(COLON))
5991 expecting = Expecting(NUMBER);
5992 expecting |= Expecting(ALPHA);
5994 else if (expecting == Expecting(DASH))
5997 expecting = Expecting(NUMBER);
5999 else if (expecting == Expecting(BACKSLASH))
6002 expecting = Expecting(NUMBER);
6011 int DoRestore (void)
6015 MrBayesPrint ("%s Restore taxa\n", spacer);
6017 /* add set to tempSet */
6018 if (fromI >= 0 && toJ < 0)
6020 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6023 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
6025 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6028 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
6030 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6034 /* merge tempSet with excludedTaxa */
6036 for (i=0; i<numTaxa; i++)
6038 if (tempSet[i] == 1)
6040 if (taxaInfo[i].isDeleted == NO && alreadyDone == NO)
6042 MrBayesPrint ("%s Some taxa already included\n", spacer);
6045 taxaInfo[i].isDeleted = NO;
6050 if (SetUpAnalysis(&globalSeed) == ERROR)
6053 /* show tempSet (for debugging) */
6055 for (i=0; i<numTaxa; i++)
6056 MrBayesPrint ("%4d %4d\n", i+1, tempSet[i]);
6063 int DoRestoreParm (char *parmName, char *tkn)
6065 int i, index, tempInt;
6067 if (defMatrix == NO)
6069 MrBayesPrint ("%s A matrix must be specified before you can restore taxa\n", spacer);
6073 if (foundFirst == NO)
6075 /* this is the first time in */
6076 fromI = toJ = everyK = -1;
6078 for (i=0; i<numTaxa; i++) /* clear tempSet */
6083 if (expecting == Expecting(ALPHA))
6085 if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
6087 for (i=0; i<numTaxa; i++)
6092 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
6094 /* we are using a pre-defined taxa set */
6095 if (numTaxaSets < 1)
6097 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
6100 if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
6102 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
6105 /* add taxa from taxset tkn to new tempSet */
6106 for (i=0; i<numTaxa; i++)
6108 if (IsBitSet (i, taxaSet[index]) == YES)
6114 /* we found the taxon name */
6115 if (fromI >= 0 && toJ < 0)
6117 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6120 else if (fromI >= 0 && toJ >= 0)
6122 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6127 fromI = toJ = everyK = -1;
6130 expecting = Expecting(ALPHA);
6131 expecting |= Expecting(NUMBER);
6132 expecting |= Expecting(SEMICOLON);
6134 else if (expecting == Expecting(NUMBER))
6136 if (strlen(tkn) == 1 && !strcmp(tkn, "."))
6142 sscanf (tkn, "%d", &tempInt);
6143 if (tempInt <= 0 || tempInt > numTaxa)
6145 MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
6150 if (foundDash == YES)
6156 MrBayesPrint ("%s Improperly formatted restore set\n", spacer);
6163 if (fromI >= 0 && toJ < 0)
6165 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6169 else if (fromI < 0 && toJ < 0)
6173 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
6175 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6180 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
6182 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
6189 MrBayesPrint ("%s Improperly formatted restore set\n", spacer);
6195 expecting = Expecting(ALPHA);
6196 expecting |= Expecting(NUMBER);
6197 expecting |= Expecting(SEMICOLON);
6198 expecting |= Expecting(DASH);
6200 else if (expecting == Expecting(DASH))
6203 expecting = Expecting(NUMBER);
6209 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
6219 int DoSetParm (char *parmName, char *tkn)
6225 if (expecting == Expecting(PARAMETER))
6227 expecting = Expecting(EQUALSIGN);
6231 /* set Autoclose (autoClose) **********************************************************/
6232 if (!strcmp(parmName, "Autoclose"))
6234 if (expecting == Expecting(EQUALSIGN))
6235 expecting = Expecting(ALPHA);
6236 else if (expecting == Expecting(ALPHA))
6238 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6240 if (!strcmp(tempStr, "Yes"))
6247 MrBayesPrint ("%s Invalid argument for autoclose\n", spacer);
6250 if (autoClose == YES)
6251 MrBayesPrint ("%s Setting autoclose to yes\n", spacer);
6253 MrBayesPrint ("%s Setting autoclose to no\n", spacer);
6254 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6259 /* set Nowarnings (noWarn) **********************************************************/
6260 else if (!strcmp(parmName, "Nowarnings"))
6262 if (expecting == Expecting(EQUALSIGN))
6263 expecting = Expecting(ALPHA);
6264 else if (expecting == Expecting(ALPHA))
6266 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6268 if (!strcmp(tempStr, "Yes"))
6275 MrBayesPrint ("%s Invalid argument for nowarnings\n", spacer);
6279 MrBayesPrint ("%s Setting nowarnings to yes\n", spacer);
6281 MrBayesPrint ("%s Setting nowarnings to no\n", spacer);
6282 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6287 /* set Quitonerror (quitOnError) **************************************************/
6288 else if (!strcmp(parmName, "Quitonerror"))
6290 if (expecting == Expecting(EQUALSIGN))
6291 expecting = Expecting(ALPHA);
6292 else if (expecting == Expecting(ALPHA))
6294 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6296 if (!strcmp(tempStr, "Yes"))
6303 MrBayesPrint ("%s Invalid argument for quitonerror\n", spacer);
6306 if (quitOnError == YES)
6307 MrBayesPrint ("%s Setting quitonerror to yes\n", spacer);
6309 MrBayesPrint ("%s Setting quitonerror to no\n", spacer);
6310 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6315 /* set Autoreplace (autoOverwrite) **************************************************/
6316 else if (!strcmp(parmName, "Autoreplace"))
6318 if (expecting == Expecting(EQUALSIGN))
6319 expecting = Expecting(ALPHA);
6320 else if (expecting == Expecting(ALPHA))
6322 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6324 if (!strcmp(tempStr, "Yes"))
6326 autoOverwrite = YES;
6327 MrBayesPrint ("%s Setting autoreplace to yes\n", spacer);
6332 MrBayesPrint ("%s Setting autoreplace to no\n", spacer);
6337 MrBayesPrint ("%s Invalid argument for autoreplace\n", spacer);
6340 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6345 /* set Scientific (scientific) *********************************************/
6346 else if (!strcmp(parmName, "Scientific"))
6348 if (expecting == Expecting(EQUALSIGN))
6349 expecting = Expecting(ALPHA);
6350 else if (expecting == Expecting(ALPHA))
6352 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6354 if (!strcmp(tempStr, "Yes"))
6361 MrBayesPrint ("%s Invalid argument for Scientific\n", spacer);
6364 if (scientific == YES)
6365 MrBayesPrint ("%s Setting Scientific to Yes\n", spacer);
6367 MrBayesPrint ("%s Setting Scientific to No\n", spacer);
6368 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6373 /* set Userlevel (userLevel) **********************************************************/
6374 else if (!strcmp(parmName, "Userlevel"))
6376 if (expecting == Expecting(EQUALSIGN))
6377 expecting = Expecting(ALPHA);
6378 else if (expecting == Expecting(ALPHA))
6380 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6382 if (!strcmp(tempStr, "Standard"))
6383 userLevel = STANDARD_USER;
6384 else if (!strcmp (tempStr,"Developer"))
6385 userLevel = DEVELOPER;
6389 MrBayesPrint ("%s Invalid argument for userlevel\n", spacer);
6392 MrBayesPrint ("%s Setting userlevel to %s\n", spacer, tempStr);
6393 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6395 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6400 /* set Npthreads (number of pthreads) ****************************************************/
6401 else if (!strcmp(parmName, "Npthreads"))
6403 if (expecting == Expecting(EQUALSIGN))
6404 expecting = Expecting(NUMBER);
6405 else if (expecting == Expecting(NUMBER))
6407 sscanf (tkn, "%d", &tempI);
6409 MrBayesPrint ("%s Setting Npthreads to %d\n", spacer, nPThreads);
6410 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6415 /* set Precision (number of decimals) ****************************************************/
6416 else if (!strcmp(parmName, "Precision"))
6418 if (expecting == Expecting(EQUALSIGN))
6419 expecting = Expecting(NUMBER);
6420 else if (expecting == Expecting(NUMBER))
6422 sscanf (tkn, "%d", &tempI);
6423 if (tempI < 3 || tempI > 15)
6425 MrBayesPrint ("%s Precision must be in the range 3 to 15\n", spacer);
6429 MrBayesPrint ("%s Setting Precision to %d\n", spacer, precision);
6430 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6435 /* set Partition (partitionNum) *******************************************************/
6436 else if (!strcmp(parmName, "Partition"))
6438 if (defMatrix == NO)
6440 MrBayesPrint ("%s A character matrix must be defined first\n", spacer);
6443 if (expecting == Expecting(EQUALSIGN))
6444 expecting = Expecting(ALPHA) | Expecting(NUMBER);
6445 else if (expecting == Expecting(ALPHA))
6447 /* first check to see if name is there */
6448 if (CheckString (partitionNames, numDefinedPartitions, tkn, &index) == ERROR)
6450 MrBayesPrint ("%s Could not find \"%s\" as a defined partition\n", spacer, tkn);
6453 if (SetPartition (index) == ERROR)
6455 if (numCurrentDivisions == 1)
6456 MrBayesPrint ("%s Setting %s as the partition (does not divide up characters).\n", spacer, tkn);
6458 MrBayesPrint ("%s Setting %s as the partition, dividing characters into %d parts.\n", spacer, tkn, numCurrentDivisions);
6459 if (SetModelDefaults () == ERROR)
6461 if (SetUpAnalysis (&globalSeed) == ERROR)
6463 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6465 else if (expecting == Expecting(NUMBER))
6467 sscanf (tkn, "%d", &index);
6468 if (index > numDefinedPartitions)
6470 MrBayesPrint ("%s Partition number %d is not a valid partition. Only %d partitions\n", spacer, index, numDefinedPartitions);
6471 MrBayesPrint ("%s have been defined.\n", spacer);
6476 MrBayesPrint ("%s Partition number %d is not a valid partition. Must be between 1 and %d.\n", spacer, index+1, numDefinedPartitions);
6479 if (SetPartition (index) == ERROR)
6481 if (numCurrentDivisions == 1)
6482 MrBayesPrint ("%s Setting %s as the partition (does not divide up characters).\n", spacer, partitionNames[index]);
6484 MrBayesPrint ("%s Setting %s as the partition, dividing characters into %d parts.\n", spacer, partitionNames[index], numCurrentDivisions);
6485 if (SetModelDefaults () == ERROR)
6487 if (SetUpAnalysis (&globalSeed) == ERROR)
6489 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6494 /* set Speciespartition (speciespartitionNum) *******************************************************/
6495 else if (!strcmp(parmName, "Speciespartition"))
6499 MrBayesPrint ("%s A taxaset must be defined first\n", spacer);
6502 if (expecting == Expecting(EQUALSIGN))
6503 expecting = Expecting(ALPHA) | Expecting(NUMBER);
6504 else if (expecting == Expecting(ALPHA))
6506 /* first check to see if name is there */
6507 if (CheckString (speciespartitionNames, numDefinedSpeciespartitions, tkn, &index) == ERROR)
6509 MrBayesPrint ("%s Could not find \"%s\" as a defined speciespartition\n", spacer, tkn);
6512 if (SetSpeciespartition (index) == ERROR)
6514 MrBayesPrint ("%s Setting %s as the speciespartition, dividing taxa into %d species.\n", spacer, tkn, numSpecies);
6515 if (SetModelDefaults () == ERROR)
6517 if (SetUpAnalysis (&globalSeed) == ERROR)
6519 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6521 else if (expecting == Expecting(NUMBER))
6523 sscanf (tkn, "%d", &index);
6524 if (index > numDefinedSpeciespartitions)
6526 MrBayesPrint ("%s Speciespartition number %d is not valid. Only %d speciespartitions\n", spacer, index, numDefinedSpeciespartitions);
6527 MrBayesPrint ("%s have been defined.\n", spacer);
6532 MrBayesPrint ("%s Speciespartition number %d is not valid. Must be between 1 and %d.\n", spacer, index, numDefinedSpeciespartitions);
6535 if (SetSpeciespartition (index-1) == ERROR)
6537 MrBayesPrint ("%s Setting %s as the speciespartition, dividing taxa into %d species.\n", spacer, speciespartitionNames[index-1], numSpecies);
6538 if (SetModelDefaults () == ERROR)
6540 if (SetUpAnalysis (&globalSeed) == ERROR)
6542 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6547 /* set Seed (global variable globalSeed) ****************************************************/
6548 else if (!strcmp(parmName, "Seed"))
6550 if (expecting == Expecting(EQUALSIGN))
6551 expecting = Expecting(NUMBER);
6552 else if (expecting == Expecting(NUMBER))
6554 sscanf (tkn, "%d", &tempI);
6555 if (tempI == 0 || tempI == 2147483647)
6557 MrBayesPrint ("%s Error: Seed can be any natural number except 0 and 2147483647\n", spacer);
6561 MrBayesPrint ("%s Setting seed to %ld\n", spacer, globalSeed);
6562 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6567 /* set Swapseed (global variable swapSeed) ***************************************************************/
6568 else if (!strcmp(parmName, "Swapseed"))
6570 if (expecting == Expecting(EQUALSIGN))
6571 expecting = Expecting(NUMBER);
6572 else if (expecting == Expecting(NUMBER))
6574 sscanf (tkn, "%d", &tempI);
6575 if (tempI == 0 || tempI == 2147483647)
6577 MrBayesPrint ("%s Error: Swapseed can be any natural number except 0 and 2147483647\n", spacer);
6581 MrBayesPrint ("%s Setting swapseed to %ld\n", spacer, swapSeed);
6582 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6587 /* set Dir (global variable workingDir) ***************************************************************/
6588 else if (!strcmp(parmName, "Dir"))
6590 if (expecting == Expecting(EQUALSIGN))
6592 expecting = Expecting(ALPHA);
6595 else if (expecting == Expecting(ALPHA))
6599 MrBayesPrint ("%s Maximum allowed length of working directory name is 99 characters. The given name:\n", spacer);
6600 MrBayesPrint ("%s '%s'\n", spacer,tkn);
6601 MrBayesPrint ("%s has %d characters.\n", spacer,strlen(tkn));
6604 strcpy (workingDir, tkn);
6605 # if defined (WIN_VERSION)
6606 /* Reformat to Windows with trailing '\' */
6607 for (index=0; index<(int)strlen(workingDir); index++)
6609 if (workingDir[index] == '/')
6610 workingDir[index] = '\\';
6612 if (strlen(workingDir) > 0 && workingDir[strlen(workingDir)-1] != '\\')
6613 strcat(workingDir,"\\");
6615 /* Reformat to Unix with trailing '/' */
6616 for (index=0; index<(int)strlen(workingDir); index++)
6618 if (workingDir[index] == '\\')
6619 workingDir[index] = '/';
6621 if (strlen(workingDir) > 0 && workingDir[strlen(workingDir)-1] != '/')
6622 strcat(workingDir,"/");
6624 MrBayesPrint ("%s Setting working directory to \"%s\"\n", spacer, workingDir);
6625 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6630 /* set Usebeagle (global variable BEAGLE usage) ***************************************************************/
6631 else if (!strcmp(parmName, "Usebeagle"))
6633 if (expecting == Expecting(EQUALSIGN))
6634 expecting = Expecting(ALPHA);
6635 else if (expecting == Expecting(ALPHA))
6637 # if defined (BEAGLE_ENABLED)
6638 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6640 if (!strcmp(tempStr, "Yes"))
6641 tryToUseBEAGLE = YES;
6643 tryToUseBEAGLE = NO;
6647 MrBayesPrint ("%s Invalid argument for usebeagle\n", spacer);
6650 if (tryToUseBEAGLE == YES)
6651 MrBayesPrint ("%s Setting usebeagle to yes\n", spacer);
6653 MrBayesPrint ("%s Setting usebeagle to no\n", spacer);
6657 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6659 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6664 /* set Beagle resource number (global variable BEAGLE flag) ****************************************/
6665 else if (!strcmp(parmName, "Beagleresource"))
6667 if (expecting == Expecting(EQUALSIGN))
6668 expecting = Expecting(NUMBER);
6669 else if (expecting == Expecting(NUMBER))
6671 # if defined (BEAGLE_ENABLED)
6672 sscanf (tkn, "%d", &tempI);
6675 MrBayesPrint ("%s Beagleresource must be a valid resource number or 99 to disable resource selection\n", spacer);
6678 beagleResourceNumber = tempI;
6679 if (beagleResourceNumber == 99)
6680 MrBayesPrint ("%s Setting Beagleresource to %d (auto)\n", spacer, beagleResourceNumber);
6682 MrBayesPrint ("%s Setting Beagleresource to %d\n", spacer, beagleResourceNumber);
6686 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6688 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6693 /* set Beagle resources requirements (global variable BEAGLE flag) ****************************************/
6694 else if (!strcmp(parmName, "Beagledevice"))
6696 if (expecting == Expecting(EQUALSIGN))
6697 expecting = Expecting(ALPHA);
6698 else if (expecting == Expecting(ALPHA))
6700 # if defined (BEAGLE_ENABLED)
6701 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6703 long oldFlags = beagleFlags;
6704 if (!strcmp(tempStr, "Gpu"))
6706 beagleFlags &= ~BEAGLE_FLAG_PROCESSOR_CPU;
6707 beagleFlags |= BEAGLE_FLAG_PROCESSOR_GPU;
6708 BeagleAddGPUDevicesToList(&beagleResource, &beagleResourceCount);
6712 beagleFlags &= ~BEAGLE_FLAG_PROCESSOR_GPU;
6713 beagleFlags |= BEAGLE_FLAG_PROCESSOR_CPU;
6714 BeagleRemoveGPUDevicesFromList(&beagleResource, &beagleResourceCount);
6716 if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
6717 beagleFlags = oldFlags;
6720 if (beagleFlags & BEAGLE_FLAG_PROCESSOR_GPU)
6721 MrBayesPrint ("%s Setting beagledevice to GPU\n", spacer);
6723 MrBayesPrint ("%s Setting beagledevice to CPU\n", spacer);
6728 MrBayesPrint ("%s Invalid argument for beagledevice\n", spacer);
6734 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6736 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6741 else if (!strcmp(parmName, "Beagleprecision"))
6743 if (expecting == Expecting(EQUALSIGN))
6744 expecting = Expecting(ALPHA);
6745 else if (expecting == Expecting(ALPHA))
6747 # if defined (BEAGLE_ENABLED)
6748 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6750 long oldFlags = beagleFlags;
6751 if (!strcmp(tempStr, "Single"))
6753 beagleFlags &= ~BEAGLE_FLAG_PRECISION_DOUBLE;
6754 beagleFlags |= BEAGLE_FLAG_PRECISION_SINGLE;
6758 beagleFlags &= ~BEAGLE_FLAG_PRECISION_SINGLE;
6759 beagleFlags |= BEAGLE_FLAG_PRECISION_DOUBLE;
6761 if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
6762 beagleFlags = oldFlags;
6765 if (beagleFlags & BEAGLE_FLAG_PRECISION_DOUBLE)
6766 MrBayesPrint ("%s Setting beagleprecision to double\n", spacer);
6768 MrBayesPrint ("%s Setting beagleprecision to single\n", spacer);
6773 MrBayesPrint ("%s Invalid argument for beagleprecision\n", spacer);
6779 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6781 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6786 else if (!strcmp(parmName, "Beagleopenmp"))
6788 if (expecting == Expecting(EQUALSIGN))
6789 expecting = Expecting(ALPHA);
6790 else if (expecting == Expecting(ALPHA))
6792 # if defined (BEAGLE_ENABLED)
6793 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6795 long oldFlags = beagleFlags;
6796 if (!strcmp(tempStr, "Yes"))
6798 beagleFlags |= BEAGLE_FLAG_THREADING_OPENMP;
6802 beagleFlags &= ~BEAGLE_FLAG_THREADING_OPENMP;
6804 if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
6805 beagleFlags = oldFlags;
6808 if (beagleFlags & BEAGLE_FLAG_THREADING_OPENMP)
6809 MrBayesPrint ("%s Setting beagleopenmp to Yes\n", spacer);
6811 MrBayesPrint ("%s Setting beagleopenmp to No\n", spacer);
6816 MrBayesPrint ("%s Invalid argument for beagleopenmp\n", spacer);
6822 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6824 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6829 else if (!strcmp(parmName, "Beaglefreq"))
6831 if (expecting == Expecting(EQUALSIGN))
6832 expecting = Expecting(NUMBER);
6833 else if (expecting == Expecting(NUMBER))
6835 # if defined (BEAGLE_ENABLED)
6836 sscanf (tkn, "%d", &tempI);
6839 MrBayesPrint ("%s Beaglefreq must be greater than 0\n", spacer);
6842 beagleScalingFrequency= tempI;
6843 MrBayesPrint ("%s Setting Beaglefreq to %d\n", spacer, beagleScalingFrequency);
6847 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6849 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6854 else if (!strcmp(parmName, "Beaglesse"))
6856 if (expecting == Expecting(EQUALSIGN))
6857 expecting = Expecting(ALPHA);
6858 else if (expecting == Expecting(ALPHA))
6860 # if defined (BEAGLE_ENABLED)
6861 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6863 long oldFlags = beagleFlags;
6864 if (!strcmp(tempStr, "Yes"))
6866 beagleFlags |= BEAGLE_FLAG_VECTOR_SSE;
6870 beagleFlags &= ~BEAGLE_FLAG_VECTOR_SSE;
6872 if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
6873 beagleFlags = oldFlags;
6876 if (beagleFlags & BEAGLE_FLAG_VECTOR_SSE)
6877 MrBayesPrint ("%s Setting beaglesse to Yes\n", spacer);
6879 MrBayesPrint ("%s Setting beaglesse to No\n", spacer);
6884 MrBayesPrint ("%s Invalid argument for beagleopenmp\n", spacer);
6890 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6892 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6898 else if (!strcmp(parmName, "Beaglevec"))
6900 if (expecting == Expecting(EQUALSIGN))
6901 expecting = Expecting(ALPHA);
6902 else if (expecting == Expecting(ALPHA))
6904 # if defined (BEAGLE_ENABLED)
6905 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6907 long oldFlags = beagleFlags;
6908 if (!strcmp(tempStr, "Sse"))
6910 beagleFlags |= BEAGLE_FLAG_VECTOR_SSE;
6911 beagleFlags &= ~BEAGLE_FLAG_VECTOR_AVX;
6913 else if (!strcmp(tempStr, "Avx"))
6915 beagleFlags |= ~BEAGLE_FLAG_VECTOR_AVX;
6916 beagleFlags &= ~BEAGLE_FLAG_VECTOR_SSE;
6918 else if (!strcmp(tempStr, "None"))
6920 beagleFlags &= ~BEAGLE_FLAG_VECTOR_SSE;
6921 beagleFlags &= ~BEAGLE_FLAG_VECTOR_AVX;
6925 MrBayesPrint("%s Unrecognized argument for beaglevec\n", spacer);
6927 MrBayesPrint ("%s Setting beaglevec to %s\n", spacer, tempStr);
6931 MrBayesPrint ("%s Invalid argument for beagleopenmp\n", spacer);
6937 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6939 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6945 else if (!strcmp(parmName, "Beaglethreads"))
6947 if (expecting == Expecting(EQUALSIGN))
6948 expecting = Expecting(ALPHA);
6949 else if (expecting == Expecting(ALPHA))
6951 # if defined (BEAGLE_ENABLED) && defined (THREADS_ENABLED)
6952 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6954 if (!strcmp(tempStr, "Yes"))
6956 tryToUseThreads = YES;
6960 tryToUseThreads = NO;
6963 if (tryToUseThreads == YES)
6964 MrBayesPrint ("%s Setting beaglethreads to Yes\n", spacer);
6966 MrBayesPrint ("%s Setting beaglethreads to No\n", spacer);
6970 MrBayesPrint ("%s Invalid argument for beaglethreads\n", spacer);
6974 BeagleThreadsNotLinked();
6976 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
6978 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
6981 else if (!strcmp(parmName, "Beaglescaling"))
6983 if (expecting == Expecting(EQUALSIGN))
6984 expecting = Expecting(ALPHA);
6985 else if (expecting == Expecting(ALPHA))
6987 # if defined (BEAGLE_ENABLED)
6988 if (IsArgValid(tkn, tempStr) == NO_ERROR)
6990 if (!strcmp(tempStr, "Always"))
6992 beagleScalingScheme = MB_BEAGLE_SCALE_ALWAYS;
6996 beagleScalingScheme = MB_BEAGLE_SCALE_DYNAMIC;
6999 if (beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS)
7000 MrBayesPrint ("%s Setting beaglescaling to Always\n", spacer);
7002 MrBayesPrint ("%s Setting beaglescaling to Dynamic\n", spacer);
7006 MrBayesPrint ("%s Invalid argument for beaglescaling\n", spacer);
7010 BeagleThreadsNotLinked();
7012 if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
7014 expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
7027 int DoShowMatrix (void)
7029 int i, j, nameLen, start, finish, ct, longestName;
7030 char tempStr[100], stride;
7032 if (defMatrix == NO)
7034 MrBayesPrint ("%s A character matrix must be defined first\n", spacer);
7039 for (i=0; i<numTaxa; i++)
7041 nameLen = (int) strlen(taxaNames[i]);
7042 if (nameLen > longestName)
7043 longestName = nameLen;
7051 if (finish > numChar)
7054 MrBayesPrint ("%s ", spacer);
7055 for (j=0; j<longestName; j++)
7058 MrBayesPrint ("%d\n", start+1);
7060 for (i=0; i<numTaxa; i++)
7062 strcpy (tempStr, taxaNames[i]);
7063 nameLen = (int) strlen(tempStr);
7065 MrBayesPrint ("%s ", spacer);
7066 if (nameLen >= longestName)
7068 for (j=0; j<longestName; j++)
7069 MrBayesPrint ("%c", tempStr[j]);
7073 MrBayesPrint ("%s", tempStr);
7074 for (j=0; j<longestName-nameLen; j++)
7079 for (j=start; j<finish; j++)
7081 ct = charInfo[j].charType;
7082 if (ct == DNA || ct == RNA)
7083 MrBayesPrint ("%c", WhichNuc(matrix[pos(i,j,numChar)]));
7084 else if (ct == PROTEIN)
7085 MrBayesPrint ("%c", WhichAA(matrix[pos(i,j,numChar)]));
7086 else if (ct == STANDARD)
7087 MrBayesPrint ("%c", WhichStand(matrix[pos(i,j,numChar)]));
7088 else if (ct == RESTRICTION)
7089 MrBayesPrint ("%c", WhichRes(matrix[pos(i,j,numChar)]));
7090 else if (ct == CONTINUOUS)
7092 if (WhichCont(matrix[pos(i,j,numChar)]) < 0.0)
7093 MrBayesPrint (" %2.2lf", WhichCont(matrix[pos(i,j,numChar)]));
7095 MrBayesPrint (" %2.2lf", WhichCont(matrix[pos(i,j,numChar)]));
7099 MrBayesPrint ("%s Unknown data type\n", spacer);
7104 MrBayesPrint ("\n");
7106 MrBayesPrint ("\n");
7108 } while (finish != numChar);
7114 int DoShowUserTrees (void)
7118 if (numUserTrees == 0)
7120 MrBayesPrint ("%s No user trees have been defined\n", spacer);
7124 for (i=0; i<numUserTrees; i++)
7126 MrBayesPrint ("\n Tree #%d -- '%s':\n\n", i+1, userTree[i]->name);
7127 ShowConTree (stdout, userTree[i], 70, NO);
7128 MrBayesPrint ("\n");
7136 int DoShowBeagle (void)
7138 # if defined (BEAGLE_ENABLED)
7139 BeaglePrintResources();
7147 int DoTaxlabels (void)
7151 /* add default speciespartition name to list of valid speciespartitions */
7152 if (AddString (&speciespartitionNames, 0, "Default") == ERROR)
7154 MrBayesPrint ("%s Problem adding Default speciespartition to list\n", spacer);
7158 /* add default species name set */
7159 AddNameSet(&speciesNameSets, 0, taxaNames, numTaxa);
7161 /* set number of defined speciespartitions to 1 */
7162 numDefinedSpeciespartitions = 1;
7168 int DoTaxlabelsParm (char *parmName, char *tkn)
7172 if (inTaxaBlock == NO)
7174 MrBayesPrint ("%s You must be in a taxa block to read a taxlabels command\n", spacer);
7180 MrBayesPrint ("%s The number of taxa must be given before a set of taxon labels can be read\n", spacer);
7184 if (isTaxsetDef == YES)
7186 MrBayesPrint ("%s A set of taxon labels has already been defined\n", spacer);
7187 if (defMatrix == NO)
7188 if (WantTo ("Do you want to delete the current set of taxon labels") == NO)
7189 return (SKIP_COMMAND);
7193 if (WantTo ("Do you want to delete the current character matrix") == NO)
7194 return (SKIP_COMMAND);
7199 if (expecting == Expecting(ALPHA) ||
7200 expecting == Expecting(NUMBER))
7202 if (CheckString (taxaNames, numNamedTaxa, tkn, &index) == ERROR)
7206 MrBayesPrint ("%s Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, tkn);
7209 if (AddString (&taxaNames, numNamedTaxa, tkn) == ERROR)
7211 MrBayesPrint ("%s Problem adding label %s to list of taxon labels\n", spacer, tkn);
7218 MrBayesPrint ("%s Taxon label '%s' is included twice in list of taxon labels\n", spacer, tkn);
7221 if (numNamedTaxa < numTaxa)
7223 expecting = Expecting(ALPHA);
7224 expecting |= Expecting(NUMBER);
7227 expecting |= Expecting(SEMICOLON);
7231 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
7232 MrBayesPrint ("%s", tkn);
7236 int DoSpeciespartition (void)
7240 /* add set to tempSet */
7242 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
7244 for (i=0; i<numDivisions; i++)
7251 /* set numDivisions; not set while reading the speciespartition */
7252 numDivisions = whichPartition + 1;
7254 /* check that all species are included */
7255 for (i=0; i<numTaxa; i++)
7257 if (tempSet[i] == 0)
7259 MrBayesPrint ("%s Tip %d not included in speciespartition\n", spacer, i+1);
7260 for (i=0; i<numDivisions; i++)
7266 /*MrBayesPrint ("%4d %4d \n", i, tempSet[i]);*/
7269 partCount = (int *) SafeCalloc (numDivisions, sizeof(int));
7272 for (i=0; i<numDivisions; i++)
7279 /* make certain that the partition labels go from 1 - numTaxa, inclusive */
7280 for (i=0; i<numTaxa; i++)
7282 if (tempSet[i] < 1 || tempSet[i] > numTaxa)
7284 MrBayesPrint ("%s Speciespartition index for tip %d out of bound (%d)\n", spacer, i+1, tempSet[i]);
7286 for (i=0; i<numDivisions; i++)
7292 partCount[tempSet[i] - 1]++;
7294 for (i=0; i<numDivisions; i++)
7296 if (partCount[i] == 0)
7298 MrBayesPrint ("%s Could not find a single tip for species %d\n", spacer, i+1);
7300 for (i=0; i<numDivisions; i++)
7309 /* add name to list of valid partitions */
7310 if (AddString (&speciespartitionNames, numDefinedSpeciespartitions, tempSetName) == ERROR)
7312 MrBayesPrint ("%s Problem adding speciespartition %s to list\n", spacer, tempSetName);
7313 for (i=0; i<numDivisions; i++)
7320 /* add new partition */
7321 for (i=0; i<numTaxa; i++)
7323 speciespartitionId[i] = (int *) SafeRealloc ((void *)(speciespartitionId[i]), ((size_t)numDefinedSpeciespartitions + 1) * sizeof(int));
7324 if (!speciespartitionId[i])
7326 for (i=0; i<numDivisions; i++)
7334 /* set new partition */
7335 for (i=0; i<numTaxa; i++)
7336 speciespartitionId[i][numDefinedSpeciespartitions] = tempSet[i];
7338 /* add new set of species names */
7339 AddNameSet(&speciesNameSets, numDefinedSpeciespartitions, tempNames, numDivisions);
7341 /* free species names */
7342 for (i=0; i<numDivisions; i++)
7347 /* increment number of defined partitions */
7348 numDefinedSpeciespartitions++;
7354 int DoSpeciespartitionParm (char *parmName, char *tkn)
7356 int i, index, tempInt;
7358 if (defTaxa == NO || numTaxa == 0)
7360 MrBayesPrint ("%s A matrix or taxaset must be specified before partitions can be defined\n", spacer);
7364 if (expecting == Expecting(PARAMETER))
7366 /* set Speciespartition name ******************************************************************/
7367 if (!strcmp(parmName, "Xxxxxxxxxx"))
7369 /* check size of partition name */
7370 if (strlen(tkn) > 99)
7372 MrBayesPrint ("%s Partition name is too long. Max 100 characters\n", spacer);
7376 /* check to see if the name has already been used as a partition */
7377 if (numDefinedSpeciespartitions > 0)
7379 if (CheckString (speciespartitionNames, numDefinedSpeciespartitions, tkn, &index) == ERROR)
7381 /* if the partition name has not been used, then we should have an ERROR returned */
7382 /* we _want_ to be here */
7387 MrBayesPrint ("%s Speciespartition name '%s' has been used previously\n", spacer, tkn);
7392 /* add the name temporarily to tempSetName */
7393 strcpy (tempSetName, tkn);
7396 for (i=0; i<numTaxa; i++)
7399 /* make sure tempNames is NULL */
7400 assert (tempNames == NULL);
7402 fromI = toJ = everyK = -1;
7403 foundDash = foundSlash = NO;
7407 MrBayesPrint ("%s Defining speciespartition called '%s'\n", spacer, tkn);
7408 expecting = Expecting(EQUALSIGN);
7413 else if (expecting == Expecting(EQUALSIGN))
7415 expecting = Expecting(ALPHA);
7417 else if (expecting == Expecting(ALPHA))
7419 if (foundFirst == NO)
7421 AddString(&tempNames, whichPartition, tkn);
7423 expecting = Expecting(COLON);
7427 /* We are defining a species partition in terms of a tip name (called tkn, here). We should be able
7428 to find tkn in the list of tip names. If we cannot, then we have a problem and
7430 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
7432 MrBayesPrint ("%s Could not find a tip called '%s'\n", spacer, tkn);
7435 /* add index of the tip named tkn to new tempSet */
7436 tempSet[index] = whichPartition + 1;
7437 fromI = toJ = everyK = -1;
7439 expecting = Expecting(ALPHA);
7440 expecting |= Expecting(NUMBER);
7441 expecting |= Expecting(SEMICOLON);
7442 expecting |= Expecting(COMMA);
7445 else if (expecting == Expecting(NUMBER))
7447 if (strlen(tkn) == 1 && tkn[0] == '.')
7450 sscanf (tkn, "%d", &tempInt);
7451 if (tempInt <= 0 || tempInt > numTaxa)
7453 MrBayesPrint ("%s Tip number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
7454 for (i=0; i<whichPartition; i++)
7461 if (foundDash == YES)
7467 MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer);
7468 for (i=0; i<whichPartition; i++)
7476 else if (foundSlash == YES)
7481 MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer);
7482 for (i=0; i<whichPartition; i++)
7488 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
7492 MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer);
7493 for (i=0; i<whichPartition; i++)
7503 if (fromI >= 0 && toJ < 0)
7505 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
7507 for (i=0; i<whichPartition; i++)
7515 else if (fromI < 0 && toJ < 0)
7519 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
7521 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
7526 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
7528 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
7535 MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer);
7537 for (i=0; i<whichPartition; i++)
7545 expecting = Expecting(ALPHA);
7546 expecting |= Expecting(NUMBER);
7547 expecting |= Expecting(SEMICOLON);
7548 expecting |= Expecting(DASH);
7549 expecting |= Expecting(BACKSLASH);
7550 expecting |= Expecting(COMMA);
7552 else if (expecting == Expecting(COMMA))
7554 /* add set to tempSet */
7556 if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
7558 for (i=0; i<whichPartition; i++)
7565 fromI = toJ = everyK = -1;
7566 foundDash = foundSlash = foundFirst = NO;
7568 if (whichPartition > numTaxa)
7570 MrBayesPrint ("%s Too many speciespartitions (expecting maximum %d speciespartitions)\n", spacer, numTaxa);
7571 for (i=0; i<whichPartition; i++)
7577 expecting = Expecting(ALPHA);
7579 else if (expecting == Expecting(COLON))
7581 expecting = Expecting(NUMBER);
7582 expecting |= Expecting(ALPHA);
7584 else if (expecting == Expecting(DASH))
7587 expecting = Expecting(NUMBER);
7589 else if (expecting == Expecting(BACKSLASH))
7592 expecting = Expecting(NUMBER);
7596 for (i=0; i<whichPartition; i++)
7607 int DoTaxaset (void)
7609 /* add set to tempSet */
7610 if (fromI >= 0 && toJ < 0)
7612 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
7615 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
7617 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
7620 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
7622 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
7626 /* add name to taxaSetNames */
7627 if (AddString (&taxaSetNames, numTaxaSets, tempSetName) == ERROR)
7629 MrBayesPrint ("%s Problem adding taxset %s to list\n", spacer, tempSetName);
7633 /* merge tempSet with taxaSet */
7634 AddBitfield (&taxaSet, numTaxaSets, tempSet, numTaxa);
7636 /* increment number of char sets */
7639 /* show taxset (for debugging) */
7641 for (i=0; i<numTaxa; i++)
7642 MrBayesPrint ("%4d %4d\n", i+1, tempSet[i]);
7649 int DoTaxasetParm (char *parmName, char *tkn)
7651 int i, index, tempInt;
7653 if (defMatrix == NO)
7655 MrBayesPrint ("%s A matrix must be specified before taxsets can be defined\n", spacer);
7659 if (expecting == Expecting(PARAMETER))
7661 if (!strcmp(parmName, "Xxxxxxxxxx"))
7663 /* check size of taxset name */
7664 if (strlen(tkn) > 99)
7666 MrBayesPrint ("%s Taxset name is too long\n", spacer);
7670 /* check to see if the name has already been used as a taxset */
7671 if (numTaxaSets > 0)
7673 if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
7675 /* if the taxset name has not been used, then we should have an ERROR returned */
7676 /* we _want_ to be here */
7681 MrBayesPrint ("%s Taxset name has been used previously\n", spacer);
7685 else if (numTaxaSets > 30)
7687 MrBayesPrint ("%s You cannot define more than 30 taxsets\n", spacer);
7691 /* add the name to the taxa set */
7692 strcpy (tempSetName, tkn);
7695 for (i=0; i<numTaxa; i++)
7698 fromI = toJ = everyK = -1;
7699 foundDash = foundSlash = NO;
7700 MrBayesPrint ("%s Defining taxset called '%s'\n", spacer, tkn);
7701 expecting = Expecting(EQUALSIGN);
7706 else if (expecting == Expecting(EQUALSIGN))
7708 expecting = Expecting(ALPHA);
7709 expecting |= Expecting(NUMBER);
7711 else if (expecting == Expecting(ALPHA))
7713 /* We are defining a taxon set in terms of another (called tkn, here) or we are referring to
7714 the taxon name. We should be able to find tkn in the list of character set names or in the list
7715 of taxon names. If we cannot, then we have a problem and return an error. */
7716 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
7718 if (numTaxaSets < 1)
7720 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
7723 if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
7725 MrBayesPrint ("%s Could not find a taxset called '%s'\n", spacer, tkn);
7728 /* add taxa from taxset tkn to new tempSet */
7729 for (i=0; i<numTaxa; i++)
7731 if (IsBitSet (i, taxaSet[index]) == YES)
7739 fromI = toJ = everyK = -1;
7741 expecting = Expecting(ALPHA);
7742 expecting |= Expecting(NUMBER);
7743 expecting |= Expecting(SEMICOLON);
7745 else if (expecting == Expecting(NUMBER))
7747 if (strlen(tkn) == 1 && !strcmp(tkn, "."))
7753 sscanf (tkn, "%d", &tempInt);
7754 if (tempInt <= 0 || tempInt > numTaxa)
7756 MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
7761 if (foundDash == YES)
7767 MrBayesPrint ("%s Improperly formatted taxset\n", spacer);
7772 else if (foundSlash == YES)
7777 MrBayesPrint ("%s Improperly formatted taxset\n", spacer);
7780 if (fromI >= 0 && toJ >= 0 && fromI < toJ)
7784 MrBayesPrint ("%s Improperly formatted taxset\n", spacer);
7791 if (fromI >= 0 && toJ < 0)
7793 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
7797 else if (fromI < 0 && toJ < 0)
7801 else if (fromI >= 0 && toJ >= 0 && everyK < 0)
7803 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
7808 else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
7810 if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
7817 MrBayesPrint ("%s Improperly formatted taxset\n", spacer);
7824 expecting = Expecting(ALPHA);
7825 expecting |= Expecting(NUMBER);
7826 expecting |= Expecting(SEMICOLON);
7827 expecting |= Expecting(DASH);
7828 expecting |= Expecting(BACKSLASH);
7830 else if (expecting == Expecting(DASH))
7833 expecting = Expecting(NUMBER);
7835 else if (expecting == Expecting(BACKSLASH))
7838 expecting = Expecting(NUMBER);
7847 int DoTaxaStat (void)
7849 int i, j, maxLen, nameLen, nIncludedTaxa;
7852 if (defMatrix == NO)
7854 MrBayesPrint ("%s A character matrix must be defined first\n", spacer);
7858 /* find maximum length of taxon name */
7859 maxLen = nIncludedTaxa = 0;
7860 for (i=0; i<numTaxa; i++)
7862 strcpy (tempName, taxaNames[i]);
7863 if ((int)strlen(tempName) > maxLen)
7864 maxLen = (int) strlen(tempName);
7865 if (taxaInfo[i].isDeleted == NO)
7869 MrBayesPrint ("%s Showing taxon status:\n\n", spacer);
7870 if (nIncludedTaxa == numTaxa)
7871 MrBayesPrint ("%s Number of taxa = %d (all of which are included)\n", spacer, numTaxa);
7873 MrBayesPrint ("%s Number of taxa = %d (of which %d are included)\n", spacer, numTaxa, nIncludedTaxa);
7874 MrBayesPrint ("%s Number of constraints = %d\n\n", spacer, numDefinedConstraints);
7876 if (numDefinedConstraints > 0)
7878 for (j=0; j<numDefinedConstraints; j++)
7880 strcpy (tempName, constraintNames[j]);
7882 /* for now, ignore the probability */
7883 if (definedConstraintsType[j] == HARD)
7884 MrBayesPrint ("%s %2d -- Trees with 'hard' constraint \"%s\" are infinitely\n", spacer, j+1, tempName);
7885 else if (definedConstraintsType[j] == PARTIAL)
7886 MrBayesPrint ("%s %2d -- Trees with 'partial' constraint \"%s\" are infinitely\n", spacer, j+1, tempName);
7888 MrBayesPrint ("%s %2d -- Trees with 'negative' constraint \"%s\" are infinitely\n", spacer, j+1, tempName);
7889 MrBayesPrint ("%s more probable than those without \n", spacer);
7891 MrBayesPrint ("\n");
7892 for (j=0; j<maxLen; j++)
7894 MrBayesPrint (" Constraints\n");
7896 MrBayesPrint ("%s Taxon ", spacer);
7897 for (j=0; j<maxLen; j++)
7899 MrBayesPrint (" Inclusion");
7901 for (j=0; j<numDefinedConstraints; j++)
7902 MrBayesPrint (" %2d", j+1);
7903 MrBayesPrint ("\n");
7904 MrBayesPrint ("%s -------", spacer);
7905 for (j=0; j<maxLen; j++)
7907 MrBayesPrint ("--------------");
7909 if (numDefinedConstraints > 0)
7911 MrBayesPrint ("----");
7912 for (j=0; j<numDefinedConstraints; j++)
7913 MrBayesPrint ("---");
7915 MrBayesPrint ("\n");
7916 for (i=0; i<numTaxa; i++)
7918 strcpy (tempName, taxaNames[i]);
7919 nameLen = (int) strlen(tempName);
7921 if (i == outGroupNum)
7922 MrBayesPrint ("%s ->%4d (%s) ", spacer, i+1, tempName);
7924 MrBayesPrint ("%s %4d (%s) ", spacer, i+1, tempName);
7925 for (j=0; j<(maxLen-nameLen); j++)
7927 MrBayesPrint (" -- ");
7929 if (taxaInfo[i].isDeleted == YES)
7930 MrBayesPrint ("Deleted ");
7932 MrBayesPrint ("Included");
7936 for (j=0; j<numDefinedConstraints; j++)
7938 if (definedConstraintsType[j] == HARD)
7940 if (IsBitSet(i, definedConstraint[j]) == NO)
7941 MrBayesPrint (" .");
7943 MrBayesPrint (" *");
7945 else if (definedConstraintsType[j] == PARTIAL)
7947 if (IsBitSet(i, definedConstraint[j]) == YES)
7948 MrBayesPrint (" +");
7949 else if (IsBitSet(i, definedConstraintTwo[j]) == YES)
7950 MrBayesPrint (" -");
7952 MrBayesPrint (" .");
7954 else if (definedConstraintsType[j] == NEGATIVE)
7956 if (IsBitSet(i, definedConstraint[j]) == NO)
7957 MrBayesPrint (" .");
7959 MrBayesPrint (" #");
7962 MrBayesPrint ("\n");
7965 MrBayesPrint ("\n");
7966 MrBayesPrint ("%s '.' indicate that the taxon is not present in the constraint. \n", spacer);
7967 MrBayesPrint ("%s '*' indicate that the taxon is present in the 'hard' constraint. \n", spacer);
7968 MrBayesPrint ("%s '+' indicate that the taxon is present in the first groupe of 'partial' constraint. \n", spacer);
7969 MrBayesPrint ("%s '-' indicate that the taxon is present in the second groupe of 'partial' constraint. \n", spacer);
7970 MrBayesPrint ("%s '#' indicate that the taxon is present in the 'negative' constraint. \n", spacer);
7971 MrBayesPrint ("%s Arrow indicates current outgroup. \n", spacer);
7977 int DoTranslate (void)
7981 if (inTreesBlock == NO)
7983 MrBayesPrint ("%s You must be in a trees block to read a translate command\n", spacer);
7986 numTranslates++; /* number of taxa in translate table */
7987 isTranslateDef = YES;
7989 isTranslateDiff = NO;
7990 if (isTaxsetDef == NO)
7991 SetTaxaFromTranslateTable();
7994 for (i=0; i<numTranslates; i++)
7996 strcpy (token, transFrom[i]);
7997 if (CheckString (taxaNames, numTaxa, token, &j) == ERROR)
7999 isTranslateDiff = YES;
8002 if (numTranslates != numTaxa)
8003 isTranslateDiff = YES;
8010 int DoTranslateParm (char *parmName, char *tkn)
8013 static int whichTranslate;
8015 if (inTreesBlock == NO)
8017 MrBayesPrint ("%s You must be in a trees block to read a translate command\n", spacer);
8021 if (isTranslateDef == YES)
8023 MrBayesPrint ("%s A translation has already been defined for this tree block\n", spacer);
8027 if (expecting == Expecting(ALPHA) ||
8028 expecting == Expecting(NUMBER))
8032 MrBayesPrint ("%s Data matrix should be defined before translation table could be set.\n", spacer);
8035 if (numTranslates == numTaxa)
8037 MrBayesPrint ("%s Too many entries in translation table. Maximum number of taxon names to translate is %d\n", spacer,numTaxa);
8040 if (whichTranslate == 0)
8042 if (CheckString (transTo, numTranslates, tkn, &index) == ERROR)
8044 if (AddString (&transTo, numTranslates, tkn) == ERROR)
8046 MrBayesPrint ("%s Problem adding taxon %s to list\n", spacer, tkn);
8052 MrBayesPrint ("%s Already found name (%s) in list\n", spacer, tkn);
8056 expecting = Expecting(ALPHA);
8057 expecting |= Expecting(NUMBER);
8061 if (CheckString (transFrom, numTranslates, tkn, &index) == ERROR)
8063 if (AddString (&transFrom, numTranslates, tkn) == ERROR)
8065 MrBayesPrint ("%s Problem adding taxon %s to list\n", spacer, tkn);
8071 MrBayesPrint ("%s Already found name (%s) in list\n", spacer, tkn);
8075 expecting = Expecting(COMMA);
8076 expecting |= Expecting(SEMICOLON);
8079 else if (expecting == Expecting(COMMA))
8082 expecting = Expecting(ALPHA);
8083 expecting |= Expecting(NUMBER);
8087 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
8088 MrBayesPrint ("%s", tkn);
8096 if (inSumtCommand == YES || inComparetreeCommand == YES)
8097 return (DoSumtTree ());
8103 int DoTreeParm (char *parmName, char *tkn)
8105 int i, tempInt, index;
8108 static BitsLong lastExpecting; /* keep track of what we expected before a comment, in case we want to skip a comment */
8109 static char *tempNameString=NULL; /* Contains multiple tokens which form name string of param set*/
8110 static int foundAmpersand, foundColon, foundComment, foundE, foundB, foundN, foundFirst,
8111 foundCurly, /* is set to YES when we are between two curly bracets ONLY while processing CppEvent name */
8113 foundName, /*is set to YES when param set name token is found and set to NO once full param set name is processed*/
8114 eSetIndex, /* is set in the begining of reading CppEvent for a node/branch to the index of currently processed CppEvent set */
8115 bSetIndex, eventIndex, treeIndex, nextIntNodeIndex;
8116 static PolyNode *pp, *qq;
8119 /* This function will read in components of a tree description. We expect one of the following formats:
8121 tree <name> = [&R] <newick-description>;
8122 tree <name> = [&U] <newick-description>;
8123 tree <name> [&E CppEvents] = [&R] [&clockrate = 1.23] ((1:0.021[&E CppEvents 2: (0.10 1.11,0.83 3.17)],...
8124 tree <name> [&B TK02Brlens] = [&R] [&clockrate = 1.23] ((1:0.021[&B TK02Brlens 0.019],...
8125 tree <name> [&B IgrBrlens] = [&R] [&clockrate = 1.23] ((1:0.021[&B IgrBrlens 0.019],...
8127 Values will be stored in event sets that go with the tree and that are used to initialize the relaxed clock
8128 parameters before a run is started. Note that several sets of events can be stored with each tree.
8131 if (isTaxsetDef == NO)
8133 MrBayesPrint ("%s Taxon labels must be specified before a tree could be red in\n", spacer);
8136 if (inTreesBlock == NO)
8138 MrBayesPrint ("%s You must be in a trees block to read a tree\n", spacer);
8142 if (expecting == Expecting(PARAMETER))
8144 /* this is the name of the tree */
8145 if (inSumtCommand==YES || inComparetreeCommand == YES)
8147 /* we are reading in a tree to sumt or comparetree counters */
8148 t = sumtParams.tree;
8153 /* we are reading in a user tree */
8154 /* check if the tree exists */
8156 for (i=0; i<numUserTrees; i++)
8157 if (strcmp(tkn,userTree[i]->name) == 0)
8160 if (treeIndex < numUserTrees)
8162 MrBayesPrint ("%s Overwriting tree '%s'.\n", spacer, userTree[treeIndex]);
8163 FreePolyTree (userTree[treeIndex]);
8165 if ((userTree[treeIndex] = AllocatePolyTree (numTaxa)) == NULL)
8167 t = userTree[treeIndex];
8169 strncpy (t->name, tkn, 99);
8170 foundColon = foundAmpersand = foundEqual = foundComment = NO;
8171 foundE = foundB = foundN = foundFirst = foundClockrate = foundName = NO;
8172 eSetIndex = bSetIndex = eventIndex = 0;
8173 nextAvailableNode = 0;
8174 if (isTranslateDef == YES && isTranslateDiff == YES)
8175 nextIntNodeIndex = numTranslates;
8177 nextIntNodeIndex = numTaxa;
8178 pp = &t->nodes[nextAvailableNode++];
8180 t->isRooted = NO; /* expect unrooted tree */
8181 t->isClock = NO; /* expect nonclock tree */
8182 t->isCalibrated = NO; /* expect uncalibrated tree */
8183 t->isRelaxed = NO; /* expect strict clock if clock tree */
8184 t->clockRate = 0.0; /* expect no clock rate */
8187 expecting = Expecting(EQUALSIGN) | Expecting(LEFTCOMMENT);
8188 lastExpecting = expecting;
8190 else if (expecting == Expecting(EQUALSIGN))
8192 if (foundClockrate == YES)
8193 expecting = Expecting(NUMBER);
8196 for (i=0; i<numTaxa; i++)
8199 expecting = Expecting(LEFTPAR) | Expecting(LEFTCOMMENT);
8200 lastExpecting = expecting;
8203 else if (expecting == Expecting(LEFTPAR))
8207 expecting = Expecting(NUMBER);
8211 if (nextAvailableNode >= 2*numTaxa)
8213 MrBayesPrint ("%s Too many nodes on tree '%s'\n", spacer, t->name);
8214 if (inSumtCommand == NO && inComparetreeCommand == NO)
8215 FreePolyTree (userTree[treeIndex]);
8218 qq = &t->nodes[nextAvailableNode++];
8221 pp->index = nextIntNodeIndex++;
8223 expecting = Expecting(LEFTPAR);
8224 expecting |= Expecting(ALPHA);
8225 expecting |= Expecting(NUMBER);
8226 expecting |= Expecting(LEFTCOMMENT);
8227 lastExpecting = expecting;
8230 else if (expecting == Expecting(ALPHA))
8232 if (foundAmpersand == YES)
8234 if (strcmp(tkn,"E") == 0)
8237 expecting = Expecting(ALPHA);
8239 else if (strcmp(tkn,"B") == 0)
8242 expecting = Expecting(ALPHA);
8244 else if (strcmp(tkn,"N") == 0)
8247 expecting = Expecting(ALPHA);
8249 else if (strcmp(tkn, "R") == 0)
8252 t->isClock = YES; /* assume clock if rooted */
8253 expecting = Expecting(RIGHTCOMMENT);
8255 else if (strcmp(tkn, "U") == 0)
8258 expecting = Expecting(RIGHTCOMMENT);
8260 else if (strcmp(tkn, "clockrate") == 0)
8262 t->isCalibrated = YES;
8263 foundClockrate = YES;
8264 expecting = Expecting(EQUALSIGN);
8270 expecting = lastExpecting;
8272 foundAmpersand = NO;
8274 else if (foundName == YES && foundCurly == YES)
8276 if (strcmp("all",tkn) == 0)
8278 SafeStrcat (&tempNameString,tkn);
8279 expecting = Expecting(RIGHTCURL);
8283 MrBayesPrint ("%s Urecognized argument '%s'\n", spacer, tkn);
8287 else if (foundE == YES) /* We have seen &E */
8289 if (foundEqual == NO) /* We have not seen name before and we are in header */
8293 t->nEvents = (int **) SafeRealloc ((void *)t->nEvents, t->nESets*sizeof(int *));
8294 t->position = (MrBFlt ***) SafeRealloc ((void *)t->position, t->nESets*sizeof(MrBFlt **));
8295 t->rateMult = (MrBFlt ***) SafeRealloc ((void *)t->rateMult, t->nESets*sizeof(MrBFlt **));
8296 t->nEvents[t->nESets-1] = (int *) SafeCalloc (2*(size_t)numTaxa, sizeof(int));
8297 t->position[t->nESets-1] = (MrBFlt **) SafeCalloc (2*(size_t)numTaxa, sizeof(MrBFlt *));
8298 t->rateMult[t->nESets-1] = (MrBFlt **) SafeCalloc (2*(size_t)numTaxa, sizeof(MrBFlt *));
8299 t->eSetName = (char **) SafeRealloc ((void *)t->eSetName, t->nESets*sizeof(char **));
8301 SafeStrcpy (&tempNameString,tkn);
8303 expecting = Expecting(LEFTCURL);
8304 if (foundEqual == YES)
8305 expecting |= Expecting(NUMBER);
8307 expecting |= Expecting(RIGHTCOMMENT);
8309 else if (foundB == YES)
8311 if (foundEqual == NO)
8315 t->effectiveBrLen = (MrBFlt **) SafeRealloc ((void *)t->effectiveBrLen, (size_t)(t->nBSets)*sizeof(MrBFlt *));
8316 t->effectiveBrLen[t->nBSets-1] = (MrBFlt *) SafeCalloc (2*(size_t)numTaxa, sizeof(MrBFlt));
8317 for (i=0; i<2*numTaxa; i++)
8318 t->effectiveBrLen[t->nBSets-1][i] = 1.0;
8319 t->bSetName = (char **) SafeRealloc ((void *)t->bSetName, (size_t)(t->nBSets)*sizeof(char *));
8320 t->bSetName[t->nBSets-1] = (char *) SafeCalloc (strlen(tkn)+1, sizeof(char));
8322 SafeStrcpy (&tempNameString,tkn);
8324 expecting = Expecting(LEFTCURL);
8325 if (foundEqual == YES)
8326 expecting |= Expecting(NUMBER);
8328 expecting |= Expecting(RIGHTCOMMENT);
8330 else if (foundN == YES)
8332 if (foundEqual == NO)
8334 if (t->popSizeSet == YES)
8336 MrBayesPrint ("%s Cannot hold more than one population size set\n", spacer);
8337 if (inSumtCommand == NO && inComparetreeCommand == NO)
8338 FreePolyTree (userTree[treeIndex]);
8341 t->popSizeSet = YES;
8342 if (isTranslateDef == YES && isTranslateDiff == YES)
8343 t->popSize = (MrBFlt *) SafeCalloc (2*numTranslates, sizeof(MrBFlt));
8345 t->popSize = (MrBFlt *) SafeCalloc (2*numLocalTaxa, sizeof(MrBFlt));
8347 SafeStrcpy (&tempNameString,tkn);
8349 expecting = Expecting(LEFTCURL);
8350 if (foundEqual == YES)
8351 expecting |= Expecting(NUMBER);
8353 expecting |= Expecting(RIGHTCOMMENT);
8355 else /* taxon name */
8357 if (isTranslateDef == YES)
8359 /* we are using the translation table */
8360 if (CheckString (transTo, numTranslates, tkn, &index) == ERROR)
8362 MrBayesPrint ("%s Could not find token '%s' in taxon translation table\n", spacer, tkn);
8363 if (inSumtCommand == NO && inComparetreeCommand == NO)
8364 FreePolyTree (userTree[treeIndex]);
8367 strcpy (tempName, transFrom[index]);
8368 if (isTranslateDiff == NO && CheckString (taxaNames, numTaxa, tempName, &index) == ERROR)
8370 MrBayesPrint ("%s Could not find taxon '%s' in list of taxa\n", spacer, tkn);
8371 if (inSumtCommand == NO && inComparetreeCommand == NO)
8372 FreePolyTree (userTree[treeIndex]);
8375 if (tempSet[index] == YES)
8377 MrBayesPrint ("%s Taxon name '%s' already used in tree\n", spacer, tkn);
8378 if (inSumtCommand == NO && inComparetreeCommand == NO)
8379 FreePolyTree (userTree[treeIndex]);
8382 tempSet[index] = YES;
8383 strcpy (pp->label, tempName);
8388 /* Check to see if the name is in the list of taxon names. */
8389 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
8391 MrBayesPrint ("%s Could not find taxon '%s' in list of taxa\n", spacer, tkn);
8392 if (inSumtCommand == NO && inComparetreeCommand == NO)
8393 FreePolyTree (userTree[treeIndex]);
8396 if (tempSet[index] == YES)
8398 MrBayesPrint ("%s Taxon name '%s' already used in tree\n", spacer, tkn);
8399 if (inSumtCommand == NO && inComparetreeCommand == NO)
8400 FreePolyTree (userTree[treeIndex]);
8403 tempSet[index] = YES;
8404 strcpy (pp->label, tkn);
8407 expecting = Expecting(COMMA);
8408 expecting |= Expecting(COLON);
8409 expecting |= Expecting(RIGHTPAR);
8412 else if (expecting == Expecting(RIGHTPAR))
8415 expecting = Expecting(RIGHTCOMMENT);
8418 if (pp->anc == NULL)
8420 MrBayesPrint ("%s Incorrect tree format: cannot go down\n", spacer);//, tkn
8421 if (inSumtCommand == NO && inComparetreeCommand == NO)
8422 FreePolyTree (userTree[treeIndex]);
8425 if (pp->anc->left == pp)
8427 MrBayesPrint ("%s Incorrect tree format: all nodes except tips should have more then one child. Either a single\n", spacer);
8428 MrBayesPrint ("%s taxon is surrounded with brackets or there is a clade surrounded by double brackets.\n", spacer);
8429 if (inSumtCommand == NO && inComparetreeCommand == NO)
8430 FreePolyTree (userTree[treeIndex]);
8434 if (pp->anc == NULL)
8436 /* finish up tree */
8437 t->nNodes = nextAvailableNode;
8438 t->nIntNodes = t->nNodes;
8439 for (i=0; i<t->nNodes; i++)
8441 if (t->nodes[i].left == NULL)
8446 /* check that number of taxa is correct */
8447 if (t->isRooted == NO && t->nNodes-t->nIntNodes == t->nIntNodes + 1)
8449 if ((t->isRooted == YES && t->nNodes-t->nIntNodes != t->nIntNodes + 1) ||
8450 (t->isRooted == NO && t->nNodes-t->nIntNodes != t->nIntNodes + 2))
8452 /* we are protected from adding too many taxa by taxon-matching code above */
8453 if (t->isRooted == YES && t->nNodes-t->nIntNodes == t->nIntNodes + 2)
8455 MrBayesPrint ("%s The tree is declared as rooted (by comment [&R]) but\n", spacer);
8456 MrBayesPrint ("%s the given tree has unrooted structure.\n", spacer);
8459 MrBayesPrint ("%s Taxa missing in tree, or NOT a binary tree\n", spacer);
8464 /* check other properties */
8465 if (t->isClock == YES && t->isRooted == NO)
8467 MrBayesPrint ("%s Tree has clock rate but is not rooted\n", spacer);
8469 /* Note: any deviation from an ultrametric tree must be assumed to be due to dated
8470 tips at this point */
8472 if (t->isRelaxed == YES && t->isClock == NO)
8474 MrBayesPrint ("%s Tree has relaxed clock rates but is not a clock tree\n", spacer);
8477 if (inSumtCommand == NO && inComparetreeCommand == NO)
8479 if (treeIndex == numUserTrees)
8481 MrBayesPrint ("%s Successfully read tree '%s'\n", spacer, userTree[treeIndex]->name);
8483 if (t->popSize == NULL)
8486 expecting = Expecting(SEMICOLON);
8491 expecting = Expecting(LEFTCOMMENT);
8492 lastExpecting = expecting;
8497 expecting = Expecting(COMMA);
8498 expecting |= Expecting(COLON);
8499 expecting |= Expecting(RIGHTPAR);
8503 else if (expecting == Expecting(COLON))
8507 expecting = Expecting(LEFTPAR);
8509 expecting = Expecting(NUMBER);
8510 expecting |= Expecting(LEFTCOMMENT);
8511 lastExpecting = expecting;
8513 else if (expecting == Expecting(COMMA))
8515 if (foundName == YES)
8517 SafeStrcat (&tempNameString,",");
8518 expecting = Expecting(NUMBER);
8520 else if (foundE == YES)
8522 expecting = Expecting(NUMBER);
8526 if (nextAvailableNode >= 2*numTaxa)
8528 MrBayesPrint ("%s Too many nodes on tree '%s'\n", spacer, t->name);
8529 if (inSumtCommand == NO && inComparetreeCommand == NO)
8530 FreePolyTree (userTree[treeIndex]);
8533 qq = &t->nodes[nextAvailableNode++];
8537 expecting = Expecting(LEFTPAR);
8538 expecting |= Expecting(ALPHA);
8539 expecting |= Expecting(NUMBER);
8540 expecting |= Expecting(LEFTCOMMENT);
8541 lastExpecting = expecting;
8544 else if (expecting == Expecting(NUMBER))
8546 if (foundClockrate == YES)
8548 sscanf (tkn, "%lf", &tempD);
8549 t->clockRate = tempD;
8550 foundClockrate = NO;
8551 expecting = Expecting(RIGHTCOMMENT);
8553 else if (foundName == YES && foundCurly == YES)
8555 /* still assembling name of a param set */
8556 SafeStrcat (&tempNameString,tkn);
8557 expecting = Expecting(RIGHTCURL) | Expecting(COMMA);
8559 else if (foundN == YES)
8561 /* we only know now that name is complete if it does not have curlies in it */
8564 if (strcmp(tempNameString,t->popSizeSetName) != 0)
8566 MrBayesPrint ("%s Could not find population size set '%s'\n", spacer, tempNameString);
8567 if (inSumtCommand == NO && inComparetreeCommand == NO)
8568 FreePolyTree (userTree[treeIndex]);
8572 sscanf (tkn, "%lf", &tempD);
8573 t->popSize[pp->index] = tempD;
8575 expecting = Expecting(RIGHTCOMMENT);
8577 else if (foundB == YES)
8579 /* we only know now that name is complete if it does not have curlies in it */
8582 /* find the right effective branch length set */
8583 for (i=0; i<t->nBSets; i++)
8584 if (strcmp(t->bSetName[i],tempNameString) == 0)
8588 MrBayesPrint ("%s Could not find effective branch length set '%s'\n", spacer, tempNameString);
8589 if (inSumtCommand == NO && inComparetreeCommand == NO)
8590 FreePolyTree (userTree[treeIndex]);
8595 sscanf (tkn, "%lf", &tempD);
8596 t->effectiveBrLen[bSetIndex][pp->index] = tempD;
8598 expecting = Expecting(RIGHTCOMMENT);
8600 else if (foundE == YES)
8602 if (foundColon == NO)
8604 /* we only know now that name is complete if it does not have curlies in it */
8607 /* find the right event set */
8608 for (i=0; i<t->nESets; i++)
8609 if (strcmp(t->eSetName[i],tempNameString) == 0)
8613 MrBayesPrint ("%s Could not find event set '%s'\n", spacer, tempNameString);
8614 if (inSumtCommand == NO && inComparetreeCommand == NO)
8615 FreePolyTree (userTree[treeIndex]);
8620 sscanf (tkn, "%d", &tempInt);
8623 MrBayesPrint ("%s Wrong number of events (%d) for event set '%s'\n", spacer, tempInt, t->eSetName[eSetIndex]);
8624 if (inSumtCommand == NO && inComparetreeCommand == NO)
8625 FreePolyTree (userTree[treeIndex]);
8628 t->nEvents[eSetIndex][pp->index] = tempInt;
8631 t->position[eSetIndex][pp->index] = (MrBFlt *) SafeCalloc (tempInt, sizeof(MrBFlt));
8632 t->rateMult[eSetIndex][pp->index] = (MrBFlt *) SafeCalloc (tempInt, sizeof(MrBFlt));
8633 expecting = Expecting (COLON);
8634 if (inSumtCommand == YES || inComparetreeCommand == YES)
8635 expecting |= Expecting (RIGHTCOMMENT); /* we allow empty event specifications in sumt and comparetree */
8638 expecting = Expecting (RIGHTCOMMENT);
8641 else if (foundFirst == NO)
8643 /* processing the first number in the cpp event pair <position rate> */
8644 sscanf (tkn, "%lf", &tempD);
8645 t->position[eSetIndex][pp->index][eventIndex] = tempD;
8646 expecting = Expecting(NUMBER);
8651 /* processing the second number in the cpp event pair <position rate> */
8653 sscanf (tkn, "%lf", &tempD);
8654 t->rateMult[eSetIndex][pp->index][eventIndex] = tempD;
8656 if (eventIndex == t->nEvents[eSetIndex][pp->index])
8658 expecting = Expecting(RIGHTPAR);
8662 expecting = Expecting(COMMA);
8665 else if (foundColon == YES)
8668 sscanf (tkn, "%lf", &tempD);
8672 expecting = Expecting(COMMA);
8673 expecting |= Expecting(RIGHTPAR);
8674 expecting |= Expecting(LEFTCOMMENT);
8675 lastExpecting = expecting;
8677 else /* taxon identifier */
8679 if (isTranslateDef == YES)
8681 /* we are using the translation table */
8682 if (CheckString (transTo, numTranslates, tkn, &index) == ERROR)
8684 MrBayesPrint ("%s Could not find token '%s' in taxon translation table\n", spacer, tkn);
8685 if (inSumtCommand == NO && inComparetreeCommand == NO)
8686 FreePolyTree (userTree[treeIndex]);
8689 strcpy (tempName, transFrom[index]);
8690 if (isTranslateDiff == NO && CheckString (taxaNames, numTaxa, tempName, &index) == ERROR)
8692 MrBayesPrint ("%s Could not find taxon '%s' in list of taxa\n", spacer, tkn);
8693 if (inSumtCommand == NO && inComparetreeCommand == NO)
8694 FreePolyTree (userTree[treeIndex]);
8697 if (tempSet[index] == YES)
8699 MrBayesPrint ("%s Taxon name '%s' already used in tree\n", spacer, tkn);
8700 if (inSumtCommand == NO && inComparetreeCommand == NO)
8701 FreePolyTree (userTree[treeIndex]);
8704 tempSet[index] = YES;
8705 strcpy (pp->label, tempName);
8710 /* Simply use taxon number; first check to see if the name is in the list of taxon names. */
8711 if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
8713 /* The number could not be found as a taxon name in the list of taxon names. We will
8714 assume that the user has then input taxa as numbers and not the names. */
8715 sscanf (tkn, "%d", &index);
8716 if (index < 1 || index > numTaxa)
8718 MrBayesPrint ("%s Taxon number %d is out of range\n", spacer, index);
8719 if (inSumtCommand == NO && inComparetreeCommand == NO)
8720 FreePolyTree (userTree[treeIndex]);
8724 if (tempSet[index] == YES)
8726 MrBayesPrint ("%s Taxon name %d has already been used in tree '%s'\n", spacer, index+1, t->name);
8727 if (inSumtCommand == NO && inComparetreeCommand == NO)
8728 FreePolyTree (userTree[treeIndex]);
8734 /* The number is in the list of taxon names */
8735 if (index < 0 || index >= numTaxa)
8737 MrBayesPrint ("%s Taxon name %s could not be found\n", spacer, tkn);
8738 if (inSumtCommand == NO && inComparetreeCommand == NO)
8739 FreePolyTree (userTree[treeIndex]);
8742 if (tempSet[index] == YES)
8744 MrBayesPrint ("%s Taxon %d has already been used in tree '%s'\n", spacer, index+1, t->name);
8745 if (inSumtCommand == NO && inComparetreeCommand == NO)
8746 FreePolyTree (userTree[treeIndex]);
8750 tempSet[index] = YES;
8751 strcpy (pp->label, taxaNames[index]);
8754 expecting = Expecting(COMMA);
8755 expecting |= Expecting(COLON);
8756 expecting |= Expecting(RIGHTPAR);
8757 expecting |= Expecting(LEFTCOMMENT);
8758 lastExpecting = expecting;
8761 else if (expecting == Expecting(LEFTCOMMENT))
8763 expecting = Expecting(AMPERSAND);
8766 else if (expecting == Expecting(RIGHTCOMMENT))
8768 if (foundEqual == NO)
8770 /* We may have a complete name of a set of branch parameters, which needs to be recorded */
8771 if (foundName == YES)
8775 t->eSetName[t->nESets-1] = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char));
8776 strcat(t->eSetName[t->nESets-1],tempNameString);
8778 else if (foundB == YES)
8780 t->bSetName[t->nBSets-1] = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char));
8781 strcat(t->bSetName[t->nBSets-1],tempNameString);
8783 else if (foundN == YES)
8785 t->popSizeSetName = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char));
8786 strcpy(t->popSizeSetName,tempNameString);
8790 expecting = Expecting(EQUALSIGN);
8794 if (pp->anc == NULL)
8796 if (pp->left == NULL)
8797 expecting = Expecting(LEFTPAR);
8799 expecting = Expecting(SEMICOLON);
8801 else if (pp == pp->anc->left)
8802 expecting = Expecting(COMMA);
8804 expecting = Expecting(RIGHTPAR);
8806 foundE = foundB = foundN = NO;
8807 expecting |= Expecting(LEFTCOMMENT);
8809 else if (expecting == Expecting(AMPERSAND))
8811 foundAmpersand = YES;
8813 expecting = Expecting (ALPHA);
8815 else if (foundComment == YES)
8820 else if (expecting == Expecting(LEFTCURL))
8822 if (foundName == YES)
8825 SafeStrcat (&tempNameString,"{");
8826 expecting = Expecting(NUMBER) | Expecting(ALPHA);
8831 else if (expecting == Expecting(RIGHTCURL))
8833 if (foundName == YES)
8835 SafeStrcat (&tempNameString,"}");
8837 if (foundEqual == NO)
8839 /* We are processing a name of a set of branch params in the header of a tree. */
8840 expecting = Expecting(RIGHTCOMMENT);
8844 /* We are processing a param value of a branch param set */
8845 expecting = Expecting(NUMBER);
8853 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
8857 int DoUserTree (void)
8859 MrBayesPrint ("%s Usertree command deprecated. Define the tree in a treeblock and use 'Startvals' instead.\n", spacer);
8864 int DoUserTreeParm (char *parmName, char *tkn)
8866 if (expecting == Expecting(EQUALSIGN))
8868 expecting = Expecting(LEFTPAR);
8869 expecting |= Expecting(RIGHTPAR);
8870 expecting |= Expecting(COLON);
8871 expecting |= Expecting(NUMBER);
8872 expecting |= Expecting(ALPHA);
8873 expecting |= Expecting(SEMICOLON);
8875 else if (expecting == Expecting(LEFTPAR))
8877 expecting = Expecting(LEFTPAR);
8878 expecting |= Expecting(ALPHA);
8879 expecting |= Expecting(NUMBER);
8881 else if (expecting == Expecting(ALPHA))
8883 expecting = Expecting(COLON);
8884 expecting |= Expecting(COMMA);
8885 expecting |= Expecting(RIGHTPAR);
8887 else if (expecting == Expecting(NUMBER))
8889 expecting = Expecting(COLON);
8890 expecting |= Expecting(COMMA);
8891 expecting |= Expecting(RIGHTPAR);
8893 else if (expecting == Expecting(COLON))
8895 expecting = Expecting(NUMBER);
8897 else if (expecting == Expecting(COMMA))
8899 expecting = Expecting(LEFTPAR);
8900 expecting |= Expecting(ALPHA);
8901 expecting |= Expecting(NUMBER);
8903 else if (expecting == Expecting(RIGHTPAR))
8905 expecting = Expecting(RIGHTPAR);
8906 expecting |= Expecting(COMMA);
8907 expecting |= Expecting(COLON);
8908 expecting |= Expecting(SEMICOLON);
8914 MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
8915 MrBayesPrint ("%s", tkn);
8919 int DoVersion (void)
8921 MrBayesPrint (" --------------------------------------------------------------------------- \n");
8922 MrBayesPrint (" Version \n");
8923 MrBayesPrint (" \n");
8924 MrBayesPrint (" MrBayes v%s \n", VERSION_NUMBER);
8925 MrBayesPrint (" --------------------------------------------------------------------------- \n");
8931 BitsLong Expecting (int y)
8935 x = (BitsLong) pow (2.0, (MrBFlt)y);
8941 #ifdef HAVE_LIBREADLINE
8942 /* This function is for commandline substitution: first word is always a command */
8943 char *command_generator(const char *text, int state)
8945 static int list_index, len;
8951 len= (int) strlen(text);
8953 while ((command=commands[list_index].string)!=NULL)
8956 if (strncasecmp(command,text,len)==0)
8957 /* memory is freed by the readline library so we need a strdup here */
8958 return strdup(command);
8960 return (char *)NULL;
8965 int FindValidCommand (char *tk, int *numMatches)
8967 int i, j, tkLen, targetLen, numDiff;
8971 tkLen = (int) strlen(tk);
8974 for (i=0; i<NUMCOMMANDS; i++)
8976 targetLen = (int) strlen(p->string);
8977 if (tkLen <= targetLen)
8979 for (j=0, numDiff=0; j<tkLen; j++)
8981 if (ChangeCase(tk[j]) != ChangeCase(p->string[j]))
8988 if (tkLen == targetLen)
8995 inValidCommand = NO;
8996 if (*numMatches == 1)
8998 inValidCommand = YES;
9006 int FindValidParam (char *tk, int *numMatches)
9008 int i, j, tkLen, targetLen, numDiff;
9016 MrBayesPrint ("%s Command pointer is NULL\n", spacer);
9019 tkLen = (int) strlen(tk);
9022 for (i=0; i<p->numParms; i++)
9024 q = paramTable + (p->parmList[i]);
9025 targetLen = (int) strlen(q->string);
9026 /* printf ("%s %d (%s %d)\n", q->string, targetLen, tk, p->numParms); */
9027 if (!strcmp(q->string, "Xxxxxxxxxx"))
9032 else if (tkLen <= targetLen)
9034 for (j=0, numDiff=0; j<tkLen; j++)
9036 if (ChangeCase(tk[j]) != ChangeCase(q->string[j]))
9043 if (tkLen == targetLen)
9049 if (*numMatches == 1)
9056 int FreeCharacters (void)
9058 int i, memoryLetFree;
9062 if (memAllocs[ALLOC_TMPSET] == YES)
9064 if (numChar > numTaxa)
9065 tempSet = (int *) SafeRealloc ((void *)tempSet, (size_t)numTaxa*sizeof(int));
9066 tempSetNeg = (int *) SafeRealloc ((void *)tempSetNeg, (size_t)numTaxa*sizeof(int));
9068 if (memAllocs[ALLOC_MATRIX] == YES)
9073 memAllocs[ALLOC_MATRIX] = NO;
9074 memoryLetFree = YES;
9076 if (memAllocs[ALLOC_CHARINFO] == YES)
9080 memAllocs[ALLOC_CHARINFO] = NO;
9081 memoryLetFree = YES;
9083 if (memAllocs[ALLOC_CHARSETS] == YES)
9085 for (i=0; i<numCharSets; i++)
9087 free (charSetNames[i]);
9090 free (charSetNames);
9092 charSetNames = NULL;
9095 memAllocs[ALLOC_CHARSETS] = NO;
9096 memoryLetFree = YES;
9098 if (memAllocs[ALLOC_PARTITIONS] == YES)
9100 for (i=0; i<numDefinedPartitions; i++)
9101 free (partitionNames[i]);
9102 free (partitionNames);
9103 partitionNames = NULL;
9104 for (i=0; i<numChar; i++)
9105 free (partitionId[i]);
9107 numDefinedPartitions = 0;
9108 memAllocs[ALLOC_PARTITIONS] = NO;
9109 memoryLetFree = YES;
9111 if (memAllocs[ALLOC_PARTITIONVARS] == YES)
9117 free (activeParams[0]);
9118 activeParams[0] = NULL;
9119 free (linkTable[0]);
9120 linkTable[0] = NULL;
9121 tempLinkUnlinkVec = NULL;
9123 tempLinkUnlinkVec = NULL;
9124 for (i=0; i<NUM_LINKED; i++)
9126 linkTable[i] = NULL;
9127 activeParams[i] = NULL;
9129 memAllocs[ALLOC_PARTITIONVARS] = NO;
9130 memoryLetFree = YES;
9133 ResetCharacterFlags();
9135 if (memoryLetFree == YES)
9136 MrBayesPrint ("%s Deleting previously defined characters\n", spacer);
9142 int FreeMatrix (void)
9144 if (FreeCharacters() == ERROR)
9147 return (FreeTaxa());
9153 int i, memoryLetFree;
9156 if (memAllocs[ALLOC_TAXA] == YES)
9160 for (i=0; i<taxonCount; i++)
9161 free (taxaNames[i]);
9167 free (tipCalibration);
9168 tipCalibration = NULL;
9170 memAllocs[ALLOC_TAXA] = NO;
9171 memoryLetFree = YES;
9173 if (memAllocs[ALLOC_TMPSET] == YES)
9179 memAllocs[ALLOC_TMPSET] = NO;
9180 memoryLetFree = YES;
9182 if (memAllocs[ALLOC_TAXASETS] == YES)
9184 for (i=0; i<numTaxaSets; i++)
9186 free (taxaSetNames[i]);
9189 free (taxaSetNames);
9190 taxaSetNames = NULL;
9194 memAllocs[ALLOC_TAXASETS] = NO;
9195 memoryLetFree = YES;
9197 if (memAllocs[ALLOC_SPECIESPARTITIONS] == YES)
9199 for (i=0; i<numDefinedSpeciespartitions; i++)
9200 free (speciespartitionNames[i]);
9201 free (speciespartitionNames);
9202 speciespartitionNames = NULL;
9203 for (i=0; i<numTaxa; i++)
9204 free (speciespartitionId[i]);
9205 free (speciespartitionId);
9206 speciespartitionId = NULL;
9207 numDefinedSpeciespartitions = 0;
9208 memAllocs[ALLOC_SPECIESPARTITIONS] = NO;
9209 memoryLetFree = YES;
9211 if (memAllocs[ALLOC_CONSTRAINTS] == YES)
9213 for (i=0; i<numDefinedConstraints; i++)
9215 free(definedConstraint[i]);
9216 free(definedConstraintTwo[i]);
9217 free(definedConstraintPruned[i]);
9218 free(definedConstraintTwoPruned[i]);
9219 free (constraintNames[i]);
9221 free (definedConstraint);
9222 definedConstraint = NULL;
9223 free (definedConstraintTwo);
9224 definedConstraintTwo = NULL;
9225 free (definedConstraintsType);
9226 definedConstraintsType = NULL;
9227 free (constraintNames);
9228 constraintNames = NULL;
9229 free (nodeCalibration);
9230 nodeCalibration = NULL;
9231 numDefinedConstraints = 0;
9232 free (tempActiveConstraints);
9233 tempActiveConstraints = NULL;
9234 memAllocs[ALLOC_CONSTRAINTS] = NO;
9235 memoryLetFree = YES;
9237 if (numUserTrees > 0)
9239 MrBayesPrint ("%s Deleting user trees\n", spacer);
9240 for (i=0; i<numUserTrees; i++)
9242 FreePolyTree(userTree[i]);
9250 if (memoryLetFree == YES)
9251 MrBayesPrint ("%s Deleting previously defined taxa\n", spacer);
9253 /* reinitialize taxa variables */
9260 int GetNumPartDivisions (int n)
9262 int i, maxDiv, numDivs, *divFound;
9265 for (i=0; i<numChar; i++)
9266 if (partitionId[i][n] > maxDiv)
9267 maxDiv = partitionId[i][n];
9269 divFound = (int *) SafeCalloc (maxDiv, sizeof(int));
9271 for (i=0; i<maxDiv; i++)
9274 for (i=0; i<numChar; i++)
9275 divFound[partitionId[i][n]] = YES;
9278 for (i=0; i<maxDiv; i++)
9279 if (divFound[i] == YES)
9284 return (numDivs + 1);
9288 int GetToken (char *token, int *tokenType, char **sourceH)
9290 int allNumbers, foundExp, foundExpSign;
9291 register char *temp;
9296 tempMax = temp + CMD_STRING_LENGTH - 10;
9298 while (IsWhite(**sourceH) == 1 || IsWhite(**sourceH) == 2)
9300 if (IsWhite(**sourceH) == 2)
9302 *tokenType = RETURNSYMBOL;
9303 /* foundNewLine = YES; Why is this commented out?? */
9304 /* MrBayesPrint ("RETURN\n"); */
9309 if (readWord == YES && **sourceH != '"')
9314 *tokenType = SEMICOLON;
9318 while (isgraph(**sourceH) && **sourceH!=';')
9322 *tokenType = NOTHING;
9324 MrBayesPrint ("%s Error while parsing a string. Token \"%s...[followed by at least %d more charectors]\" is too long.\n", spacer,token,tempMax-token-20);
9325 MrBayesPrint ("%s Maximum allowed lenght of a token is %d\n", spacer,tempMax-token);
9328 *temp++ = *(*sourceH)++;
9337 *tokenType = UNKNOWN_TOKEN_TYPE;
9338 if (IsIn(**sourceH,"="))
9340 *temp++ = *(*sourceH)++;
9341 *tokenType = EQUALSIGN;
9343 else if (IsIn(**sourceH,";"))
9345 *temp++ = *(*sourceH)++;
9346 *tokenType = SEMICOLON;
9348 else if (IsIn(**sourceH,":"))
9350 *temp++ = *(*sourceH)++;
9353 else if (IsIn(**sourceH,","))
9355 *temp++ = *(*sourceH)++;
9358 else if (IsIn(**sourceH,"#"))
9360 *temp++ = *(*sourceH)++;
9361 *tokenType = POUNDSIGN;
9363 else if (IsIn(**sourceH,"("))
9365 *temp++ = *(*sourceH)++;
9366 *tokenType = LEFTPAR;
9368 else if (IsIn(**sourceH,")"))
9370 *temp++ = *(*sourceH)++;
9371 *tokenType = RIGHTPAR;
9373 else if (IsIn(**sourceH,"{"))
9375 *temp++ = *(*sourceH)++;
9376 *tokenType = LEFTCURL;
9378 else if (IsIn(**sourceH,"}"))
9380 *temp++ = *(*sourceH)++;
9381 *tokenType = RIGHTCURL;
9383 else if (IsIn(**sourceH,"["))
9385 *temp++ = *(*sourceH)++;
9386 *tokenType = LEFTCOMMENT;
9388 else if (IsIn(**sourceH,"]"))
9390 *temp++ = *(*sourceH)++;
9391 *tokenType = RIGHTCOMMENT;
9393 else if (IsIn(**sourceH,"?"))
9395 *temp++ = *(*sourceH)++;
9396 *tokenType = QUESTIONMARK;
9398 else if (IsIn(**sourceH,"-"))
9400 *temp++ = *(*sourceH)++;
9403 else if (IsIn(**sourceH,"$"))
9405 *temp++ = *(*sourceH)++;
9406 *tokenType = DOLLAR;
9408 else if (IsIn(**sourceH,"\"") && readWord == YES)
9411 while (**sourceH != '"' && **sourceH != '\0')
9415 *tokenType = NOTHING;
9417 MrBayesPrint ("%s Error while parsing a string. Token \"%s...[followed by at least %d more charectors]\" is too long.\n", spacer,token,tempMax-token-20);
9418 MrBayesPrint ("%s Maximum allowed lenght of a token is %d\n", spacer,tempMax-token);
9421 *temp++ = *((*sourceH)++);
9428 else if (IsIn(**sourceH,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789."))
9430 if (IsIn(**sourceH,"0123456789."))
9434 foundExp = foundExpSign = FALSE;
9435 *temp++ = *(*sourceH)++;
9436 while (IsIn(**sourceH,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.-+"))
9440 *tokenType = NOTHING;
9442 MrBayesPrint ("%s Error while parsing a string. Token \"%s...[followed by at least %d more charectors]\" is too long.\n", spacer,token,tempMax-token-20);
9443 MrBayesPrint ("%s Maximum allowed lenght of a token is %d\n", spacer,tempMax-token);
9446 if (allNumbers == TRUE && !IsIn((*sourceH)[-1],"Ee") && **sourceH=='-')
9448 else if (allNumbers == TRUE && IsIn(**sourceH,"Ee") && foundExp == NO)
9450 else if (allNumbers == TRUE && IsIn(**sourceH,"+-") && IsIn((*sourceH)[-1],"Ee"))
9451 foundExpSign = TRUE;
9452 else if (!IsIn(**sourceH,"0123456789."))
9454 *temp++ = *(*sourceH)++;
9456 if (allNumbers == TRUE)
9457 *tokenType = NUMBER;
9461 else if (IsIn(**sourceH,"*"))
9463 *temp++ = *(*sourceH)++;
9464 *tokenType = ASTERISK;
9466 else if (IsIn(**sourceH,"/"))
9468 *temp++ = *(*sourceH)++;
9469 *tokenType = FORWARDSLASH;
9471 else if (IsIn(**sourceH,"'\\'"))
9473 *temp++ = *(*sourceH)++;
9474 *tokenType = BACKSLASH;
9476 else if (IsIn(**sourceH,"!"))
9478 *temp++ = *(*sourceH)++;
9479 *tokenType = EXCLAMATIONMARK;
9481 else if (IsIn(**sourceH,"%"))
9483 *temp++ = *(*sourceH)++;
9484 *tokenType = PERCENT;
9486 else if (IsIn(**sourceH,"\""))
9488 *temp++ = *(*sourceH)++;
9489 *tokenType = QUOTATIONMARK;
9491 else if (IsIn(**sourceH,"&"))
9493 *temp++ = *(*sourceH)++;
9494 *tokenType = AMPERSAND;
9496 else if (IsIn(**sourceH,"~+^@{}`><"))
9498 *temp++ = *(*sourceH)++;
9501 else if (IsIn(**sourceH,"|"))
9503 *temp++ = *(*sourceH)++;
9504 *tokenType = VERTICALBAR;
9512 int GetUserHelp (char *helpTkn)
9514 int i, j, k, tempInt;
9515 char tempString[100];
9518 if (!strcmp(helpTkn, "Begin"))
9520 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9521 MrBayesPrint (" Begin \n");
9522 MrBayesPrint (" \n");
9523 MrBayesPrint (" This command is used to format data or commands in the program. The correct \n");
9524 MrBayesPrint (" usage is \n");
9525 MrBayesPrint (" \n");
9526 MrBayesPrint (" begin <data or mrbayes>; \n");
9527 MrBayesPrint (" \n");
9528 MrBayesPrint (" The two valid uses of the \"begin\" command, then, are \n");
9529 MrBayesPrint (" \n");
9530 MrBayesPrint (" begin data; \n");
9531 MrBayesPrint (" begin mrbayes; \n");
9532 MrBayesPrint (" \n");
9533 MrBayesPrint (" The \"data\" specifier is used to specify the beginning of a data block; your \n");
9534 MrBayesPrint (" character data should follow. For example, the following is an example of \n");
9535 MrBayesPrint (" a data block for four taxa and ten DNA sites: \n");
9536 MrBayesPrint (" \n");
9537 MrBayesPrint (" begin data; \n");
9538 MrBayesPrint (" dimensions ntax=4 nchar=10; \n");
9539 MrBayesPrint (" format datatype=dna; \n");
9540 MrBayesPrint (" matrix \n");
9541 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9542 MrBayesPrint (" taxon_2 AAGGATTCCA \n");
9543 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9544 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9545 MrBayesPrint (" ; \n");
9546 MrBayesPrint (" end; \n");
9547 MrBayesPrint (" \n");
9548 MrBayesPrint (" The other commands -- dimensions, format, and matrix -- are discussed \n");
9549 MrBayesPrint (" in the appropriate help menu. The only thing to note here is that the \n");
9550 MrBayesPrint (" block begins with a \"begin data\" command. The \"mrbayes\" command is \n");
9551 MrBayesPrint (" used to enter commands specific to the MrBayes program into the file. \n");
9552 MrBayesPrint (" This allows you to automatically process commands on execution of the \n");
9553 MrBayesPrint (" program. The following is a simple mrbayes block: \n");
9554 MrBayesPrint (" \n");
9555 MrBayesPrint (" begin mrbayes; \n");
9556 MrBayesPrint (" charset first = 1-10\\3; \n");
9557 MrBayesPrint (" charset second = 2-10\\3; \n");
9558 MrBayesPrint (" charset third = 3-10\\3; \n");
9559 MrBayesPrint (" end; \n");
9560 MrBayesPrint (" \n");
9561 MrBayesPrint (" This mrbayes block sets off the three \"charset\" commands, used to \n");
9562 MrBayesPrint (" predefine some blocks of characters. The mrbayes block can be very useful. \n");
9563 MrBayesPrint (" For example, in this case, it would save you the time of typing the char- \n");
9564 MrBayesPrint (" acter sets each time you executed the file. Also, note that every \n");
9565 MrBayesPrint (" \"begin <data or mrbayes>\" command ends with an \"end\". Finally, you can \n");
9566 MrBayesPrint (" have so-called foreign blocks in the file. An example of a foreign block \n");
9567 MrBayesPrint (" would be \"begin paup\". The program will simply skip this block. This is \n");
9568 MrBayesPrint (" useful because it means that you can use the same file for MrBayes, PAUP* \n");
9569 MrBayesPrint (" or MacClade (although it isn't clear why you would want to use those other \n");
9570 MrBayesPrint (" programs). \n");
9571 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9573 else if (!strcmp(helpTkn, "End"))
9575 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9576 MrBayesPrint (" End \n");
9577 MrBayesPrint (" \n");
9578 MrBayesPrint (" This command is used to terminate a data or mrbayes block. The correct \n");
9579 MrBayesPrint (" usage is \n");
9580 MrBayesPrint (" \n");
9581 MrBayesPrint (" end; \n");
9582 MrBayesPrint (" \n");
9583 MrBayesPrint (" For more information on this, check the help for the \"begin\" command. \n");
9584 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9586 else if (!strcmp(helpTkn, "Endblock"))
9588 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9589 MrBayesPrint (" Endblock \n");
9590 MrBayesPrint (" \n");
9591 MrBayesPrint (" This is an older, deprecated version of \"End\", see that command. \n");
9592 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9594 else if (!strcmp(helpTkn, "Plot"))
9596 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9597 MrBayesPrint (" Plot \n");
9598 MrBayesPrint (" \n");
9599 MrBayesPrint (" This command plots specified parameters in the .p file or one of the .p files \n");
9600 MrBayesPrint (" created during an MCMC analysis. An x-y graph of the parameter over the course\n");
9601 MrBayesPrint (" of the chain is created. The command can be useful for visually diagnosing \n");
9602 MrBayesPrint (" convergence for many of the parameters of the phylogenetic model. The para- \n");
9603 MrBayesPrint (" meter to be plotted is specified by the \"parameter\" option. Several para- \n");
9604 MrBayesPrint (" meters can be plotted at once by using the \"match\" option, which has a \n");
9605 MrBayesPrint (" default value of \"perfect\". For example, if you were to set \"parameter = pi\"\n");
9606 MrBayesPrint (" and \"match = consistentwith\", then all of the state frequency parameters \n");
9607 MrBayesPrint (" would be plotted. You can also set \"match=all\", in which case all of the \n");
9608 MrBayesPrint (" parameters are plotted. \n");
9609 MrBayesPrint (" \n");
9610 MrBayesPrint (" Note that the \"Sump\" command provides a different set of convergence diag- \n");
9611 MrBayesPrint (" nostics tools that you may also want to explore. Unlike \"Plot\", \"Sump\" can\n");
9612 MrBayesPrint (" compare two or more parameter samples and will calculate convergence diagnos- \n");
9613 MrBayesPrint (" tics as wel as parameter summaries for the pooled sample. \n");
9614 MrBayesPrint (" \n");
9615 MrBayesPrint (" Options: \n");
9616 MrBayesPrint (" \n");
9617 MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n");
9618 MrBayesPrint (" samples will be discarded as burnin when creating the plot. \n");
9619 MrBayesPrint (" The proportion to be discarded is set with Burninfrac (see \n");
9620 MrBayesPrint (" Burninfrac below). When the Relburnin option is set to 'No', \n");
9621 MrBayesPrint (" then a specific number of samples is discarded instead. This \n");
9622 MrBayesPrint (" number is set by Burnin (see below). Note that the burnin \n");
9623 MrBayesPrint (" setting is shared across the 'comparetree', 'sump' and 'sumt'\n");
9624 MrBayesPrint (" commands. \n");
9625 MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n");
9626 MrBayesPrint (" be discarded when summary statistics are calculated. The \n");
9627 MrBayesPrint (" value of this option is only relevant when Relburnin is set \n");
9628 MrBayesPrint (" to 'No'. \n");
9629 MrBayesPrint (" Burninfrac -- Determines the fraction of samples that will be discarded \n");
9630 MrBayesPrint (" when creating a plot. The value of this parameter is only \n");
9631 MrBayesPrint (" relevant when Relburnin is set to 'Yes'. Example: A value of \n");
9632 MrBayesPrint (" this option of 0.25 means that 25%% of the samples will be \n");
9633 MrBayesPrint (" discarded. \n");
9634 MrBayesPrint (" Filename -- The name of the file to plot. \n");
9635 MrBayesPrint (" Parameter -- Specification of parameters to be plotted. See above for \n");
9636 MrBayesPrint (" details. \n");
9637 MrBayesPrint (" Match -- Specifies how to match parameter names to the Parameter \n");
9638 MrBayesPrint (" specification. See above for details. \n");
9639 MrBayesPrint (" \n");
9640 MrBayesPrint (" Current settings: \n");
9641 MrBayesPrint (" \n");
9642 MrBayesPrint (" Parameter Options Current Setting \n");
9643 MrBayesPrint (" ------------------------------------------------------------ \n");
9644 MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
9645 MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn);
9646 MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction);
9647 MrBayesPrint (" Filename <name> %s \n", plotParams.plotFileName);
9648 MrBayesPrint (" Parameter <name> %s \n", plotParams.parameter);
9649 MrBayesPrint (" Match Perfect/Consistentwith/All %s \n", plotParams.match);
9650 MrBayesPrint (" \n");
9651 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9653 else if (!strcmp(helpTkn, "Dimensions"))
9655 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9656 MrBayesPrint (" Dimensions \n");
9657 MrBayesPrint (" \n");
9658 MrBayesPrint (" This command is used in a data block to define the number of taxa and \n");
9659 MrBayesPrint (" characters. The correct usage is \n");
9660 MrBayesPrint (" \n");
9661 MrBayesPrint (" dimensions ntax=<number> nchar=<number> \n");
9662 MrBayesPrint (" \n");
9663 MrBayesPrint (" The dimensions must be the first command in a data block. The following \n");
9664 MrBayesPrint (" provides an example of the proper use of this command: \n");
9665 MrBayesPrint (" \n");
9666 MrBayesPrint (" begin data; \n");
9667 MrBayesPrint (" dimensions ntax=4 nchar=10; \n");
9668 MrBayesPrint (" format datatype=dna; \n");
9669 MrBayesPrint (" matrix \n");
9670 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9671 MrBayesPrint (" taxon_2 AAGGATTCCA \n");
9672 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9673 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9674 MrBayesPrint (" ; \n");
9675 MrBayesPrint (" end; \n");
9676 MrBayesPrint (" \n");
9677 MrBayesPrint (" Here, the dimensions command tells MrBayes to expect a matrix with four \n");
9678 MrBayesPrint (" taxa and 10 characters. \n");
9679 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9681 else if (!strcmp(helpTkn, "Format"))
9683 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9684 MrBayesPrint (" Format \n");
9685 MrBayesPrint (" \n");
9686 MrBayesPrint (" This command is used in a data block to define the format of the char- \n");
9687 MrBayesPrint (" acter matrix. The correct usage is \n");
9688 MrBayesPrint (" \n");
9689 MrBayesPrint (" format datatype=<name> ... <parameter>=<option> \n");
9690 MrBayesPrint (" \n");
9691 MrBayesPrint (" The format command must be the second command in a data block. The following \n");
9692 MrBayesPrint (" provides an example of the proper use of this command: \n");
9693 MrBayesPrint (" \n");
9694 MrBayesPrint (" begin data; \n");
9695 MrBayesPrint (" dimensions ntax=4 nchar=10; \n");
9696 MrBayesPrint (" format datatype=dna gap=-; \n");
9697 MrBayesPrint (" matrix \n");
9698 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9699 MrBayesPrint (" taxon_2 AAGGAT--CA \n");
9700 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9701 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9702 MrBayesPrint (" ; \n");
9703 MrBayesPrint (" end; \n");
9704 MrBayesPrint (" \n");
9705 MrBayesPrint (" Here, the format command tells MrBayes to expect a matrix with DNA char- \n");
9706 MrBayesPrint (" acters and with gaps coded as \"-\". \n");
9707 MrBayesPrint (" \n");
9708 MrBayesPrint (" The following are valid options for format: \n");
9709 MrBayesPrint (" \n");
9710 MrBayesPrint (" Datatype -- This parameter MUST BE INCLUDED in the format command. More- \n");
9711 MrBayesPrint (" over, it must be the first parameter in the line. The \n");
9712 MrBayesPrint (" datatype command specifies what type of characters are \n");
9713 MrBayesPrint (" in the matrix. The following are valid options: \n");
9714 MrBayesPrint (" Datatype = Dna: DNA states (A,C,G,T,R,Y,M,K,S,W,H,B, \n");
9715 MrBayesPrint (" V,D,N) \n");
9716 MrBayesPrint (" Datatype = Rna: DNA states (A,C,G,U,R,Y,M,K,S,W,H,B, \n");
9717 MrBayesPrint (" V,D,N) \n");
9718 MrBayesPrint (" Datatype = Protein: Amino acid states (A,R,N,D,C,Q,E, \n");
9719 MrBayesPrint (" G,H,I,L,K,M,F,P,S,T,W,Y,V) \n");
9720 MrBayesPrint (" Datatype = Restriction: Restriction site (0,1) states \n");
9721 MrBayesPrint (" Datatype = Standard: Morphological (0,1) states \n");
9722 MrBayesPrint (" Datatype = Continuous: Real number valued states \n");
9723 MrBayesPrint (" Datatype = Mixed(<type>:<range>,...,<type>:<range>): A \n");
9724 MrBayesPrint (" mixture of the above datatypes. For example, \n");
9725 MrBayesPrint (" \"datatype=mixed(dna:1-100,protein:101-200)\" \n");
9726 MrBayesPrint (" would specify a mixture of DNA and amino acid \n");
9727 MrBayesPrint (" characters with the DNA characters occupying \n");
9728 MrBayesPrint (" the first 100 sites and the amino acid char- \n");
9729 MrBayesPrint (" acters occupying the last 100 sites. \n");
9730 MrBayesPrint (" \n");
9731 MrBayesPrint (" Interleave -- This parameter specifies whether the data matrix is in \n");
9732 MrBayesPrint (" interleave format. The valid options are \"Yes\" or \"No\", \n");
9733 MrBayesPrint (" with \"No\" as the default. An interleaved matrix looks like \n");
9734 MrBayesPrint (" \n");
9735 MrBayesPrint (" format datatype=dna gap=- interleave=yes; \n");
9736 MrBayesPrint (" matrix \n");
9737 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9738 MrBayesPrint (" taxon_2 AAGGAT--CA \n");
9739 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9740 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9741 MrBayesPrint (" \n");
9742 MrBayesPrint (" taxon_1 CCTGGTAC \n");
9743 MrBayesPrint (" taxon_2 CCTGGTAC \n");
9744 MrBayesPrint (" taxon_3 ---GGTAG \n");
9745 MrBayesPrint (" taxon_4 ---GGTAG \n");
9746 MrBayesPrint (" ; \n");
9747 MrBayesPrint (" \n");
9748 MrBayesPrint (" Gap -- This parameter specifies the format for gaps. Note that \n");
9749 MrBayesPrint (" gap character can only be a single character and that it \n");
9750 MrBayesPrint (" cannot correspond to a standard state (e.g., A,C,G,T,R,Y, \n");
9751 MrBayesPrint (" M,K,S,W,H,B,V,D,N for nucleotide data). \n");
9752 MrBayesPrint (" \n");
9753 MrBayesPrint (" Missing -- This parameter specifies the format for missing data. Note \n");
9754 MrBayesPrint (" that the missing character can only be a single character and \n");
9755 MrBayesPrint (" cannot correspond to a standard state (e.g., A,C,G,T,R,Y, \n");
9756 MrBayesPrint (" M,K,S,W,H,B,V,D,N for nucleotide data). This is often an \n");
9757 MrBayesPrint (" unnecessary parameter to set because many data types, such \n");
9758 MrBayesPrint (" as nucleotide or amino acid, already have a missing char- \n");
9759 MrBayesPrint (" acter specified. However, for morphological or restriction \n");
9760 MrBayesPrint (" site data, \"missing=?\" is often used to specify ambiguity \n");
9761 MrBayesPrint (" or unobserved data. \n");
9762 MrBayesPrint (" \n");
9763 MrBayesPrint (" Matchchar -- This parameter specifies the matching character for the \n");
9764 MrBayesPrint (" matrix. For example, \n");
9765 MrBayesPrint (" \n");
9766 MrBayesPrint (" format datatype=dna gap=- matchchar=.; \n");
9767 MrBayesPrint (" matrix \n");
9768 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9769 MrBayesPrint (" taxon_2 ..G...--CA \n");
9770 MrBayesPrint (" taxon_3 .....C..C. \n");
9771 MrBayesPrint (" taxon_4 ..G.....C. \n");
9772 MrBayesPrint (" ; \n");
9773 MrBayesPrint (" \n");
9774 MrBayesPrint (" is equivalent to \n");
9775 MrBayesPrint (" \n");
9776 MrBayesPrint (" format datatype=dna gap=-; \n");
9777 MrBayesPrint (" matrix \n");
9778 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9779 MrBayesPrint (" taxon_2 AAGGAT--CA \n");
9780 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9781 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9782 MrBayesPrint (" ; \n");
9783 MrBayesPrint (" \n");
9784 MrBayesPrint (" The only non-standard NEXUS format option is the use of the \"mixed\", \n");
9785 MrBayesPrint (" \"restriction\", \"standard\" and \"continuous\" datatypes. Hence, if \n");
9786 MrBayesPrint (" you use any of these datatype specifiers, a program like PAUP* or \n");
9787 MrBayesPrint (" MacClade will report an error (as they should because MrBayes is not \n");
9788 MrBayesPrint (" strictly NEXUS compliant). \n");
9789 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9791 else if (!strcmp(helpTkn, "Matrix"))
9793 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9794 MrBayesPrint (" Matrix \n");
9795 MrBayesPrint (" \n");
9796 MrBayesPrint (" This command specifies the actual data for the phylogenetic analysis. \n");
9797 MrBayesPrint (" The character matrix should follow the dimensions and format commands \n");
9798 MrBayesPrint (" in a data block. The matrix can have all of the characters for a taxon \n");
9799 MrBayesPrint (" on a single line: \n");
9800 MrBayesPrint (" \n");
9801 MrBayesPrint (" begin data; \n");
9802 MrBayesPrint (" dimensions ntax=4 nchar=10; \n");
9803 MrBayesPrint (" format datatype=dna gap=-; \n");
9804 MrBayesPrint (" matrix \n");
9805 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9806 MrBayesPrint (" taxon_2 AAGGAT--CA \n");
9807 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9808 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9809 MrBayesPrint (" ; \n");
9810 MrBayesPrint (" end; \n");
9811 MrBayesPrint (" \n");
9812 MrBayesPrint (" or be in \"interleaved\" format: \n");
9813 MrBayesPrint (" \n");
9814 MrBayesPrint (" begin data; \n");
9815 MrBayesPrint (" dimensions ntax=4 nchar=20; \n");
9816 MrBayesPrint (" format datatype=dna gap=- interleave=yes; \n");
9817 MrBayesPrint (" matrix \n");
9818 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9819 MrBayesPrint (" taxon_2 AAGGAT--CA \n");
9820 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9821 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9822 MrBayesPrint (" \n");
9823 MrBayesPrint (" taxon_1 TTTTCGAAGC \n");
9824 MrBayesPrint (" taxon_2 TTTTCGGAGC \n");
9825 MrBayesPrint (" taxon_3 TTTTTGATGC \n");
9826 MrBayesPrint (" taxon_4 TTTTCGGAGC \n");
9827 MrBayesPrint (" ; \n");
9828 MrBayesPrint (" end; \n");
9829 MrBayesPrint (" \n");
9830 MrBayesPrint (" Note that the taxon names must not have spaces. If you really want to \n");
9831 MrBayesPrint (" indicate a space in a taxon name (perhaps between a genus and species \n");
9832 MrBayesPrint (" name), then you might use an underline (\"_\"). There should be at \n");
9833 MrBayesPrint (" least a single space after the taxon name, separating the name from \n");
9834 MrBayesPrint (" the actual data on that line. There can be spaces between the char- \n");
9835 MrBayesPrint (" acters. \n");
9836 MrBayesPrint (" \n");
9837 MrBayesPrint (" If you have mixed data, then you specify all of the data in the same \n");
9838 MrBayesPrint (" matrix. Here is an example that includes two different data types: \n");
9839 MrBayesPrint (" \n");
9840 MrBayesPrint (" begin data; \n");
9841 MrBayesPrint (" dimensions ntax=4 nchar=20; \n");
9842 MrBayesPrint (" format datatype=mixed(dna:1-10,standard:21-30) interleave=yes; \n");
9843 MrBayesPrint (" matrix \n");
9844 MrBayesPrint (" taxon_1 AACGATTCGT \n");
9845 MrBayesPrint (" taxon_2 AAGGAT--CA \n");
9846 MrBayesPrint (" taxon_3 AACGACTCCT \n");
9847 MrBayesPrint (" taxon_4 AAGGATTCCT \n");
9848 MrBayesPrint (" \n");
9849 MrBayesPrint (" taxon_1 0001111111 \n");
9850 MrBayesPrint (" taxon_2 0111110000 \n");
9851 MrBayesPrint (" taxon_3 1110000000 \n");
9852 MrBayesPrint (" taxon_4 1000001111 \n");
9853 MrBayesPrint (" ; \n");
9854 MrBayesPrint (" end; \n");
9855 MrBayesPrint (" \n");
9856 MrBayesPrint (" The matrix command is terminated by a semicolon. \n");
9857 MrBayesPrint (" \n");
9858 MrBayesPrint (" Finally, just a note on data presentation. It is much easier for others \n");
9859 MrBayesPrint (" to (1) understand your data and (2) repeat your analyses if you make \n");
9860 MrBayesPrint (" your data clean, comment it liberally (using the square brackets), and \n");
9861 MrBayesPrint (" embed the commands you used in a publication in the mrbayes block. \n");
9862 MrBayesPrint (" Remember that the data took a long time for you to collect. You might \n");
9863 MrBayesPrint (" as well spend a little time making the data file look nice and clear to \n");
9864 MrBayesPrint (" any that may later request the data for further analysis. \n");
9865 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9867 else if (!strcmp(helpTkn, "Pairs"))
9869 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9870 MrBayesPrint (" Pairs \n");
9871 MrBayesPrint (" \n");
9872 MrBayesPrint (" This command is used to specify pairs of nucleotides. For example, your \n");
9873 MrBayesPrint (" data may be RNA sequences with a known secondary structure of stems and \n");
9874 MrBayesPrint (" loops. Substitutions in nucleotides involved in a Watson-Crick pairing \n");
9875 MrBayesPrint (" in stems are not strictly independent; a change in one changes the prob- \n");
9876 MrBayesPrint (" ability of a change in the partner. A solution to this problem is to \n");
9877 MrBayesPrint (" expand the model around the pair of nucleotides in the stem. This \n");
9878 MrBayesPrint (" command allows you to do this. The correct usage is: \n");
9879 MrBayesPrint (" \n");
9880 MrBayesPrint (" pairs <NUC1>:<NUC2>, <NUC1>:<NUC2>,..., <NUC1>:<NUC2>; \n");
9881 MrBayesPrint (" \n");
9882 MrBayesPrint (" For example, \n");
9883 MrBayesPrint (" \n");
9884 MrBayesPrint (" pairs 30:56, 31:55, 32:54, 33:53, 34:52, 35:51, 36:50; \n");
9885 MrBayesPrint (" \n");
9886 MrBayesPrint (" specifies pairings between nucleotides 30 and 56, 31 and 55, etc. Only \n");
9887 MrBayesPrint (" nucleotide data (DNA or RNA) may be paired using this command. Note that \n");
9888 MrBayesPrint (" in order for the program to actually implement a \"doublet\" model \n");
9889 MrBayesPrint (" involving a 16 X 16 rate matrix, you must specify that the structure of \n");
9890 MrBayesPrint (" the model is 16 X 16 using \"lset nucmodel=doublet\". \n");
9891 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9893 else if (!strcmp(helpTkn, "Databreaks"))
9895 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9896 MrBayesPrint (" Databreaks \n");
9897 MrBayesPrint (" \n");
9898 MrBayesPrint (" This command is used to specify breaks in your input data matrix. Your \n");
9899 MrBayesPrint (" data may be a mixture of genes or a mixture of different types of data. \n");
9900 MrBayesPrint (" Some of the models implemented by MrBayes account for nonindependence at \n");
9901 MrBayesPrint (" adjacent characters. The autocorrelated gamma model, for example, allows \n");
9902 MrBayesPrint (" rates at adjacent sites to be correlated. However, there is no way for \n");
9903 MrBayesPrint (" such a model to tell whether two sites, adjacent in the matrix, are \n");
9904 MrBayesPrint (" actually separated by many kilobases or megabases in the genome. The \n");
9905 MrBayesPrint (" databreaks command allows you to specify such breaks. The correct \n");
9906 MrBayesPrint (" usage is: \n");
9907 MrBayesPrint (" \n");
9908 MrBayesPrint (" databreaks <break 1> <break 2> <break 3> ... \n");
9909 MrBayesPrint (" \n");
9910 MrBayesPrint (" For example, say you have a data matrix of 3204 characters that include \n");
9911 MrBayesPrint (" nucleotide data from three genes. The first gene covers characters 1 to \n");
9912 MrBayesPrint (" 970, the second gene covers characters 971 to 2567, and the third gene \n");
9913 MrBayesPrint (" covers characters 2568 to 3204. Also, let's assume that the genes are \n");
9914 MrBayesPrint (" not directly adjacent to one another in the genome, as might be likely \n");
9915 MrBayesPrint (" if you have mitochondrial sequences. In this case, you can specify \n");
9916 MrBayesPrint (" breaks between the genes using: \n");
9917 MrBayesPrint (" \n");
9918 MrBayesPrint (" databreaks 970 2567; \n");
9919 MrBayesPrint (" \n");
9920 MrBayesPrint (" The first break, between genes one and two, is after character 970 and \n");
9921 MrBayesPrint (" the second break, between genes two and three, is after character 2567. \n");
9922 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9924 else if (!strcmp(helpTkn, "Acknowledgments"))
9926 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9927 MrBayesPrint (" Acknowledgments \n");
9928 MrBayesPrint (" \n");
9929 MrBayesPrint (" This command shows the authors' acknowledgments. \n");
9930 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9932 else if (!strcmp(helpTkn, "About"))
9934 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9935 MrBayesPrint (" About \n");
9936 MrBayesPrint (" \n");
9937 MrBayesPrint (" This command provides some general information about the program. \n");
9938 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9940 else if (!strcmp(helpTkn, "Version"))
9942 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9943 MrBayesPrint (" Version \n");
9944 MrBayesPrint (" \n");
9945 MrBayesPrint (" This command shows the release version of the program. \n");
9946 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9948 else if (!strcmp(helpTkn, "Citations"))
9950 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9951 MrBayesPrint (" Citations \n");
9952 MrBayesPrint (" \n");
9953 MrBayesPrint (" This command shows a thorough list of citations you may consider using \n");
9954 MrBayesPrint (" when publishing the results of a MrBayes analysis. \n");
9955 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9957 else if (!strcmp(helpTkn, "Showmatrix"))
9959 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9960 MrBayesPrint (" Showmatrix \n");
9961 MrBayesPrint (" \n");
9962 MrBayesPrint (" This command shows the character matrix currently in memory. \n");
9963 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9965 else if (!strcmp(helpTkn, "Showbeagle"))
9967 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9968 MrBayesPrint (" Showbeagle \n");
9969 MrBayesPrint (" \n");
9970 MrBayesPrint (" This command shows available BEAGLE resources. \n");
9971 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9973 else if (!strcmp(helpTkn, "Speciespartition"))
9975 MrBayesPrint (" --------------------------------------------------------------------------- \n");
9976 MrBayesPrint (" Speciespartition \n");
9977 MrBayesPrint (" \n");
9978 MrBayesPrint (" Defines a partition of tips into species. The format for the speciespartition \n");
9979 MrBayesPrint (" command is \n");
9980 MrBayesPrint (" \n");
9981 MrBayesPrint (" Speciespartition <name> = <species name>:<taxon list> ,...,<sp nm>:<tx lst>\n");
9982 MrBayesPrint (" \n");
9983 MrBayesPrint (" The command enumerates comma separated list of pairs consisting of 'species \n");
9984 MrBayesPrint (" name' and 'taxon list'. The 'taxon list' is a standard taxon list, as used by \n");
9985 MrBayesPrint (" the 'Taxset' command. This means that you can use either the index or the name\n");
9986 MrBayesPrint (" of a sequence ('taxon'). Ranges are specified using a dash, and a period can \n");
9987 MrBayesPrint (" be used as a synonym of the last sequence in the matrix. \n");
9988 MrBayesPrint (" \n");
9989 MrBayesPrint (" For exammple: speciespartition species = SpeciesA: 1, SpeciesB: 2-. \n");
9990 MrBayesPrint (" Here, we name two species. SpeciesA is represented by a single sequence while \n");
9991 MrBayesPrint (" SpeciesB is represented by all remaining sequences in the matrix. \n");
9992 MrBayesPrint (" Each sequence is specified by its row index in the data matrix. \n");
9993 MrBayesPrint (" \n");
9994 MrBayesPrint (" As with ordinary partitioning you may define multiple species partitioning \n");
9995 MrBayesPrint (" scheme. You have to use command 'set speciespartition' to enable use of one of\n");
9996 MrBayesPrint (" them. \n");
9997 MrBayesPrint (" \n");
9998 MrBayesPrint (" Currently defined Speciespartitions: \n");
9999 MrBayesPrint (" \n");
10000 MrBayesPrint (" Number Speciespartition name Number of species \n");
10001 MrBayesPrint (" -------------------------------------------------------------------------- \n");
10002 for (i=0; i<numDefinedSpeciespartitions; i++)
10005 for (j=0; j<numTaxa; j++)
10007 if (tempInt < speciespartitionId[j][i])
10008 tempInt = speciespartitionId[j][i];
10010 MrBayesPrint (" %4d %-24.24s %4d",i+1, speciespartitionNames[i], tempInt);
10011 MrBayesPrint ("\n");
10013 MrBayesPrint (" \n");
10014 MrBayesPrint (" -------------------------------------------------------------------------- \n");
10016 else if (!strcmp(helpTkn, "Constraint"))
10018 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10019 MrBayesPrint (" Constraint \n");
10020 MrBayesPrint (" \n");
10021 MrBayesPrint (" This command defines a tree constraint. The format for the constraint \n");
10022 MrBayesPrint (" command is \n");
10023 MrBayesPrint (" \n");
10024 MrBayesPrint (" constraint <name> [hard|negative|partial] = <taxon list> [:<taxon list>] \n");
10025 MrBayesPrint (" \n");
10026 MrBayesPrint (" There are three types of constraint implemented in MrBayes. The type of the \n");
10027 MrBayesPrint (" constraint is specified by using one of the three keywords 'hard', 'negative',\n");
10028 MrBayesPrint (" or 'partial' right after the name of the constraint. If no type is specified, \n");
10029 MrBayesPrint (" then the constraint is assumed to be 'hard'. \n");
10030 MrBayesPrint (" \n");
10031 MrBayesPrint (" In a rooted tree, a 'hard' constraint forces the taxa in the list to form a \n");
10032 MrBayesPrint (" monophyletic group. In an unrooted tree, the taxon split that separates the \n");
10033 MrBayesPrint (" taxa in the list from other taxa is forced to be present. The interpretation \n");
10034 MrBayesPrint (" of this depends on whether the tree is rooted on a taxon outside the list or \n");
10035 MrBayesPrint (" a taxon in the list. If the outgroup is excluded , the taxa in the list are \n");
10036 MrBayesPrint (" assumed to form a monophyletic group, but if the outgroup is included, the \n");
10037 MrBayesPrint (" taxa that are not in the list are forced together. \n");
10038 MrBayesPrint (" \n");
10039 MrBayesPrint (" A 'negative' constraint bans all the trees that have the listed taxa in the \n");
10040 MrBayesPrint (" same subtree. In other words, it is the opposite of a hard constraint. \n");
10041 MrBayesPrint (" \n");
10042 MrBayesPrint (" A 'partial' or backbone constraint is defined in terms of two sets of taxa \n");
10043 MrBayesPrint (" separated by a colon character. The constraint forces all taxa in the first \n");
10044 MrBayesPrint (" list to form a monophyletic group that does not include any taxon in the \n");
10045 MrBayesPrint (" second list. Taxa that are not included in either list can be placed in any \n");
10046 MrBayesPrint (" position on the tree, either inside or outside the constrained group. In an \n");
10047 MrBayesPrint (" unrooted tree, the two taxon lists can be switched with each other with no \n");
10048 MrBayesPrint (" effect. For a rooted tree, it is the taxa in the first list that have to be \n");
10049 MrBayesPrint (" monophyletic, that is, these taxa must share a common ancestor not shared with\n");
10050 MrBayesPrint (" any taxon in the second list. The taxa in the second list may or may not fall \n");
10051 MrBayesPrint (" in a monophyletic group depending on the rooting of the tree. \n");
10052 MrBayesPrint (" \n");
10053 MrBayesPrint (" A list of taxa can be specified using a taxset, taxon names, taxon numbers, or\n");
10054 MrBayesPrint (" any combination of the above, sepatated by spaces. The constraint is treated \n");
10055 MrBayesPrint (" as an absolute requirement of trees, that is, trees that are not compatible \n");
10056 MrBayesPrint (" with the constraint have zero prior (and hence zero posterior) probabilty. \n");
10057 MrBayesPrint (" \n");
10058 MrBayesPrint (" If you are interested in inferring ancestral states for a particular node, \n");
10059 MrBayesPrint (" you need to 'hard' constrain that node first using the 'constraint' command. \n");
10060 MrBayesPrint (" The same applies if you wish to calibrate an interior node in a dated \n");
10061 MrBayesPrint (" analysis. For more information on how to infer ancestral states, see the help \n");
10062 MrBayesPrint (" for the 'report' command. For more on dating, see the 'calibrate' command. \n");
10063 MrBayesPrint (" \n");
10064 MrBayesPrint (" It is important to note that simply defining a constraint using this \n");
10065 MrBayesPrint (" command is not sufficient for the program to actually implement the \n");
10066 MrBayesPrint (" constraint in an analysis. You must also enforce the constraints using \n");
10067 MrBayesPrint (" 'prset topologypr = constraints (<list of constraints>)'. For more infor- \n");
10068 MrBayesPrint (" mation on this, see the help on the 'prset' command. \n");
10069 MrBayesPrint (" \n");
10070 MrBayesPrint (" Examples: \n");
10071 MrBayesPrint (" \n");
10072 MrBayesPrint (" constraint myclade = Homo Pan Gorilla \n");
10073 MrBayesPrint (" \n");
10074 MrBayesPrint (" Defines a hard constraint forcing Homo, Pan, and Gorilla to form a mono- \n");
10075 MrBayesPrint (" phyletic group or a split that does not include any other taxa. \n");
10076 MrBayesPrint (" \n");
10077 MrBayesPrint (" constraint forbiddenclade negative = Homo Pan Gorilla \n");
10078 MrBayesPrint (" \n");
10079 MrBayesPrint (" Defines a negative constraint that associates all trees where Homon, Pan, and \n");
10080 MrBayesPrint (" Gorilla form a monophyletic group with zero posterior probability. In other \n");
10081 MrBayesPrint (" words, such trees will not be sampled during MCMC. \n");
10082 MrBayesPrint (" \n");
10083 MrBayesPrint (" constraint backbone partial = Homo Gorilla : Mus \n");
10084 MrBayesPrint (" \n");
10085 MrBayesPrint (" Defines a partial constraint that keeps Mus outside of the clade defined by \n");
10086 MrBayesPrint (" the most recent common ancestor of Homo and Gorilla. Other taxa are allowed to\n");
10087 MrBayesPrint (" sit anywhere in the tree. Note that this particular constraint is meaningless \n");
10088 MrBayesPrint (" in unrooted trees. MrBayes does not assume anything about the position of the \n");
10089 MrBayesPrint (" outgroup unless it is explicitly included in the partial constraint. Therefore\n");
10090 MrBayesPrint (" a partial constraint must have at least two taxa on each side of the ':' to be\n");
10091 MrBayesPrint (" useful in analyses of unrooted trees. The case is different for rooted trees, \n");
10092 MrBayesPrint (" where it is sufficient for a partial constraint to have more than one taxon \n");
10093 MrBayesPrint (" before the ':', as in the example given above, to constrain tree space. \n");
10094 MrBayesPrint (" \n");
10095 MrBayesPrint (" To define a more complex constraint tree, simply combine constraints into a \n");
10096 MrBayesPrint (" list when issuing the 'prset topologypr' command. \n");
10097 MrBayesPrint (" \n");
10098 if (numDefinedConstraints > 0)
10100 MrBayesPrint (" Currently defined constraints: \n");
10101 MrBayesPrint (" \n");
10102 MrBayesPrint (" Number Constraint name type Number of taxa in[:out] \n");
10103 MrBayesPrint (" -------------------------------------------------------------------------- \n");
10105 for (i=0; i<numDefinedConstraints; i++)
10107 strncpy (tempString, constraintNames[i], 22);
10108 MrBayesPrint (" %4d %-22.22s ",i+1, tempString);
10109 if (definedConstraintsType[i] == HARD)
10110 MrBayesPrint ("hard ");
10111 else if (definedConstraintsType[i] == PARTIAL)
10112 MrBayesPrint ("partial ");
10115 assert (definedConstraintsType[i] == NEGATIVE);
10116 MrBayesPrint ("negative ");
10118 k = NumBits (definedConstraint[i], numTaxa/nBitsInALong + 1);
10119 MrBayesPrint ("%d", k);
10120 if (definedConstraintsType[i] == PARTIAL)
10122 k = NumBits (definedConstraintTwo[i], numTaxa/nBitsInALong + 1);
10123 MrBayesPrint (":%d", k);
10125 MrBayesPrint ("\n");
10127 MrBayesPrint (" \n");
10128 MrBayesPrint (" -------------------------------------------------------------------------- \n");
10130 else if (!strcmp(helpTkn, "Calibrate"))
10132 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10133 MrBayesPrint (" Calibrate \n");
10134 MrBayesPrint (" \n");
10135 MrBayesPrint (" This command dates a terminal or interior node in the tree. The format is \n");
10136 MrBayesPrint (" \n");
10137 MrBayesPrint (" calibrate <node_name> = <age_prior> \n");
10138 MrBayesPrint (" \n");
10139 MrBayesPrint (" where <node_name> is the name of a defined interior constraint node or the \n");
10140 MrBayesPrint (" name of a terminal node (tip) and <age_prior> is a prior probability distribu-\n");
10141 MrBayesPrint (" tion on the age of the node. The latter can either be a fixed date or a date \n");
10142 MrBayesPrint (" drawn from one of the available prior probability distributions. In general, \n");
10143 MrBayesPrint (" the available prior probability distributions are parameterized in terms of \n");
10144 MrBayesPrint (" the expected mean age of the distribution to facilitate for users. Some dis- \n");
10145 MrBayesPrint (" tributions put a positive probability on all ages above 0.0, while others in- \n");
10146 MrBayesPrint (" clude a minimum-age constraint and sometimes a maximum-age constraint. The \n");
10147 MrBayesPrint (" available distributions and their parameters are: \n");
10148 MrBayesPrint (" \n");
10149 MrBayesPrint (" calibrate <node_name> = fixed(<age>) \n");
10150 MrBayesPrint (" calibrate <node_name> = uniform(<min_age>,<max_age>) \n");
10151 MrBayesPrint (" calibrate <node_name> = offsetexponential(<min_age>,<mean_age>) \n");
10152 MrBayesPrint (" calibrate <node_name> = truncatednormal(<min_age>,<mean_age>,<stdev>) \n");
10153 MrBayesPrint (" calibrate <node_name> = lognormal(<mean_age>,<stdev>) \n");
10154 MrBayesPrint (" calibrate <node_name> = offsetlognormal(<min_age>,<mean_age>,<stdev>) \n");
10155 MrBayesPrint (" calibrate <node_name> = gamma(<mean_age>,<stdev>) \n");
10156 MrBayesPrint (" calibrate <node_name> = offsetgamma(<min_age>,<mean_age>,<stdev>) \n");
10157 MrBayesPrint (" \n");
10158 MrBayesPrint (" Note that mean_age is always the mean age and stdev the standard deviation of \n");
10159 MrBayesPrint (" the distribution measured in user-defined time units. This way of specifying \n");
10160 MrBayesPrint (" the distribution parameters is often different from the parameterization used \n");
10161 MrBayesPrint (" elsewhere in the program. For instance, the standard parameters of the gamma \n");
10162 MrBayesPrint (" distribution used by MrBayes are shape (alpha) and rate (beta). If you want \n");
10163 MrBayesPrint (" to use the standard parameterization, the conversions are as follows: \n");
10164 MrBayesPrint (" \n");
10165 MrBayesPrint (" exponential distributon: mean = 1 / rate \n");
10166 MrBayesPrint (" gamma distributon: mean = alpha / beta \n");
10167 MrBayesPrint (" st.dev. = square_root (alpha / beta^2) \n");
10168 MrBayesPrint (" lognormal distributon: mean = exp (mean_log + st.dev._log^2/2) \n");
10169 MrBayesPrint (" st.dev. = square_root ((exp (st.dev._log^2) - 1) \n");
10170 MrBayesPrint (" * (exp (2*mean_log + st.dev._log^2)) \n");
10171 MrBayesPrint (" \n");
10172 MrBayesPrint (" The truncated normal distribution is an exception in that the mean_age and \n");
10173 MrBayesPrint (" stdev parameters are the mean and standard deviation of the underlying non- \n");
10174 MrBayesPrint (" truncated normal distribution. The truncation will cause the modified distri- \n");
10175 MrBayesPrint (" bution to have a higher mean and lower standard deviation. The magnitude of \n");
10176 MrBayesPrint (" that effect depends on how much of the tail of the distribution is removed. \n");
10177 MrBayesPrint (" \n");
10178 MrBayesPrint (" Note that previous to version 3.2.2, MrBayes used the standard rate parameter-\n");
10179 MrBayesPrint (" ization of the offset exponential. This should not cause a problem in most \n");
10180 MrBayesPrint (" cases because the old parameterization will result in an error in more recent \n");
10181 MrBayesPrint (" versions of MrBayes, and the likely source of the error is given in the error \n");
10182 MrBayesPrint (" message. \n");
10183 MrBayesPrint (" \n");
10184 MrBayesPrint (" For a practical example, assume that we had three fossil terminals named \n");
10185 MrBayesPrint (" 'FossilA', 'FossilB', and 'FossilC'. Assume further that we want to fix the \n");
10186 MrBayesPrint (" age of FossilA to 100.0 million years, we think that FossilB is somewhere \n");
10187 MrBayesPrint (" between 100.0 and 200.0 million years old, and that FossilC is at least 300.0 \n");
10188 MrBayesPrint (" million years old, possibly older but relatively unlikely to be more than \n");
10189 MrBayesPrint (" 400.0 million years old. Then we might use the commands: \n");
10190 MrBayesPrint (" \n");
10191 MrBayesPrint (" calibrate FossilA = fixed(100) FossilB = uniform(100,200) \n");
10192 MrBayesPrint (" calibrate FossilC = offsetexponential(300,400) \n");
10193 MrBayesPrint (" \n");
10194 MrBayesPrint (" Note that it is possible to give more than one calibration for each \n");
10195 MrBayesPrint (" 'calibrate' statement. Thus, 'calibrate FossilA=<setting> FossilB=<setting>' \n");
10196 MrBayesPrint (" would be a valid statement. \n");
10197 MrBayesPrint (" \n");
10198 MrBayesPrint (" To actually use the calibrations to obtain dated trees, you also need to set \n");
10199 MrBayesPrint (" a clock model using relevant 'brlenspr' and 'nodeagepr' options of the 'prset'\n");
10200 MrBayesPrint (" command. You may also want to examine the 'clockvarpr' and 'clockratepr' op- \n");
10201 MrBayesPrint (" tions. Furthermore, you need to activate the relevant constraint(s) using \n");
10202 MrBayesPrint (" 'topologypr', if you use any dated interior nodes in the tree. \n");
10203 MrBayesPrint (" \n");
10204 MrBayesPrint (" You may wish to remove a calibration from an interior or terminal node, which \n");
10205 MrBayesPrint (" has previously been calibrated. You can do that using \n");
10206 MrBayesPrint (" \n");
10207 MrBayesPrint (" calibrate <node_name> = unconstrained \n");
10208 MrBayesPrint (" \n");
10210 for (i=0; i<numTaxa; i++)
10211 if (tipCalibration[i].prior != unconstrained)
10213 for (i=0; i<numDefinedConstraints; i++)
10214 if (nodeCalibration[i].prior != unconstrained)
10218 MrBayesPrint (" \n");
10219 MrBayesPrint (" Currently defined calibrations: \n");
10220 MrBayesPrint (" \n");
10221 MrBayesPrint (" Node name Type Calibration \n");
10222 MrBayesPrint (" ------------------------------------------------------------------ \n");
10223 for (i=0; i<numTaxa+numDefinedConstraints; i++)
10226 calibrationPtr = &tipCalibration[i];
10228 calibrationPtr = &nodeCalibration[i-numTaxa];
10229 if (calibrationPtr != NULL && calibrationPtr->prior != unconstrained)
10232 strncpy (tempString, taxaNames[i], 22);
10234 strncpy (tempString, constraintNames[i-numTaxa], 22);
10236 MrBayesPrint (" %-22.22s Terminal %s\n", tempString, calibrationPtr->name);
10238 MrBayesPrint (" %-22.22s Interior %s\n", tempString, calibrationPtr->name);
10242 MrBayesPrint (" \n");
10243 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10245 else if (!strcmp(helpTkn, "Showmodel"))
10247 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10248 MrBayesPrint (" Showmodel \n");
10249 MrBayesPrint (" \n");
10250 MrBayesPrint (" This command shows the current model settings. The correct usage is \n");
10251 MrBayesPrint (" \n");
10252 MrBayesPrint (" showmodel \n");
10253 MrBayesPrint (" \n");
10254 MrBayesPrint (" After typing \"showmodel\", the modelling assumptions are shown on a \n");
10255 MrBayesPrint (" partition-by-partition basis. \n");
10256 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10258 else if (!strcmp(helpTkn, "Execute"))
10260 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10261 MrBayesPrint (" Execute \n");
10262 MrBayesPrint (" \n");
10263 MrBayesPrint (" This command executes a file called <file name>. The correct usage is: \n");
10264 MrBayesPrint (" \n");
10265 MrBayesPrint (" execute <file name> \n");
10266 MrBayesPrint (" \n");
10267 MrBayesPrint (" For example, \n");
10268 MrBayesPrint (" \n");
10269 MrBayesPrint (" execute replicase.nex \n");
10270 MrBayesPrint (" \n");
10271 MrBayesPrint (" would execute the file named \"replicase.nex\". This file must be in the \n");
10272 MrBayesPrint (" same directory as the executable. \n");
10273 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10275 else if (!strcmp(helpTkn, "Lset"))
10277 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10278 MrBayesPrint (" Lset \n");
10279 MrBayesPrint (" \n");
10280 MrBayesPrint (" This command sets the parameters of the likelihood model. The likelihood \n");
10281 MrBayesPrint (" function is the probability of observing the data conditional on the phylo- \n");
10282 MrBayesPrint (" genetic model. In order to calculate the likelihood, you must assume a \n");
10283 MrBayesPrint (" model of character change. This command lets you tailor the biological \n");
10284 MrBayesPrint (" assumptions made in the phylogenetic model. The correct usage is \n");
10285 MrBayesPrint (" \n");
10286 MrBayesPrint (" lset <parameter>=<option> ... <parameter>=<option> \n");
10287 MrBayesPrint (" \n");
10288 MrBayesPrint (" For example, \"lset nst=6 rates=gamma\" would set the model to a general \n");
10289 MrBayesPrint (" model of DNA substition (the GTR) with gamma-distributed rate variation \n");
10290 MrBayesPrint (" across sites. \n");
10291 MrBayesPrint (" \n");
10292 MrBayesPrint (" Options: \n");
10293 MrBayesPrint (" \n");
10294 MrBayesPrint (" Applyto -- This option allows you to apply the lset commands to specific \n");
10295 MrBayesPrint (" partitions. This command should be the first in the list of \n");
10296 MrBayesPrint (" commands specified in lset. Moreover, it only makes sense to \n");
10297 MrBayesPrint (" be using this command if the data have been partitioned. A \n");
10298 MrBayesPrint (" default partition is set on execution of a matrix. If the data \n");
10299 MrBayesPrint (" are homogeneous (i.e., all of the same data type), then this \n");
10300 MrBayesPrint (" partition will not subdivide the characters. Up to 30 other \n");
10301 MrBayesPrint (" partitions can be defined, and you can switch among them using \n");
10302 MrBayesPrint (" \"set partition=<partition name>\". Now, you may want to \n");
10303 MrBayesPrint (" specify different models to different partitions of the data. \n");
10304 MrBayesPrint (" Applyto allows you to do this. For example, say you have \n");
10305 MrBayesPrint (" partitioned the data by codon position, and you want to apply \n");
10306 MrBayesPrint (" a nst=2 model to the first two partitions and nst=6 to the \n");
10307 MrBayesPrint (" last. This could be implemented in two uses of lset: \n");
10308 MrBayesPrint (" \n");
10309 MrBayesPrint (" lset applyto=(1,2) nst=2 \n");
10310 MrBayesPrint (" \n");
10311 MrBayesPrint (" lset applyto=(3) nst=6 \n");
10312 MrBayesPrint (" \n");
10313 MrBayesPrint (" The first applies the parameters after \"applyto\" to the \n");
10314 MrBayesPrint (" first and second partitions. The second lset applies nst=6 \n");
10315 MrBayesPrint (" to the third partition. You can also use applyto=(all), which \n");
10316 MrBayesPrint (" attempts to apply the parameter settings to all of the data \n");
10317 MrBayesPrint (" partitions. Importantly, if the option is not consistent with \n");
10318 MrBayesPrint (" the data in the partition, the program will not apply the \n");
10319 MrBayesPrint (" lset option to that partition. \n");
10320 MrBayesPrint (" Nucmodel -- This specifies the general form of the nucleotide substitution \n");
10321 MrBayesPrint (" model. The options are \"4by4\" [the standard model of DNA \n");
10322 MrBayesPrint (" substitution in which there are only four states (A,C,G,T/U)], \n");
10323 MrBayesPrint (" \"doublet\" (a model appropriate for modelling the stem regions \n");
10324 MrBayesPrint (" of ribosomal genes where the state space is the 16 doublets of \n");
10325 MrBayesPrint (" nucleotides), \"codon\" (the substitution model is expanded \n");
10326 MrBayesPrint (" around triplets of nucleotides--a codon), and \"Protein\" \n");
10327 MrBayesPrint (" (triplets of nucleotides are translated to amino acids, which \n");
10328 MrBayesPrint (" form the basis of the substitution model). \n");
10329 MrBayesPrint (" Nst -- Sets the number of substitution types: \"1\" constrains all of \n");
10330 MrBayesPrint (" the rates to be the same (e.g., a JC69 or F81 model); \"2\" all- \n");
10331 MrBayesPrint (" ows transitions and transversions to have potentially different \n");
10332 MrBayesPrint (" rates (e.g., a K80 or HKY85 model); \"6\" allows all rates to \n");
10333 MrBayesPrint (" be different, subject to the constraint of time-reversibility \n");
10334 MrBayesPrint (" (e.g., a GTR model). Finally, 'nst' can be set to 'mixed', which \n");
10335 MrBayesPrint (" results in the Markov chain sampling over the space of all poss- \n");
10336 MrBayesPrint (" ible reversible substitution models, including the GTR model and \n");
10337 MrBayesPrint (" all models that can be derived from it model by grouping the six \n");
10338 MrBayesPrint (" rates in various combinations. This includes all the named models\n");
10339 MrBayesPrint (" above and a large number of others, with or without name. \n");
10340 MrBayesPrint (" Code -- Enforces the use of a particular genetic code. The default \n");
10341 MrBayesPrint (" is the universal code. Other options include \"vertmt\" for \n");
10342 MrBayesPrint (" vertebrate mitocondrial, \"invermt\", \"mycoplasma\", \"yeast\", \n");
10343 MrBayesPrint (" \"ciliate\", \"echinoderm\", \"euplotid\", and \"metmt\" (for \n");
10344 MrBayesPrint (" metazoan mitochondrial except vertebrates). \n");
10345 MrBayesPrint (" Ploidy -- Specifies the ploidy of the organism. Options are \"Haploid\", \n");
10346 MrBayesPrint (" \"Diploid\" or \"Zlinked\". This option is used when a coalescent\n");
10347 MrBayesPrint (" prior is used on trees. \n");
10348 MrBayesPrint (" Rates -- Sets the model for among-site rate variation. In general, the \n");
10349 MrBayesPrint (" rate at a site is considered to be an unknown random variable. \n");
10350 MrBayesPrint (" The valid options are: \n");
10351 MrBayesPrint (" * equal -- No rate variation across sites. \n");
10352 MrBayesPrint (" * gamma -- Gamma-distributed rates across sites. The rate \n");
10353 MrBayesPrint (" at a site is drawn from a gamma distribution. \n");
10354 MrBayesPrint (" The gamma distribution has a single parameter \n");
10355 MrBayesPrint (" that describes how much rates vary. \n");
10356 MrBayesPrint (" * lnorm -- Log Normal-distributed rates across sites. The \n");
10357 MrBayesPrint (" rate at a site is drawn from a lognormal \n");
10358 MrBayesPrint (" distribution. the lognormal distribiton has a \n");
10359 MrBayesPrint (" single parameter, sigma (SD) that describes how \n");
10360 MrBayesPrint (" much rates vary (mean fixed to log(1.0) == 0.0. \n");
10361 MrBayesPrint (" * adgamma -- Autocorrelated rates across sites. The marg- \n");
10362 MrBayesPrint (" inal rate distribution is gamma, but adjacent \n");
10363 MrBayesPrint (" sites have correlated rates. \n");
10364 MrBayesPrint (" * propinv -- A proportion of the sites are invariable. \n");
10365 MrBayesPrint (" * invgamma -- A proportion of the sites are invariable while \n");
10366 MrBayesPrint (" the rate for the remaining sites are drawn from \n");
10367 MrBayesPrint (" a gamma distribution. \n");
10368 MrBayesPrint (" Note that MrBayes versions 2.0 and earlier supported options \n");
10369 MrBayesPrint (" that allowed site specific rates (e.g., ssgamma). In versions \n");
10370 MrBayesPrint (" 3.0 and later, site specific rates are allowed, but set using \n");
10371 MrBayesPrint (" the 'prset ratepr' command for each partition. \n");
10372 MrBayesPrint (" Ngammacat -- Sets the number of rate categories for the gamma distribution. \n");
10373 MrBayesPrint (" The gamma distribution is continuous. However, it is virtually \n");
10374 MrBayesPrint (" impossible to calculate likelihoods under the continuous gamma \n");
10375 MrBayesPrint (" distribution. Hence, an approximation to the continuous gamma \n");
10376 MrBayesPrint (" is used; the gamma distribution is broken into ncat categories \n");
10377 MrBayesPrint (" of equal weight (1/ncat). The mean rate for each category rep- \n");
10378 MrBayesPrint (" resents the rate for the entire cateogry. This option allows \n");
10379 MrBayesPrint (" you to specify how many rate categories to use when approx- \n");
10380 MrBayesPrint (" imating the gamma. The approximation is better as ncat is inc- \n");
10381 MrBayesPrint (" reased. In practice, \"ncat=4\" does a reasonable job of \n");
10382 MrBayesPrint (" approximating the continuous gamma. \n");
10383 MrBayesPrint (" It is also used to set the number of rate categories for the \n");
10384 MrBayesPrint (" lognormal distribution to avoid changing too much of the code, \n");
10385 MrBayesPrint (" although the name is bad (should add Nlnormcat in future). \n");
10387 /* Temporarily disable this because of conflict with likelihood calculators. It should be renamed to samplerates when reintroduced. */
10388 MrBayesPrint (" Usegibbs -- Specifies whether site probabilities under the discrete gamma \n");
10389 MrBayesPrint (" model of rate variation across sites will be summed across rate \n");
10390 MrBayesPrint (" categories ('Usegibbs=No') or sampled using a Gibbs sampler \n");
10391 MrBayesPrint (" ('Usegibbs=Yes'). The Gibbs sampling approach is much faster and \n");
10392 MrBayesPrint (" requires less memory but the likelihood of the sampled points \n");
10393 MrBayesPrint (" will be considerably higher than with the standard approach of \n");
10394 MrBayesPrint (" summing probabilities, so you need to be aware of this when com- \n");
10395 MrBayesPrint (" paring your results with those you obtain with other programs. \n");
10396 MrBayesPrint (" Assume that you are using n rate categories in your discrete \n");
10397 MrBayesPrint (" gamma distribution. Then the Gibbs approach is up to n times \n");
10398 MrBayesPrint (" faster and requires 1/n as much memory as the standard method. \n");
10399 MrBayesPrint (" Unfortunately, the state space also becomes larger so the chain \n");
10400 MrBayesPrint (" may need more time to converge. The approach should work best \n");
10401 MrBayesPrint (" for large trees, where the uncertainty concerning the best rate \n");
10402 MrBayesPrint (" category for each site is negligible. Gibbs sampling cannot be \n");
10403 MrBayesPrint (" used for the autocorrelated discrete gamma model, for standard \n");
10404 MrBayesPrint (" data, or for restriction data. Also, MrBayes will not use Gibbs \n");
10405 MrBayesPrint (" sampling when you want to infer site rates. \n");
10406 MrBayesPrint (" Gibbsfreq -- Sets the frequency with which the rate categories of the discrete\n");
10407 MrBayesPrint (" gamma will be Gibbs sampled. In practice, we have found that a \n");
10408 MrBayesPrint (" resampling frequency of every 100 MCMC generations works well for\n");
10409 MrBayesPrint (" reasonably long runs. The more frequent the Gibbs sampling, the \n");
10410 MrBayesPrint (" slower the Gibbs sampling approach will be. If you have k rate \n");
10411 MrBayesPrint (" categories and Gibbs sample them every n generations, then the \n");
10412 MrBayesPrint (" time it takes to complete n generations will roughly be propor- \n");
10413 MrBayesPrint (" tional to n+k. Compare this with the traditional approach of \n");
10414 MrBayesPrint (" summing across the n rate categories in every generation, which \n");
10415 MrBayesPrint (" requires time proportional to n*k. In practice, however, the \n");
10416 MrBayesPrint (" speed difference is not quite as large as this. \n");
10418 MrBayesPrint (" Nbetacat -- Sets the number of rate categories for the beta distribution. \n");
10419 MrBayesPrint (" A symmetric beta distribution is used to model the stationary \n");
10420 MrBayesPrint (" frequencies when morphological data are used. This option \n");
10421 MrBayesPrint (" specifies how well the beta distribution will be approximated. \n");
10422 MrBayesPrint (" Omegavar -- Allows the nonsynonymous/synonymous rate ratio (omega) to vary \n");
10423 MrBayesPrint (" across codons. Ny98 assumes that there are three classes, with \n");
10424 MrBayesPrint (" potentially different omega values (omega1, omega2, omega3): \n");
10425 MrBayesPrint (" omega2 = 1; 0 < omega1 < 1; and omega3 > 1. Like the Ny98 model, \n");
10426 MrBayesPrint (" the M3 model has three omega classes. However, their values are \n");
10427 MrBayesPrint (" less constrained, with omega1 < omega2 < omega3. The default \n");
10428 MrBayesPrint (" (omegavar = equal) has no variation on omega across sites. \n");
10429 MrBayesPrint (" Covarion -- This forces the use of a covarion-like model of substitution \n");
10430 MrBayesPrint (" for nucleotide or amino acid data. The valid options are \"yes\" \n");
10431 MrBayesPrint (" and \"no\". The covarion model allows the rate at a site to \n");
10432 MrBayesPrint (" change over its evolutionary history. Specifically, the site \n");
10433 MrBayesPrint (" is either on or off. When it is off, no substitutions are poss- \n");
10434 MrBayesPrint (" ible. When the process is on, substitutions occur according to \n");
10435 MrBayesPrint (" a specified substitution model (specified using the other \n");
10436 MrBayesPrint (" lset options). \n");
10437 MrBayesPrint (" Coding -- This specifies how characters were sampled. If all site patterns \n");
10438 MrBayesPrint (" had the possibility of being sampled, then \"All\" should be \n");
10439 MrBayesPrint (" specified (the default). Otherwise \"Variable\" (only variable \n");
10440 MrBayesPrint (" characters had the possibility of being sampled), \"Informative\"\n");
10441 MrBayesPrint (" (only parsimony informative characters has the possibility of \n");
10442 MrBayesPrint (" being sampled), \"Nosingletons\" (characters which are constant \n");
10443 MrBayesPrint (" in all but one taxon were not sampled), \"Noabsencesites\" (char-\n");
10444 MrBayesPrint (" acters for which all taxa were coded as absent were not sampled),\n");
10445 MrBayesPrint (" \"Nopresencesites\" (characters for which all taxa were coded as \n");
10446 MrBayesPrint (" present were not sampled). \"All\" works for all data types. \n");
10447 MrBayesPrint (" However, the others only work for morphological (All/Variable/ \n");
10448 MrBayesPrint (" Informative/Nosingletons) or restriction site (All/Variable/ \n");
10449 MrBayesPrint (" Informative/Nosingletons/Noabsencesites/Nopresencesites/ \n");
10450 MrBayesPrint (" Nosingletonpresence/Nosingletonabsence) data. \n");
10451 MrBayesPrint (" Parsmodel -- This forces calculation under the so-called parsimony model \n");
10452 MrBayesPrint (" described by Tuffley and Steel (1998). The options are \"yes\" \n");
10453 MrBayesPrint (" or \"no\". Note that the biological assumptions of this model \n");
10454 MrBayesPrint (" are anything but parsimonious. In fact, this model assumes many \n");
10455 MrBayesPrint (" more parameters than the next most complicated model implemented \n");
10456 MrBayesPrint (" in this program. If you really believe that the parsimony model \n");
10457 MrBayesPrint (" makes the biological assumptions described by Tuffley and Steel, \n");
10458 MrBayesPrint (" then the parsimony method is miss-named. \n");
10459 /* MrBayesPrint (" Augment -- This allows the chain to consider the missing entries of \n");
10460 MrBayesPrint (" the data matrix as random variables. A Gibbs sampler is \n");
10461 MrBayesPrint (" used to sample states. \n"); */
10462 MrBayesPrint (" \n");
10463 if (numCurrentDivisions == 0)
10466 tempInt = numCurrentDivisions;
10467 for (i=0; i<tempInt; i++)
10469 if (numCurrentDivisions == 0)
10471 MrBayesPrint (" Default model settings: \n");
10472 mp = &defaultModel;
10476 MrBayesPrint (" Model settings for partition %d: \n", i+1);
10477 mp = &modelParams[i];
10479 MrBayesPrint (" \n");
10480 MrBayesPrint (" Parameter Options Current Setting \n");
10481 MrBayesPrint (" ------------------------------------------------------------------ \n");
10482 MrBayesPrint (" Nucmodel 4by4/Doublet/Codon/Protein %s \n", mp->nucModel);
10483 MrBayesPrint (" Nst 1/2/6/Mixed %s \n", mp->nst);
10484 MrBayesPrint (" Code Universal/Vertmt/Invermt/Yeast/Mycoplasma/ \n");
10485 MrBayesPrint (" Ciliate/Echinoderm/Euplotid/Metmt %s \n", mp->geneticCode);
10486 MrBayesPrint (" Ploidy Haploid/Diploid/Zlinked %s \n", mp->ploidy);
10487 MrBayesPrint (" Rates Equal/Gamma/LNorm/Propinv/ \n");
10488 MrBayesPrint (" Invgamma/Adgamma %s \n", mp->ratesModel);
10489 MrBayesPrint (" Ngammacat <number> %d \n", mp->numGammaCats);
10491 /* Temporarily disable this because of conflict with likelihood calculators. It should be renamed to samplerates when reintroduced. */
10492 MrBayesPrint (" Usegibbs Yes/No %s \n", mp->useGibbs);
10493 MrBayesPrint (" Gibbsfreq <number> %d \n", mp->gibbsFreq);
10495 MrBayesPrint (" Nbetacat <number> %d \n", mp->numBetaCats);
10496 MrBayesPrint (" Omegavar Equal/Ny98/M3 %s \n", mp->omegaVar);
10497 MrBayesPrint (" Covarion No/Yes %s \n", mp->covarionModel);
10498 MrBayesPrint (" Coding All/Variable/Informative/Nosingletons \n");
10499 MrBayesPrint (" Noabsencesites/Nopresencesites/ \n");
10500 MrBayesPrint (" Nosingletonabsence/Nosingletonpresence %s \n", mp->codingString);
10501 MrBayesPrint (" Parsmodel No/Yes %s \n", mp->parsModel);
10502 /* MrBayesPrint (" Augment No/Yes %s \n", mp->augmentData); */
10503 MrBayesPrint (" ------------------------------------------------------------------ \n");
10504 MrBayesPrint (" \n");
10507 else if (!strcmp(helpTkn, "Prset"))
10509 MrBayesPrint (" --------------------------------------------------------------------------- \n");
10510 MrBayesPrint (" Prset \n");
10511 MrBayesPrint (" \n");
10512 MrBayesPrint (" This command sets the priors for the phylogenetic model. Remember that \n");
10513 MrBayesPrint (" in a Bayesian analysis, you must specify a prior probability distribution \n");
10514 MrBayesPrint (" for the parameters of the likelihood model. The prior distribution rep- \n");
10515 MrBayesPrint (" resents your prior beliefs about the parameter before observation of the \n");
10516 MrBayesPrint (" data. This command allows you to tailor your prior assumptions to a large \n");
10517 MrBayesPrint (" extent. \n");
10518 MrBayesPrint (" \n");
10519 MrBayesPrint (" Options: \n");
10520 MrBayesPrint (" \n");
10521 MrBayesPrint (" Applyto -- This option allows you to apply the prset commands to \n");
10522 MrBayesPrint (" specific partitions. This command should be the first \n");
10523 MrBayesPrint (" in the list of commands specified in prset. Moreover, it \n");
10524 MrBayesPrint (" only makes sense to be using this command if the data \n");
10525 MrBayesPrint (" have been partitioned. A default partition is set on \n");
10526 MrBayesPrint (" execution of a matrix. If the data are homogeneous \n");
10527 MrBayesPrint (" (i.e., all of the same data type), then this partition \n");
10528 MrBayesPrint (" will not subdivide the characters. Up to 30 other part- \n");
10529 MrBayesPrint (" itions can be defined, and you can switch among them using \n");
10530 MrBayesPrint (" \"set partition=<partition name>\". Now, you may want to \n");
10531 MrBayesPrint (" specify different priors to different partitions of the \n");
10532 MrBayesPrint (" data. Applyto allows you to do this. For example, say \n");
10533 MrBayesPrint (" you have partitioned the data by codon position, and \n");
10534 MrBayesPrint (" you want to fix the statefreqs to equal for the first two \n");
10535 MrBayesPrint (" partitions but apply a flat Dirichlet prior to the state- \n");
10536 MrBayesPrint (" freqs of the last. This could be implemented in two uses of \n");
10537 MrBayesPrint (" prset: \n");
10538 MrBayesPrint (" \n");
10539 MrBayesPrint (" prset applyto=(1,2) statefreqs=fixed(equal) \n");
10540 MrBayesPrint (" \n");
10541 MrBayesPrint (" prset applyto=(3) statefreqs=dirichlet(1,1,1,1) \n");
10542 MrBayesPrint (" \n");
10543 MrBayesPrint (" The first applies the parameters after \"applyto\" \n");
10544 MrBayesPrint (" to the first and second partitions. The second prset \n");
10545 MrBayesPrint (" applies a flat Dirichlet to the third partition. You can \n");
10546 MrBayesPrint (" also use applyto=(all), which attempts to apply the para- \n");
10547 MrBayesPrint (" meter settings to all of the data partitions. Importantly, \n");
10548 MrBayesPrint (" if the option is not consistent with the data in the part- \n");
10549 MrBayesPrint (" ition, the program will not apply the prset option to \n");
10550 MrBayesPrint (" that partition. \n");
10551 MrBayesPrint (" Tratiopr -- This parameter sets the prior for the transition/trans- \n");
10552 MrBayesPrint (" version rate ratio (tratio). The options are: \n");
10553 MrBayesPrint (" \n");
10554 MrBayesPrint (" prset tratiopr = beta(<number>, <number>) \n");
10555 MrBayesPrint (" prset tratiopr = fixed(<number>) \n");
10556 MrBayesPrint (" \n");
10557 MrBayesPrint (" The program assumes that the transition and transversion \n");
10558 MrBayesPrint (" rates are independent gamma-distributed random variables \n");
10559 MrBayesPrint (" with the same scale parameter when beta is selected. If you \n");
10560 MrBayesPrint (" want a diffuse prior that puts equal emphasis on transition/ \n");
10561 MrBayesPrint (" transversion rate ratios above 1.0 and below 1.0, then use a \n");
10562 MrBayesPrint (" flat Beta, beta(1,1), which is the default. If you wish to \n");
10563 MrBayesPrint (" concentrate this distribution more in the equal-rates region,\n");
10564 MrBayesPrint (" then use a prior of the type beta(x,x), where the magnitude \n");
10565 MrBayesPrint (" of x determines how much the prior is concentrated in the \n");
10566 MrBayesPrint (" equal rates region. For instance, a beta(20,20) puts more \n");
10567 MrBayesPrint (" probability on rate ratios close to 1.0 than a beta(1,1). If \n");
10568 MrBayesPrint (" you think it is likely that the transition/transversion rate \n");
10569 MrBayesPrint (" ratio is 2.0, you can use a prior of the type beta(2x,x), \n");
10570 MrBayesPrint (" where x determines how strongly the prior is concentrated on \n");
10571 MrBayesPrint (" tratio values near 2.0. For instance, a beta(2,1) is much \n");
10572 MrBayesPrint (" more diffuse than a beta(80,40) but both have the expected \n");
10573 MrBayesPrint (" tratio 2.0 in the absence of data. The parameters of the \n");
10574 MrBayesPrint (" Beta can be interpreted as counts: if you have observed x \n");
10575 MrBayesPrint (" transitions and y transversions, then a beta(x+1,y+1) is a \n");
10576 MrBayesPrint (" good representation of this information. The fixed option \n");
10577 MrBayesPrint (" allows you to fix the tratio to a particular value. \n");
10578 MrBayesPrint (" Revmatpr -- This parameter sets the prior for the substitution rates \n");
10579 MrBayesPrint (" of the GTR model for nucleotide data. The options are: \n");
10580 MrBayesPrint (" \n");
10581 MrBayesPrint (" prset revmatpr = dirichlet(<number>,<number>,...,<number>)\n");
10582 MrBayesPrint (" prset revmatpr = fixed(<number>,<number>,...,<number>) \n");
10583 MrBayesPrint (" \n");
10584 MrBayesPrint (" The program assumes that the six substitution rates \n");
10585 MrBayesPrint (" are independent gamma-distributed random variables with the \n");
10586 MrBayesPrint (" same scale parameter when dirichlet is selected. The six \n");
10587 MrBayesPrint (" numbers in brackets each corresponds to a particular substi- \n");
10588 MrBayesPrint (" tution type. Together, they determine the shape of the prior.\n");
10589 MrBayesPrint (" The six rates are in the order A<->C, A<->G, A<->T, C<->G, \n");
10590 MrBayesPrint (" C<->T, and G<->T. If you want an uninformative prior you can \n");
10591 MrBayesPrint (" use dirichlet(1,1,1,1,1,1), also referred to as a 'flat' \n");
10592 MrBayesPrint (" Dirichlet. This is the default setting. If you wish a prior \n");
10593 MrBayesPrint (" where the C<->T rate is 5 times and the A<->G rate 2 times \n");
10594 MrBayesPrint (" higher, on average, than the transversion rates, which are \n");
10595 MrBayesPrint (" all the same, then you should use a prior of the form \n");
10596 MrBayesPrint (" dirichlet(x,2x,x,x,5x,x), where x determines how much the \n");
10597 MrBayesPrint (" prior is focused on these particular rates. For more info, \n");
10598 MrBayesPrint (" see tratiopr. The fixed option allows you to fix the substi- \n");
10599 MrBayesPrint (" tution rates to particular values. \n");
10600 MrBayesPrint (" Revratepr -- This parameter sets the prior for each substitution rate of \n");
10601 MrBayesPrint (" the GTR model subspace when 'nst' is set to 'mixed' (see the \n");
10602 MrBayesPrint (" 'lset' command). The only option is \n");
10603 MrBayesPrint (" \n");
10604 MrBayesPrint (" prset revratepr = symdir(<number>) \n");
10605 MrBayesPrint (" \n");
10606 MrBayesPrint (" which will associate each independent rate in the rate matrix\n");
10607 MrBayesPrint (" with a modified symmetric Dirichlet prior, where a singleton \n");
10608 MrBayesPrint (" rate has the specified alpha parameter, while a rate that \n");
10609 MrBayesPrint (" applies to n pairwise substitution types has an alpha that is\n");
10610 MrBayesPrint (" n times the specified number. The higher the specified num- \n");
10611 MrBayesPrint (" ber, the more focused the prior will be on equal rates. The \n");
10612 MrBayesPrint (" default value is 1, which gives an effect similar to a flat \n");
10613 MrBayesPrint (" Dirichlet. \n");
10614 MrBayesPrint (" Aamodelpr -- This parameter sets the rate matrix for amino acid data. \n");
10615 MrBayesPrint (" You can either fix the model by specifying aamodelpr=fixed \n");
10616 MrBayesPrint (" (<model name>), where <model name> is 'poisson' (a glorified \n");
10617 MrBayesPrint (" Jukes-Cantor model), 'jones', 'dayhoff', 'mtrev', 'mtmam', \n");
10618 MrBayesPrint (" 'wag', 'rtrev', 'cprev', 'vt', 'blosum', 'lg', 'equalin' \n");
10619 MrBayesPrint (" (a glorified Felsenstein 1981 model), or 'gtr'. You can also \n");
10620 MrBayesPrint (" average over the first ten models by specifying aamodelpr= \n");
10621 MrBayesPrint (" mixed. If you do so, the Markov chain will sample each model \n");
10622 MrBayesPrint (" according to its probability. The sampled model is reported \n");
10623 MrBayesPrint (" as an index: poisson(0), jones(1), dayhoff(2), mtrev(3), \n");
10624 MrBayesPrint (" mtmam(4), wag(5), rtrev(6), cprev(7), vt(8), or blosum(9). \n");
10625 MrBayesPrint (" The 'Sump' command summarizes the MCMC samples and calculates\n");
10626 MrBayesPrint (" the posterior probability estimate for each of these models. \n");
10627 MrBayesPrint (" Aarevmatpr -- This parameter sets the prior for the substitution rates \n");
10628 MrBayesPrint (" of the GTR model for amino acid data. The options are: \n");
10629 MrBayesPrint (" \n");
10630 MrBayesPrint (" prset aarevmatpr = dirichlet(<number>,<number>,...,<number>)\n");
10631 MrBayesPrint (" prset aarevmatpr = fixed(<number>,<number>,...,<number>) \n");
10632 MrBayesPrint (" \n");
10633 MrBayesPrint (" The options are the same as those for 'Revmatpr' except that \n");
10634 MrBayesPrint (" they are defined over the 190 rates of the time-reversible \n");
10635 MrBayesPrint (" GTR model for amino acids instead of over the 6 rates of the \n");
10636 MrBayesPrint (" GTR model for nucleotides. The rates are in the order A<->R, \n");
10637 MrBayesPrint (" A<->N, etc to Y<->V. In other words, amino acids are listed \n");
10638 MrBayesPrint (" in alphabetic order based on their full name. The first amino\n");
10639 MrBayesPrint (" acid (Alanine) is then combined in turn with all amino acids \n");
10640 MrBayesPrint (" following it in the list, starting with amino acid 2 (Argi- \n");
10641 MrBayesPrint (" nine) and finishing with amino acid 20 (Valine). The second \n");
10642 MrBayesPrint (" amino acid (Arginine) is then combined in turn with all amino\n");
10643 MrBayesPrint (" acids following it, starting with amino acid 3 (Asparagine) \n");
10644 MrBayesPrint (" and finishing with amino acid 20 (Valine), and so on. \n");
10645 MrBayesPrint (" Omegapr -- This parameter specifies the prior on the nonsynonymous/ \n");
10646 MrBayesPrint (" synonymous rate ratio. The options are: \n");
10647 MrBayesPrint (" \n");
10648 MrBayesPrint (" prset omegapr = dirichlet(<number>,<number>) \n");
10649 MrBayesPrint (" prset omegapr = fixed(<number>) \n");
10650 MrBayesPrint (" \n");
10651 MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n");
10652 MrBayesPrint (" stitution model is set to codon using the lset command \n");
10653 MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n");
10654 MrBayesPrint (" case when there is no variation in omega across sites (i.e., \n");
10655 MrBayesPrint (" \"lset omegavar=equal\"). \n");
10656 MrBayesPrint (" Ny98omega1pr -- This parameter specifies the prior on the nonsynonymous/ \n");
10657 MrBayesPrint (" synonymous rate ratio for sites under purifying selection. \n");
10658 MrBayesPrint (" The options are: \n");
10659 MrBayesPrint (" \n");
10660 MrBayesPrint (" prset Ny98omega1pr = beta(<number>,<number>) \n");
10661 MrBayesPrint (" prset Ny98omega1pr = fixed(<number>) \n");
10662 MrBayesPrint (" \n");
10663 MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n");
10664 MrBayesPrint (" stitution model is set to codon using the lset command \n");
10665 MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n");
10666 MrBayesPrint (" case where omega varies across sites using the model of \n");
10667 MrBayesPrint (" Nielsen and Yang (1998) (i.e., \"lset omegavar=ny98\"). If \n");
10668 MrBayesPrint (" fixing the parameter, you must specify a number between \n");
10669 MrBayesPrint (" 0 and 1. \n");
10670 MrBayesPrint (" Ny98omega3pr -- This parameter specifies the prior on the nonsynonymous/ \n");
10671 MrBayesPrint (" synonymous rate ratio for positively selected sites. The \n");
10672 MrBayesPrint (" options are: \n");
10673 MrBayesPrint (" \n");
10674 MrBayesPrint (" prset Ny98omega3pr = uniform(<number>,<number>) \n");
10675 MrBayesPrint (" prset Ny98omega3pr = exponential(<number>) \n");
10676 MrBayesPrint (" prset Ny98omega3pr = fixed(<number>) \n");
10677 MrBayesPrint (" \n");
10678 MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n");
10679 MrBayesPrint (" stitution model is set to codon using the lset command \n");
10680 MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n");
10681 MrBayesPrint (" case where omega varies across sites according to the \n");
10682 MrBayesPrint (" NY98 model. Note that if the NY98 model is specified \n");
10683 MrBayesPrint (" that this parameter must be greater than 1, so you should \n");
10684 MrBayesPrint (" not specify a uniform(0,10) prior, for example. \n");
10685 MrBayesPrint (" M3omegapr -- This parameter specifies the prior on the nonsynonymous/ \n");
10686 MrBayesPrint (" synonymous rate ratios for all three classes of sites for \n");
10687 MrBayesPrint (" the M3 model. The options are: \n");
10688 MrBayesPrint (" \n");
10689 MrBayesPrint (" prset M3omegapr = exponential \n");
10690 MrBayesPrint (" prset M3omegapr = fixed(<number>,<number>,<number>) \n");
10691 MrBayesPrint (" \n");
10692 MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n");
10693 MrBayesPrint (" stitution model is set to codon using the lset command \n");
10694 MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n");
10695 MrBayesPrint (" case where omega varies across sites using the M3 model of \n");
10696 MrBayesPrint (" Yang et al. (2000) (i.e., \"lset omegavar=M3\"). Under the \n");
10697 MrBayesPrint (" exponential prior, the four rates (dN1, dN2, dN3, and dS) \n");
10698 MrBayesPrint (" are all considered to be independent draws from the same \n");
10699 MrBayesPrint (" exponential distribution (the parameter of the exponential \n");
10700 MrBayesPrint (" does not matter, and so you don't need to specify it). The \n");
10701 MrBayesPrint (" rates dN1, dN2, and dN3 are taken to be the order statistics \n");
10702 MrBayesPrint (" with dN1 < dN2 < dN3. These three rates are all scaled to \n");
10703 MrBayesPrint (" the same synonymous rate, dS. The other option is to simply \n");
10704 MrBayesPrint (" fix the three rate ratios to some values. \n");
10705 MrBayesPrint (" Codoncatfreqs -- This parameter specifies the prior on frequencies of sites \n");
10706 MrBayesPrint (" under purifying, neutral, and positive selection. The \n");
10707 MrBayesPrint (" options are: \n");
10708 MrBayesPrint (" \n");
10709 MrBayesPrint (" prset codoncatfreqs = dirichlet(<num>,<num>,<num>) \n");
10710 MrBayesPrint (" prset codoncatfreqs = fixed(<number>,<number>,<number>) \n");
10711 MrBayesPrint (" \n");
10712 MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n");
10713 MrBayesPrint (" stitution model is set to codon using the lset command \n");
10714 MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n");
10715 MrBayesPrint (" case where omega varies across sites using the models of \n");
10716 MrBayesPrint (" Nielsen and Yang (1998) (i.e., \"lset omegavar=ny98\") \n");
10717 MrBayesPrint (" or Yang et al. (2000) (i.e., \"lset omegavar=M3\") \n");
10718 MrBayesPrint (" Note that the sum of the three frequencies must be 1. \n");
10719 MrBayesPrint (" Statefreqpr -- This parameter specifies the prior on the state freq- \n");
10720 MrBayesPrint (" uencies. The options are: \n");
10721 MrBayesPrint (" \n");
10722 MrBayesPrint (" prset statefreqpr = dirichlet(<number>) \n");
10723 MrBayesPrint (" prset statefreqpr = dirichlet(<number>,...,<number>) \n");
10724 MrBayesPrint (" prset statefreqpr = fixed(equal) \n");
10725 MrBayesPrint (" prset statefreqpr = fixed(empirical) \n");
10726 MrBayesPrint (" prset statefreqpr = fixed(<number>,...,<number>) \n");
10727 MrBayesPrint (" \n");
10728 MrBayesPrint (" For the dirichlet, you can specify either a single number \n");
10729 MrBayesPrint (" or as many numbers as there are states. If you specify a \n");
10730 MrBayesPrint (" single number, then the prior has all states equally \n");
10731 MrBayesPrint (" probable with a variance related to the single parameter \n");
10732 MrBayesPrint (" passed in. \n");
10733 MrBayesPrint (" Shapepr -- This parameter specifies the prior for the gamma/lnorm shape \n");
10734 MrBayesPrint (" parameter for among-site rate variation. The options are: \n");
10735 MrBayesPrint (" \n");
10736 MrBayesPrint (" prset shapepr = uniform(<number>,<number>) \n");
10737 MrBayesPrint (" prset shapepr = exponential(<number>) \n");
10738 MrBayesPrint (" prset shapepr = fixed(<number>) \n");
10739 MrBayesPrint (" \n");
10740 MrBayesPrint (" Pinvarpr -- This parameter specifies the prior for the proportion of \n");
10741 MrBayesPrint (" invariable sites. The options are: \n");
10742 MrBayesPrint (" \n");
10743 MrBayesPrint (" prset pinvarpr = uniform(<number>,<number>) \n");
10744 MrBayesPrint (" prset pinvarpr = fixed(<number>) \n");
10745 MrBayesPrint (" \n");
10746 MrBayesPrint (" Note that the valid range for the parameter is between 0 \n");
10747 MrBayesPrint (" and 1. Hence, \"prset pinvarpr=uniform(0,0.8)\" is valid \n");
10748 MrBayesPrint (" while \"prset pinvarpr=uniform(0,10)\" is not. The def- \n");
10749 MrBayesPrint (" ault setting is \"prset pinvarpr=uniform(0,1)\". \n");
10750 MrBayesPrint (" Ratecorrpr -- This parameter specifies the prior for the autocorrelation \n");
10751 MrBayesPrint (" parameter of the autocorrelated gamma distribution for \n");
10752 MrBayesPrint (" among-site rate variation. The options are: \n");
10753 MrBayesPrint (" \n");
10754 MrBayesPrint (" prset ratecorrpr = uniform(<number>,<number>) \n");
10755 MrBayesPrint (" prset ratecorrpr = fixed(<number>) \n");
10756 MrBayesPrint (" \n");
10757 MrBayesPrint (" Note that the valid range for the parameter is between -1 \n");
10758 MrBayesPrint (" and 1. Hence, \"prset ratecorrpr=uniform(-1,1)\" is valid \n");
10759 MrBayesPrint (" while \"prset ratecorrpr=uniform(-11,10)\" is not. The \n");
10760 MrBayesPrint (" default setting is \"prset ratecorrpr=uniform(-1,1)\". \n");
10761 MrBayesPrint (" Covswitchpr -- This option sets the prior for the covarion switching \n");
10762 MrBayesPrint (" rates. The options are: \n");
10763 MrBayesPrint (" \n");
10764 MrBayesPrint (" prset covswitchpr = uniform(<number>,<number>) \n");
10765 MrBayesPrint (" prset covswitchpr = exponential(<number>) \n");
10766 MrBayesPrint (" prset covswitchpr = fixed(<number>,<number>) \n");
10767 MrBayesPrint (" \n");
10768 MrBayesPrint (" The covarion model has two rates: a rate from on to off \n");
10769 MrBayesPrint (" and a rate from off to on. The rates are assumed to have \n");
10770 MrBayesPrint (" independent priors that individually are either uniformly \n");
10771 MrBayesPrint (" or exponentially distributed. The other option is to \n");
10772 MrBayesPrint (" fix the switching rates, in which case you must specify \n");
10773 MrBayesPrint (" both rates. (The first number is off->on and the second \n");
10774 MrBayesPrint (" is on->off). \n");
10775 MrBayesPrint (" Symdirihyperpr - This option sets the prior for the stationary frequencies \n");
10776 MrBayesPrint (" of the states for morphological (standard) data. There can \n");
10777 MrBayesPrint (" be as many as 10 states for standard data. However, the \n");
10778 MrBayesPrint (" labelling of the states is somewhat arbitrary. For example, \n");
10779 MrBayesPrint (" the state \"1\" for different characters does not have the \n");
10780 MrBayesPrint (" same meaning. This is not true for DNA characters, for ex- \n");
10781 MrBayesPrint (" ample, where a \"G\" has the same meaning across characters. \n");
10782 MrBayesPrint (" The fact that the labelling of morphological characters is \n");
10783 MrBayesPrint (" arbitrary makes it difficult to allow unequal character- \n");
10784 MrBayesPrint (" state frequencies. MrBayes gets around this problem by \n");
10785 MrBayesPrint (" assuming that the states have a symmetric Dirichlet prior \n");
10786 MrBayesPrint (" (i.e. all Dirichlet parameters are equal). The variation in \n");
10787 MrBayesPrint (" the Dirichlet can be controlled by this parameter. \n");
10788 MrBayesPrint (" Symdirihyperpr specifies the distribution on the parameter \n");
10789 MrBayesPrint (" of the symmetric Dirichlet. The valid options are: \n");
10790 MrBayesPrint (" \n");
10791 MrBayesPrint (" prset Symdirihyperpr = uniform(<number>,<number>) \n");
10792 MrBayesPrint (" prset Symdirihyperpr = exponential(<number>) \n");
10793 MrBayesPrint (" prset Symdirihyperpr = fixed(<number>) \n");
10794 MrBayesPrint (" prset Symdirihyperpr = fixed(infinity) \n");
10795 MrBayesPrint (" \n");
10796 MrBayesPrint (" If \"fixed(infinity)\" is chosen, the Dirichlet prior is \n");
10797 MrBayesPrint (" fixed such that all character states have equal frequency. \n");
10798 MrBayesPrint (" Topologypr -- This parameter specifies the prior probabilities of \n");
10799 MrBayesPrint (" phylogenies. The options are: \n");
10800 MrBayesPrint (" \n");
10801 MrBayesPrint (" prset topologypr = uniform \n");
10802 MrBayesPrint (" prset topologypr = speciestree \n");
10803 MrBayesPrint (" prset topologypr = constraints(<list>) \n");
10804 MrBayesPrint (" prset topologypr = fixed(<treename>) \n");
10805 MrBayesPrint (" \n");
10806 MrBayesPrint (" If the prior is selected to be \"uniform\", the default, \n");
10807 MrBayesPrint (" then all possible trees are considered a priori equally \n");
10808 MrBayesPrint (" probable. The 'speciestree' option is used when the topology \n");
10809 MrBayesPrint (" is constrained to fold inside a species tree together with \n");
10810 MrBayesPrint (" other (gene) trees. The constraints option allows you to \n");
10811 MrBayesPrint (" specify complicated prior probabilities on trees (constraints\n");
10812 MrBayesPrint (" are discussed more fully in \"help constraint\"). Note that \n");
10813 MrBayesPrint (" you must specify a list of constraints that you wish to be \n");
10814 MrBayesPrint (" obeyed. The list can be either the constraints' name or \n");
10815 MrBayesPrint (" number. Finally, you can fix the topology to that of a user \n");
10816 MrBayesPrint (" tree defined in a trees block. Branch lengths will still be \n");
10817 MrBayesPrint (" sampled as usual on the fixed topology. \n");
10818 MrBayesPrint (" Brlenspr -- This parameter specifies the prior probability dist- \n");
10819 MrBayesPrint (" ribution on branch lengths. The options are specified using: \n");
10820 MrBayesPrint (" \n");
10821 MrBayesPrint (" prset brlenspr = <setting> \n");
10822 MrBayesPrint (" \n");
10823 MrBayesPrint (" where <setting> is one of \n");
10824 MrBayesPrint (" \n");
10825 MrBayesPrint (" unconstrained:uniform(<num>,<num>) \n");
10826 MrBayesPrint (" unconstrained:exponential(<number>) \n");
10827 MrBayesPrint (" unconstrained:twoexp(<num>,<num>) \n");
10828 MrBayesPrint (" unconstrained:gammadir(<num>,<num>,<num>,<num>) \n");
10829 MrBayesPrint (" unconstrained:invgamdir(<num>,<num>,<num>,<num>) \n");
10830 MrBayesPrint (" clock:uniform \n");
10831 MrBayesPrint (" clock:birthdeath \n");
10832 MrBayesPrint (" clock:coalescence \n");
10833 MrBayesPrint (" clock:fossilization \n");
10834 MrBayesPrint (" clock:speciestree \n");
10835 MrBayesPrint (" fixed(<treename>) \n");
10836 MrBayesPrint (" \n");
10837 MrBayesPrint (" Trees with unconstrained branch lengths are unrooted \n");
10838 MrBayesPrint (" whereas clock-constrained trees are rooted. The option \n");
10839 MrBayesPrint (" after the colon specifies the details of the probability \n");
10840 MrBayesPrint (" density of branch lengths. If you choose a birth-death \n");
10841 MrBayesPrint (" or coalescence prior, you may want to modify the details \n");
10842 MrBayesPrint (" of the parameters of those processes (speciation rate, \n");
10843 MrBayesPrint (" extinction rate and sample probability for the birth-death \n");
10844 MrBayesPrint (" prior; population size and clock rate parameter for the \n");
10845 MrBayesPrint (" coalescence prior). When gene trees are constrained to fold \n");
10846 MrBayesPrint (" inside species trees, the appropriate branch length prior is \n");
10847 MrBayesPrint (" 'clock:speciestree'. Under this model, it is possible to \n");
10848 MrBayesPrint (" control whether the population size is constant or variable \n");
10849 MrBayesPrint (" across the species tree using the 'popvarpr' setting. \n");
10850 MrBayesPrint (" Branch lengths can also be fixed but only if the topology is \n");
10851 MrBayesPrint (" fixed. \n");
10852 MrBayesPrint (" \n");
10853 MrBayesPrint (" For unconstrained branch lengths, MrBayes offers five alter- \n");
10854 MrBayesPrint (" native prior distributions. The first two are the simple \n");
10855 MrBayesPrint (" 'uniform' and 'exponential' priors. The 'uniform' prior takes\n");
10856 MrBayesPrint (" two parameters, the lower and upper bound of the uniform dis-\n");
10857 MrBayesPrint (" tribution, respectively. The 'exponential' prior takes a sin-\n");
10858 MrBayesPrint (" gle parameter, the rate of the exponential distribution. The \n");
10859 MrBayesPrint (" mean of the exponential distribution is the inverse of the \n");
10860 MrBayesPrint (" rate. For instance, an 'exp(10)' distribution has an expected\n");
10861 MrBayesPrint (" mean of 0.1. \n");
10862 MrBayesPrint (" MrBayes also offers three more complex prior distributions \n");
10863 MrBayesPrint (" on unconstrained branch lengths. The two-exponential prior \n");
10864 MrBayesPrint (" (Yang and Rannala 2005; Yang 2007) uses two different expo- \n");
10865 MrBayesPrint (" nential distributions, one for internal and one for external \n");
10866 MrBayesPrint (" branch lengths. The two-exponential prior is invoked using \n");
10867 MrBayesPrint (" 'twoexp(<r_I>,<r_E>)', where '<r_I>' is a number specifying \n");
10868 MrBayesPrint (" the rate of the exponential distribution on internal branch \n");
10869 MrBayesPrint (" lengths, while '<r_E>' is the rate for external branch \n");
10870 MrBayesPrint (" lengths. The prior mean for internal branch lengths is then \n");
10871 MrBayesPrint (" 1/r_I, and for external ones is 1/r_E. For instance, to set \n");
10872 MrBayesPrint (" prior mean of internal branch lengths to 0.01, and external \n");
10873 MrBayesPrint (" ones to 0.1, use 'twoexp(100,10)'. \n");
10874 MrBayesPrint (" The setting 'twoexp(10,10)' is equivalent to 'exp(10)'. \n");
10875 MrBayesPrint (" The compound Dirichlet priors 'gammadir(<a_T>,<b_T>,<a>,<c>)'\n");
10876 MrBayesPrint (" and 'invgamdir(<a_T>,<b_T>,<a>,<c>)' specify a fairly diffuse\n");
10877 MrBayesPrint (" prior on tree length 'T', and then partition the tree length \n");
10878 MrBayesPrint (" into branch lengths according to a Dirichlet distribution \n");
10879 MrBayesPrint (" (Rannala et al. 2012). If 'T' is considered drawn from a \n");
10880 MrBayesPrint (" gamma distribution with parameters a_T and b_T, and with mean\n");
10881 MrBayesPrint (" a_T/b_T, we recommend setting a_T = 1; if it is instead con- \n");
10882 MrBayesPrint (" sidered drawn from an inverse gamma (invgamma) distribution \n");
10883 MrBayesPrint (" with parameters a_T and b_T, and with mean b_T/(a_T -1), then\n");
10884 MrBayesPrint (" we reccommend setting a_T = 3. In the latter case, b_T should\n");
10885 MrBayesPrint (" be chosen so that the prior mean of T is reasonable for the \n");
10886 MrBayesPrint (" data. In the former case, setting b_T = 0.1 (corresponding to\n");
10887 MrBayesPrint (" a mean tree length of 10) should be appropriate for a wide \n");
10888 MrBayesPrint (" range of tree lengths (at least in the interval 1 to 100). \n");
10889 MrBayesPrint (" The concentration parameter a of the Dirichlet distribution \n");
10890 MrBayesPrint (" is inversely related to the variance of the branch lengths, \n");
10891 MrBayesPrint (" while c is the ratio of the prior means for the internal and \n");
10892 MrBayesPrint (" external branch lengths. The default setting, a = c = 1, \n");
10893 MrBayesPrint (" specifies a uniform Dirichlet distribution of branch lengths \n");
10894 MrBayesPrint (" given the tree length. For instance, 'gammadir(1,0.1,1,1)' \n");
10895 MrBayesPrint (" specifies a compound Dirichlet prior on branch lengths, where\n");
10896 MrBayesPrint (" tree length is associated with a gamma distribution with mean\n");
10897 MrBayesPrint (" 10, and branch length proportions are associated with a uni- \n");
10898 MrBayesPrint (" form Dirichlet distribution (default). \n");
10899 MrBayesPrint (" \n");
10900 MrBayesPrint (" For clock trees with calibrated external nodes (fossils), \n");
10901 MrBayesPrint (" MrBayes also offers the fossilized birth-death prior: \n");
10902 MrBayesPrint (" 'clock:fossilization'. \n");
10903 MrBayesPrint (" If 'SampleStrat' is set to 'fossiltip', it assumes that upon \n");
10904 MrBayesPrint (" sampling the lineage is dead and won't produce descendants, \n");
10905 MrBayesPrint (" meaning each fossil sample is a tip. If 'SampleStrat' is set \n");
10906 MrBayesPrint (" to 'random' (default), fossils are sampled serially along the\n");
10907 MrBayesPrint (" birth-death tree (Stadler 2010), so they can be tips or an- \n");
10908 MrBayesPrint (" cestors. See 'Speciationpr', 'Extinctionpr', 'SampleStrat', \n");
10909 MrBayesPrint (" 'Fossilizationpr' for more information. \n");
10910 MrBayesPrint (" \n");
10911 MrBayesPrint (" Treeagepr -- This parameter specifies the prior probability distribution \n");
10912 MrBayesPrint (" on the tree age when a uniform or fossilization prior is used\n");
10913 MrBayesPrint (" on the branch lengths of a clock tree. \n");
10914 MrBayesPrint (" \n");
10915 MrBayesPrint (" The options are: \n");
10916 MrBayesPrint (" \n");
10917 MrBayesPrint (" prset treeagepr = <setting> \n");
10918 MrBayesPrint (" \n");
10919 MrBayesPrint (" where <setting> is one of \n");
10920 MrBayesPrint (" \n");
10921 MrBayesPrint (" fixed(<age>) \n");
10922 MrBayesPrint (" uniform(<min_age>,<max_age>) \n");
10923 MrBayesPrint (" offsetexponential(<min_age>,<mean_age>) \n");
10924 MrBayesPrint (" truncatednormal(<min_age>,<mean_age>,<st.dev.>) \n");
10925 MrBayesPrint (" lognormal(<mean_age>,<st.dev.>) \n");
10926 MrBayesPrint (" offsetlognormal(<min_age>,<mean_age>,<st.dev.>) \n");
10927 MrBayesPrint (" gamma(<mean_age>,<st.dev.>) \n");
10928 MrBayesPrint (" offsetgamma(<min_age>,<mean_age>,<st.dev.>) \n");
10929 MrBayesPrint (" \n");
10930 MrBayesPrint (" These are the same options used for the 'Calibrate' command. \n");
10931 MrBayesPrint (" Note that, unlike elsewhere in MrMayes, we always use the \n");
10932 MrBayesPrint (" mean and standard deviation of the resulting age distribution\n");
10933 MrBayesPrint (" rather than the standard parameterization, if different. This\n");
10934 MrBayesPrint (" is to facilitate for the users who want to focus on the in- \n");
10935 MrBayesPrint (" formation conveyed about the age. For those who wish to use \n");
10936 MrBayesPrint (" the standard parameterization, there are simple conversions \n");
10937 MrBayesPrint (" between the two. See the 'Calibrate' command for more infor- \n");
10938 MrBayesPrint (" mation. \n");
10939 MrBayesPrint (" \n");
10940 MrBayesPrint (" The tree age is simply the age of the most recent common \n");
10941 MrBayesPrint (" ancestor of the tree. If the clock rate is fixed to 1.0, \n");
10942 MrBayesPrint (" which is the default, the tree age is equivalent to the \n");
10943 MrBayesPrint (" expected number of substitutions from the root to the tip of \n");
10944 MrBayesPrint (" the tree, that is, tree height. The tree age prior ensures \n");
10945 MrBayesPrint (" that the joint probability for the uniform prior (or fossil- \n");
10946 MrBayesPrint (" ization prior) model of branch lengths on a clock tree is \n");
10947 MrBayesPrint (" proper. The default setting is 'gamma(1,1)'. If the root node\n");
10948 MrBayesPrint (" in the tree is calibrated, the root calibration replaces the \n");
10949 MrBayesPrint (" tree age prior. \n");
10950 MrBayesPrint (" Speciationpr -- This parameter sets the prior on the net speciation rate (net\n");
10951 MrBayesPrint (" diversification), that is, (lambda - mu) in the birth-death \n");
10952 MrBayesPrint (" model and the general case of fossilized birth-death model. \n");
10953 MrBayesPrint (" Or, (lambda - mu - psi) in the special case of f-b-d model \n");
10954 MrBayesPrint (" (fossiltip). Values of this parameter are > 0. Prior options:\n");
10955 MrBayesPrint (" \n");
10956 MrBayesPrint (" prset speciationpr = uniform(<number>,<number>) \n");
10957 MrBayesPrint (" prset speciationpr = exponential(<number>) \n");
10958 MrBayesPrint (" prset speciationpr = fixed(<number>) \n");
10959 MrBayesPrint (" \n");
10960 MrBayesPrint (" This parameter is only relevant if the (fossil) birth-death \n");
10961 MrBayesPrint (" process is selected as the prior on branch lengths. \n");
10962 MrBayesPrint (" Extinctionpr -- This parameter sets the prior on the relative extinction rate\n");
10963 MrBayesPrint (" (turnover), that is, (mu / lambda) in the birth-death model \n");
10964 MrBayesPrint (" and the general case of fossilized birth-death model. \n");
10965 MrBayesPrint (" Or, (mu + psi) / lambda in the special case of f-b-d model \n");
10966 MrBayesPrint (" (fossiltip). Values of this parameter are in range (0,1). \n");
10967 MrBayesPrint (" \n");
10968 MrBayesPrint (" prset extinctionpr = beta(<number>,<number>) \n");
10969 MrBayesPrint (" prset extinctionpr = fixed(<number>) \n");
10970 MrBayesPrint (" \n");
10971 MrBayesPrint (" This parameter is only relevant if the (fossil) birth-death \n");
10972 MrBayesPrint (" process is selected as the prior on branch lengths. \n");
10973 MrBayesPrint (" Fossilizationpr -- This parameter sets the prior on the relative fossilization \n");
10974 MrBayesPrint (" rate (sampling proportion), psi/(mu+psi), in the fossilized \n");
10975 MrBayesPrint (" b-d model. Values of this parameter are in range (0,1). \n");
10976 MrBayesPrint (" If SampleStrat is used to divide up time intervals, it sets \n");
10977 MrBayesPrint (" the prior for the fossilization parameter in each interval. \n");
10978 MrBayesPrint (" \n");
10979 MrBayesPrint (" prset fossilizationpr = beta(<number>,<number>) \n");
10980 MrBayesPrint (" prset fossilizationpr = fixed(<number>) \n");
10981 MrBayesPrint (" \n");
10982 MrBayesPrint (" This parameter is only relevant if the fossilized birth-death\n");
10983 MrBayesPrint (" process is selected as the prior on branch lengths. \n");
10984 MrBayesPrint (" SampleStrat -- This parameter sets the strategy under which species were \n");
10985 MrBayesPrint (" sampled in the analysis. For the birth-death prior, 'birth- \n");
10986 MrBayesPrint (" death' (Hohna et al. 2011), three strategies: 'random', \n");
10987 MrBayesPrint (" 'diversity' and 'cluster' sampling can be used for extant \n");
10988 MrBayesPrint (" taxa. No extinct sample (fossil) is allowed in this prior. \n");
10989 MrBayesPrint (" For data with extant and extinct samples, use 'prset brlenspr\n");
10990 MrBayesPrint (" =clock:fossilization'. (Stadler 2010; Zhang et al. 2015) \n");
10991 MrBayesPrint (" For the fossilized birth-death prior, 'fossiltip' assumes \n");
10992 MrBayesPrint (" extant taxa are sampled randomly, and extinct taxa (fossils) \n");
10993 MrBayesPrint (" are sampled with constant rate and upon sampling the lineage \n");
10994 MrBayesPrint (" is dead and won't produce any descendant. So fossils are all \n");
10995 MrBayesPrint (" at tips. Except 'fossiltip', the following strategies allow \n");
10996 MrBayesPrint (" fossils also being ancestors of other samples. \n");
10997 MrBayesPrint (" 'random' (default) assumes extant taxa are sampled randomly \n");
10998 MrBayesPrint (" with prob rho, while fossils are sampled on the birth-death \n");
10999 MrBayesPrint (" tree with piecewise constant rates, psi_i (i = 1,...,s+1). \n");
11000 MrBayesPrint (" 'diversity' assumes extant taxa are sampled to maximize \n");
11001 MrBayesPrint (" diversity, while fossils are sampled randomly. \n");
11002 MrBayesPrint (" Time is divided by <s> slice samping events in the past, each\n");
11003 MrBayesPrint (" at time <t_i> with probability <rho_i> (s >= 0). If rho_i = 0\n");
11004 MrBayesPrint (" the slice is only used to divide up time intervals not for \n");
11005 MrBayesPrint (" sampling of fossils. Extant taxa are sampled with prob. \n");
11006 MrBayesPrint (" (proportion) rho (set in sampleprob). \n");
11007 MrBayesPrint (" \n");
11008 MrBayesPrint (" prset samplestrat = random \n");
11009 MrBayesPrint (" prset samplestrat = diversity \n");
11010 MrBayesPrint (" prset samplestrat = cluster \n");
11011 MrBayesPrint (" prset samplestrat = fossiltip \n");
11012 MrBayesPrint (" prset samplestrat = random <s>:...,<t_i> <rho_i>,... \n");
11013 MrBayesPrint (" prset samplestrat = diversity <s>:...,<t_i> <rho_i>,... \n");
11014 MrBayesPrint (" \n");
11015 MrBayesPrint (" Sampleprob -- This parameter sets the fraction of extant species that are \n");
11016 MrBayesPrint (" sampled in the analysis. This is used with the birth-death \n");
11017 MrBayesPrint (" prior on trees (Yang and Rannala 1997; Stadler 2009; Hohna \n");
11018 MrBayesPrint (" et al. 2011), and the fossilized birth-death prior (Stadler \n");
11019 MrBayesPrint (" 2010, Zhang et al. 2015). \n");
11020 MrBayesPrint (" \n");
11021 MrBayesPrint (" prset sampleprob = <number> \n");
11022 MrBayesPrint (" \n");
11023 MrBayesPrint (" Popsizepr -- This parameter sets the prior on the population size compo- \n");
11024 MrBayesPrint (" nent of the coalescent parameter. The options are: \n");
11025 MrBayesPrint (" \n");
11026 MrBayesPrint (" prset popsizepr = uniform(<number>,<number>) \n");
11027 MrBayesPrint (" prset popsizepr = lognormal(<number>,<number>) \n");
11028 MrBayesPrint (" prset popsizepr = normal(<number>,<number>) \n");
11029 MrBayesPrint (" prset popsizepr = gamma(<number>,<number>) \n");
11030 MrBayesPrint (" prset popsizepr = fixed(<number>) \n");
11031 MrBayesPrint (" \n");
11032 MrBayesPrint (" This parameter is only relevant if the coalescence process is\n");
11033 MrBayesPrint (" selected as the prior on branch lengths. Note that the set- \n");
11034 MrBayesPrint (" ting of 'ploidy' in 'lset' is important for how this para- \n");
11035 MrBayesPrint (" meter is interpreted. \n");
11036 MrBayesPrint (" Popvarpr -- In a gene tree - species tree model, this parameter deter- \n");
11037 MrBayesPrint (" mines whether the population size is the same for the entire \n");
11038 MrBayesPrint (" species tree ('popvarpr = equal', the default), or varies \n");
11039 MrBayesPrint (" across branches of the species tree ('popvarpr=variable'). \n");
11040 /* MrBayesPrint (" Growthpr -- This parameter sets the prior on the exponential growth \n");
11041 MrBayesPrint (" parameter of the coalescence process. The options are: \n");
11042 MrBayesPrint (" \n");
11043 MrBayesPrint (" prset growthpr = uniform(<number>,<number>) \n");
11044 MrBayesPrint (" prset growthpr = exponential(<number>) \n");
11045 MrBayesPrint (" prset growthpr = fixed(<number>) \n");
11046 MrBayesPrint (" \n");
11047 MrBayesPrint (" This parameter is only relevant if the coalescence \n");
11048 MrBayesPrint (" process is selected as the prior on branch lengths. \n"); */
11049 MrBayesPrint (" Nodeagepr -- This parameter specifies the assumptions concerning the age \n");
11050 MrBayesPrint (" of the terminal and interior nodes in the tree. The default \n");
11051 MrBayesPrint (" model ('nodeagepr = unconstrained') assumes that all terminal\n");
11052 MrBayesPrint (" nodes are of the same age while the age of interior nodes is \n");
11053 MrBayesPrint (" unconstrained. The alternative ('nodeagepr = calibrated') \n");
11054 MrBayesPrint (" option derives a prior probability distribution on terminal \n");
11055 MrBayesPrint (" and interior node ages from the calibration settings (see \n");
11056 MrBayesPrint (" the 'calibrate' command). The 'nodeagepr' parameter is only \n");
11057 MrBayesPrint (" relevant for clock trees. \n");
11058 MrBayesPrint (" Clockratepr -- This parameter specifies the prior assumptions concerning the\n");
11059 MrBayesPrint (" base substitution rate of the tree, measured in expected num-\n");
11060 MrBayesPrint (" ber of substitutions per site per time unit. The default set-\n");
11061 MrBayesPrint (" ting is 'Fixed(1.0)', which effectively means that the time \n");
11062 MrBayesPrint (" unit is the number of expected substitutions per site. \n");
11063 /* MrBayesPrint (" If you apply age constraints to the tree, the default setting\n");
11064 MrBayesPrint (" changes automatically to 'Exponential(<x>)', where '<x>' (the\n");
11065 MrBayesPrint (" rate of exponential) is ten times the age of the maximum age \n");
11066 MrBayesPrint (" constraint. This will give you a very vague prior, which may \n");
11067 MrBayesPrint (" or may not be adequate for your particular problem. \n"); */
11068 MrBayesPrint (" If you do not have any age calibrations in the tree, you can \n");
11069 MrBayesPrint (" still calibrate the tree using 'Clockratepr'. For instance, \n");
11070 MrBayesPrint (" if you know that your sequence data evolve at a rate of 0.20 \n");
11071 MrBayesPrint (" substitutions per million years, you might calibrate the tree\n");
11072 MrBayesPrint (" by fixing the substitution rate to 0.20 using \n");
11073 MrBayesPrint (" \n");
11074 MrBayesPrint (" prset clockratepr = fixed(0.20) \n");
11075 MrBayesPrint (" \n");
11076 MrBayesPrint (" after which the tree will be calibrated using millions of \n");
11077 MrBayesPrint (" years as the unit. \n");
11078 MrBayesPrint (" \n");
11079 MrBayesPrint (" You can also assign a prior probability distribution to the \n");
11080 MrBayesPrint (" substitution rate, accommodating the uncertainty of it. \n");
11081 MrBayesPrint (" When you calibrate the nodes, you should properly set this \n");
11082 MrBayesPrint (" prior to match the time unit of the calibrations. \n");
11083 MrBayesPrint (" You can choose among normal, lognormal, exponential and gamma\n");
11084 MrBayesPrint (" distributions for this purpose. For instance, to assign a \n");
11085 MrBayesPrint (" normal distribution truncated at 0, so that only positive \n");
11086 MrBayesPrint (" values are allowed, and with mean 0.20 and standard deviation\n");
11087 MrBayesPrint (" of 0.02, you would use \n");
11088 MrBayesPrint (" \n");
11089 MrBayesPrint (" prset clockratepr = normal(0.20,0.02) \n");
11090 MrBayesPrint (" \n");
11091 MrBayesPrint (" The lognormal distribution is parameterized in terms of the \n");
11092 MrBayesPrint (" mean and standard deviation on the log scale (natural logs). \n");
11093 MrBayesPrint (" For instance, \n");
11094 MrBayesPrint (" \n");
11095 MrBayesPrint (" prset clockratepr = lognormal(-1.61,0.10) \n");
11096 MrBayesPrint (" \n");
11097 MrBayesPrint (" specifies a lognormal distribution with a mean of log values \n");
11098 MrBayesPrint (" of -1.61 and a standard deviation of log values of 0.10. In \n");
11099 MrBayesPrint (" such a case, the mean value of the lognormal distribution is \n");
11100 MrBayesPrint (" equal to e^(-1.61 + 0.10^2/2) = 0.20. \n");
11101 MrBayesPrint (" \n");
11102 MrBayesPrint (" Note that the 'Clockratepr' parameter has no effect on non- \n");
11103 MrBayesPrint (" clock trees. \n");
11104 MrBayesPrint (" Clockvarpr -- This parameter allows you to specify the type of clock you \n");
11105 MrBayesPrint (" are assuming. The default is 'strict', which corresponds to \n");
11106 MrBayesPrint (" the standard clock model where the evolutionary rate is \n");
11107 MrBayesPrint (" constant throughout the tree. For relaxed clock models, you \n");
11108 MrBayesPrint (" can use 'cpp', 'tk02', 'igr'. ('mixed' is not working) \n");
11109 MrBayesPrint (" 'cpp' invokes a relaxed clock model where the rate evolves \n");
11110 MrBayesPrint (" according to a Compound Poisson Process (CPP) (Huelsenbeck \n");
11111 MrBayesPrint (" et al., 2000). \n");
11112 MrBayesPrint (" 'tk02' invokes the Brownian Motion model described by Thorne \n");
11113 MrBayesPrint (" and Kishino (2002). [autocorrelated lognormal distributions] \n");
11114 MrBayesPrint (" 'igr' invokes the Independent Gamma Rate (IGR) model where \n");
11115 MrBayesPrint (" each branch has an independent rate drawn from a gamma \n");
11116 MrBayesPrint (" distribution (LePage et al., 2007). \n");
11117 MrBayesPrint (" Each of the relaxed clock models has additional parameters \n");
11118 MrBayesPrint (" with priors. For the CPP model, it is 'cppratepr' and \n");
11119 MrBayesPrint (" 'cppmultdevpr'; for the TK02 model, it is 'tk02varpr'; for \n");
11120 MrBayesPrint (" the IGR model, it is 'igrvarpr'. \n");
11121 MrBayesPrint (" The 'clockvarpr' parameter is only relevant for clock trees. \n");
11122 MrBayesPrint (" \n");
11123 MrBayesPrint (" For backward compatibility, 'bm' is allowed as a synonym of \n");
11124 MrBayesPrint (" 'tk02', and 'ibr' as a synonym of 'igr'. \n");
11125 MrBayesPrint (" Cppratepr -- This parameter allows you to specify a prior probability \n");
11126 MrBayesPrint (" distribution on the rate of the Poisson process generating \n");
11127 MrBayesPrint (" changes in the evolutionary rate in the CPP relaxed clock \n");
11128 MrBayesPrint (" model. You can either fix the rate or associate it with an \n");
11129 MrBayesPrint (" exponential prior using \n");
11130 MrBayesPrint (" \n");
11131 MrBayesPrint (" prset cppratepr = fixed(<number>) \n");
11132 MrBayesPrint (" prset cppratepr = exponential(<number>) \n");
11133 MrBayesPrint (" \n");
11134 MrBayesPrint (" For instance, if you fix the rate to 2, then on a branch \n");
11135 MrBayesPrint (" with the length equual to one expresed in terms of average \n");
11136 MrBayesPrint (" expected number of substitution per site, you expect to see, \n");
11137 MrBayesPrint (" on average, two rate-modifying events. \n");
11138 MrBayesPrint (" If you put an exponential(0.1) on the rate, you will be \n");
11139 MrBayesPrint (" estimating the rate against a prior probability distribution \n");
11140 MrBayesPrint (" where the expected rate is 10 (= 1/0.1). \n");
11141 MrBayesPrint (" Cppmultdevpr -- This parameter allows you to specify the standard deviation \n");
11142 MrBayesPrint (" of the log-normal distribution from which the rate multi- \n");
11143 MrBayesPrint (" pliers of the CPP relaxed clock model are drawn. The standard\n");
11144 MrBayesPrint (" deviation is given on the log scale. The default value of 1.0\n");
11145 MrBayesPrint (" thus corresponds to rate multipliers varying from 0.37 (1/e) \n");
11146 MrBayesPrint (" to 2.7 (e) when they are +/- one standard deviation from the \n");
11147 MrBayesPrint (" expected mean. The expected mean of the logarithm of the mul-\n");
11148 MrBayesPrint (" pliers is fixed to 0, ensuring that the expected mean rate is\n");
11149 MrBayesPrint (" 1.0. You can change the default value by using \n");
11150 MrBayesPrint (" \n");
11151 MrBayesPrint (" prset cppmultdevpr = fixed(<number>) \n");
11152 MrBayesPrint (" \n");
11153 MrBayesPrint (" where <number> is the standard deviation on the log scale. \n");
11154 MrBayesPrint (" TK02varpr -- This parameter allows you to specify the prior probability \n");
11155 MrBayesPrint (" distribution for the variance of the rate multiplier in the \n");
11156 MrBayesPrint (" Thorne-Kishino ('Brownian motion') relaxed clock model. \n");
11157 MrBayesPrint (" Specifically, the parameter specifies the rate at which the \n");
11158 MrBayesPrint (" variance increases with respect to the base rate of the \n");
11159 MrBayesPrint (" clock. If you have a branch of a length corresponding to 0.4 \n");
11160 MrBayesPrint (" expected changes per site according to the base rate of the \n");
11161 MrBayesPrint (" clock, and the tk02var parameter has a value of 2.0, then the\n");
11162 MrBayesPrint (" rate multiplier at the end of the branch will be drawn from a\n");
11163 MrBayesPrint (" lognormal distribution with a variance of 0.4*2.0 (on the \n");
11164 MrBayesPrint (" linear, not the logarithm scale). The mean is the same as the\n");
11165 MrBayesPrint (" rate multiplier at the start of the branch (again on the \n");
11166 MrBayesPrint (" linear scale). \n");
11167 MrBayesPrint (" \n");
11168 MrBayesPrint (" You can set the parameter to a fixed value, or specify that \n");
11169 MrBayesPrint (" it is drawn from an exponential or uniform distribution: \n");
11170 MrBayesPrint (" \n");
11171 MrBayesPrint (" prset tk02varpr = fixed(<number>) \n");
11172 MrBayesPrint (" prset tk02varpr = exponential(<number>) \n");
11173 MrBayesPrint (" prset tk02varpr = uniform(<number>,<number>) \n");
11174 MrBayesPrint (" \n");
11175 MrBayesPrint (" For backward compatibility, 'bmvarpr' is allowed as a synonym\n");
11176 MrBayesPrint (" of 'tko2varpr'. \n");
11177 MrBayesPrint (" Igrvarpr -- This parameter allows you to specify a prior on the variance \n");
11178 MrBayesPrint (" of the gamma distribution from which the branch lengths are \n");
11179 MrBayesPrint (" drawn in the independent branch rate (IGR) relaxed clock \n");
11180 MrBayesPrint (" model. Specifically, the parameter specifies the rate at \n");
11181 MrBayesPrint (" which the variance increases with respect to the base rate of\n");
11182 MrBayesPrint (" the clock. If you have a branch of a length corresponding to \n");
11183 MrBayesPrint (" 0.4 expected changes per site according to the base rate of \n");
11184 MrBayesPrint (" the clock, and the igrvar parameter has a value of 2.0, then \n");
11185 MrBayesPrint (" the effective branch length will be drawn from a distribution\n");
11186 MrBayesPrint (" with a variance of 0.4*2.0. \n");
11187 MrBayesPrint (" \n");
11188 MrBayesPrint (" You can set the parameter to a fixed value, or specify that \n");
11189 MrBayesPrint (" it is drawn from an exponential or uniform distribution: \n");
11190 MrBayesPrint (" \n");
11191 MrBayesPrint (" prset igrvarpr = fixed(<number>) \n");
11192 MrBayesPrint (" prset igrvarpr = exponential(<number>) \n");
11193 MrBayesPrint (" prset igrvarpr = uniform(<number>,<number>) \n");
11194 MrBayesPrint (" \n");
11195 MrBayesPrint (" For backward compatibility, 'ibrvarpr' is allowed as a syn- \n");
11196 MrBayesPrint (" onym of 'igrvarpr'. \n");
11197 MrBayesPrint (" Ratepr -- This parameter allows you to specify the site specific rates \n");
11198 MrBayesPrint (" model or any other model that allows different partitions to \n");
11199 MrBayesPrint (" evolve at different rates. First, you must have defined a \n");
11200 MrBayesPrint (" partition of the characters. For example, you may define a \n");
11201 MrBayesPrint (" partition that divides the characters by codon position, if \n");
11202 MrBayesPrint (" you have DNA data. You can also divide your data using a \n");
11203 MrBayesPrint (" partition that separates different genes from each other. \n");
11204 MrBayesPrint (" The next step is to make the desired partition the active one\n");
11205 MrBayesPrint (" using the set command. For example, if your partition is \n");
11206 MrBayesPrint (" called \"by_codon\", then you make that the active partition \n");
11207 MrBayesPrint (" using \"set partition=by_codon\". Now that you have defined \n");
11208 MrBayesPrint (" and activated a partition, you can specify the rate multi- \n");
11209 MrBayesPrint (" pliers for the various partitions. The options are: \n");
11210 MrBayesPrint (" \n");
11211 MrBayesPrint (" prset ratepr = fixed \n");
11212 MrBayesPrint (" prset ratepr = variable \n");
11213 MrBayesPrint (" prset ratepr = dirichlet(<number>,<number>,...,<number>) \n");
11214 MrBayesPrint (" \n");
11215 MrBayesPrint (" If you specify \"fixed\", then the rate multiplier for \n");
11216 MrBayesPrint (" that partition is set to 1 (i.e., the rate is fixed to \n");
11217 MrBayesPrint (" the average rate across partitions). On the other hand, \n");
11218 MrBayesPrint (" if you specify \"variable\", then the rate is allowed to \n");
11219 MrBayesPrint (" vary across partitions subject to the constraint that the \n");
11220 MrBayesPrint (" average rate of substitution across the partitions is 1. \n");
11221 MrBayesPrint (" You must specify a variable rate prior for at least two \n");
11222 MrBayesPrint (" partitions, otherwise the option is not activated when \n");
11223 MrBayesPrint (" calculating likelihoods. The variable option automatically \n");
11224 MrBayesPrint (" associates the partition rates with a dirichlet(1,...,1) \n");
11225 MrBayesPrint (" prior. The dirichlet option is an alternative way of setting \n");
11226 MrBayesPrint (" a partition rate to be variable, and also gives accurate \n");
11227 MrBayesPrint (" control of the shape of the prior. The parameters of the \n");
11228 MrBayesPrint (" Dirichlet are listed in the order of the partitions that the \n");
11229 MrBayesPrint (" ratepr is applied to. For instance, \"prset applyto=(1,3,4) \n");
11230 MrBayesPrint (" ratepr = dirichlet(10,40,15)\" would set the Dirichlet para- \n");
11231 MrBayesPrint (" meter 10 to partition 1, 40 to partition 3, and 15 to parti- \n");
11232 MrBayesPrint (" tion 4. The Dirichlet distribution is applied to the weighted\n");
11233 MrBayesPrint (" rates; that is, it weights the partition rates according to \n");
11234 MrBayesPrint (" the number of included characters in each partition. \n");
11235 MrBayesPrint (" Generatepr -- This parameter is similar to 'Ratepr' but applies to gene \n");
11236 MrBayesPrint (" trees in the multispecies coalescent, whereas 'Ratepr' app- \n");
11237 MrBayesPrint (" lies to partitions within genes. \n");
11238 MrBayesPrint (" \n");
11239 if (numCurrentDivisions == 0)
11242 tempInt = numCurrentDivisions;
11243 for (i=0; i<tempInt; i++)
11245 if (numCurrentDivisions == 0)
11247 MrBayesPrint (" Default model settings: \n");
11248 mp = &defaultModel;
11252 MrBayesPrint (" Model settings for partition %d: \n", i+1);
11253 mp = &modelParams[i];
11255 MrBayesPrint (" \n");
11256 MrBayesPrint (" Parameter Options Current Setting \n");
11257 MrBayesPrint (" ------------------------------------------------------------------ \n");
11259 MrBayesPrint (" Tratiopr Beta/Fixed %s", mp->tRatioPr);
11260 if (!strcmp(mp->tRatioPr, "Beta"))
11261 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->tRatioDir[0], mp->tRatioDir[1]);
11263 MrBayesPrint ("(%1.1lf)\n", mp->tRatioFix);
11265 MrBayesPrint (" Revmatpr Dirichlet/Fixed %s", mp->revMatPr);
11266 if (!strcmp(mp->revMatPr, "Dirichlet"))
11267 MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->revMatDir[0],
11268 mp->revMatDir[1], mp->revMatDir[2], mp->revMatDir[3],
11269 mp->revMatDir[4], mp->revMatDir[5]);
11271 MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->revMatFix[0],
11272 mp->revMatFix[1], mp->revMatFix[2], mp->revMatFix[3],
11273 mp->revMatFix[4], mp->revMatFix[5]);
11275 MrBayesPrint (" Aamodelpr Fixed/Mixed %s", mp->aaModelPr);
11276 if (!strcmp(mp->aaModelPr, "Fixed"))
11277 MrBayesPrint ("(%s)\n", mp->aaModel);
11279 MrBayesPrint ("\n");
11281 MrBayesPrint (" Aarevmatpr Dirichlet/Fixed %s", mp->aaRevMatPr);
11282 if (!strcmp(mp->aaRevMatPr, "Dirichlet"))
11284 for (j=1; j<190; j++)
11285 if (AreDoublesEqual (mp->aaRevMatDir[0], mp->aaRevMatDir[j], 0.00001) == NO)
11288 MrBayesPrint ("(%1.1lf,%1.1lf,...)\n", mp->aaRevMatDir[0], mp->aaRevMatDir[0]);
11290 MrBayesPrint (" (use 'Showmodel' to see values set by user)\n");
11294 for (j=1; j<190; j++)
11295 if (AreDoublesEqual (mp->aaRevMatFix[0], mp->aaRevMatFix[j], 0.00001) == NO)
11298 MrBayesPrint ("(%1.1lf,%1.1lf,...)\n", mp->aaRevMatFix[0], mp->aaRevMatFix[0]);
11300 MrBayesPrint (" (use 'Showmodel' to see values set by user)\n");
11303 MrBayesPrint (" Omegapr Dirichlet/Fixed %s", mp->omegaPr);
11304 if (!strcmp(mp->omegaPr, "Dirichlet"))
11305 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->omegaDir[0], mp->omegaDir[1]);
11307 MrBayesPrint ("(%1.1lf)\n", mp->omegaFix);
11309 MrBayesPrint (" Ny98omega1pr Beta/Fixed %s", mp->ny98omega1pr);
11310 if (!strcmp(mp->ny98omega1pr, "Beta"))
11311 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->ny98omega1Beta[0], mp->ny98omega1Beta[1]);
11312 else if (!strcmp(mp->ny98omega1pr, "Fixed"))
11313 MrBayesPrint ("(%1.1lf)\n", mp->ny98omega1Fixed);
11315 MrBayesPrint (" Ny98omega3pr Uniform/Exponential/Fixed %s", mp->ny98omega3pr);
11316 if (!strcmp(mp->ny98omega3pr, "Uniform"))
11317 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->ny98omega3Uni[0], mp->ny98omega3Uni[1]);
11318 else if (!strcmp(mp->ny98omega3pr, "Exponential"))
11319 MrBayesPrint ("(%1.1lf)\n", mp->ny98omega3Exp);
11321 MrBayesPrint ("(%1.1lf)\n", mp->ny98omega3Fixed);
11323 MrBayesPrint (" M3omegapr Exponential/Fixed %s", mp->m3omegapr);
11324 if (!strcmp(mp->m3omegapr, "Exponential"))
11325 MrBayesPrint ("\n");
11326 else if (!strcmp(mp->m3omegapr, "Fixed"))
11327 MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->m3omegaFixed[0], mp->m3omegaFixed[1], mp->m3omegaFixed[2]);
11329 MrBayesPrint (" Codoncatfreqs Dirichlet/Fixed %s", mp->codonCatFreqPr);
11330 if (!strcmp(mp->codonCatFreqPr, "Dirichlet"))
11331 MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->codonCatDir[0], mp->codonCatDir[1], mp->codonCatDir[2]);
11333 MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->codonCatFreqFix[0], mp->codonCatFreqFix[1], mp->codonCatFreqFix[2]);
11335 MrBayesPrint (" Statefreqpr Dirichlet/Fixed %s", mp->stateFreqPr);
11336 if (!strcmp(mp->stateFreqPr, "Dirichlet"))
11338 if (mp->dataType == DNA || mp->dataType == RNA)
11340 if (!strcmp(mp->nucModel, "4by4"))
11341 MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->stateFreqsDir[0], mp->stateFreqsDir[1],
11342 mp->stateFreqsDir[2], mp->stateFreqsDir[3]);
11344 MrBayesPrint ("\n");
11346 else if (mp->dataType == RESTRICTION)
11348 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->stateFreqsDir[0], mp->stateFreqsDir[1]);
11351 MrBayesPrint ("\n");
11353 else if (!strcmp(mp->stateFreqPr, "Fixed"))
11355 if (mp->dataType == DNA || mp->dataType == RNA)
11357 if (!strcmp(mp->nucModel, "4by4"))
11358 MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->stateFreqsFix[0], mp->stateFreqsFix[1],
11359 mp->stateFreqsFix[2], mp->stateFreqsFix[3]);
11361 MrBayesPrint ("\n");
11363 else if (mp->dataType == RESTRICTION)
11365 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->stateFreqsFix[0], mp->stateFreqsFix[1]);
11368 MrBayesPrint ("\n");
11371 MrBayesPrint (" Shapepr Uniform/Exponential/Fixed %s", mp->shapePr);
11372 if (!strcmp(mp->shapePr, "Uniform"))
11373 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->shapeUni[0], mp->shapeUni[1]);
11374 else if (!strcmp(mp->shapePr, "Exponential"))
11375 MrBayesPrint ("(%1.1lf)\n", mp->shapeExp);
11377 MrBayesPrint ("(%1.1lf)\n", mp->shapeFix);
11379 MrBayesPrint (" Ratecorrpr Uniform/Fixed %s", mp->adGammaCorPr);
11380 if (!strcmp(mp->adGammaCorPr, "Uniform"))
11381 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->corrUni[0], mp->corrUni[1]);
11383 MrBayesPrint ("(%1.1lf)\n", mp->corrFix);
11385 MrBayesPrint (" Pinvarpr Uniform/Fixed %s", mp->pInvarPr);
11386 if (!strcmp(mp->pInvarPr, "Uniform"))
11387 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->pInvarUni[0], mp->pInvarUni[1]);
11389 MrBayesPrint ("(%1.1lf)\n", mp->pInvarFix);
11391 MrBayesPrint (" Covswitchpr Uniform/Exponential/Fixed %s", mp->covSwitchPr);
11392 if (!strcmp(mp->covSwitchPr, "Uniform"))
11393 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->covswitchUni[0], mp->covswitchUni[1]);
11394 else if (!strcmp(mp->covSwitchPr, "Exponential"))
11395 MrBayesPrint ("(%1.1lf)\n", mp->covswitchExp);
11397 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->covswitchFix[0], mp->covswitchFix[1]);
11399 MrBayesPrint (" Symdirihyperpr Uniform/Exponential/Fixed %s", mp->symPiPr);
11400 if (!strcmp(mp->symPiPr, "Uniform"))
11401 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->symBetaUni[0], mp->symBetaUni[1]);
11402 else if (!strcmp(mp->covSwitchPr, "Exponential"))
11403 MrBayesPrint ("(%1.1lf)\n", mp->symBetaExp);
11406 if (mp->symBetaFix < 0)
11407 MrBayesPrint ("(Infinity)\n");
11409 MrBayesPrint ("(%1.1lf)\n", mp->symBetaFix);
11412 MrBayesPrint (" Topologypr Uniform/Constraints/Fixed/ %s", mp->topologyPr);
11413 if (!strcmp(mp->topologyPr, "Constraints"))
11415 MrBayesPrint ("(");
11416 for (j=0; j<numDefinedConstraints; j++)
11418 if (mp->activeConstraints[j] == YES)
11420 MrBayesPrint ("%d", j+1);
11424 for (j++; j<numDefinedConstraints; j++)
11426 if (mp->activeConstraints[j] == YES)
11428 MrBayesPrint (",%d", j+1);
11431 MrBayesPrint (")\n");
11433 else if (!strcmp(mp->topologyPr, "Fixed"))
11434 MrBayesPrint("(%s)\n", userTree[mp->topologyFix]->name);
11436 MrBayesPrint ("\n");
11437 MrBayesPrint (" Speciestree \n");
11439 MrBayesPrint (" Brlenspr Unconstrained/Clock/Fixed %s", mp->brlensPr);
11440 if (!strcmp(mp->brlensPr, "Unconstrained"))
11442 if (!strcmp(mp->unconstrainedPr, "Uniform"))
11443 MrBayesPrint (":Uni(%1.1lf,%1.1lf)\n", mp->brlensUni[0], mp->brlensUni[1]);
11444 else if (!strcmp(mp->unconstrainedPr, "GammaDir"))
11445 MrBayesPrint (":GammaDir(%1.1lf,%1.3lf,%1.1lf,%1.1lf)\n",
11446 mp->brlensDir[0], mp->brlensDir[1], mp->brlensDir[2], mp->brlensDir[3]);
11447 else if (!strcmp(mp->unconstrainedPr, "invGamDir"))
11448 MrBayesPrint (":invGamDir(%1.1lf,%1.3lf,%1.1lf,%1.1lf)\n",
11449 mp->brlensDir[0], mp->brlensDir[1], mp->brlensDir[2], mp->brlensDir[3]);
11450 else if (!strcmp(mp->unconstrainedPr, "twoExp"))
11451 MrBayesPrint (":twoExp(%1.1lf,%1.1lf)\n", mp->brlens2Exp[0], mp->brlens2Exp[1]);
11453 MrBayesPrint (":Exp(%1.1lf)\n", mp->brlensExp);
11455 else if (!strcmp(mp->brlensPr, "Clock"))
11457 if (!strcmp(mp->clockPr,"Fixed"))
11458 MrBayesPrint (":%s(%s)\n", mp->clockPr, userTree[mp->brlensFix]->name);
11460 MrBayesPrint (":%s\n", mp->clockPr);
11462 else if (!strcmp(mp->brlensPr, "Fixed"))
11463 MrBayesPrint("(%s)\n", userTree[mp->brlensFix]->name);
11465 MrBayesPrint (" Treeagepr Gamma/Uniform/Fixed/ %s\n", mp->treeAgePr.name);
11466 MrBayesPrint (" Truncatednormal/Lognormal/ \n");
11467 MrBayesPrint (" Offsetlognormal/Offsetgamma/ \n");
11468 MrBayesPrint (" Offsetexponential \n");
11470 MrBayesPrint (" Speciationpr Uniform/Exponential/Fixed %s", mp->speciationPr);
11471 if (!strcmp(mp->speciationPr, "Uniform"))
11472 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->speciationUni[0], mp->speciationUni[1]);
11473 else if (!strcmp(mp->speciationPr, "Exponential"))
11474 MrBayesPrint ("(%1.1lf)\n", mp->speciationExp);
11476 MrBayesPrint ("(%1.1lf)\n", mp->speciationFix);
11478 MrBayesPrint (" Extinctionpr Beta/Fixed %s", mp->extinctionPr);
11479 if (!strcmp(mp->extinctionPr, "Beta"))
11480 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->extinctionBeta[0], mp->extinctionBeta[1]);
11482 MrBayesPrint ("(%1.1lf)\n", mp->extinctionFix);
11484 MrBayesPrint (" Fossilizationpr Beta/Fixed %s", mp->fossilizationPr);
11485 if (!strcmp(mp->fossilizationPr, "Beta"))
11486 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->fossilizationBeta[0], mp->fossilizationBeta[1]);
11488 MrBayesPrint ("(%1.2lf)\n", mp->fossilizationFix);
11490 MrBayesPrint (" SampleStrat Random/Diversity/Cluster/ %s\n", mp->sampleStrat);
11491 MrBayesPrint (" FossilTip \n");
11492 // if (!strcmp(mp->sampleStrat, "Random") || !strcmp(mp->sampleStrat, "Diversity"))
11494 MrBayesPrint (" Sampleprob <number> %1.8lf\n", mp->sampleProb);
11496 MrBayesPrint (" Popsizepr Lognormal/Gamma/Uniform/ %s", mp->popSizePr);
11497 if (!strcmp(mp->popSizePr, "Uniform"))
11498 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeUni[0], mp->popSizeUni[1]);
11499 else if (!strcmp(mp->popSizePr, "Lognormal"))
11500 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeLognormal[0], mp->popSizeLognormal[1]);
11501 else if (!strcmp(mp->popSizePr, "Normal"))
11502 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeNormal[0], mp->popSizeNormal[1]);
11503 else if (!strcmp(mp->popSizePr, "Gamma"))
11504 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeGamma[0], mp->popSizeGamma[1]);
11506 MrBayesPrint ("(%1.1lf)\n", mp->popSizeFix);
11507 MrBayesPrint (" Normal/Fixed \n");
11509 MrBayesPrint (" Popvarpr Equal/Variable %s\n", mp->popVarPr);
11512 MrBayesPrint (" Growthpr Uniform/Exponential/ \n");
11513 MrBayesPrint (" Fixed/Normal %s", mp->growthPr);
11514 if (!strcmp(mp->growthPr, "Uniform"))
11515 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->growthUni[0], mp->growthUni[1]);
11516 else if (!strcmp(mp->growthPr, "Exponential"))
11517 MrBayesPrint ("(%1.1lf)\n", mp->growthExp);
11518 else if (!strcmp(mp->growthPr, "Normal"))
11519 MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->growthNorm[0], mp->growthNorm[1]);
11521 MrBayesPrint ("(%1.1lf)\n", mp->growthFix);
11524 MrBayesPrint (" Nodeagepr Unconstrained/Calibrated %s\n", mp->nodeAgePr);
11526 MrBayesPrint (" Clockratepr Fixed/Normal/Lognormal/ %s", mp->clockRatePr);
11527 if (!strcmp(mp->clockRatePr, "Fixed"))
11528 MrBayesPrint ("(%1.2lf)\n", mp->clockRateFix);
11529 else if (!strcmp(mp->clockRatePr,"Exponential"))
11530 MrBayesPrint ("(%1.2lf)\n", mp->clockRateExp);
11531 else if (!strcmp(mp->clockRatePr,"Normal"))
11532 MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateNormal[0], mp->clockRateNormal[1]);
11533 else if (!strcmp(mp->clockRatePr,"Lognormal"))
11534 MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateLognormal[0], mp->clockRateLognormal[1]);
11537 assert (!strcmp(mp->clockRatePr,"Gamma"));
11538 MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateGamma[0], mp->clockRateGamma[1]);
11540 MrBayesPrint (" Exponential/Gamma \n");
11542 MrBayesPrint (" Clockvarpr Strict/Cpp/TK02/Igr/Mixed %s\n", mp->clockVarPr);
11544 MrBayesPrint (" Cppratepr Fixed/Exponential %s", mp->cppRatePr);
11545 if (!strcmp(mp->cppRatePr, "Fixed"))
11546 MrBayesPrint ("(%1.2lf)\n", mp->cppRateFix);
11547 else /* if (!strcmp(mp->cppRatePr,"Exponential")) */
11548 MrBayesPrint ("(%1.2lf)\n", mp->cppRateExp);
11550 MrBayesPrint (" Cppmultdevpr Fixed %s", mp->cppMultDevPr);
11551 MrBayesPrint ("(%1.2lf)\n", mp->cppMultDevFix);
11553 MrBayesPrint (" TK02varpr Fixed/Exponential/Uniform %s", mp->tk02varPr);
11554 if (!strcmp(mp->tk02varPr, "Fixed"))
11555 MrBayesPrint ("(%1.2lf)\n", mp->tk02varFix);
11556 else if (!strcmp(mp->tk02varPr,"Exponential"))
11557 MrBayesPrint ("(%1.2lf)\n", mp->tk02varExp);
11560 assert (!strcmp(mp->tk02varPr,"Uniform"));
11561 MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->tk02varUni[0], mp->tk02varUni[1]);
11564 MrBayesPrint (" Igrvarpr Fixed/Exponential/Uniform %s", mp->igrvarPr);
11565 if (!strcmp(mp->igrvarPr, "Fixed"))
11566 MrBayesPrint ("(%1.2lf)\n", mp->igrvarFix);
11567 else if (!strcmp(mp->igrvarPr,"Exponential"))
11568 MrBayesPrint ("(%1.2lf)\n", mp->igrvarExp);
11571 assert (!strcmp(mp->igrvarPr,"Uniform"));
11572 MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->igrvarUni[0], mp->igrvarUni[1]);
11575 /* MrBayesPrint (" Mixedvarpr Fixed/Exponential/Uniform %s", mp->mixedvarPr);
11576 if (!strcmp(mp->mixedvarPr, "Fixed"))
11577 MrBayesPrint ("(%1.2lf)\n", mp->mixedvarFix);
11578 else if (!strcmp(mp->mixedvarPr,"Exponential"))
11579 MrBayesPrint ("(%1.2lf)\n", mp->mixedvarExp);
11582 assert (!strcmp(mp->mixedvarPr,"Uniform"));
11583 MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->mixedvarUni[0], mp->mixedvarUni[1]);
11586 MrBayesPrint (" Ratepr Fixed/Variable=Dirichlet %s", mp->ratePr);
11587 if (!strcmp(mp->ratePr, "Dirichlet"))
11588 MrBayesPrint ("(...,%1.1lf,...)\n", mp->ratePrDir);
11590 MrBayesPrint ("\n");
11592 MrBayesPrint (" Generatepr Fixed/Variable=Dirichlet %s", mp->generatePr);
11593 if (!strcmp(mp->generatePr, "Dirichlet"))
11594 MrBayesPrint ("(...,%1.1lf,...)\n", mp->generatePrDir);
11596 MrBayesPrint ("\n");
11598 MrBayesPrint (" ------------------------------------------------------------------ \n");
11599 MrBayesPrint (" \n");
11602 else if (!strcmp(helpTkn, "Ctype"))
11604 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11605 MrBayesPrint (" Ctype \n");
11606 MrBayesPrint (" \n");
11607 MrBayesPrint (" This command sets the character ordering for standard-type data. The \n");
11608 MrBayesPrint (" correct usage is: \n");
11609 MrBayesPrint (" \n");
11610 MrBayesPrint (" ctype <ordering>:<characters> \n");
11611 MrBayesPrint (" \n");
11612 MrBayesPrint (" The available options for the <ordering> specifier are: \n");
11613 MrBayesPrint (" \n");
11614 MrBayesPrint (" unordered -- Movement directly from one state to another is \n");
11615 MrBayesPrint (" allowed in an instant of time. \n");
11616 MrBayesPrint (" ordered -- Movement is only allowed between adjacent characters. \n");
11617 MrBayesPrint (" For example, perhaps only between 0 <-> 1 and 1 <-> 2 \n");
11618 MrBayesPrint (" for a three state character ordered as 0 - 1 - 2. \n");
11619 MrBayesPrint (" irreversible -- Rates of change for losses are 0. \n");
11620 MrBayesPrint (" \n");
11621 MrBayesPrint (" The characters to which the ordering is applied is specified in manner \n");
11622 MrBayesPrint (" that is identical to commands such as \"include\" or \"exclude\". For \n");
11623 MrBayesPrint (" example, \n");
11624 MrBayesPrint (" \n");
11625 MrBayesPrint (" ctype ordered: 10 23 45 \n");
11626 MrBayesPrint (" \n");
11627 MrBayesPrint (" defines charactes 10, 23, and 45 to be of type ordered. Similarly, \n");
11628 MrBayesPrint (" \n");
11629 MrBayesPrint (" ctype irreversible: 54 - 67 71-92 \n");
11630 MrBayesPrint (" \n");
11631 MrBayesPrint (" defines characters 54 to 67 and characters 71 to 92 to be of type \n");
11632 MrBayesPrint (" irreversible. You can use the \".\" to denote the last character, and \n");
11633 MrBayesPrint (" \"all\" to denote all of the characters. Finally, you can use the \n");
11634 MrBayesPrint (" specifier \"\\\" to apply the ordering to every n-th character or \n");
11635 MrBayesPrint (" you can use predefined charsets to specify the character. \n");
11636 MrBayesPrint (" \n");
11637 MrBayesPrint (" Only one ordering can be used on any specific application of ctype. \n");
11638 MrBayesPrint (" If you want to apply different orderings to different characters, then \n");
11639 MrBayesPrint (" you need to use ctype multiple times. For example, \n");
11640 MrBayesPrint (" \n");
11641 MrBayesPrint (" ctype ordered: 1-50 \n");
11642 MrBayesPrint (" ctype irreversible: 51-100 \n");
11643 MrBayesPrint (" \n");
11644 MrBayesPrint (" sets characters 1 to 50 to be ordered and characters 51 to 100 to be \n");
11645 MrBayesPrint (" irreversible. \n");
11646 MrBayesPrint (" \n");
11647 MrBayesPrint (" The ctype command is only sensible with morphological (here called \n");
11648 MrBayesPrint (" \"standard\") characters. The program ignores attempts to apply char- \n");
11649 MrBayesPrint (" acter orderings to other types of characters, such as DNA characters. \n");
11651 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11653 else if (!strcmp(helpTkn, "Propset"))
11655 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11656 MrBayesPrint (" Propset \n");
11657 MrBayesPrint (" \n");
11658 MrBayesPrint (" This command allows the user to change the details of the MCMC samplers \n");
11659 MrBayesPrint (" (moves) that update the state of the chain. The useage is: \n");
11660 MrBayesPrint (" \n");
11661 MrBayesPrint (" propset <move_name>$<tuning-parameter>=<value> \n");
11662 MrBayesPrint (" \n");
11663 MrBayesPrint (" Assume we have a topology parameter called 'Tau{all}', which is sampled by \n");
11664 MrBayesPrint (" the move 'ExtTBR(Tau{all})' (note that the parameter name is included in the \n");
11665 MrBayesPrint (" move name). This move has three tuning parameters: (1) 'prob', the relative \n");
11666 MrBayesPrint (" proposal probability (a weight defining its probability relative to other \n");
11667 MrBayesPrint (" moves); (2) 'p_ext', the extension probability; and (3) 'lambda', the tuning \n");
11668 MrBayesPrint (" parameter of the branch length multiplier. A list of the tuning parameters is \n");
11669 MrBayesPrint (" available by using 'Showmoves' (see below). To change the relative proposal \n");
11670 MrBayesPrint (" probability to 20 and the extension probability to 0.7, use: \n");
11671 MrBayesPrint (" \n");
11672 MrBayesPrint (" propset etbr(tau{all})$prob=20 etbr(tau{all})$p_ext=0.7 \n");
11673 MrBayesPrint (" \n");
11674 MrBayesPrint (" This change would apply to all chains in all runs. It is also possible to set \n");
11675 MrBayesPrint (" the tuning parameters of individual runs and chains using the format: \n");
11676 MrBayesPrint (" \n");
11677 MrBayesPrint (" propset <move_name>$<tuning-parameter>(<run>,<chain>)=<value> \n");
11678 MrBayesPrint (" \n");
11679 MrBayesPrint (" where <run> and <chain> are the index numbers of the run and chain for which \n");
11680 MrBayesPrint (" you want to change the value. If you leave out the index of the run, the \n");
11681 MrBayesPrint (" change will apply to all runs; if you leave out the index of the chain, the \n");
11682 MrBayesPrint (" change will similarly apply to all chains. To switch off the exttbr(tau{all}) \n");
11683 MrBayesPrint (" move in chain 2 of all runs, use: \n");
11684 MrBayesPrint (" \n");
11685 MrBayesPrint (" propset etbr(tau{all})$prob(,2)=0 \n");
11686 MrBayesPrint (" \n");
11687 MrBayesPrint (" It is important to note that all moves are not available until the model has \n");
11688 MrBayesPrint (" been completely defined. Any change to the model will cause all proposal \n");
11689 MrBayesPrint (" tuning parameters to return to their default values. To see a list of all the \n");
11690 MrBayesPrint (" moves that are currently switched on for the model, use 'showmoves'. You can \n");
11691 MrBayesPrint (" also see other available moves by using 'showmoves allavailable=yes'. A list \n");
11692 MrBayesPrint (" of the moves for each parameter in the model is available by using the command\n");
11693 MrBayesPrint (" 'Showparams'. If you change proposal probabilities, make sure that all \n");
11694 MrBayesPrint (" parameters that are not fixed in your model have at least one move switched \n");
11695 MrBayesPrint (" on. \n");
11696 MrBayesPrint (" \n");
11697 MrBayesPrint (" One word of warning: You should be extremely careful when modifying any \n");
11698 MrBayesPrint (" of the chain parameters using 'propset'. It is quite possible to completely \n");
11699 MrBayesPrint (" wreck any hope of achieving convergence by inappropriately setting the \n");
11700 MrBayesPrint (" tuning parameters. In general, you want to set move tuning parameters such \n");
11701 MrBayesPrint (" that the acceptance rate of the move is intermediate (we suggest targeting \n");
11702 MrBayesPrint (" the range 10%% to 70%% acceptance, if possible). If the acceptance rate is \n");
11703 MrBayesPrint (" outside of this range, the MCMC chain will probably not sample that parameter \n");
11704 MrBayesPrint (" very efficiently. The acceptance rates for all moves in the cold chain(s) are \n");
11705 MrBayesPrint (" summarized at the end of each run in the screen output. The acceptance rates \n");
11706 MrBayesPrint (" (potentially for all chains, cold and heated) are also printed to the .mcmc \n");
11707 MrBayesPrint (" file if Mcmc convergence diagnostics are turned on (using 'Mcmc' or 'Mcmcp'). \n");
11708 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11710 else if (!strcmp(helpTkn, "Log"))
11712 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11713 MrBayesPrint (" Log \n");
11714 MrBayesPrint (" \n");
11715 MrBayesPrint (" This command allows output to the screen to also be output to a file. \n");
11716 MrBayesPrint (" The useage is: \n");
11717 MrBayesPrint (" \n");
11718 MrBayesPrint (" log start/stop filename=<name> append/replace \n");
11719 MrBayesPrint (" \n");
11720 MrBayesPrint (" The options are: \n");
11721 MrBayesPrint (" \n");
11722 MrBayesPrint (" Start/Stop -- Starts or stops logging of output to file. \n");
11723 MrBayesPrint (" Append/Replace -- Either append to or replace existing file. \n");
11724 MrBayesPrint (" Filename -- Name of log file (currently, the name of the log \n");
11725 MrBayesPrint (" file is \"%s\").\n", logFileName);
11726 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11728 else if (!strcmp(helpTkn, "Translate"))
11730 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11731 MrBayesPrint (" Translate \n");
11732 MrBayesPrint (" \n");
11733 MrBayesPrint (" This command is used by MrBayes to specify the mapping between taxon names \n");
11734 MrBayesPrint (" and taxon numbers in a Nexus tree file. For instance, \n");
11735 MrBayesPrint (" \n");
11736 MrBayesPrint (" translate \n");
11737 MrBayesPrint (" 1 Homo, \n");
11738 MrBayesPrint (" 2 Pan, \n");
11739 MrBayesPrint (" 3 Gorilla, \n");
11740 MrBayesPrint (" 4 Hylobates; \n");
11741 MrBayesPrint (" \n");
11742 MrBayesPrint (" establishes that the taxon labeled 1 in the trees that follow is Homo, the \n");
11743 MrBayesPrint (" taxon labeled 2 is Pan, etc. \n");
11744 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11746 else if (!strcmp(helpTkn, "Usertree"))
11748 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11749 MrBayesPrint (" Usertree \n");
11750 MrBayesPrint (" \n");
11751 MrBayesPrint (" This command allows you to specify a user tree. The user tree can then be \n");
11752 MrBayesPrint (" used as a starting tree for a MCMC analysis. The format for the command is \n");
11753 MrBayesPrint (" \n");
11754 MrBayesPrint (" usertree = <tree in Newick format> \n");
11755 MrBayesPrint (" \n");
11756 MrBayesPrint (" For example, \n");
11757 MrBayesPrint (" \n");
11758 MrBayesPrint (" usertree = (A,B,(C,D)) \n");
11759 MrBayesPrint (" \n");
11760 MrBayesPrint (" specifies an unrooted tree of four species. Note that the program re- \n");
11761 MrBayesPrint (" quires that trees are binary (i.e., strictly bifurcating). Hence, there \n");
11762 MrBayesPrint (" can be only one three-way split, as shown in the example. If the tree \n");
11763 MrBayesPrint (" is not binary, the program will return an error. \n");
11764 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11766 else if (!strcmp(helpTkn, "Mcmc"))
11768 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11769 MrBayesPrint (" Mcmc \n");
11770 MrBayesPrint (" \n");
11771 MrBayesPrint (" This command starts the Markov chain Monte Carlo (MCMC) analysis. The \n");
11772 MrBayesPrint (" posterior probability of phylogenetic trees (and other parameters of the \n");
11773 MrBayesPrint (" substitution model) cannot be determined analytically. Instead, MCMC is \n");
11774 MrBayesPrint (" used to approximate the posterior probabilities of trees by drawing \n");
11775 MrBayesPrint (" (dependent) samples from the posterior distribution. This program can \n");
11776 MrBayesPrint (" implement a variant of MCMC called \"Metropolis-coupled Markov chain Monte \n");
11777 MrBayesPrint (" Carlo\", or MCMCMC for short. Basically, \"Nchains\" are run, with \n");
11778 MrBayesPrint (" Nchains - 1 of them heated. The chains are labelled 1, 2, ..., Nchains. \n");
11779 MrBayesPrint (" The heat that is applied to the i-th chain is B = 1 / (1 + temp X i). B \n");
11780 MrBayesPrint (" is the power to which the posterior probability is raised. When B = 0, all \n");
11781 MrBayesPrint (" trees have equal probability and the chain freely visits trees. B = 1 is \n");
11782 MrBayesPrint (" the \"cold\" chain (or the distribution of interest). MCMCMC can mix \n");
11783 MrBayesPrint (" better than ordinary MCMC; after all of the chains have gone through \n");
11784 MrBayesPrint (" one cycle, two chains are chosen at random and an attempt is made to \n");
11785 MrBayesPrint (" swap the states (with the probability of a swap being determined by the \n");
11786 MrBayesPrint (" Metropolis et al. equation). This allows the chain to potentially jump \n");
11787 MrBayesPrint (" a valley in a single bound. The correct usage is \n");
11788 MrBayesPrint (" \n");
11789 MrBayesPrint (" mcmc <parameter> = <value> ... <parameter> = <value> \n");
11790 MrBayesPrint (" \n");
11791 MrBayesPrint (" For example, \n");
11792 MrBayesPrint (" \n");
11793 MrBayesPrint (" mcmc ngen=100000 nchains=4 temp=0.5 \n");
11794 MrBayesPrint (" \n");
11795 MrBayesPrint (" performs a MCMCMC analysis with four chains with the temperature set to \n");
11796 MrBayesPrint (" 0.5. The chains would be run for 100,000 cycles. \n");
11797 MrBayesPrint (" \n");
11798 MrBayesPrint (" Options: \n");
11799 MrBayesPrint (" \n");
11800 MrBayesPrint (" Ngen -- This option sets the number of cycles for the MCMC alg- \n");
11801 MrBayesPrint (" orithm. This should be a big number as you want the chain \n");
11802 MrBayesPrint (" to first reach stationarity, and then remain there for \n");
11803 MrBayesPrint (" enough time to take lots of samples. \n");
11804 MrBayesPrint (" Nruns -- How many independent analyses are started simultaneously. \n");
11805 MrBayesPrint (" Nchains -- How many chains are run for each analysis for the MCMCMC \n");
11806 MrBayesPrint (" variant. The default is 4: 1 cold chain and 3 heated chains. \n");
11807 MrBayesPrint (" If Nchains is set to 1, MrBayes will use regular MCMC sam- \n");
11808 MrBayesPrint (" pling, without heating. \n");
11809 MrBayesPrint (" Temp -- The temperature parameter for heating the chains. The higher \n");
11810 MrBayesPrint (" the temperature, the more likely the heated chains are to \n");
11811 MrBayesPrint (" move between isolated peaks in the posterior distribution. \n");
11812 MrBayesPrint (" However, excessive heating may lead to very low acceptance \n");
11813 MrBayesPrint (" rates for swaps between different chains. Before changing the \n");
11814 MrBayesPrint (" default setting, however, note that the acceptance rates of \n");
11815 MrBayesPrint (" swaps tend to fluctuate during the burn-in phase of the run. \n");
11816 MrBayesPrint (" Reweight -- Here, you specify three numbers, that respectively represent \n");
11817 MrBayesPrint (" the percentage of characters to decrease in weight, the \n");
11818 MrBayesPrint (" percentage of characters to increase in weight, and the \n");
11819 MrBayesPrint (" increment. An increase/decrease in weight is acheived by \n");
11820 MrBayesPrint (" replicating/removing a character in the matrix. This is \n");
11821 MrBayesPrint (" only done to non-cold chains. The format for this parameter \n");
11822 MrBayesPrint (" is \"reweight=(<number>,<number>)\" or \"reweight=(<number>, \n");
11823 MrBayesPrint (" <number>,<number>)\". \n");
11824 MrBayesPrint (" Swapfreq -- This specifies how often swaps of states between chains are \n");
11825 MrBayesPrint (" attempted. You must be running at least two chains for this \n");
11826 MrBayesPrint (" option to be relevant. The default is Swapfreq=1, resulting \n");
11827 MrBayesPrint (" in Nswaps (see below) swaps being tried each generation of \n");
11828 MrBayesPrint (" the run. If Swapfreq is set to 10, then Nswaps swaps will be \n");
11829 MrBayesPrint (" tried every tenth generation of the run. \n");
11830 MrBayesPrint (" Nswaps -- The number of swaps tried for each swapping generation of the \n");
11831 MrBayesPrint (" chain (see also Swapfreq). \n");
11832 MrBayesPrint (" Samplefreq -- This specifies how often the Markov chain is sampled. You \n");
11833 MrBayesPrint (" can sample the chain every cycle, but this results in very \n");
11834 MrBayesPrint (" large output files. Thinning the chain is a way of making \n");
11835 MrBayesPrint (" these files smaller and making the samples more independent. \n");
11836 MrBayesPrint (" Printfreq -- This specifies how often information about the chain is \n");
11837 MrBayesPrint (" printed to the screen. \n");
11838 MrBayesPrint (" Printall -- If set to NO, only cold chains in a MCMC analysis are printed \n");
11839 MrBayesPrint (" to screen. If set to YES, both cold and heated chains will be \n");
11840 MrBayesPrint (" output. This setting only affects the printing to screen, it \n");
11841 MrBayesPrint (" does not change the way values are written to file. \n");
11842 MrBayesPrint (" Printmax -- The maximum number of chains to print to screen. \n");
11843 MrBayesPrint (" Mcmcdiagn -- Determines whether acceptance ratios of moves and swaps will \n");
11844 MrBayesPrint (" be printed to file. The file will be named similarly to the \n");
11845 MrBayesPrint (" '.p' and '.t' files, but will have the ending '.mcmc'. If \n");
11846 MrBayesPrint (" more than one independent analysis is run simultaneously (see \n");
11847 MrBayesPrint (" Nruns below), convergence diagnostics for tree topology will \n");
11848 MrBayesPrint (" also be printed to this file. The convergence diagnostic used \n");
11849 MrBayesPrint (" is the average standard deviation in partition frequency \n");
11850 MrBayesPrint (" values across independent analyses. The Burnin setting (see \n");
11851 MrBayesPrint (" below) determines how many samples will be discarded as burnin\n");
11852 MrBayesPrint (" before calculating the partition frequencies. The Minpartfreq \n");
11853 MrBayesPrint (" setting (see below) determines the minimum partition frequency\n");
11854 MrBayesPrint (" required for a partition to be included in the calculation. As\n");
11855 MrBayesPrint (" the independent analyses approach stationarity (converge), the\n");
11856 MrBayesPrint (" value of the diagnostic is expected to approach zero. \n");
11857 MrBayesPrint (" Diagnfreq -- The number of generations between the calculation of MCMC \n");
11858 MrBayesPrint (" diagnostics (see Mcmcdiagn above). \n");
11859 MrBayesPrint (" Diagnstat -- The statistic to use for run-time convergence diagnostics. \n");
11860 MrBayesPrint (" Choices are 'Avgstddev' for average standard deviation of \n");
11861 MrBayesPrint (" split frequencies and 'Maxstddev' for maximum standard devia- \n");
11862 MrBayesPrint (" tion of split frequencies. \n");
11863 MrBayesPrint (" Savetrees -- If you are using a relative burnin for run-time convergence \n");
11864 MrBayesPrint (" diagnostics, tree samples need to be deleted from split \n");
11865 MrBayesPrint (" frequency counters as the cut-off point for the burnin moves \n");
11866 MrBayesPrint (" during the run. If 'Savetrees' is set to 'No', tree samples \n");
11867 MrBayesPrint (" to be discarded are read back in from file. If 'Savetrees' is \n");
11868 MrBayesPrint (" set to 'Yes', the tree samples to be removed will be stored \n");
11869 MrBayesPrint (" in the internal memory instead. This can use up a lot of \n");
11870 MrBayesPrint (" memory in large analyses. \n");
11871 MrBayesPrint (" Minpartfreq -- The minimum frequency required for a partition to be included \n");
11872 MrBayesPrint (" in the calculation of the topology convergence diagnostic. The\n");
11873 MrBayesPrint (" partition is included if the minimum frequency is reached in \n");
11874 MrBayesPrint (" at least one of the independent tree samples that are com- \n");
11875 MrBayesPrint (" pared. \n");
11876 MrBayesPrint (" Allchains -- If this option is set to YES, acceptance ratios for moves are \n");
11877 MrBayesPrint (" recorded for all chains, cold or heated. By default, only the \n");
11878 MrBayesPrint (" acceptance ratios for the cold chain are recorded. \n");
11879 MrBayesPrint (" Allcomps -- If this option is set to YES, topological convergence diag- \n");
11880 MrBayesPrint (" nostics are calculated over all pairwise comparisons of runs. \n");
11881 MrBayesPrint (" If it is set to NO, only the overall value is reported. \n");
11882 MrBayesPrint (" Relburnin -- If this option is set to YES, then a proportion of the sampled\n");
11883 MrBayesPrint (" values will be discarded as burnin when calculating the con- \n");
11884 MrBayesPrint (" vergence diagnostic. The proportion to be discarded is set \n");
11885 MrBayesPrint (" with Burninfrac (see below). When the Relburnin option is set \n");
11886 MrBayesPrint (" to NO, then a specific number of samples will be discarded \n");
11887 MrBayesPrint (" instead. This number is set by Burnin (see below). \n");
11888 MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n");
11889 MrBayesPrint (" be discarded when convergence diagnostics are calculated. \n");
11890 MrBayesPrint (" The value of this option is only relevant when Relburnin is \n");
11891 MrBayesPrint (" set to NO. \n");
11892 MrBayesPrint (" BurninFrac -- Determines the fraction of samples that will be discarded \n");
11893 MrBayesPrint (" when convergence diagnostics are calculated. The value of \n");
11894 MrBayesPrint (" this option is only relevant when Relburnin is set to YES. \n");
11895 MrBayesPrint (" Example: A value for this option of 0.25 means that 25%% of \n");
11896 MrBayesPrint (" the samples will be discarded. \n");
11897 MrBayesPrint (" Stoprule -- If this option is set to NO, then the chain is run the number \n");
11898 MrBayesPrint (" of generations determined by Ngen. If it is set to YES, and \n");
11899 MrBayesPrint (" topological convergence diagnostics are calculated (Mcmcdiagn \n");
11900 MrBayesPrint (" is set to YES), then the chain will be stopped before the pre-\n");
11901 MrBayesPrint (" determined number of generations if the convergence diagnostic\n");
11902 MrBayesPrint (" falls below the stop value. \n");
11903 MrBayesPrint (" Stopval -- The critical value for the topological convergence diagnostic.\n");
11904 MrBayesPrint (" Only used when Stoprule and Mcmcdiagn are set to yes, and \n");
11905 MrBayesPrint (" more than one analysis is run simultaneously (Nruns > 1). \n");
11906 MrBayesPrint (" Checkpoint -- If this parameter is set to 'Yes', all the current parameter \n");
11907 MrBayesPrint (" values of all chains will be printed to a check-pointing file \n");
11908 MrBayesPrint (" every 'Checkfreq' generation of the analysis. The file will be\n");
11909 MrBayesPrint (" named <Filename>.ckp and allows you to restart the analysis \n");
11910 MrBayesPrint (" from the last check point. This can be handy if you are \n");
11911 MrBayesPrint (" running a long analysis and want to extend it, or if there is \n");
11912 MrBayesPrint (" a risk that a long analysis will be inadvertently interupted \n");
11913 MrBayesPrint (" by hardware failure or other factors that are out of your \n");
11914 MrBayesPrint (" control. \n");
11915 MrBayesPrint (" Checkfreq -- The number of generations between check-pointing. See the \n");
11916 MrBayesPrint (" 'Checkpoint' parameter above for more information. \n");
11917 MrBayesPrint (" Filename -- The name of the files that will be generated. Two files \n");
11918 MrBayesPrint (" are generated: \"<Filename>.t\" and \"<Filename>.p\". \n");
11919 MrBayesPrint (" The .t file contains the trees whereas the .p file con- \n");
11920 MrBayesPrint (" tains the sampled values of the parameters. \n");
11921 MrBayesPrint (" Startparams -- The starting values for the model parameters are set to \n");
11922 MrBayesPrint (" arbitrary or random values when the parameters are created. \n");
11923 MrBayesPrint (" These starting values can be altered using the 'Startvals' \n");
11924 MrBayesPrint (" command. The 'Startparams=reset' option allows you to reset \n");
11925 MrBayesPrint (" the starting values to the default at the start of the ana- \n");
11926 MrBayesPrint (" lysis, overriding any previous user-defined starting values. \n");
11927 MrBayesPrint (" Under the default option, 'current', the chains will use the \n");
11928 MrBayesPrint (" current starting values. \n");
11929 MrBayesPrint (" Starttree -- The starting tree(s) for the chain can either be randomly \n");
11930 MrBayesPrint (" selected or user-defined. It might be a good idea to \n");
11931 MrBayesPrint (" start from randomly chosen trees; convergence seems \n");
11932 MrBayesPrint (" likely if independently run chains, each of which \n");
11933 MrBayesPrint (" started from different random trees, converge to the same \n");
11934 MrBayesPrint (" answer. If you want the chain to start from user-defined \n");
11935 MrBayesPrint (" trees instead, you first need to read in your tree(s) from a \n");
11936 MrBayesPrint (" Nexus file with a 'trees' block, and then you need to set the \n");
11937 MrBayesPrint (" starting tree(s) using the 'Startvals' command. Finally, you \n");
11938 MrBayesPrint (" need to make sure that 'Starttree' is set to 'current'. If \n");
11939 MrBayesPrint (" you do not set the starting tree(s), the chains will start \n");
11940 MrBayesPrint (" with random trees. Setting 'Starttree' to 'random' causes \n");
11941 MrBayesPrint (" new starting trees to be drawn randomly at the start of the \n");
11942 MrBayesPrint (" run, overwriting any previous user-defined starting trees. \n");
11943 MrBayesPrint (" Nperts -- This is the number of random perturbations to apply to the \n");
11944 MrBayesPrint (" user starting tree. This allows you to have something \n");
11945 MrBayesPrint (" between completely random and user-defined trees start \n");
11946 MrBayesPrint (" the chain. \n");
11947 /* MrBayesPrint (" Savebrlens -- This specifies whether branch length information is \n");
11948 MrBayesPrint (" saved on the trees. \n"); */
11949 MrBayesPrint (" Data -- When Data is set to NO, the chain is run without data. This \n");
11950 MrBayesPrint (" should be used only for examining induced priors. DO NOT SET \n");
11951 MrBayesPrint (" 'DATA' TO 'NO' UNLESS YOU KNOW WHAT YOU ARE DOING! \n");
11952 MrBayesPrint (" Ordertaxa -- Determines whether taxa should be ordered before trees are \n");
11953 MrBayesPrint (" printed to file. If set to 'Yes', terminals in the sampled \n");
11954 MrBayesPrint (" trees will be reordered to match the order of the taxa in the \n");
11955 MrBayesPrint (" data matrix as closely as possible. By default, trees will be \n");
11956 MrBayesPrint (" printed without reordering of taxa. \n");
11957 MrBayesPrint (" Append -- Set this to 'Yes' to append the results of the current run to \n");
11958 MrBayesPrint (" a previous run. MrBayes will first read in the results of the \n");
11959 MrBayesPrint (" previous run (number of generations and sampled splits) and \n");
11960 MrBayesPrint (" will then continue that run where you left it off. Make sure \n");
11961 MrBayesPrint (" that the output file names used in the previous run are the \n");
11962 MrBayesPrint (" same as those in the current run. \n");
11963 MrBayesPrint (" Autotune -- Set this to 'Yes' to autotune the proposals that change \n");
11964 MrBayesPrint (" substitution model parameters. When set to 'No', the tuning \n");
11965 MrBayesPrint (" parameters are fixed to their starting values. Note that the \n");
11966 MrBayesPrint (" autotuning occurs independently for each chain. The target \n");
11967 MrBayesPrint (" acceptance rate for each move can be changed using the \n");
11968 MrBayesPrint (" 'Propset' command. \n");
11969 MrBayesPrint (" Tunefreq -- When a proposal has been tried 'Tunefreq' times, its tuning \n");
11970 MrBayesPrint (" parameter is adjusted to reach the target acceptance rate \n");
11971 MrBayesPrint (" if 'Autotune' is set to 'Yes'. \n");
11972 MrBayesPrint (" \n");
11973 PrintSettings ("Mcmc");
11974 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11976 else if (!strcmp(helpTkn, "Mcmcp"))
11978 // PrintYesNo (chainParams.saveBrlens, yesNoStr);
11979 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11980 MrBayesPrint (" Mcmcp \n");
11981 MrBayesPrint (" \n");
11982 MrBayesPrint (" This command sets the parameters of the Markov chain Monte Carlo (MCMC) \n");
11983 MrBayesPrint (" analysis without actually starting the chain. This command is identical \n");
11984 MrBayesPrint (" in all respects to Mcmc, except that the analysis will not start after \n");
11985 MrBayesPrint (" this command is issued. For more details on the options, check the help \n");
11986 MrBayesPrint (" menu for Mcmc.\n");
11987 MrBayesPrint (" \n");
11988 PrintSettings ("Mcmc");
11989 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11991 else if (!strcmp(helpTkn, "Ss"))
11993 MrBayesPrint (" --------------------------------------------------------------------------- \n");
11994 MrBayesPrint (" Ss \n");
11995 MrBayesPrint (" \n");
11996 MrBayesPrint (" This command is used to start stepping-stone sampling, which is an efficient \n");
11997 MrBayesPrint (" and accurate method for estimating the marginal likelihood of the currently \n");
11998 MrBayesPrint (" specified model. It is considerably more accurate than the harmonic mean of \n");
11999 MrBayesPrint (" the likelihoods from a standard MCMC run on the model (calculated by the \n");
12000 MrBayesPrint (" 'Sump' command) but it requires a separate MCMC-like run. To be more specific,\n");
12001 MrBayesPrint (" stepping-stone sampling uses importance sampling to estimate each ratio in a \n");
12002 MrBayesPrint (" series of discrete steps bridging the posterior and prior distributions. \n");
12003 MrBayesPrint (" The importance distributions that are used are called power posterior distri- \n");
12004 MrBayesPrint (" butions, and are defined as prior*(likelihood^beta). By varying beta from 1 to\n");
12005 MrBayesPrint (" 0, we get a series of distributions that connect the posterior (beta = 1) to \n");
12006 MrBayesPrint (" the prior (beta = 0). \n");
12007 MrBayesPrint (" \n");
12008 MrBayesPrint (" The power posterior distributions are sampled using MCMC. First, we start a \n");
12009 MrBayesPrint (" standard MCMC chain on the posterior distribution, and let it run until we \n");
12010 MrBayesPrint (" have reached the criterion specified by the 'Burninss' option. After this, we \n");
12011 MrBayesPrint (" step through the power posterior distributions until we reach the prior dis- \n");
12012 MrBayesPrint (" tribution. In each of the 'Nsteps' steps, we sample from a new power poster- \n");
12013 MrBayesPrint (" ior distribution with a distinct beta value. The beta values correspond to \n");
12014 MrBayesPrint (" 'Nsteps' evenly spaced quantiles in a Beta distribution with the parameters \n");
12015 MrBayesPrint (" 'Alpha' and 1.0. For the first sampling step, the beta value is equal to the \n");
12016 MrBayesPrint (" last quantile, i.e., it is close to 1.0. For each successive step, the beta \n");
12017 MrBayesPrint (" value takes on the value of the next quantile, in decreasing order, until it \n");
12018 MrBayesPrint (" reaches the value of 0.0. If you change value of 'FromPrior' from default 'No'\n");
12019 MrBayesPrint (" to 'Yes' then the direction of power posterior change during SS analizes is \n");
12020 MrBayesPrint (" opposite to the one described above, i.e. we start from sampling prior and \n");
12021 MrBayesPrint (" finish close to posterior. \n");
12022 MrBayesPrint (" \n");
12023 MrBayesPrint (" The 'Ss' procedure uses the same machinery as the standard 'Mcmc' algorithm, \n");
12024 MrBayesPrint (" and shares most of its parameters with the 'Mcmc' and 'Mcmcp' commands. All \n");
12025 MrBayesPrint (" 'Mcmc' parameters, except those related to burnin, have the same meaning and \n");
12026 MrBayesPrint (" usage in the 'Ss' command as they have in the 'Mcmc' command. The 'Mcmc' \n");
12027 MrBayesPrint (" burnin parameters are used to set up burnin within each step. The 'Ss' command\n");
12028 MrBayesPrint (" also uses its own burnin parameter, 'Burninss' (see below for details). The \n");
12029 MrBayesPrint (" 'Ss' command also has its own parameters for specifying the number of steps \n");
12030 MrBayesPrint (" and the shape of the Beta distribution from which the beta values are computed\n");
12031 MrBayesPrint (" (see below). \n");
12032 MrBayesPrint (" \n");
12033 MrBayesPrint (" Note that the 'Ngen' parameter of 'Mcmc' is used to set the maximum number of \n");
12034 MrBayesPrint (" generations processed, including both the burnin and the following steps in \n");
12035 MrBayesPrint (" the stepping-stone sampling phase. For instance, assume that 'Burninss' is set\n");
12036 MrBayesPrint (" to '-1', 'Nsteps' to '49', 'Ngen' to '1000000' and 'Samplefreq' to '1000'. \n");
12037 MrBayesPrint (" We will then get 1,000 samples in total (1,000,000 / 1,000). These will fall \n");
12038 MrBayesPrint (" into 50 bins, one of which represents the burnin and is discarded. Each step \n");
12039 MrBayesPrint (" in the algorithm will thus be represented by 20 samples. \n");
12040 MrBayesPrint (" \n");
12041 MrBayesPrint (" More information on 'Mcmc' parameters is available in the help for the 'Mcmc' \n");
12042 MrBayesPrint (" and 'Mcmcp' commands. Only the exclusive 'Ss' parameters are listed below. \n");
12043 MrBayesPrint (" These can only be set up using the 'Ss' command, while the parameters shared \n");
12044 MrBayesPrint (" with 'Mcmc' and 'Mcmcp' can also be set up using those commands. \n");
12045 MrBayesPrint (" \n");
12046 MrBayesPrint (" The correct usage is \n");
12047 MrBayesPrint (" \n");
12048 MrBayesPrint (" ss <parameter>=<value> ... <parameter>=<value> \n");
12049 MrBayesPrint (" \n");
12050 MrBayesPrint (" Note that a command: \n");
12051 MrBayesPrint (" \n");
12052 MrBayesPrint (" ss <setting parameters shared with mcmc> <setting exclusive ss parameters> \n");
12053 MrBayesPrint (" \n");
12054 MrBayesPrint (" would be equivalent to executing two commands: \n");
12055 MrBayesPrint (" \n");
12056 MrBayesPrint (" mcmcp <setting parameters shared with mcmc>; \n");
12057 MrBayesPrint (" ss <setting exclusive ss parameters>; \n");
12058 MrBayesPrint (" \n");
12059 MrBayesPrint (" For more information on the stepping-stone algorithm, see: \n");
12060 MrBayesPrint (" \n");
12061 MrBayesPrint (" Xie, W., P. O. Lewis, Y. Fan, L. Kuo, and M.-H. Chen. 2011. Improving marginal\n");
12062 MrBayesPrint (" likelihood estimation for Bayesian phylogenetic model selection. Systematic\n");
12063 MrBayesPrint (" Biology 60:150-160. \n");
12064 MrBayesPrint (" \n");
12065 MrBayesPrint (" Available options: \n");
12066 MrBayesPrint (" (NB: Only exclusive ss parameters listed here. For additional parameters, see \n");
12067 MrBayesPrint (" help on 'mcmc' or 'mcmcp'. \n");
12068 MrBayesPrint (" \n");
12069 MrBayesPrint (" Alpha -- The beta values used in the stepping-stone sampling procedure \n");
12070 MrBayesPrint (" correspond to evenly spaced quantiles from a Beta('Alpha',1.0)\n");
12071 MrBayesPrint (" distribution. The parameter 'Alpha' determines the skewness of\n");
12072 MrBayesPrint (" the beta values. If 'Alpha' is set to '1.0', the beta values \n");
12073 MrBayesPrint (" would be spaced uniformly on the interval (0.0,1.0). However, \n");
12074 MrBayesPrint (" better results are obtained if the beta values are skewed. \n");
12075 MrBayesPrint (" Empirically, it was observed that 'Alpha' values in the range \n");
12076 MrBayesPrint (" of 0.3 to 0.5 produce the most accurate results. \n");
12077 MrBayesPrint (" Burninss -- Fixed number of samples discarded before sampling of the first\n");
12078 MrBayesPrint (" step starts. 'Burninss' can be specified using either a pos- \n");
12079 MrBayesPrint (" itive or a negative number. If the number is positive, it is \n");
12080 MrBayesPrint (" interpreted as the number of samples to discard as burnin. If \n");
12081 MrBayesPrint (" the number is negative, its absolute value is interpreted as \n");
12082 MrBayesPrint (" the length of the burnin in terms of the length of each of the\n");
12083 MrBayesPrint (" following steps in the stepping-stone algorithm. For instance,\n");
12084 MrBayesPrint (" a value of '-1' means that the length of the burnin is the \n");
12085 MrBayesPrint (" same as the length of each of the subsequent steps. \n");
12086 MrBayesPrint (" Nsteps -- Number of steps in the stepping-stone algorithm. Typically, a \n");
12087 MrBayesPrint (" number above 30 is sufficient for accurate results. \n");
12088 MrBayesPrint (" FromPrior -- If it is set to 'Yes', it indicates that in the first step we \n");
12089 MrBayesPrint (" sample from the prior, with each consequtive step we sample \n");
12090 MrBayesPrint (" closer to the posterior. 'No' indicates the opposite direction\n");
12091 MrBayesPrint (" of power posterior change, i.e. in the first step we sample \n");
12092 MrBayesPrint (" close to the posterior, and with each consequtive step we \n");
12093 MrBayesPrint (" sample closer to the prior. \n");
12094 MrBayesPrint (" \n");
12095 MrBayesPrint (" Current settings: \n");
12096 MrBayesPrint (" \n");
12097 MrBayesPrint (" Parameter Options Current Setting \n");
12098 MrBayesPrint (" -------------------------------------------------------- \n");
12099 MrBayesPrint (" Alpha <number> %1.2lf\n", chainParams.alphaSS);
12100 MrBayesPrint (" BurninSS <number> %d\n", chainParams.burninSS);
12101 MrBayesPrint (" Nsteps <number> %d\n", chainParams.numStepsSS);
12102 MrBayesPrint (" FromPrior Yes/No %s \n", chainParams.startFromPriorSS == YES ? "Yes" : "No");
12103 MrBayesPrint (" \n");
12104 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12106 else if (!strcmp(helpTkn, "Ssp"))
12108 // PrintYesNo (chainParams.saveBrlens, yesNoStr);
12109 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12110 MrBayesPrint (" Ssp \n");
12111 MrBayesPrint (" \n");
12112 MrBayesPrint (" This command sets the parameters of the stepping-stone sampling \n");
12113 MrBayesPrint (" analysis without actually starting the chain. This command is identical \n");
12114 MrBayesPrint (" in all respects to Ss, except that the analysis will not start after \n");
12115 MrBayesPrint (" this command is issued. For more details on the options, check the help \n");
12116 MrBayesPrint (" menu for Ss.\n");
12117 MrBayesPrint (" \n");
12118 MrBayesPrint (" Current settings: \n");
12119 MrBayesPrint (" \n");
12120 MrBayesPrint (" Parameter Options Current Setting \n");
12121 MrBayesPrint (" -------------------------------------------------------- \n");
12122 MrBayesPrint (" Alpha <number> %1.2lf\n", chainParams.alphaSS);
12123 MrBayesPrint (" BurninSS <number> %d\n", chainParams.burninSS);
12124 MrBayesPrint (" Nsteps <number> %d\n", chainParams.numStepsSS);
12125 MrBayesPrint (" FromPrior Yes/No %s \n", chainParams.startFromPriorSS == YES ? "Yes" : "No");
12126 MrBayesPrint (" \n");
12127 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12129 else if (!strcmp(helpTkn, "Set"))
12131 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12132 MrBayesPrint (" Set \n");
12133 MrBayesPrint (" \n");
12134 MrBayesPrint (" This command is used to set some general features of the model or program \n");
12135 MrBayesPrint (" behavior. The correct usage is \n");
12136 MrBayesPrint (" \n");
12137 MrBayesPrint (" set <parameter>=<value> ... <parameter>=<value> \n");
12138 MrBayesPrint (" \n");
12139 MrBayesPrint (" Available options: \n");
12140 MrBayesPrint (" \n");
12141 MrBayesPrint (" Seed -- Sets the seed number for the random number generator. The \n");
12142 MrBayesPrint (" random number seed is initialized haphazardly at the beg- \n");
12143 MrBayesPrint (" inning of each MrBayes session. This option allows you to \n");
12144 MrBayesPrint (" set the seed to some specific value, thereby allowing you \n");
12145 MrBayesPrint (" to exactly repeat an analysis. If the analysis uses swapping \n");
12146 MrBayesPrint (" between cold and heated chains, you must also set the swap \n");
12147 MrBayesPrint (" seed (see below) to exactly repeat the analysis. \n");
12148 MrBayesPrint (" Swapseed -- Sets the seed used for generating the swapping sequence \n");
12149 MrBayesPrint (" when Metropolis-coupled heated chains are used. This seed \n");
12150 MrBayesPrint (" is initialized haphazardly at the beginning of each MrBayes \n");
12151 MrBayesPrint (" session. This option allows you to set the seed to some \n");
12152 MrBayesPrint (" specific value, thereby allowing you to exactly repeat a \n");
12153 MrBayesPrint (" swap sequence. See also the 'Seed' option. \n");
12154 MrBayesPrint (" Dir -- The working directory. Specifies the absolute or relative path\n");
12155 MrBayesPrint (" to the working directory. If left empty, the working directory\n");
12156 MrBayesPrint (" is the current directory. \n");
12157 MrBayesPrint (" Partition -- Set this option to a valid partition id, either the number or \n");
12158 MrBayesPrint (" name of a defined partition, to enforce a specific partition- \n");
12159 MrBayesPrint (" ing of the data. When a data matrix is read in, a partition \n");
12160 MrBayesPrint (" called \"Default\" is automatically created. It divides the \n");
12161 MrBayesPrint (" data into one part for each data type. If you only have one \n");
12162 MrBayesPrint (" data type, DNA for instance, the default partition will not \n");
12163 MrBayesPrint (" divide up the data at all. The default partition is always \n");
12164 MrBayesPrint (" the first partition, so 'set partition=1' is the same as \n");
12165 MrBayesPrint (" 'set partition=default'. \n");
12166 MrBayesPrint (" Speciespartition -- Set this option to a valid speciespartition id, either the\n");
12167 MrBayesPrint (" number or name of a defined speciespartition, to enforce a \n");
12168 MrBayesPrint (" specific partitioning of taxa to species. When a data matrix \n");
12169 MrBayesPrint (" is read in, a speciespartition called \"Default\" is auto- \n");
12170 MrBayesPrint (" matically created. It assigns one taxon for each species. The \n");
12171 MrBayesPrint (" default speciespartition is always the first speciespartition,\n");
12172 MrBayesPrint (" so 'set speciespartition=1' is the same as \n");
12173 MrBayesPrint (" 'set speciespartition=default'. \n");
12174 MrBayesPrint (" Autoclose -- If autoclose is set to 'yes', then the program will not prompt\n");
12175 MrBayesPrint (" you during the course of executing a file. This is particular-\n");
12176 MrBayesPrint (" ly useful when you run MrBayes in batch mode. \n");
12177 MrBayesPrint (" Nowarnings -- If nowarnings is set to yes, then the program will not prompt \n");
12178 MrBayesPrint (" you when overwriting or appending an ouput file that is al- \n");
12179 MrBayesPrint (" ready present. If 'nowarnings=no' (the default setting), then \n");
12180 MrBayesPrint (" the program propts the user before overwriting output files. \n");
12181 MrBayesPrint (" Autoreplace -- When nowarnings is set to yes, then MrBayes will by default \n");
12182 MrBayesPrint (" overwrite output files that already exists. This may cause \n");
12183 MrBayesPrint (" irrecoverable loss of previous results if you have not removed\n");
12184 MrBayesPrint (" or renamed the files from previous runs. To override this be- \n");
12185 MrBayesPrint (" havior, set autoreplace to no, in which case new output will \n");
12186 MrBayesPrint (" be appended to existing files instead. \n");
12187 MrBayesPrint (" Quitonerror -- If quitonerror is set to yes, then the program will quit when \n");
12188 MrBayesPrint (" an error is encountered, after printing an error message. If \n");
12189 MrBayesPrint (" quitonerror is set to no (the default setting), then the \n");
12190 MrBayesPrint (" program will wait for additional commands from the command \n");
12191 MrBayesPrint (" line after the error message is printed. \n");
12192 MrBayesPrint (" Scientific -- Set this option to 'Yes' to write sampled values to file in \n");
12193 MrBayesPrint (" scientific format and to 'No' to write them in fixed format. \n");
12194 MrBayesPrint (" Fixed format is easier for humans to read but you risk losing \n");
12195 MrBayesPrint (" precision for small numbers. For instance, sampled values that\n");
12196 MrBayesPrint (" are less than 1E-6 will print to file as '0.000000' if fixed \n");
12197 MrBayesPrint (" format is used and 'precision' is set to 6. \n");
12198 MrBayesPrint (" Precision -- Precision allows you to set the number of decimals to be prin-\n");
12199 MrBayesPrint (" ted when sampled values are written to file. Precision must be\n");
12200 MrBayesPrint (" in the range 3 to 15. \n");
12201 # if defined (BEAGLE_ENABLED)
12202 MrBayesPrint (" Usebeagle -- Set this option to 'Yes' to attempt to use the BEAGLE library \n");
12203 MrBayesPrint (" to compute the phylogenetic likelihood on a variety of high- \n");
12204 MrBayesPrint (" performance hardware including multicore CPUs and GPUs. Some \n");
12205 MrBayesPrint (" models in MrBayes are not yet supported by BEAGLE. \n");
12206 MrBayesPrint (" Beagleresource -- Set this option to the number of a specific resource you \n");
12207 MrBayesPrint (" wish to use with BEAGLE (use 'Showbeagle' to see the list of \n");
12208 MrBayesPrint (" available resources). Set to '99' for auto-resource selection.\n");
12209 MrBayesPrint (" Beagledevice -- Set this option to 'GPU' or 'CPU' to select processor. \n");
12210 MrBayesPrint (" Beagleprecision -- Selection 'Single' or 'Double' precision computation. \n");
12211 MrBayesPrint (" Beaglescaling -- 'Always' rescales partial likelihoods at each evaluation. \n");
12212 MrBayesPrint (" 'Dynamic' rescales less frequently and should run faster. \n");
12213 MrBayesPrint (" Beaglesse -- Use SSE instructions on Intel CPU processors. \n");
12214 MrBayesPrint (" Beagleopenmp -- Use OpenMP to parallelize across multi-core CPU processors. \n");
12216 # if defined (THREADS_ENABLED)
12217 MrBayesPrint (" Beaglethreads -- Set this option to 'Yes' to employ multiple threads to drive \n");
12218 MrBayesPrint (" multiple BEAGLE resource simultaneously. This is highly \n");
12219 MrBayesPrint (" recommended for more than one GPU, and for sufficiently large \n");
12220 MrBayesPrint (" data partitions, multi-core CPUs should also demonstrate \n");
12221 MrBayesPrint (" speed-ups. \n");
12223 MrBayesPrint (" \n");
12224 MrBayesPrint (" Current settings: \n");
12225 MrBayesPrint (" \n");
12226 MrBayesPrint (" Parameter Options Current Setting \n");
12227 MrBayesPrint (" -------------------------------------------------------- \n");
12228 MrBayesPrint (" Seed <number> %ld \n", globalSeed);
12229 MrBayesPrint (" Swapseed <number> %ld \n", swapSeed);
12230 MrBayesPrint (" Dir <name> \"%s\"\n", workingDir);
12231 if (defMatrix == YES)
12232 MrBayesPrint (" Partition <name> %s\n", partitionNames[partitionNum]);
12234 MrBayesPrint (" Partition <name> \"\"\n");
12235 if (defTaxa == YES)
12236 MrBayesPrint (" Speciespartition <name> %s\n", speciespartitionNames[speciespartitionNum]);
12238 MrBayesPrint (" Speciespartition <name> \"\"\n");
12239 MrBayesPrint (" Autoclose Yes/No %s \n", autoClose == YES ? "Yes" : "No");
12240 MrBayesPrint (" Nowarnings Yes/No %s \n", noWarn == YES ? "Yes" : "No");
12241 MrBayesPrint (" Autoreplace Yes/No %s \n", autoOverwrite == YES ? "Yes" : "No");
12242 MrBayesPrint (" Quitonerror Yes/No %s \n", quitOnError == YES ? "Yes" : "No");
12243 MrBayesPrint (" Scientific Yes/No %s \n", scientific == YES ? "Yes" : "No");
12244 MrBayesPrint (" Precision <number> %d \n", precision);
12245 # if defined (BEAGLE_ENABLED)
12246 MrBayesPrint (" Usebeagle Yes/No %s \n", tryToUseBEAGLE == YES ? "Yes" : "No");
12247 MrBayesPrint (" Beagleresource <number> %d \n", beagleResourceNumber);
12248 MrBayesPrint (" Beagledevice CPU/GPU %s \n", beagleFlags & BEAGLE_FLAG_PROCESSOR_GPU ? "GPU" : "CPU");
12249 MrBayesPrint (" Beagleprecision Single/Double %s \n", beagleFlags & BEAGLE_FLAG_PRECISION_SINGLE ? "Single" : "Double");
12250 MrBayesPrint (" Beaglescaling Always/Dynamic %s \n", beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS ? "Always" : "Dynamic");
12251 MrBayesPrint (" Beaglesse Yes/No %s \n", beagleFlags & BEAGLE_FLAG_VECTOR_SSE ? "Yes" : "No");
12252 MrBayesPrint (" Beagleopenmp Yes/No %s \n", beagleFlags & BEAGLE_FLAG_THREADING_OPENMP ? "Yes" : "No");
12254 # if defined (THREADS_ENABLED)
12255 MrBayesPrint (" Beaglethreads Yes/No %s \n", tryToUseThreads == YES ? "Yes" : "No");
12257 MrBayesPrint (" \n");
12258 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12260 else if (!strcmp(helpTkn, "Charset"))
12262 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12263 MrBayesPrint (" Charset \n");
12264 MrBayesPrint (" \n");
12265 MrBayesPrint (" This command defines a character set. The format for the charset command \n");
12266 MrBayesPrint (" is \n");
12267 MrBayesPrint (" \n");
12268 MrBayesPrint (" charset <name> = <character numbers> \n");
12269 MrBayesPrint (" \n");
12270 MrBayesPrint (" For example, \"charset first_pos = 1-720\\3\" defines a character set \n");
12271 MrBayesPrint (" called \"first_pos\" that includes every third site from 1 to 720. \n");
12272 MrBayesPrint (" The character set name cannot have any spaces in it. The slash (\\) \n");
12273 MrBayesPrint (" is a nifty way of telling the program to assign every third (or \n");
12274 MrBayesPrint (" second, or fifth, or whatever) character to the character set. \n");
12275 MrBayesPrint (" This option is best used not from the command line, but rather as a \n");
12276 MrBayesPrint (" line in the mrbayes block of a file. Note that you can use \".\" to \n");
12277 MrBayesPrint (" stand in for the last character (e.g., charset 1-.\\3). \n");
12278 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12280 else if (!strcmp(helpTkn, "Outgroup"))
12282 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12283 MrBayesPrint (" Outgroup \n");
12284 MrBayesPrint (" \n");
12285 MrBayesPrint (" This command assigns a taxon to the outgroup. The correct usage is: \n");
12286 MrBayesPrint (" \n");
12287 MrBayesPrint (" outgroup <number>/<taxon name> \n");
12288 MrBayesPrint (" \n");
12289 MrBayesPrint (" For example, \"outgroup 3\" assigns the third taxon in the matrix to be \n");
12290 MrBayesPrint (" the outgroup. Similarly, \"outgroup Homo_sapiens\" assings the taxon \n");
12291 MrBayesPrint (" \"Homo_sapiens\" to be the outgroup (assuming that there is a taxon named \n");
12292 MrBayesPrint (" \"Homo_sapiens\" in the matrix). Only a single taxon can be assigned to \n");
12293 MrBayesPrint (" be the outgroup. \n");
12294 MrBayesPrint (" \n");
12295 if (defTaxa == YES)
12296 MrBayesPrint (" Current outgroup: %s (taxon no. %d)\n", taxaNames[outGroupNum], outGroupNum+1);
12297 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12299 else if (!strcmp(helpTkn, "Showusertrees"))
12301 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12302 MrBayesPrint (" Showusertrees \n");
12303 MrBayesPrint (" \n");
12304 MrBayesPrint (" This command shows the currently defined user trees. The correct usage \n");
12305 MrBayesPrint (" is \"showusertrees\". \n");
12306 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12308 else if (!strcmp(helpTkn, "Showmcmctrees"))
12310 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12311 MrBayesPrint (" Showmcmctrees \n");
12312 MrBayesPrint (" \n");
12313 MrBayesPrint (" This command shows the current trees used by the Markov chains. \n");
12314 MrBayesPrint (" is \"showmcmctrees\". \n");
12315 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12317 else if (!strcmp(helpTkn, "Deroot"))
12319 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12320 MrBayesPrint (" Deroot \n");
12321 MrBayesPrint (" \n");
12322 MrBayesPrint (" This command deroots the user tree. If the tree is already unrooted, a \n");
12323 MrBayesPrint (" warning is issued. The correct usage is \"deroot\". \n");
12324 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12326 else if (!strcmp(helpTkn, "Root"))
12328 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12329 MrBayesPrint (" Root \n");
12330 MrBayesPrint (" \n");
12331 MrBayesPrint (" This command roots the tree. If the tree is already rooted, a warning \n");
12332 MrBayesPrint (" is issued. The tree is rooted at the midpoint between the outgroup species \n");
12333 MrBayesPrint (" and the ingroup species. The correct usage is \"root\". \n");
12334 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12336 else if (!strcmp(helpTkn, "Taxset"))
12338 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12339 MrBayesPrint (" Taxset \n");
12340 MrBayesPrint (" \n");
12341 MrBayesPrint (" This command defines a taxon set. The format for the taxset command \n");
12342 MrBayesPrint (" is \n");
12343 MrBayesPrint (" \n");
12344 MrBayesPrint (" taxset <name> = <taxon names or numbers> \n");
12345 MrBayesPrint (" \n");
12346 MrBayesPrint (" For example, \"taxset apes = Homo Pan Gorilla Orang gibbon\" defines a \n");
12347 MrBayesPrint (" taxon set called \"apes\" that includes five taxa (namely, apes). \n");
12348 MrBayesPrint (" You can assign up to 30 taxon sets. This option is best used \n");
12349 MrBayesPrint (" not from the command line but rather as a line in the mrbayes block \n");
12350 MrBayesPrint (" of a file. \n");
12351 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12353 else if (!strcmp(helpTkn, "Taxlabels"))
12355 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12356 MrBayesPrint (" Taxlabels \n");
12357 MrBayesPrint (" \n");
12358 MrBayesPrint (" This command defines taxon labels. It could be used within taxa block. \n");
12359 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12361 else if (!strcmp(helpTkn, "Charstat"))
12363 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12364 MrBayesPrint (" Charstat \n");
12365 MrBayesPrint (" \n");
12366 MrBayesPrint (" This command shows the status of all the characters. The correct usage \n");
12367 MrBayesPrint (" is \n");
12368 MrBayesPrint (" \n");
12369 MrBayesPrint (" charstat \n");
12370 MrBayesPrint (" \n");
12371 MrBayesPrint (" After typing \"charstat\", the character number, whether it is excluded \n");
12372 MrBayesPrint (" or included, and the partition identity are shown. The output is paused \n");
12373 MrBayesPrint (" every 100 characters. This pause can be turned off by setting autoclose \n");
12374 MrBayesPrint (" to \"yes\" (set autoclose=yes). \n");
12375 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12377 else if (!strcmp(helpTkn, "Taxastat"))
12379 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12380 MrBayesPrint (" Taxastat \n");
12381 MrBayesPrint (" \n");
12382 MrBayesPrint (" This command shows the status of all the taxa. The correct usage is \n");
12383 MrBayesPrint (" \n");
12384 MrBayesPrint (" taxastat \n");
12385 MrBayesPrint (" \n");
12386 MrBayesPrint (" After typing \"taxastat\", the taxon number, name, and whether it is \n");
12387 MrBayesPrint (" excluded or included are shown. \n");
12388 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12390 else if (!strcmp(helpTkn, "Partition"))
12392 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12393 MrBayesPrint (" Partition \n");
12394 MrBayesPrint (" \n");
12395 MrBayesPrint (" This command allows you to specify a character partition. The format for \n");
12396 MrBayesPrint (" this command is \n");
12397 MrBayesPrint (" \n");
12398 MrBayesPrint (" partition <name> = <num parts>:<chars in first>, ...,<chars in last> \n");
12399 MrBayesPrint (" \n");
12400 MrBayesPrint (" For example, \"partition by_codon = 3:1st_pos,2nd_pos,3rd_pos\" specifies \n");
12401 MrBayesPrint (" a partition called \"by_codon\" which consists of three parts (first, \n");
12402 MrBayesPrint (" second, and third codon positions). Here, we are assuming that the sites \n");
12403 MrBayesPrint (" in each partition were defined using the charset command. You can specify \n");
12404 MrBayesPrint (" a partition without using charset as follows: \n");
12405 MrBayesPrint (" \n");
12406 MrBayesPrint (" partition by_codon = 3:1 4 6 9 12,2 5 7 10 13,3 6 8 11 14 \n");
12407 MrBayesPrint (" \n");
12408 MrBayesPrint (" However, we recommend that you use the charsets to define a set of char- \n");
12409 MrBayesPrint (" acters and then use these predefined sets when defining the partition. \n");
12410 MrBayesPrint (" Also, it makes more sense to define a partition as a line in the mrbayes \n");
12411 MrBayesPrint (" block than to issue the command from the command line (then again, you \n");
12412 MrBayesPrint (" may be a masochist, and want to do extra work). \n");
12413 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12415 else if (!strcmp(helpTkn, "Exclude"))
12417 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12418 MrBayesPrint (" Exclude \n");
12419 MrBayesPrint (" \n");
12420 MrBayesPrint (" This command excludes characters from the analysis. The correct usage is \n");
12421 MrBayesPrint (" \n");
12422 MrBayesPrint (" exclude <number> <number> <number> \n");
12423 MrBayesPrint (" \n");
12424 MrBayesPrint (" or \n");
12425 MrBayesPrint (" \n");
12426 MrBayesPrint (" exclude <number> - <number> \n");
12427 MrBayesPrint (" \n");
12428 MrBayesPrint (" or \n");
12429 MrBayesPrint (" \n");
12430 MrBayesPrint (" exclude <charset> \n");
12431 MrBayesPrint (" \n");
12432 MrBayesPrint (" or some combination thereof. Moreover, you can use the specifier \"\\\" to \n");
12433 MrBayesPrint (" exclude every nth character. For example, the following \n");
12434 MrBayesPrint (" \n");
12435 MrBayesPrint (" exclude 1-100\\3 \n");
12436 MrBayesPrint (" \n");
12437 MrBayesPrint (" would exclude every third character. As a specific example, \n");
12438 MrBayesPrint (" \n");
12439 MrBayesPrint (" exclude 2 3 10-14 22 \n");
12440 MrBayesPrint (" \n");
12441 MrBayesPrint (" excludes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also, \n");
12442 MrBayesPrint (" \n");
12443 MrBayesPrint (" exclude all \n");
12444 MrBayesPrint (" \n");
12445 MrBayesPrint (" excludes all of the characters from the analysis. Excluding all characters \n");
12446 MrBayesPrint (" does not leave you much information for inferring phylogeny. \n");
12447 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12449 else if (!strcmp(helpTkn, "Include"))
12451 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12452 MrBayesPrint (" Include \n");
12453 MrBayesPrint (" \n");
12454 MrBayesPrint (" This command includes characters that were previously excluded from the \n");
12455 MrBayesPrint (" analysis. The correct usage is \n");
12456 MrBayesPrint (" \n");
12457 MrBayesPrint (" include <number> <number> <number> \n");
12458 MrBayesPrint (" \n");
12459 MrBayesPrint (" or \n");
12460 MrBayesPrint (" \n");
12461 MrBayesPrint (" include <number> - <number> \n");
12462 MrBayesPrint (" \n");
12463 MrBayesPrint (" or \n");
12464 MrBayesPrint (" \n");
12465 MrBayesPrint (" include <charset> \n");
12466 MrBayesPrint (" \n");
12467 MrBayesPrint (" or some combination thereof. Moreover, you can use the specifier \"\\\" to \n");
12468 MrBayesPrint (" include every nth character. For example, the following \n");
12469 MrBayesPrint (" \n");
12470 MrBayesPrint (" include 1-100\\3 \n");
12471 MrBayesPrint (" \n");
12472 MrBayesPrint (" would include every third character. As a specific example, \n");
12473 MrBayesPrint (" \n");
12474 MrBayesPrint (" include 2 3 10-14 22 \n");
12475 MrBayesPrint (" \n");
12476 MrBayesPrint (" includes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also, \n");
12477 MrBayesPrint (" \n");
12478 MrBayesPrint (" include all \n");
12479 MrBayesPrint (" \n");
12480 MrBayesPrint (" includes all of the characters in the analysis. Including all of the \n");
12481 MrBayesPrint (" characters (even if many of them are bad) is a very total-evidence-like \n");
12482 MrBayesPrint (" thing to do. Doing this will make a certain group of people very happy. \n");
12483 MrBayesPrint (" On the other hand, simply using this program would make those same people \n");
12484 MrBayesPrint (" unhappy. \n");
12485 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12487 else if (!strcmp(helpTkn, "Delete"))
12489 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12490 MrBayesPrint (" Delete \n");
12491 MrBayesPrint (" \n");
12492 MrBayesPrint (" This command deletes taxa from the analysis. The correct usage is: \n");
12493 MrBayesPrint (" \n");
12494 MrBayesPrint (" delete <name and/or number and/or taxset> ... \n");
12495 MrBayesPrint (" \n");
12496 MrBayesPrint (" A list of the taxon names or taxon numbers (labelled 1 to ntax in the order \n");
12497 MrBayesPrint (" in the matrix) or taxset(s) can be used. For example, the following: \n");
12498 MrBayesPrint (" \n");
12499 MrBayesPrint (" delete 1 2 Homo_sapiens \n");
12500 MrBayesPrint (" \n");
12501 MrBayesPrint (" deletes taxa 1, 2, and the taxon labelled Homo_sapiens from the analysis. \n");
12502 MrBayesPrint (" You can also use \"all\" to delete all of the taxa. For example, \n");
12503 MrBayesPrint (" \n");
12504 MrBayesPrint (" delete all \n");
12505 MrBayesPrint (" \n");
12506 MrBayesPrint (" deletes all of the taxa from the analysis. Of course, a phylogenetic anal- \n");
12507 MrBayesPrint (" ysis that does not include any taxa is fairly uninteresting. \n");
12508 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12510 else if (!strcmp(helpTkn, "Restore"))
12512 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12513 MrBayesPrint (" Restore \n");
12514 MrBayesPrint (" \n");
12515 MrBayesPrint (" This command restores taxa to the analysis. The correct usage is: \n");
12516 MrBayesPrint (" \n");
12517 MrBayesPrint (" restore <name and/or number and/or taxset> ... \n");
12518 MrBayesPrint (" \n");
12519 MrBayesPrint (" A list of the taxon names or taxon numbers (labelled 1 to ntax in the order \n");
12520 MrBayesPrint (" in the matrix) or taxset(s) can be used. For example, the following: \n");
12521 MrBayesPrint (" \n");
12522 MrBayesPrint (" restore 1 2 Homo_sapiens \n");
12523 MrBayesPrint (" \n");
12524 MrBayesPrint (" restores taxa 1, 2, and the taxon labelled Homo_sapiens to the analysis. \n");
12525 MrBayesPrint (" You can also use \"all\" to restore all of the taxa. For example, \n");
12526 MrBayesPrint (" \n");
12527 MrBayesPrint (" restore all \n");
12528 MrBayesPrint (" \n");
12529 MrBayesPrint (" restores all of the taxa to the analysis. \n");
12530 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12532 else if (!strcmp(helpTkn, "Quit"))
12534 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12535 MrBayesPrint (" Quit \n");
12536 MrBayesPrint (" \n");
12537 MrBayesPrint (" This command quits the program. The correct usage is: \n");
12538 MrBayesPrint (" \n");
12539 MrBayesPrint (" quit \n");
12540 MrBayesPrint (" \n");
12541 MrBayesPrint (" It is a very easy command to use properly. \n");
12542 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12544 else if (!strcmp(helpTkn, "Disclaimer"))
12546 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12547 MrBayesPrint (" Disclaimer \n");
12548 MrBayesPrint (" \n");
12549 MrBayesPrint (" This command shows the disclaimer for the program. In short, the disclaimer \n");
12550 MrBayesPrint (" states that the authors are not responsible for any silly things you may do \n");
12551 MrBayesPrint (" to your computer or any unforseen but possibly nasty things the computer \n");
12552 MrBayesPrint (" program may inadvertently do to you. \n");
12553 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12555 else if (!strcmp(helpTkn, "Unlink"))
12557 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12558 MrBayesPrint (" Unlink \n");
12559 MrBayesPrint (" \n");
12560 MrBayesPrint (" This command unlinks model parameters across partitions of the data. The \n");
12561 MrBayesPrint (" correct usage is: \n");
12562 MrBayesPrint (" \n");
12563 MrBayesPrint (" unlink <parameter name> = (<all> or <partition list>) \n");
12564 MrBayesPrint (" \n");
12565 MrBayesPrint (" A little background is necessary to understand this command. Upon exe- \n");
12566 MrBayesPrint (" cution of a file, a default partition is set up. This partition refer- \n");
12567 MrBayesPrint (" enced either by its name (\"default\") or number (0). If your data are \n");
12568 MrBayesPrint (" all of one type, then this default partition does not actually divide up \n");
12569 MrBayesPrint (" your characters. However, if your datatype is mixed, then the default \n");
12570 MrBayesPrint (" partition contains as many divisions as there are datatypes in your \n");
12571 MrBayesPrint (" character matrix. Of course, you can also define other partitions, and \n");
12572 MrBayesPrint (" switch among them using the set command (\"set partition=<name/number>\"). \n");
12573 MrBayesPrint (" Importantly, you can also assign model parameters to individual part- \n");
12574 MrBayesPrint (" itions or to groups of them using the \"applyto\" option in lset and \n");
12575 MrBayesPrint (" prset. When the program attempts to perform an analysis, the model is \n");
12576 MrBayesPrint (" set for individual partitions. If the same parameter applies to differ- \n");
12577 MrBayesPrint (" partitions and if that parameter has the same prior, then the program \n");
12578 MrBayesPrint (" will link the parameters: that is, it will use a single value for the \n");
12579 MrBayesPrint (" parameter. The program's default, then, is to strive for parsimony. \n");
12580 MrBayesPrint (" However, there are lots of cases where you may want unlink a parameter \n");
12581 MrBayesPrint (" across partitions. For example, you may want a different transition/ \n");
12582 MrBayesPrint (" transversion rate ratio to apply to different partitions. This command \n");
12583 MrBayesPrint (" allows you to unlink the parameters, or to make them different across \n");
12584 MrBayesPrint (" partitions. The converse of this command is \"link\", which links to- \n");
12585 MrBayesPrint (" gether parameters that were previously told to be different. The list \n");
12586 MrBayesPrint (" of parameters that can be unlinked includes: \n");
12587 MrBayesPrint (" \n");
12588 MrBayesPrint (" Tratio -- Transition/transversion rate ratio \n");
12589 MrBayesPrint (" Revmat -- Substitution rates of GTR model \n");
12590 MrBayesPrint (" Omega -- Nonsynonymous/synonymous rate ratio \n");
12591 MrBayesPrint (" Statefreq -- Character state frequencies \n");
12592 MrBayesPrint (" Shape -- Gamma/LNorm shape parameter \n");
12593 MrBayesPrint (" Pinvar -- Proportion of invariable sites \n");
12594 MrBayesPrint (" Correlation -- Correlation parameter of autodiscrete gamma \n");
12595 MrBayesPrint (" Ratemultiplier -- Rate multiplier for partitions \n");
12596 MrBayesPrint (" Switchrates -- Switching rates for covarion model \n");
12597 MrBayesPrint (" Topology -- Topology of tree \n");
12598 MrBayesPrint (" Brlens -- Branch lengths of tree \n");
12599 MrBayesPrint (" Speciationrate -- Speciation rates for birth-death process \n");
12600 MrBayesPrint (" Extinctionrate -- Extinction rates for birth-death process \n");
12601 // MrBayesPrint (" Fossilizationrate -- Fossilization rates for fossilized birth-death process \n");
12602 MrBayesPrint (" Popsize -- Population size for coalescence process \n");
12603 MrBayesPrint (" Growthrate -- Growth rate of coalescence process \n");
12604 MrBayesPrint (" Aamodel -- Aminoacid rate matrix \n");
12605 MrBayesPrint (" Cpprate -- Rate of Compound Poisson Process (CPP) \n");
12606 MrBayesPrint (" Cppmultdev -- Standard dev. of CPP rate multipliers (log scale) \n");
12607 MrBayesPrint (" Cppevents -- CPP events \n");
12608 MrBayesPrint (" TK02var -- Variance increase in TK02 relaxed clock model \n");
12609 MrBayesPrint (" Igrvar -- Variance increase in IGR relaxed clock model \n");
12610 MrBayesPrint (" Mixedvar -- Variance increase in Mixed relaxed clock model \n");
12611 // MrBayesPrint (" TK02branchrates -- Branch rates of TK02 relaxed clock model \n");
12612 // MrBayesPrint (" Igrbranchrates -- Branch rates of IGR relaxed clock model \n");
12613 // MrBayesPrint (" Mixedbrchrates -- Branch rates of Mixed relaxed clock model \n");
12614 MrBayesPrint (" \n");
12615 MrBayesPrint (" For example, \n");
12616 MrBayesPrint (" \n");
12617 MrBayesPrint (" unlink shape=(all) \n");
12618 MrBayesPrint (" \n");
12619 MrBayesPrint (" unlinks the gamma/lnorm shape parameter across all partitions of the data. \n");
12620 MrBayesPrint (" You can use \"showmodel\" to see the current linking status of the \n");
12621 MrBayesPrint (" characters. \n");
12622 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12624 else if (!strcmp(helpTkn, "Link"))
12626 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12627 MrBayesPrint (" Link \n");
12628 MrBayesPrint (" \n");
12629 MrBayesPrint (" This command links model parameters across partitions of the data. The \n");
12630 MrBayesPrint (" correct usage is: \n");
12631 MrBayesPrint (" \n");
12632 MrBayesPrint (" link <parameter name> = (<all> or <partition list>) \n");
12633 MrBayesPrint (" \n");
12634 MrBayesPrint (" The list of parameters that can be linked includes: \n");
12635 MrBayesPrint (" \n");
12636 MrBayesPrint (" Tratio -- Transition/transversion rate ratio \n");
12637 MrBayesPrint (" Revmat -- Substitution rates of GTR model \n");
12638 MrBayesPrint (" Omega -- Nonsynonymous/synonymous rate ratio \n");
12639 MrBayesPrint (" Statefreq -- Character state frequencies \n");
12640 MrBayesPrint (" Shape -- Gamma/LNorm shape parameter \n");
12641 MrBayesPrint (" Pinvar -- Proportion of invariable sites \n");
12642 MrBayesPrint (" Correlation -- Correlation parameter of autodiscrete gamma \n");
12643 MrBayesPrint (" Ratemultiplier -- Rate multiplier for partitions \n");
12644 MrBayesPrint (" Switchrates -- Switching rates for covarion model \n");
12645 MrBayesPrint (" Topology -- Topology of tree \n");
12646 MrBayesPrint (" Brlens -- Branch lengths of tree \n");
12647 MrBayesPrint (" Speciationrate -- Speciation rates for birth-death process \n");
12648 MrBayesPrint (" Extinctionrate -- Extinction rates for birth-death process \n");
12649 // MrBayesPrint (" Fossilizationrate -- Fossilization rates for fossilized birth-death process \n");
12650 MrBayesPrint (" Popsize -- Population size for coalescence process \n");
12651 MrBayesPrint (" Growthrate -- Growth rate of coalescence process \n");
12652 MrBayesPrint (" Aamodel -- Aminoacid rate matrix \n");
12653 MrBayesPrint (" Cpprate -- Rate of Compound Poisson Process (CPP) \n");
12654 MrBayesPrint (" Cppmultdev -- Standard dev. of CPP rate multipliers (log scale) \n");
12655 MrBayesPrint (" Cppevents -- CPP events \n");
12656 MrBayesPrint (" TK02var -- Variance increase in TK02 relaxed clock model \n");
12657 MrBayesPrint (" Igrvar -- Variance increase in IGR relaxed clock model \n");
12658 MrBayesPrint (" Mixedvar -- Variance increase in Mixed relaxed clock model \n");
12659 // MrBayesPrint (" TK02branchrates -- Branch rates of TK02 relaxed clock model \n");
12660 // MrBayesPrint (" Igrbranchrates -- Branch rates of IGR relaxed clock model \n");
12661 // MrBayesPrint (" Mixedbrchrates -- Branch rates of Mixed relaxed clock model \n");
12662 MrBayesPrint (" \n");
12663 MrBayesPrint (" For example, \n");
12664 MrBayesPrint (" \n");
12665 MrBayesPrint (" link shape=(all) \n");
12666 MrBayesPrint (" \n");
12667 MrBayesPrint (" links the gamma/lnorm shape parameter across all partitions of the data. \n");
12668 MrBayesPrint (" You can use \"showmodel\" to see the current linking status of the \n");
12669 MrBayesPrint (" characters. For more information on this command, see the help menu \n");
12670 MrBayesPrint (" for link's converse, unlink (\"help unlink\"); \n");
12671 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12673 else if (!strcmp(helpTkn, "Help"))
12675 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12676 MrBayesPrint (" Help \n");
12677 MrBayesPrint (" \n");
12678 MrBayesPrint (" This command provides useful information on the use of this program. The \n");
12679 MrBayesPrint (" correct usage is \n");
12680 MrBayesPrint (" \n");
12681 MrBayesPrint (" help \n");
12682 MrBayesPrint (" \n");
12683 MrBayesPrint (" which gives a list of all available commands with a brief description of \n");
12684 MrBayesPrint (" each or \n");
12685 MrBayesPrint (" \n");
12686 MrBayesPrint (" help <command> \n");
12687 MrBayesPrint (" \n");
12688 MrBayesPrint (" which gives detailed information on the use of <command>. \n");
12689 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12691 else if (!strcmp(helpTkn, "Sump"))
12693 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12694 MrBayesPrint (" Sump \n");
12695 MrBayesPrint (" \n");
12696 MrBayesPrint (" During an MCMC analysis, MrBayes prints the sampled parameter values to one or\n");
12697 MrBayesPrint (" more tab-delimited text files, one for each independent run in your analysis. \n");
12698 MrBayesPrint (" The command 'Sump' summarizes the information in this parameter file or these \n");
12699 MrBayesPrint (" parameter files. By default, the root of the parameter file name(s) is assumed\n");
12700 MrBayesPrint (" to be the name of the last matrix-containing nexus file. MrBayes also remem- \n");
12701 MrBayesPrint (" bers the number of independent runs in the last analysis that you set up, re- \n");
12702 MrBayesPrint (" gardless of whether you actually ran it. For instance, if there were two in- \n");
12703 MrBayesPrint (" dependent runs, which is the initial setting when you read in a new matrix, \n");
12704 MrBayesPrint (" MrBayes will assume that there are two parameter files with the endings \n");
12705 MrBayesPrint (" '.run1.p' and '.run2.p'. You can change the root of the file names and the \n");
12706 MrBayesPrint (" number of runs using the 'Filename' and 'Nruns' settings. \n");
12707 MrBayesPrint (" \n");
12708 MrBayesPrint (" When you invoke the 'Sump' command, three items are output: (1) a generation \n");
12709 MrBayesPrint (" plot of the likelihood values; (2) estimates of the marginal likelihood of \n");
12710 MrBayesPrint (" the model; and (3) a table with the mean, variance, and 95 percent credible \n");
12711 MrBayesPrint (" interval for the sampled parameters. All three items are output to screen. \n");
12712 MrBayesPrint (" The table of marginal likelihoods is also printed to a file with the ending \n");
12713 MrBayesPrint (" '.lstat' and the parameter table to a file with the ending '.pstat'. For some \n");
12714 MrBayesPrint (" model parameters, there may also be a '.mstat' file. \n");
12715 MrBayesPrint (" \n");
12716 MrBayesPrint (" When running 'Sump' you typically want to discard a specified number or \n");
12717 MrBayesPrint (" fraction of samples from the beginning of the chain as the burn in. This is \n");
12718 MrBayesPrint (" done using the same mechanism used by the 'mcmc' command. That is, if you \n");
12719 MrBayesPrint (" run an mcmc analysis with a relative burn in of 25 %% of samples for con- \n");
12720 MrBayesPrint (" vergence diagnostics, then the same burn in will be used for a subsequent \n");
12721 MrBayesPrint (" sump command, unless a different burn in is specified. That is, issuing \n");
12722 MrBayesPrint (" \n");
12723 MrBayesPrint (" sump \n");
12724 MrBayesPrint (" \n");
12725 MrBayesPrint (" immediately after 'mcmc', will result in using the same burn in settings as \n");
12726 MrBayesPrint (" for the 'mcmc' command. All burnin settings are reset to default values every \n");
12727 MrBayesPrint (" time a new matrix is read in, namely relative burnin ('relburnin=yes') with \n");
12728 MrBayesPrint (" 25 %% of samples discarded ('burninfrac = 0.25'). \n");
12729 MrBayesPrint (" \n");
12730 MrBayesPrint (" Options: \n");
12731 MrBayesPrint (" \n");
12732 MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n");
12733 MrBayesPrint (" samples will be discarded as burnin when calculating summary \n");
12734 MrBayesPrint (" statistics. The proportion to be discarded is set with \n");
12735 MrBayesPrint (" 'Burninfrac' (see below). When the 'Relburnin' option is set \n");
12736 MrBayesPrint (" to 'No', then a specific number of samples is discarded \n");
12737 MrBayesPrint (" instead. This number is set by 'Burnin' (see below). Note that\n");
12738 MrBayesPrint (" the burnin setting is shared across the 'sumt', 'sump', and \n");
12739 MrBayesPrint (" 'mcmc' commands. \n");
12740 MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n");
12741 MrBayesPrint (" be discarded when summary statistics are calculated. The \n");
12742 MrBayesPrint (" value of this option is only applicable when 'Relburnin' is \n");
12743 MrBayesPrint (" set to 'No'. \n");
12744 MrBayesPrint (" Burninfrac -- Determines the fraction of samples that will be discarded when\n");
12745 MrBayesPrint (" summary statistics are calculated. The setting only takes \n");
12746 MrBayesPrint (" effect if 'Relburnin' is set to 'Yes'. \n");
12747 MrBayesPrint (" Nruns -- Determines how many '.p' files from independent analyses that \n");
12748 MrBayesPrint (" will be summarized. If Nruns > 1 then the names of the files \n");
12749 MrBayesPrint (" are derived from 'Filename' by adding '.run1.p', '.run2.p', \n");
12750 MrBayesPrint (" etc. If Nruns=1, then the single file name is obtained by \n");
12751 MrBayesPrint (" adding '.p' to 'Filename'. \n");
12752 MrBayesPrint (" Filename -- The name of the file to be summarized. This is the base of the\n");
12753 MrBayesPrint (" file name to which endings are added according to the current \n");
12754 MrBayesPrint (" setting of the 'Nruns' parameter. If 'Nruns' is 1, then only \n");
12755 MrBayesPrint (" '.p' is added to the file name. Otherwise, the endings will \n");
12756 MrBayesPrint (" be '.run1.p', '.run2.p', etc. \n");
12757 MrBayesPrint (" Outputname -- Base name of the file(s) to which 'Sump' results will be \n");
12758 MrBayesPrint (" printed. \n");
12759 MrBayesPrint (" Hpd -- Determines whether credibility intervals will be given as the \n");
12760 MrBayesPrint (" region of Highest Posterior Density ('Yes') or as the interval\n");
12761 MrBayesPrint (" containing the median 95 %% of sampled values ('No'). \n");
12762 MrBayesPrint (" Minprob -- Determines the minimum probability of submodels to be included\n");
12763 MrBayesPrint (" in summary statistics. Only applicable to models that explore \n");
12764 MrBayesPrint (" submodel spaces, like 'nst=mixed' and 'aamodelpr=mixed'. \n");
12765 MrBayesPrint (" \n");
12766 MrBayesPrint (" Current settings: \n");
12767 MrBayesPrint (" \n");
12768 MrBayesPrint (" Parameter Options Current Setting \n");
12769 MrBayesPrint (" -------------------------------------------------------- \n");
12770 MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
12771 MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn);
12772 MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction);
12773 MrBayesPrint (" Nruns <number> %d \n", sumpParams.numRuns);
12774 if (sumpParams.numRuns == 1)
12775 MrBayesPrint (" Filename <name> %s<.p>\n", sumpParams.sumpFileName);
12777 MrBayesPrint (" Filename <name> %s<.run<i>.p>\n", sumpParams.sumpFileName);
12778 MrBayesPrint (" Outputname <name> %s<.pstat etc>\n", sumpParams.sumpOutfile);
12779 MrBayesPrint (" Hpd Yes/No %s \n", sumpParams.HPD == YES ? "Yes" : "No");
12780 MrBayesPrint (" Minprob <number> %1.3lf \n", sumpParams.minProb);
12781 MrBayesPrint (" \n");
12782 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12784 else if (!strcmp(helpTkn, "Sumss"))
12786 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12787 MrBayesPrint (" Sumss \n");
12788 MrBayesPrint (" \n");
12789 MrBayesPrint (" This command summarizes results of stepping stone analyses. It is a tool to \n");
12790 MrBayesPrint (" investigate the obtained results, and to help find the proper step burn-in. \n");
12791 MrBayesPrint (" To get more help information on stepping-stone analyses, use 'help ss'. \n");
12792 MrBayesPrint (" \n");
12793 MrBayesPrint (" During stepping-stone analysis, MrBayes collects the sampled likelihoods in \n");
12794 MrBayesPrint (" order to estimate the marginal likelihood at the end. It also prints the sam- \n");
12795 MrBayesPrint (" pled parameter values to one or more tab-delimited text files, one for each \n");
12796 MrBayesPrint (" independent run in your analysis. The command 'Sumss' summarizes likelihood \n");
12797 MrBayesPrint (" values stored in these parameter files and calculates marginal likelihood es- \n");
12798 MrBayesPrint (" timates. The names of the files that are summarized are exactly the same as \n");
12799 MrBayesPrint (" the names of the files used for the 'sump' command. In fact, the 'filename' \n");
12800 MrBayesPrint (" setting is a shared setting for the 'sump' and 'sumss' commands. That is, if \n");
12801 MrBayesPrint (" you change the setting in one of the commands, it would change the setting in \n");
12802 MrBayesPrint (" the other command as well. \n");
12803 MrBayesPrint (" \n");
12804 MrBayesPrint (" When you invoke the 'Sumss' command, three items are output: (1) 'Step contri-\n");
12805 MrBayesPrint (" bution table' - summarizes the contribution of each step to the overall esti- \n");
12806 MrBayesPrint (" mate; (2) 'Step plot' - plot of the likelihood values for the initial burn-in \n");
12807 MrBayesPrint (" phase or a chosen step in the stepping-stone algorithm; (3) 'Joined plot' - \n");
12808 MrBayesPrint (" summarizes sampling across all steps in the algorithm. \n");
12809 MrBayesPrint (" \n");
12810 MrBayesPrint (" Step contribution table \n");
12811 MrBayesPrint (" The printed table is similar to the one output to the .ss file. The main pur- \n");
12812 MrBayesPrint (" pose of the table is to summarize marginal likelihood for different values of \n");
12813 MrBayesPrint (" the step burn-in after the stepping stone analysis has finished. The burn-in \n");
12814 MrBayesPrint (" is controlled by the 'Relburnin', 'Burnin' and 'Burninfrac' settings. \n");
12815 MrBayesPrint (" Note that during stepping-stone analyses, step contributions to marginal \n");
12816 MrBayesPrint (" likelihood are calculated based on all generations excluding burn-in. 'Sumss' \n");
12817 MrBayesPrint (" on the other hand makes estimates based only on the sampled generations. This \n");
12818 MrBayesPrint (" may lead to slight difference in results compared to the one printed to the \n");
12819 MrBayesPrint (" .ss file. \n");
12820 MrBayesPrint (" \n");
12821 MrBayesPrint (" Step plot \n");
12822 MrBayesPrint (" The main objective of the plot is to provide a close look at a given step in \n");
12823 MrBayesPrint (" the analysis. Which step is printed here is defined by the 'Steptoplot' set- \n");
12824 MrBayesPrint (" ting. The plot could be used to inspect if the chosen step burn-in is appro- \n");
12825 MrBayesPrint (" priate for the given step. It could also be used to check if the initial burn-\n");
12826 MrBayesPrint (" in phase has converged. Note that the amount of discarded samples is controled\n");
12827 MrBayesPrint (" by the 'Discardfrac' setting, and not by the ordinary burn-in settings. \n");
12828 MrBayesPrint (" \n");
12829 MrBayesPrint (" Joined plot \n");
12830 MrBayesPrint (" Different steps sample from different power posterior distributions. When we \n");
12831 MrBayesPrint (" switch from one distribution to another, it takes some number of generations \n");
12832 MrBayesPrint (" before the chain settles at the correct stationary distribution. This lag is \n");
12833 MrBayesPrint (" called a 'temperature lag' and if the corresponding samples are not removed, \n");
12834 MrBayesPrint (" it will result in a biased estimate. It is difficult to determine the lag be- \n");
12835 MrBayesPrint (" forehand, but MrBayes allows you to explore different step burn-in settings \n");
12836 MrBayesPrint (" after you have finished the stepping-stone algorithm, without having to rerun \n");
12837 MrBayesPrint (" the whole analysis. The 'Joined plot' helps to facilitate the choice of the \n");
12838 MrBayesPrint (" right step burn-in. The plot summarizes samples across all steps and gives you\n");
12839 MrBayesPrint (" a quick overview of the whole analysis. \n");
12840 MrBayesPrint (" \n");
12841 MrBayesPrint (" Specifically, the following procedure is used to obtain the joined plot. Each \n");
12842 MrBayesPrint (" step has the same number N of samples taken. We number each sample 1 to N \n");
12843 MrBayesPrint (" within steps according to the order in which the samples are taken. The first \n");
12844 MrBayesPrint (" sample in each step is numbered 1, and the last sample is N. For each number i\n");
12845 MrBayesPrint (" in [1,..., N], we sum up log likelihoods for all samples numbered i across all\n");
12846 MrBayesPrint (" steps. The joined plot is a graph of the step number versus the normalized \n");
12847 MrBayesPrint (" sums we get in the procedure describe above. This directly visualizes the tem-\n");
12848 MrBayesPrint (" perature lag and allows you to select the appropriate step burn-in. \n");
12849 MrBayesPrint (" \n");
12850 MrBayesPrint (" Ideally, after you discard the appropriate step burn-in, the graph should \n");
12851 MrBayesPrint (" appear as white noise around the estimated value. If you see an increasing or \n");
12852 MrBayesPrint (" decreasing tendency in the beginning of the graph, you should increase the \n");
12853 MrBayesPrint (" step burn-in. If you see an increasing or decreasing tendency across the whole\n");
12854 MrBayesPrint (" graph, then the initial burn-in phase was not long enough. In this case, you \n");
12855 MrBayesPrint (" need to rerun the analysis with a longer initial burn-in. \n");
12856 MrBayesPrint (" \n");
12857 MrBayesPrint (" To make it easier to observe tendencies in the plotted graph you can choose \n");
12858 MrBayesPrint (" different levels of curve smoothing. If 'Smoothing' is set to k, it means that\n");
12859 MrBayesPrint (" for each step i we take an average over step i and k neighboring samples in \n");
12860 MrBayesPrint (" both directions, i.e., the k-smoothed estimate for step i is an average over \n");
12861 MrBayesPrint (" values for steps [i-k,...,i+k]. \n");
12862 MrBayesPrint (" \n");
12863 MrBayesPrint (" \n");
12864 MrBayesPrint (" Options: \n");
12865 MrBayesPrint (" \n");
12866 MrBayesPrint (" Allruns -- If set to 'Yes', it forces all runs to be printed on the same \n");
12867 MrBayesPrint (" graph when drawing joined and step plots. If set to 'No', each\n");
12868 MrBayesPrint (" run is printed on a separat plot. \n");
12869 MrBayesPrint (" Askmore -- Long analyses may produce huge .p files. Reading in them may \n");
12870 MrBayesPrint (" take several minutes. If you want to investigate different \n");
12871 MrBayesPrint (" aspects of your analyses, it could be very inconvenient to \n");
12872 MrBayesPrint (" wait for several minutes each time you want to get a new sum- \n");
12873 MrBayesPrint (" mary for different settings. If you set 'Askmore' to 'YES', \n");
12874 MrBayesPrint (" sumss will read .p files only once. After responding to the \n");
12875 MrBayesPrint (" original query, it will interactivaly ask you if you wish to \n");
12876 MrBayesPrint (" produce more tables and plots for different settings of \n");
12877 MrBayesPrint (" 'Burnin' or 'Smoothing' (see below). \n");
12878 MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n");
12879 MrBayesPrint (" samples from each step will be discarded as burnin when calcu-\n");
12880 MrBayesPrint (" lsting summary statistics. The proportion to be discarded is \n");
12881 MrBayesPrint (" set with 'Burninfrac' (see below). When the 'Relburnin' option\n");
12882 MrBayesPrint (" is set to 'No', then a specific number of samples is discarded\n");
12883 MrBayesPrint (" instead. This number is set by 'Burnin'. Note that the burnin \n");
12884 MrBayesPrint (" settings --- 'Relburnin', 'Burnin', and 'Burninfrac' --- are \n");
12885 MrBayesPrint (" shared across the 'sumt', 'sump', 'sumss' and 'mcmc' commands.\n");
12886 MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n");
12887 MrBayesPrint (" be discarded from each step when summary statistics are calcu-\n");
12888 MrBayesPrint (" lated. The value of this option is only applicable when \n");
12889 MrBayesPrint (" 'Relburnin' is set to 'No'. \n");
12890 MrBayesPrint (" Burninfrac -- Determines the fraction of samples that will be discarded from\n");
12891 MrBayesPrint (" each step when summary statistics are calculated. The setting \n");
12892 MrBayesPrint (" only takes effect if 'Relburnin' is set to 'Yes'. \n");
12893 MrBayesPrint (" Discardfrac -- Determines the fraction of samples that will be discarded when\n");
12894 MrBayesPrint (" a step plot is printed. It is similar to the 'Burninfrac' set-\n");
12895 MrBayesPrint (" ting, but unlike 'Burninfrac' it is used only for better vis- \n");
12896 MrBayesPrint (" ualization of the step plot. It has no effect on the number of\n");
12897 MrBayesPrint (" samples discarded during marginal likelihood computation. \n");
12898 MrBayesPrint (" Filename -- The name of the file to be summarized. This is the base of the\n");
12899 MrBayesPrint (" file name to which endings are added according to the current \n");
12900 MrBayesPrint (" setting of the 'Nruns' parameter. If 'Nruns' is 1, then only \n");
12901 MrBayesPrint (" '.p' is added to the file name. Otherwise, the endings will \n");
12902 MrBayesPrint (" be '.run1.p', '.run2.p', etc. Note that the 'Filename' setting\n");
12903 MrBayesPrint (" is shared with 'sump' command. \n");
12904 MrBayesPrint (" Nruns -- Determines how many '.p' files from independent analyses that \n");
12905 MrBayesPrint (" will be summarized. If Nruns > 1 then the names of the files \n");
12906 MrBayesPrint (" are derived from 'Filename' by adding '.run1.p', '.run2.p', \n");
12907 MrBayesPrint (" etc. If Nruns=1, then the single file name is obtained by \n");
12908 MrBayesPrint (" adding '.p' to 'Filename'. \n");
12909 MrBayesPrint (" Steptoplot -- Defines which step will be printed in the step plot.If the \n");
12910 MrBayesPrint (" value is set to 0, then the initial sample from the posterior \n");
12911 MrBayesPrint (" will be used. \n");
12912 MrBayesPrint (" Smoothing -- Determines smoothing of the joined plot (see above). A value \n");
12913 MrBayesPrint (" equal to 0 results in no smoothing. \n");
12914 MrBayesPrint (" \n");
12915 MrBayesPrint (" Current settings: \n");
12916 MrBayesPrint (" \n");
12917 MrBayesPrint (" Parameter Options Current Setting \n");
12918 MrBayesPrint (" -------------------------------------------------------- \n");
12919 MrBayesPrint (" Allruns Yes/No %s \n", sumssParams.allRuns == YES ? "Yes" : "No");
12920 MrBayesPrint (" Askmore Yes/No %s \n", sumssParams.askForMorePlots == YES ? "Yes" : "No");
12921 MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
12922 MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn);
12923 MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction);
12924 MrBayesPrint (" Discardfrac <number> %1.2lf \n", sumssParams.discardFraction);
12925 if (sumpParams.numRuns == 1)
12926 MrBayesPrint (" Filename <name> %s<.p>\n", sumpParams.sumpFileName);
12928 MrBayesPrint (" Filename <name> %s<.run<i>.p>\n", sumpParams.sumpFileName);
12929 MrBayesPrint (" Nruns <number> %d \n", sumpParams.numRuns);
12930 MrBayesPrint (" Steptoplot <number> %d \n", sumssParams.stepToPlot);
12931 MrBayesPrint (" Smoothing <number> %d \n", sumssParams.smoothing);
12932 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12934 else if (!strcmp(helpTkn, "Comparetree"))
12936 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12937 MrBayesPrint (" Comparetree \n");
12938 MrBayesPrint (" \n");
12939 MrBayesPrint (" This command compares the trees in two files, called \"filename1\" and \n");
12940 MrBayesPrint (" \"filename2\". It will output a bivariate plot of the split frequencies \n");
12941 MrBayesPrint (" as well as plots of the tree distance as a function of the generation. The \n");
12942 MrBayesPrint (" plots can be used to get a quick indication of whether two runs have con- \n");
12943 MrBayesPrint (" verged onto the same set of trees. The \"Comparetree\" command will also \n");
12944 MrBayesPrint (" produce a \".pairs\" file and a \".dists\" file (these file endings are added \n");
12945 MrBayesPrint (" to the end of the \"Outputname\"). The \".pairs\" file contains the paired \n");
12946 MrBayesPrint (" split frequencies from the two tree samples; the \".dists\" file contains the \n");
12947 MrBayesPrint (" tree distance values. \n");
12948 MrBayesPrint (" \n");
12949 MrBayesPrint (" Note that the \"Sumt\" command provides a different set of convergence diag- \n");
12950 MrBayesPrint (" nostics tools that you may also want to explore. Unlike \"Comparetree\", \n");
12951 MrBayesPrint (" \"Sumt\" can compare more than two tree samples and will calculate consensus \n");
12952 MrBayesPrint (" trees and split frequencies from the pooled samples. \n");
12953 MrBayesPrint (" \n");
12954 MrBayesPrint (" Options: \n");
12955 MrBayesPrint (" \n");
12956 MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n");
12957 MrBayesPrint (" samples will be discarded as burnin when calculating summary \n");
12958 MrBayesPrint (" statistics. The proportion to be discarded is set with \n");
12959 MrBayesPrint (" Burninfrac (see below). When the Relburnin option is set to \n");
12960 MrBayesPrint (" 'No', then a specific number of samples is discarded instead.\n");
12961 MrBayesPrint (" This number is set by Burnin (see below). Note that the \n");
12962 MrBayesPrint (" burnin setting is shared with the 'mcmc', 'sumt', 'sump' and \n");
12963 MrBayesPrint (" 'plot' commands. \n");
12964 MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n");
12965 MrBayesPrint (" be discarded when summary statistics are calculated. The \n");
12966 MrBayesPrint (" value of this option is only relevant when Relburnin is set \n");
12967 MrBayesPrint (" to 'No'. \n");
12968 MrBayesPrint (" BurninFrac -- Determines the fraction of samples that will be discarded \n");
12969 MrBayesPrint (" when summary statistics are calculated. The value of this \n");
12970 MrBayesPrint (" option is only relevant when Relburnin is set to 'Yes'. \n");
12971 MrBayesPrint (" Example: A value for this option of 0.25 means that 25%% of \n");
12972 MrBayesPrint (" the samples will be discarded. \n");
12973 MrBayesPrint (" Minpartfreq -- The minimum probability of partitions to include in summary \n");
12974 MrBayesPrint (" statistics. \n");
12975 MrBayesPrint (" Filename1 -- The name of the first tree file to compare. \n");
12976 MrBayesPrint (" Filename2 -- The name of the second tree file to compare. \n");
12977 MrBayesPrint (" Outputname -- Name of the file to which 'comparetree' results will be \n");
12978 MrBayesPrint (" printed. \n");
12979 MrBayesPrint (" \n");
12980 MrBayesPrint (" Current settings: \n");
12981 MrBayesPrint (" \n");
12982 MrBayesPrint (" Parameter Options Current Setting \n");
12983 MrBayesPrint (" -------------------------------------------------------- \n");
12984 MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
12985 MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn);
12986 MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction);
12987 MrBayesPrint (" Minpartfreq <number> %1.2lf \n", comptreeParams.minPartFreq);
12988 MrBayesPrint (" Filename1 <name> %s \n", comptreeParams.comptFileName1);
12989 MrBayesPrint (" Filename2 <name> %s \n", comptreeParams.comptFileName2);
12990 MrBayesPrint (" Outputname <name> %s \n", comptreeParams.comptOutfile);
12991 MrBayesPrint (" \n");
12992 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12994 else if (!strcmp(helpTkn, "Sumt"))
12996 MrBayesPrint (" --------------------------------------------------------------------------- \n");
12997 MrBayesPrint (" Sumt \n");
12998 MrBayesPrint (" \n");
12999 MrBayesPrint (" This command is used to produce summary statistics for trees sampled during \n");
13000 MrBayesPrint (" a Bayesian MCMC analysis. You can either summarize trees from one individual \n");
13001 MrBayesPrint (" analysis, or trees coming from several independent analyses. In either case, \n");
13002 MrBayesPrint (" all the sampled trees are read in and the proportion of the time any single \n");
13003 MrBayesPrint (" taxon bipartition (split) is found is counted. The proportion of the time that\n");
13004 MrBayesPrint (" the bipartition is found is an approximation of the posterior probability of \n");
13005 MrBayesPrint (" the bipartition. (Remember that a taxon bipartition is defined by removing a \n");
13006 MrBayesPrint (" branch on the tree, dividing the tree into those taxa to the left and right \n");
13007 MrBayesPrint (" of the removed branch. This set is called a taxon bipartition.) The branch \n");
13008 MrBayesPrint (" length of the bipartition is also recorded, if branch lengths have been saved \n");
13009 MrBayesPrint (" to file. The result is a list of the taxon bipartitions found, the frequency \n");
13010 MrBayesPrint (" with which they were found, the posterior probability of the bipartition \n");
13011 MrBayesPrint (" and, the mean and variance of the branch lengths or node depths, and various \n");
13012 MrBayesPrint (" other statistics. \n");
13013 MrBayesPrint (" \n");
13014 MrBayesPrint (" The key to the partitions is output to a file with the suffix '.parts'. The \n");
13015 MrBayesPrint (" summary statistics pertaining to bipartition probabilities are output to a \n");
13016 MrBayesPrint (" file with the suffix '.tstat', and the statistics pertaining to branch or node\n");
13017 MrBayesPrint (" parameters are output to a file with the suffix '.vstat'. \n");
13018 MrBayesPrint (" \n");
13019 MrBayesPrint (" A consensus tree is also printed to a file with the suffix '.con.tre' and \n");
13020 MrBayesPrint (" printed to the screen as a cladogram, and as a phylogram if branch lengths \n");
13021 MrBayesPrint (" have been saved. The consensus tree is either a 50 percent majority rule tree \n");
13022 MrBayesPrint (" or a majority rule tree showing all compatible partitions. If branch lengths \n");
13023 MrBayesPrint (" have been recorded during the run, the '.con.tre' file will contain a consen- \n");
13024 MrBayesPrint (" sus tree with branch lengths and interior nodes labelled with support values. \n");
13025 MrBayesPrint (" By default, the consensus tree will also contain other summary information in \n");
13026 MrBayesPrint (" a format understood by the program 'FigTree'. To use a simpler format under- \n");
13027 MrBayesPrint (" stood by other tree-drawing programs, such as 'TreeView', set 'Conformat' to \n");
13028 MrBayesPrint (" 'Simple'. \n");
13029 MrBayesPrint (" \n");
13030 MrBayesPrint (" MrBayes alo produces a file with the ending \".trprobs\" that contains a list \n");
13031 MrBayesPrint (" of all the trees that were found during the MCMC analysis, sorted by their \n");
13032 MrBayesPrint (" probabilities. This list of trees can be used to construct a credible set of \n");
13033 MrBayesPrint (" trees. For example, if you want to construct a 95 percent credible set of \n");
13034 MrBayesPrint (" trees, you include all of those trees whose cumulative probability is less \n");
13035 MrBayesPrint (" than or equal to 0.95. You have the option of displaying the trees to the \n");
13036 MrBayesPrint (" screen using the \"Showtreeprobs\" option. The default is to not display the \n");
13037 MrBayesPrint (" trees to the screen; the number of different trees sampled by the chain can \n");
13038 MrBayesPrint (" be quite large. If you are analyzing a large set of taxa, you may actually \n");
13039 MrBayesPrint (" want to skip the calculation of tree probabilities entirely by setting \n");
13040 MrBayesPrint (" 'Calctreeprobs' to 'No'. \n");
13041 MrBayesPrint (" \n");
13042 MrBayesPrint (" When calculating summary statistics you probably want to skip those trees that\n");
13043 MrBayesPrint (" were sampled in the initial part of the run, the so-called burn-in period. The\n");
13044 MrBayesPrint (" number of skipped samples is controlled by the 'Relburnin', 'Burnin', and \n");
13045 MrBayesPrint (" 'Burninfrac' settings, just as for the 'Mcmc' command. Since version 3.2.0, \n");
13046 MrBayesPrint (" the burn-in settings are shared across the 'Sumt', 'Sump' and 'Mcmc' commands.\n");
13047 MrBayesPrint (" That is, changing the burn-in setting for one command will change the settings\n");
13048 MrBayesPrint (" for subsequent calls to any of the other commands. \n");
13049 MrBayesPrint (" \n");
13050 MrBayesPrint (" If you are summarizing the trees sampled in several independent analyses, \n");
13051 MrBayesPrint (" such as those resulting from setting the 'Nruns' option of the 'Mcmc' command \n");
13052 MrBayesPrint (" to a value larger than 1, MrBayes will also calculate convergence diagnostics \n");
13053 MrBayesPrint (" for the sampled topologies and branch lengths. These values can help you \n");
13054 MrBayesPrint (" determine whether it is likely that your chains have converged. \n");
13055 MrBayesPrint (" \n");
13056 MrBayesPrint (" The 'Sumt' command expands the 'Filename' according to the current values of \n");
13057 MrBayesPrint (" the 'Nruns' and 'Ntrees' options. For instance, if both 'Nruns' and 'Ntrees' \n");
13058 MrBayesPrint (" are set to 1, 'Sumt' will try to open a file named '<Filename>.t'. If 'Nruns' \n");
13059 MrBayesPrint (" is set to 2 and 'Ntrees' to 1, then 'Sumt' will open two files, the first \n");
13060 MrBayesPrint (" named '<Filename>.run1.t' and the second '<Filename>.run2.t', etc. By default,\n");
13061 MrBayesPrint (" the 'Filename' option is set such that 'Sumt' automatically summarizes all the\n");
13062 MrBayesPrint (" results from your immediately preceding 'Mcmc' command. You can also use the \n");
13063 MrBayesPrint (" 'Sumt' command to summarize tree samples in older analyses. If you want to do \n");
13064 MrBayesPrint (" that, remember to first read in a matrix so that MrBayes knows what taxon \n");
13065 MrBayesPrint (" names to expect in the trees. Then set the 'Nruns', 'Ntrees' and 'Filename' \n");
13066 MrBayesPrint (" options appropriately if they differ from the MrBayes defaults. \n");
13067 MrBayesPrint (" \n");
13068 MrBayesPrint (" Options: \n");
13069 MrBayesPrint (" \n");
13070 MrBayesPrint (" Relburnin -- If this option is set to YES, then a proportion of the \n");
13071 MrBayesPrint (" samples will be discarded as burnin when calculating summary \n");
13072 MrBayesPrint (" statistics. The proportion to be discarded is set with \n");
13073 MrBayesPrint (" Burninfrac (see below). When the Relburnin option is set to \n");
13074 MrBayesPrint (" NO, then a specific number of samples is discarded instead. \n");
13075 MrBayesPrint (" This number is set by Burnin (see below). Note that the \n");
13076 MrBayesPrint (" burnin setting is shared across the 'sumt', 'sump', and \n");
13077 MrBayesPrint (" 'mcmc' commands. \n");
13078 MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n");
13079 MrBayesPrint (" be discarded when summary statistics are calculated. The \n");
13080 MrBayesPrint (" value of this option is only relevant when Relburnin is set \n");
13081 MrBayesPrint (" to NO. \n");
13082 MrBayesPrint (" BurninFrac -- Determines the fraction of samples that will be discarded \n");
13083 MrBayesPrint (" when summary statistics are calculated. The value of this \n");
13084 MrBayesPrint (" option is only relevant when Relburnin is set to YES. \n");
13085 MrBayesPrint (" Example: A value for this option of 0.25 means that 25%% of \n");
13086 MrBayesPrint (" the samples will be discarded. \n");
13087 MrBayesPrint (" Nruns -- Determines how many '.t' files from independent analyses that\n");
13088 MrBayesPrint (" will be summarized. If Nruns > 1 then the names of the files \n");
13089 MrBayesPrint (" are derived from 'Filename' by adding '.run1.t', '.run2.t', \n");
13090 MrBayesPrint (" etc. If Nruns=1 and Ntrees=1 (see below), then only '.t' is \n");
13091 MrBayesPrint (" added to 'Filename'. \n");
13092 MrBayesPrint (" Ntrees -- Determines how many trees there are in the sampled model. If \n");
13093 MrBayesPrint (" 'Ntrees' > 1 then the names of the files are derived from \n");
13094 MrBayesPrint (" 'Filename' by adding '.tree1.t', '.tree2.t', etc. If there \n");
13095 MrBayesPrint (" are both multiple trees and multiple runs, the filenames will\n");
13096 MrBayesPrint (" be '<Filename>.tree1.run1.t', '<Filename>.tree1.run2.t', etc.\n");
13097 MrBayesPrint (" Filename -- The name of the file(s) to be summarized. This is the base of\n");
13098 MrBayesPrint (" the file name, to which endings are added according to the \n");
13099 MrBayesPrint (" current settings of the 'Nruns' and 'Ntrees' options. \n");
13100 MrBayesPrint (" Minpartfreq -- The minimum probability of partitions to include in summary \n");
13101 MrBayesPrint (" statistics. \n");
13102 MrBayesPrint (" Contype -- Type of consensus tree. 'Halfcompat' results in a 50%% major-\n");
13103 MrBayesPrint (" ity rule tree, 'Allcompat' adds all compatible groups to such\n");
13104 MrBayesPrint (" a tree. \n");
13105 MrBayesPrint (" Conformat -- Format of consensus tree. The 'Figtree' setting results in a \n");
13106 MrBayesPrint (" consensus tree formatted for the program FigTree, with rich \n");
13107 MrBayesPrint (" summary statistics. The 'Simple' setting results in a simple \n");
13108 MrBayesPrint (" consensus tree written in a format read by a variety of pro- \n");
13109 MrBayesPrint (" grams. \n");
13110 MrBayesPrint (" Outputname -- Base name of the file(s) to which 'sumt' results will be \n");
13111 MrBayesPrint (" printed. The default is the same as 'Filename'. \n");
13112 MrBayesPrint (" Calctreeprobs -- Determines whether tree probabilities should be calculated. \n");
13113 MrBayesPrint (" Showtreeprobs -- Determines whether tree probabilities should be displayed on \n");
13114 MrBayesPrint (" screen. \n");
13115 MrBayesPrint (" Hpd -- Determines whether credibility intervals will be given as the\n");
13116 MrBayesPrint (" region of Highest Posterior Density ('Yes') or as the inter- \n");
13117 MrBayesPrint (" val containing the median 95 %% of sampled values ('No'). \n");
13118 MrBayesPrint (" \n");
13119 MrBayesPrint (" Current settings: \n");
13120 MrBayesPrint (" \n");
13121 MrBayesPrint (" Parameter Options Current Setting \n");
13122 MrBayesPrint (" -------------------------------------------------------- \n");
13123 MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
13124 MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn);
13125 MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction);
13126 MrBayesPrint (" Nruns <number> %d \n", sumtParams.numRuns);
13127 MrBayesPrint (" Ntrees <number> %d \n", sumtParams.numTrees);
13128 if (sumtParams.numRuns == 1 && sumtParams.numTrees == 1)
13129 MrBayesPrint (" Filename <name> %s<.t>\n", sumtParams.sumtFileName);
13130 else if (sumtParams.numRuns == 1 && sumtParams.numTrees > 1)
13131 MrBayesPrint (" Filename <name> %s<.tree<i>.t>\n", sumtParams.sumtFileName);
13132 else if (sumtParams.numRuns > 1 && sumtParams.numTrees == 1)
13133 MrBayesPrint (" Filename <name> %s<.run<i>.t>\n", sumtParams.sumtFileName);
13134 else if (sumtParams.numRuns > 1 && sumtParams.numTrees > 1)
13135 MrBayesPrint (" Filename <name> %s<.tree<i>.run<i>.t>\n", sumtParams.sumtFileName);
13136 MrBayesPrint (" Minpartfreq <number> %1.2lf \n", sumtParams.minPartFreq);
13137 MrBayesPrint (" Contype Halfcompat/Allcompat %s\n", sumtParams.sumtConType);
13138 MrBayesPrint (" Conformat Figtree/Simple %s \n", sumtParams.consensusFormat == SIMPLE ? "Simple" : "Figtree");
13139 MrBayesPrint (" Outputname <name> %s<.parts etc>\n", sumtParams.sumtOutfile);
13140 MrBayesPrint (" Calctreeprobs Yes/No %s \n", sumtParams.calcTreeprobs == YES ? "Yes" : "No");
13141 MrBayesPrint (" Showtreeprobs Yes/No %s \n", sumtParams.showSumtTrees == YES ? "Yes" : "No");
13142 MrBayesPrint (" Hpd Yes/No %s \n", sumtParams.HPD == YES ? "Yes" : "No");
13143 MrBayesPrint (" \n");
13144 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13146 else if (!strcmp(helpTkn, "Tree"))
13148 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13149 MrBayesPrint (" Tree \n");
13150 MrBayesPrint (" \n");
13151 MrBayesPrint (" This command is used by MrBayes to write trees to a nexus tree file. Trees \n");
13152 MrBayesPrint (" are written in the Newick format. For instance, \n");
13153 MrBayesPrint (" \n");
13154 MrBayesPrint (" tree ((1,2),3,4); \n");
13155 MrBayesPrint (" \n");
13156 MrBayesPrint (" describes an unrooted tree with taxa 1 and 2 being more closely related to \n");
13157 MrBayesPrint (" each other than to taxa 3 and 4. If branch lengths are saved to file, they \n");
13158 MrBayesPrint (" are given after a colon sign immediately following the terminal taxon or the \n");
13159 MrBayesPrint (" interior node they refer to. An example of an unrooted tree with branch \n");
13160 MrBayesPrint (" lengths is: \n");
13161 MrBayesPrint (" \n");
13162 MrBayesPrint (" tree ((1:0.064573,2:0.029042):0.041239,3:0.203988,4:0.187654); \n");
13163 MrBayesPrint (" \n");
13164 MrBayesPrint (" Trees that are rooted (clock trees) are written with a basal dichotomy \n");
13165 MrBayesPrint (" instead of a basal trichotomy. If the tree described above had been rooted \n");
13166 MrBayesPrint (" on the branch leading to taxon 4, it would have been represented as: \n");
13167 MrBayesPrint (" \n");
13168 MrBayesPrint (" tree (((1,2),3),4); \n");
13169 MrBayesPrint (" \n");
13170 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13172 else if (!strcmp(helpTkn, "Report"))
13174 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13175 MrBayesPrint (" Report \n");
13176 MrBayesPrint (" \n");
13177 MrBayesPrint (" This command allows you to control how the posterior distribution is \n");
13178 MrBayesPrint (" reported. For rate parameters, it allows you to choose among several popular \n");
13179 MrBayesPrint (" parameterizations. The report command also allows you to request printing of \n");
13180 MrBayesPrint (" some model aspects that are usually not reported. For instance, if a node is \n");
13181 MrBayesPrint (" constrained in the analysis, MrBayes can print the probabilities of the \n");
13182 MrBayesPrint (" ancestral states at that node. Similarly, if there is rate variation in the \n");
13183 MrBayesPrint (" model, MrBayes can print the inferred site rates, and if there is omega varia-\n");
13184 MrBayesPrint (" tion, MrBayes can print the inferred omega (positive selection) values for \n");
13185 MrBayesPrint (" each codon. In a complex model with several partitions, each partition is \n");
13186 MrBayesPrint (" controlled separately using the same 'Applyto' mechanism as in the 'Lset' and \n");
13187 MrBayesPrint (" 'Prset' commands. \n");
13188 MrBayesPrint (" \n");
13189 MrBayesPrint (" Options: \n");
13190 MrBayesPrint (" \n");
13191 MrBayesPrint (" Applyto -- This option allows you to apply the report commands to specific \n");
13192 MrBayesPrint (" partitions. This command should be the first in the list of \n");
13193 MrBayesPrint (" commands specified in 'report'. \n");
13194 MrBayesPrint (" For example, \n");
13195 MrBayesPrint (" \n");
13196 MrBayesPrint (" report applyto=(1,2) tratio=ratio \n");
13197 MrBayesPrint (" \n");
13198 MrBayesPrint (" report applyto=(3) tratio=dirichlet \n");
13199 MrBayesPrint (" \n");
13200 MrBayesPrint (" would result in the transition and transversion rates of the \n");
13201 MrBayesPrint (" first and second partitions in the model being reported as a \n");
13202 MrBayesPrint (" ratio and the transition and transversion rates of the third \n");
13203 MrBayesPrint (" partition being reported as proportions of the rate sum (the \n");
13204 MrBayesPrint (" Dirichlet parameterization). \n");
13205 MrBayesPrint (" Tratio -- This specifies the report format for the transition and trans- \n");
13206 MrBayesPrint (" version rates of a nucleotide substituion model with nst=2. \n");
13207 MrBayesPrint (" If 'ratio' is selected, the rates will be reported as a ratio \n");
13208 MrBayesPrint (" (transition rate/transversion rate). If 'dirichlet' is selected, \n");
13209 MrBayesPrint (" the transition and transversion rates will instead be reported \n");
13210 MrBayesPrint (" as proportions of the rate sum. For example, if the transition \n");
13211 MrBayesPrint (" rate is three times the transversion rate and 'ratio' is selec- \n");
13212 MrBayesPrint (" ted, this will reported as a single value, '3.0'. If 'dirichlet' \n");
13213 MrBayesPrint (" is selected instead, the same rates will be reported using two \n");
13214 MrBayesPrint (" values, '0.75 0.25'. The sum of the Dirichlet values is always 1.\n");
13215 MrBayesPrint (" Although the Dirichlet format may be unfamiliar to some users, \n");
13216 MrBayesPrint (" it is more convenient for specifying priors than the ratio \n");
13217 MrBayesPrint (" format. \n");
13218 MrBayesPrint (" Revmat -- This specifies the report format for the substitution rates of \n");
13219 MrBayesPrint (" a GTR substitution model for nucleotide or amino acid data. If \n");
13220 MrBayesPrint (" 'ratio' is selected, the rates will be reported scaled to the \n");
13221 MrBayesPrint (" G-T rate (for nucleotides) or the Y-V rate (for amino acids). If \n");
13222 MrBayesPrint (" 'dirichlet' is specified instead, the rates are reported as pro- \n");
13223 MrBayesPrint (" portions of the rate sum. For instance, assume that the C-T rate \n");
13224 MrBayesPrint (" is twice the A-G rate and four times the transversion rates, \n");
13225 MrBayesPrint (" which are equal. If the report format is set to 'ratio', this \n");
13226 MrBayesPrint (" would be reported as '1.0 2.0 1.0 1.0 4.0 1.0' since the rates \n");
13227 MrBayesPrint (" are reported in the order rAC, rAG, rAT, rCG, rCT, rGT and scaled\n");
13228 MrBayesPrint (" relative to the last rate, the G-T rate. If 'dirichlet' is selec-\n");
13229 MrBayesPrint (" ted instead, the same rates would have been reported as '0.1 0.2 \n");
13230 MrBayesPrint (" 0.1 0.1 0.4 0.1' since the rates are now scaled so that they sum \n");
13231 MrBayesPrint (" to 1.0. The Dirichlet format is the parameterization used for \n");
13232 MrBayesPrint (" formulating priors on the rates. \n");
13233 MrBayesPrint (" Ratemult -- This specifies the report format used for the rate multiplier of \n");
13234 MrBayesPrint (" different model partitions. Three formats are available. If \n");
13235 MrBayesPrint (" 'scaled' is selected, then rates are scaled such that the mean \n");
13236 MrBayesPrint (" rate per site across partitions is 1.0. If 'ratio' is chosen, \n");
13237 MrBayesPrint (" the rates are scaled relative to the rate of the first parti- \n");
13238 MrBayesPrint (" tion. Finally, if 'dirichlet' is chosen, the rates are given as \n");
13239 MrBayesPrint (" proportions of the rate sum. The latter is the format used \n");
13240 MrBayesPrint (" when formulating priors on the rate multiplier. \n");
13241 MrBayesPrint (" Tree -- This specifies the report format used for the tree(s). Two op- \n");
13242 MrBayesPrint (" tions are available. 'Topology' results in only the topology \n");
13243 MrBayesPrint (" being printed to file, whereas 'brlens' causes branch lengths to \n");
13244 MrBayesPrint (" to be printed as well. \n");
13245 MrBayesPrint (" Ancstates -- If this option is set to 'yes', MrBayes will print the pro- \n");
13246 MrBayesPrint (" bability of the ancestral states at all constrained nodes. Typ- \n");
13247 MrBayesPrint (" ically, you are interested in the ancestral states of only a few \n");
13248 MrBayesPrint (" characters and only at one node in the tree. To perform such \n");
13249 MrBayesPrint (" an analysis, first define and enforce a topology constraint \n");
13250 MrBayesPrint (" using 'constraint' and 'prset topologypr = constraints (...)'. \n");
13251 MrBayesPrint (" Then put the character(s) of interest in a separate partition and\n");
13252 MrBayesPrint (" set MrBayes to report the ancestral states for that partition. \n");
13253 MrBayesPrint (" For instance, if the characters of interest are in partition 2, \n");
13254 MrBayesPrint (" use 'report applyto=(2) ancstates=yes' to force MrBayes to print \n");
13255 MrBayesPrint (" the probability of the ancestral states of those characters at \n");
13256 MrBayesPrint (" the constrained node to the '.p' file. \n");
13257 MrBayesPrint (" Siterates -- If this option is set to 'yes' and the relevant model has rate \n");
13258 MrBayesPrint (" variation across sites, then the site rates, weighted over rate \n");
13259 MrBayesPrint (" categories, will be reported to the '.p' file. \n");
13260 MrBayesPrint (" Possel -- If this option is set to 'yes' and the relevant model has omega \n");
13261 MrBayesPrint (" variation across sites, the probability that each model site \n");
13262 MrBayesPrint (" (codon in this case) is positively selected will be written to \n");
13263 MrBayesPrint (" file. \n");
13264 MrBayesPrint (" Siteomega -- If this option is set to 'yes' and the relevant model has omega \n");
13265 MrBayesPrint (" variation across sites, the weighted omega value (over omega \n");
13266 MrBayesPrint (" categories) for each model site will be reported to file. \n");
13267 MrBayesPrint (" \n");
13268 if (numCurrentDivisions == 0)
13271 tempInt = numCurrentDivisions;
13272 for (i=0; i<tempInt; i++)
13274 if (numCurrentDivisions == 0)
13276 MrBayesPrint (" Default report settings: \n");
13277 mp = &defaultModel;
13281 MrBayesPrint (" Current report settings for partition %d: \n", i+1);
13282 mp = &modelParams[i];
13284 MrBayesPrint (" \n");
13285 MrBayesPrint (" Parameter Options Current Setting \n");
13286 MrBayesPrint (" -------------------------------------------------------- \n");
13287 MrBayesPrint (" Tratio Ratio/Dirichlet %s \n", mp->tratioFormat);
13288 MrBayesPrint (" Revmat Ratio/Dirichlet %s \n", mp->revmatFormat);
13289 MrBayesPrint (" Ratemult Scaled/Ratio/Dirichlet %s \n", mp->ratemultFormat);
13290 MrBayesPrint (" Tree Brlens/Topology %s \n", mp->treeFormat);
13291 MrBayesPrint (" Ancstates Yes/No %s \n", mp->inferAncStates);
13292 MrBayesPrint (" Siterates Yes/No %s \n", mp->inferSiteRates);
13293 MrBayesPrint (" Possel Yes/No %s \n", mp->inferPosSel);
13294 MrBayesPrint (" Siteomega Yes/No %s \n", mp->inferSiteOmegas);
13295 MrBayesPrint (" \n");
13296 MrBayesPrint (" ------------------------------------------------------------------ \n");
13299 else if (!strcmp(helpTkn, "Manual"))
13301 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13302 MrBayesPrint (" Manual \n");
13303 MrBayesPrint (" \n");
13304 MrBayesPrint (" This command allows you to generate a text file containing help information \n");
13305 MrBayesPrint (" on all the available commands. This text file can be used as an up-to-date \n");
13306 MrBayesPrint (" command reference. You can set the name of the text file using the \n");
13307 MrBayesPrint (" \"filename\" option; the default is \"commref_mb<version>.txt\". \n");
13308 MrBayesPrint (" \n");
13309 MrBayesPrint (" Parameter Options Current Setting \n");
13310 MrBayesPrint (" -------------------------------------------------------- \n");
13311 MrBayesPrint (" Filename <name> %s \n", manFileName);
13312 MrBayesPrint (" \n");
13313 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13315 else if (!strcmp(helpTkn, "Showmoves"))
13317 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13318 MrBayesPrint (" Showmoves \n");
13319 MrBayesPrint (" \n");
13320 MrBayesPrint (" This command shows the MCMC samplers (moves) that are switched on for the \n");
13321 MrBayesPrint (" parameters in the current model. The basic usage is \n");
13322 MrBayesPrint (" \n");
13323 MrBayesPrint (" showmoves \n");
13324 MrBayesPrint (" \n");
13325 MrBayesPrint (" If you want to see all available moves, use \n");
13326 MrBayesPrint (" \n");
13327 MrBayesPrint (" showmoves allavailable=yes \n");
13328 MrBayesPrint (" \n");
13329 MrBayesPrint (" If you want to change any of the tuning parameters for the moves, use the \n");
13330 MrBayesPrint (" 'propset' command. \n");
13331 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13333 else if (!strcmp(helpTkn, "Showparams"))
13335 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13336 MrBayesPrint (" Showparams \n");
13337 MrBayesPrint (" \n");
13338 MrBayesPrint (" This command shows all of the parameters in the current model. The basic \n");
13339 MrBayesPrint (" usage is \n");
13340 MrBayesPrint (" \n");
13341 MrBayesPrint (" showparams \n");
13342 MrBayesPrint (" \n");
13343 MrBayesPrint (" The parameters are listed together with their priors, the available moves, \n");
13344 MrBayesPrint (" and the current value(s), which will be used as the starting values in the \n");
13345 MrBayesPrint (" next mcmc analysis. \n");
13346 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13348 else if (!strcmp(helpTkn, "Startvals"))
13350 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13351 MrBayesPrint (" Startvals \n");
13352 MrBayesPrint (" \n");
13353 MrBayesPrint (" Use this command to change the current values for parameters in your model. \n");
13354 MrBayesPrint (" These values will be used as the starting values in the next mcmc analysis. \n");
13355 MrBayesPrint (" The basic format is: \n");
13356 MrBayesPrint (" \n");
13357 MrBayesPrint (" startvals <param>=(<value_1>,<value_2>,...,<value_n>) \n");
13358 MrBayesPrint (" \n");
13359 MrBayesPrint (" for all substitution model parameters. The format is slightly different for \n");
13360 MrBayesPrint (" parameters that are written to a tree file: \n");
13361 MrBayesPrint (" \n");
13362 MrBayesPrint (" startvals <param>=<tree_name> \n");
13363 MrBayesPrint (" \n");
13364 MrBayesPrint (" This version of the command will look for a tree with the specified name \n");
13365 MrBayesPrint (" among the trees read in previously when parsing a tree block. The information \n");
13366 MrBayesPrint (" stored in that tree will be used to set the starting value of the parameter. \n");
13367 MrBayesPrint (" The parameters that are set using this mechanism include topology and branch \n");
13368 MrBayesPrint (" length parameters, as well as relaxed clock branch rates, cpp events and \n");
13369 MrBayesPrint (" cpp branch rate multipliers. \n");
13370 MrBayesPrint (" \n");
13371 MrBayesPrint (" The above versions of the command will set the value for all runs and chains. \n");
13372 MrBayesPrint (" You can also set the value for an individual run and chain by using the format\n");
13373 MrBayesPrint (" \n");
13374 MrBayesPrint (" startvals <param>(<run>,<chain>)=(<value_1>,...) \n");
13375 MrBayesPrint (" \n");
13376 MrBayesPrint (" where <run> is the index of the run and <chain> the index of the chain. If \n");
13377 MrBayesPrint (" the run index is omitted, the values will be changed for all runs. Similarly, \n");
13378 MrBayesPrint (" if the chain index is omitted, all chains will be set to the specified value. \n");
13379 MrBayesPrint (" For example, if we wanted to set the values of the stationary frequency \n");
13380 MrBayesPrint (" parameter pi{1} to (0.1,0.1,0.4,0.4) for all chains in run 1, and to \n");
13381 MrBayesPrint (" (0.3,0.3,0.2,0.2) for chain 3 of run 2, we would use \n");
13382 MrBayesPrint (" \n");
13383 MrBayesPrint (" startvals pi{1}(1,)=(0.1,0.1,0.4,0.4) pi{1}(2,3)=(0.3,0.3,0.2,0.2) \n");
13384 MrBayesPrint (" \n");
13385 MrBayesPrint (" --------------------------------------------------------------------------- \n");
13396 /* IsAmbig: This function returns YES if character is set as ambiguous
13397 either by using parenthetic notation or by ambiguity codes. It returns
13398 NO if character is unambiguous, missing or gapped */
13399 int IsAmbig (int charCode, int dType)
13401 if (dType == DNA || dType == RNA || dType == STANDARD || dType == RESTRICTION || dType == PROTEIN)
13403 if (charCode != MISSING && charCode != GAP)
13404 if (NBits(charCode) > 1)
13407 else if (dType == CONTINUOUS)
13409 /* do nothing, these cannot be partly ambiguous */
13413 MrBayesPrint ("Unknown datatype in \"IsAmbig\"\n", spacer);
13420 int IsArgValid (char *tk, char *validArg)
13422 int i, j, k, tkLen, targetLen, numDiff, numStrMatches;
13427 tkLen = (int) strlen(tk);
13429 numStrMatches = i = j = 0;
13432 if (p->valueList[i] == '|' || p->valueList[i] == '\0')
13434 tempStr[j++] = '\0';
13435 targetLen = (int) strlen(tempStr);
13436 if (tkLen <= targetLen)
13439 for (k=0; k<tkLen; k++)
13440 if (ChangeCase(tk[k]) != ChangeCase(tempStr[k]))
13445 strcpy (validArg, tempStr);
13451 tempStr[j++] = p->valueList[i];
13454 while (p->valueList[i] != '\0');
13456 if (numStrMatches == 0)
13458 MrBayesPrint ("%s No valid match for argument \"%s\"\n", spacer, tk);
13461 else if (numStrMatches == 1)
13467 MrBayesPrint ("%s Argument \"%s\" is ambiguous\n", spacer, tk);
13473 int IsIn (char ch, char *s)
13484 int IsMissing (int charCode, int dType)
13486 if (dType == DNA || dType == RNA)
13488 if (charCode == 15 || charCode == 16)
13491 else if (dType == STANDARD || dType == PROTEIN)
13493 if (charCode == MISSING || charCode == GAP)
13496 else if (dType == RESTRICTION)
13498 if (charCode == 3 || charCode == 4)
13501 else if (dType == CONTINUOUS)
13507 MrBayesPrint ("Unknown datatype in \"IsMissing\"\n", spacer);
13513 int IsSame (char *s1, char *s2)
13515 int i, nDiff, isIdentical, len;
13518 if (strlen(s1) != strlen(s2))
13519 isIdentical = NO; /* strings cannot be identical because they are different lengths */
13521 /* now, we go through both strings, one character at a time, to see if
13522 any are different */
13523 if (strlen(s1) > strlen(s2))
13524 len = (int) strlen(s2);
13526 len = (int) strlen(s1);
13530 if (tolower(s1[i]) != tolower(s2[i]))
13534 if (nDiff == 0 && isIdentical == YES)
13536 else if (nDiff == 0 && isIdentical == NO)
13537 return (CONSISTENT_WITH);
13539 return (DIFFERENT);
13543 int IsWhite (char c)
13545 if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
13547 if (c == '\n' || c == '\r')
13555 int NucID (char nuc)
13559 if (nuc == 'U' || nuc == 'u')
13564 if (n == 'A' || n == 'a')
13568 else if (n == 'C' || n == 'c')
13572 else if (n == 'G' || n == 'g')
13576 else if (n == 'T' || n == 't')
13580 else if (n == 'R' || n == 'r')
13584 else if (n == 'Y' || n == 'y')
13588 else if (n == 'M' || n == 'm')
13592 else if (n == 'K' || n == 'k')
13596 else if (n == 'S' || n == 's')
13600 else if (n == 'W' || n == 'w')
13604 else if (n == 'H' || n == 'h')
13608 else if (n == 'B' || n == 'b')
13612 else if (n == 'V' || n == 'v')
13616 else if (n == 'D' || n == 'd')
13620 else if (n == 'N' || n == 'n')
13624 else if (n == gapId)
13628 else if (n == missingId)
13637 /*-------| ParseCommand |------------------------------------------------
13639 | This function is used to parse a file. The expected format is:
13641 | command parameter=value parameter=value ... ;
13643 | For example, the following is a valid line for this parser:
13647 | In some cases, however, the format is:
13649 | command stuff more stuff ... ;
13651 | For example, when reading a data file, the matrix command might be:
13659 | Like before, the command and all of the stuff for that command are
13660 | terminated by a semicolon.
13663 int ParseCommand (char *s)
13665 int rc, tokenType, inError, numMatches, skipCmd;
13668 numMatches = 0; /* Avoid gcc warnings (actually set in call to FindValidCommand) */
13672 # if defined (ECHO_PROCESSED_COMMANDS)
13673 MrBayesPrint ("Currently processing command: %s\n", s);
13676 inError = skipCmd = NO;
13679 /* Get the next token. A token is a valid word in a line. Token type is defined in "bayes.h". */
13680 if (GetToken (token, &tokenType, &tokenP))
13685 if (strlen(token) > 0 || tokenType == ALPHA)
13687 # if defined (SHOW_TOKENS)
13688 MrBayesPrint ("%s\n", token);
13690 if (tokenType == LEFTCOMMENT)
13692 /* If the token is a left comment "[", then we don't want to
13693 actually process commands until we find a right comment. */
13694 /* The exception is if readComment is set to YES, in which case
13695 we will leave it to the parser functions to decide on whether
13696 they want to read the comment or not */
13697 if (readComment == NO || inComment == YES)
13703 if (inComment == NO && inForeignBlock == NO)
13705 if (tokenType != SEMICOLON)
13707 /* If the token is not a semicolon, then we will be processing
13708 either a command or a parameter. */
13709 if (expecting == Expecting(COMMAND))
13711 /* We are expecting to find a command (defined above in "commands[]"). Find the
13712 correct command and set a pointer to that command. */
13714 if (FindValidCommand (token, &numMatches) == ERROR)
13716 /* We couldn't find the command or the user did not specify enough letters
13717 to unambiguously determine the command. The command pointer (commandPtr)
13719 if (numMatches == 0)
13720 MrBayesPrint ("%s Could not find command \"%s\"\n", spacer, token);
13722 MrBayesPrint ("%s Ambiguous command \"%s\"\n", spacer, token);
13727 /* We did find a valid command. Set what we are expecting to see next. */
13728 expecting = commandPtr->expect;
13730 /* Check to see if we have one of the so-called special cases in which a
13731 command is not necessarily followed by a parameter (e.g., matrix). If we
13732 do have a special case, then we want to set the parameter pointer (paramPtr)
13733 appropriately. In this case, simply go to the first parameter in the parmList. */
13734 if (commandPtr->specialCmd == YES)
13736 isFirstMatrixRead = YES;
13738 paramPtr = paramTable + commandPtr->parmList[0];
13740 if (strcmp(commandPtr->string, "Execute")==0)
13742 /* set the tokenizer to recognize quoted strings */
13749 /* We are expecting to find a parameter or a value for the parameter, not a command. */
13750 if ((expecting & Expecting(PARAMETER)) == Expecting(PARAMETER) &&
13751 (expecting & Expecting(tokenType)) != Expecting(tokenType))
13753 /* Specifically, if we are here, we need to go through the parameter list,
13754 checking to see if the token is a valid parameter. */
13755 expecting = (expecting & Expecting(PARAMETER));
13756 if (FindValidParam (token, &numMatches) == ERROR)
13758 /* The token is not a valid parameter. */
13759 if (numMatches == 0)
13760 MrBayesPrint ("%s Could not find parameter \"%s\"\n", spacer, token);
13762 MrBayesPrint ("%s Ambiguous parameter \"%s\"\n", spacer, token);
13767 /* The token is a valid parameter. Call the appropriate function ("DoXxxxParm"). */
13768 if ((paramPtr->fp)(paramPtr->string, token) == ERROR)
13770 if (strcmp("Xxxxxxxxxx", paramPtr->string))
13771 MrBayesPrint ("%s Error when setting parameter \"%s\" (1)\n", spacer, paramPtr->string);
13778 /* Otherwise, we are expecting a value for the parameter. Call the appropriate function ("DoXxxxParm"). */
13779 if ((expecting & Expecting(tokenType)) != 0)
13780 expecting = (expecting & Expecting(tokenType));
13781 if ((Expecting(tokenType) & expecting) == Expecting(tokenType))
13783 if ((paramPtr->fp)(paramPtr->string, token) == ERROR)
13785 if (strcmp("Xxxxxxxxxx", paramPtr->string))
13786 MrBayesPrint ("%s Error when setting parameter \"%s\" (2)\n", spacer, paramPtr->string);
13793 WhatVariableExp (expecting, errStr);
13794 MrBayesPrint ("%s Expecting '%s'\n", spacer, errStr+1); /* there will be an initial space in errStr so print from pos 1 */
13795 if (numOpenExeFiles > 0)
13796 MrBayesPrint ("%s Instead found '%s' in command '%s'\n",
13797 spacer, token, commandPtr->string);
13799 MrBayesPrint ("%s Instead found '%s' in command '%s' at position %d\n",
13800 spacer, token, commandPtr->string, tokenP - cmdStr - strlen(token)+1);
13807 /* The token is a semicolon. This means that we are at the end of processing one command. We
13808 need to clean things up. We do this by calling the finishing function ("DoXxxx"). */
13809 if ((Expecting(SEMICOLON) & expecting) == Expecting(SEMICOLON))
13811 if (commandPtr->cmdFxnPtr != NULL)
13813 /* Finish up the command here. */
13814 rc = (commandPtr->cmdFxnPtr) ();
13815 if (rc == ERROR || rc == ABORT)
13819 MrBayesPrint (" Mcmc run aborted\n");
13821 else if (rc == SKIP_COMMAND)
13823 MrBayesPrint (" Cancelled execution of command\n");
13828 MrBayesPrint ("%s Error in command \"%s\"\n", spacer, commandPtr->string);
13833 /* if the user typed "quit", then we want to bail out of this loop, with a NO_ERROR_QUIT */
13834 if (!strcmp(commandPtr->string, "Quit"))
13835 return (NO_ERROR_QUIT);
13836 expecting = Expecting(COMMAND);
13841 WhatVariableExp (expecting, errStr);
13842 MrBayesPrint ("%s Expecting %s\n", spacer, errStr);
13846 /* Check to see if a comment is terminated. A comment can either be a right comment "]" or, if we were in a foreign nexus block
13847 (e.g., a "paup" block) the terminating comment will be "end". */
13848 if (tokenType == RIGHTCOMMENT)
13850 if (inComment == NO && readComment == NO)
13852 MrBayesPrint ("%s Found \"]\", without having previously found \"[\"\n", spacer);
13855 else if (inComment == NO && readComment == YES)
13857 /* This is OK, we just pass through and rely on the command to handle the RIGHTCOMMENT */
13862 if (numComments == 0)
13866 if ((IsSame(token, "end") == SAME || IsSame(token, "endblock") == SAME) && inForeignBlock == YES)
13868 strcpy (spacer, "");
13869 inForeignBlock = NO;
13873 } while ((*token || tokenType == ALPHA) && inError == NO && skipCmd == NO);
13875 if (inError == YES)
13877 readComment = NO; /* reset this in case it is set to YES in command and we get an error exit */
13885 void PrintSettings (char *command)
13889 if (!strcmp(command,"Mcmc"))
13891 MrBayesPrint (" Parameter Options Current Setting \n");
13892 MrBayesPrint (" ----------------------------------------------------- \n");
13893 MrBayesPrint (" Ngen <number> %d \n", chainParams.numGen);
13894 MrBayesPrint (" Nruns <number> %d \n", chainParams.numRuns);
13895 MrBayesPrint (" Nchains <number> %d \n", chainParams.numChains);
13896 MrBayesPrint (" Temp <number> %lf \n", chainParams.chainTemp);
13897 MrBayesPrint (" Reweight <number>,<number> %1.2lf v %1.2lf ^ \n", chainParams.weightScheme[0], chainParams.weightScheme[1]);
13898 MrBayesPrint (" Swapfreq <number> %d \n", chainParams.swapFreq);
13899 MrBayesPrint (" Nswaps <number> %d \n", chainParams.numSwaps);
13900 MrBayesPrint (" Samplefreq <number> %d \n", chainParams.sampleFreq);
13901 MrBayesPrint (" Printfreq <number> %d \n", chainParams.printFreq);
13902 PrintYesNo (chainParams.printAll, yesNoStr);
13903 MrBayesPrint (" Printall Yes/No %s \n", yesNoStr);
13904 MrBayesPrint (" Printmax <number> %d \n", chainParams.printMax);
13905 PrintYesNo (chainParams.mcmcDiagn, yesNoStr);
13906 MrBayesPrint (" Mcmcdiagn Yes/No %s \n", yesNoStr);
13907 MrBayesPrint (" Diagnfreq <number> %d \n", chainParams.diagnFreq);
13908 if (chainParams.diagnStat == AVGSTDDEV)
13909 strcpy (yesNoStr, "Avgstddev");
13911 strcpy (yesNoStr, "Maxstddev");
13912 MrBayesPrint (" Diagnstat Avgstddev/Maxstddev %s \n", yesNoStr);
13913 MrBayesPrint (" Minpartfreq <number> %1.2lf \n", chainParams.minPartFreq);
13914 PrintYesNo (chainParams.allChains, yesNoStr);
13915 MrBayesPrint (" Allchains Yes/No %s \n", yesNoStr);
13916 PrintYesNo (chainParams.allComps, yesNoStr);
13917 MrBayesPrint (" Allcomps Yes/No %s \n", yesNoStr);
13918 PrintYesNo (chainParams.relativeBurnin, yesNoStr);
13919 MrBayesPrint (" Relburnin Yes/No %s \n", yesNoStr);
13920 MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn);
13921 MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction);
13922 PrintYesNo (chainParams.stopRule, yesNoStr);
13923 MrBayesPrint (" Stoprule Yes/No %s \n", yesNoStr);
13924 MrBayesPrint (" Stopval <number> %1.2lf \n", chainParams.stopVal);
13925 PrintYesNo (chainParams.saveTrees, yesNoStr);
13926 MrBayesPrint (" Savetrees Yes/No %s \n", yesNoStr);
13927 PrintYesNo (chainParams.checkPoint, yesNoStr);
13928 MrBayesPrint (" Checkpoint Yes/No %s \n", yesNoStr);
13929 MrBayesPrint (" Checkfreq <number> %d \n", chainParams.checkFreq);
13930 MrBayesPrint (" Filename <name> %s.<p/t>\n", chainParams.chainFileName);
13931 MrBayesPrint (" Startparams Current/Reset %s \n", chainParams.startParams);
13932 MrBayesPrint (" Starttree Current/Random/ %s \n", chainParams.startTree);
13933 MrBayesPrint (" Parsimony \n");
13934 MrBayesPrint (" Nperts <number> %d \n", chainParams.numStartPerts);
13935 PrintYesNo (chainParams.runWithData, yesNoStr);
13936 MrBayesPrint (" Data Yes/No %s \n", yesNoStr);
13937 MrBayesPrint (" Ordertaxa Yes/No %s \n", chainParams.orderTaxa == YES? "Yes" : "No");
13938 MrBayesPrint (" Append Yes/No %s \n", chainParams.append == YES? "Yes" : "No");
13939 MrBayesPrint (" Autotune Yes/No %s \n", chainParams.autotune == YES? "Yes" : "No");
13940 MrBayesPrint (" Tunefreq <number> %d \n", chainParams.tuneFreq);
13941 MrBayesPrint (" \n");
13946 void PrintYesNo (int yn, char s[4])
13955 int ProtID (char aa)
13957 if (aa == 'A' || aa == 'a') /* Ala */
13961 else if (aa == 'R' || aa == 'r') /* Arg */
13965 else if (aa == 'N' || aa == 'n') /* Asn */
13969 else if (aa == 'D' || aa == 'd') /* Asp */
13973 else if (aa == 'C' || aa == 'c') /* Cys */
13977 else if (aa == 'Q' || aa == 'q') /* Gln */
13981 else if (aa == 'E' || aa == 'e') /* Glu */
13985 else if (aa == 'G' || aa == 'g') /* Gly */
13989 else if (aa == 'H' || aa == 'h') /* His */
13993 else if (aa == 'I' || aa == 'i') /* Ile */
13997 else if (aa == 'L' || aa == 'l') /* Leu */
14001 else if (aa == 'K' || aa == 'k') /* Lys */
14005 else if (aa == 'M' || aa == 'm') /* Met */
14009 else if (aa == 'F' || aa == 'f') /* Phe */
14013 else if (aa == 'P' || aa == 'p') /* Pro */
14017 else if (aa == 'S' || aa == 's') /* Ser */
14021 else if (aa == 'T' || aa == 't') /* Thr */
14025 else if (aa == 'W' || aa == 'w') /* Trp */
14029 else if (aa == 'Y' || aa == 'y') /* Tyr */
14033 else if (aa == 'V' || aa == 'v') /* Val */
14037 else if (aa == 'X' || aa == 'x') /* Nonidentified */
14041 else if (aa == gapId)
14045 else if (aa == missingId)
14054 int RemoveLastFromString (char *s1)
14056 int i, j, numPrev, numRemoved;
14058 /* We remove the last name from the string simply by deleting the last "|". */
14061 while (s1[i] != '\0')
14068 i = j = numRemoved = 0;
14069 while (s1[i] != '\0')
14082 if (numRemoved != 1)
14084 MrBayesPrint ("%s Could not find name to remove\n", spacer);
14092 int MBResID (char nuc)
14098 if (n == '0' || n == 'a' || n == 'A')
14102 else if (n == '1' || n == 'b' || n == 'B')
14106 else if (n == gapId)
14110 else if (n == missingId)
14119 /* Reset character flags */
14120 void ResetCharacterFlags (void)
14122 /* reset all characters flags */
14123 numChar = 0; /* number of defined characters */
14124 defChars = NO; /* flag for whether number of characters is known*/
14125 defMatrix = NO; /* flag for whether matrix is successfull read */
14126 matrixHasPoly = NO; /* flag for whether matrix has polymorphisms */
14127 isInAmbig = NO; /* flag for whether the parser is within () */
14128 isInPoly = NO; /* flag for whether the parser is within {} */
14129 defPartition = NO; /* flag for whether character partition is read */
14130 defPairs = NO; /* flag indicating whether pairs have been defnd */
14131 numDefinedPartitions = 0; /* number of defined partitions */
14132 partitionNum = 0; /* partition number currently enforced */
14133 numCurrentDivisions = 0; /* number of partitions of data */
14134 numCharSets = 0; /* holds number of character sets */
14135 numDivisions = 1; /* holds number of partitions */
14136 isMixed = NO; /* are data mixed ? */
14137 dataType = NONE; /* holds datatype */
14138 matchId = '\0'; /* no default for match character */
14139 gapId = '\0'; /* no default for gap character */
14140 missingId = '\0'; /* no default for missing characters */
14144 /* Reset taxa flags */
14145 void ResetTaxaFlags (void)
14147 numTaxa = 0; /* number of taxa */
14148 numNamedTaxa = 0; /* number of named taxa */
14149 defTaxa = NO; /* flag for whether number of taxa is known */
14150 isTaxsetDef = NO; /* is a taxlabels set defined */
14151 numDefinedConstraints = 0; /* holds number of defined constraints */
14152 definedConstraint = NULL;
14153 definedConstraintTwo = NULL;
14154 definedConstraintPruned = NULL;
14155 definedConstraintTwoPruned = NULL;
14156 constraintNames = NULL;
14157 nodeCalibration = NULL;
14158 tempActiveConstraints = NULL; /* holds temp info on active constraints */
14159 outGroupNum = 0; /* default outgroup */
14160 numTaxaSets = 0; /* holds number of taxa sets */
14164 /* SetPartition: Set model partition */
14165 int SetPartition (int part)
14169 /* Free space for modelParams and modelSettings */
14170 if (memAllocs[ALLOC_MODEL] == YES)
14172 for (i=0; i<numCurrentDivisions; i++)
14173 free (modelParams[i].activeConstraints);
14174 free (modelParams);
14175 free (modelSettings);
14176 modelParams = NULL;
14177 modelSettings = NULL;
14178 memAllocs[ALLOC_MODEL] = NO;
14181 /* Set model partition */
14182 partitionNum = part;
14183 numCurrentDivisions = 0;
14185 /* Set numCurrentDivisions to maximum division a character belongs to in partition part */
14186 for (i=0; i<numChar; i++)
14188 j = partitionId[i][part];
14189 if (j > numCurrentDivisions)
14190 numCurrentDivisions = j;
14193 /* Allocate space for partition models */
14194 modelParams = (Model *) SafeCalloc (numCurrentDivisions, sizeof (Model));
14195 modelSettings = (ModelInfo *) SafeCalloc (numCurrentDivisions, sizeof (ModelInfo));
14196 if (!modelParams || !modelSettings)
14198 MrBayesPrint ("%s Could not allocate modelParams or modelSettings\n", spacer);
14200 free (modelParams);
14202 free (modelSettings);
14205 memAllocs[ALLOC_MODEL] = YES;
14207 numVars = (int *) SafeRealloc ((void *) numVars, 3 * (size_t)numCurrentDivisions * sizeof(int));
14208 tempLinkUnlinkVec = numVars + numCurrentDivisions;
14209 activeParts = numVars + 2*numCurrentDivisions;
14211 tempNum = (MrBFlt *) SafeRealloc ((void *) tempNum, 6 * sizeof(MrBFlt));
14213 activeParams[0] = (int *) SafeRealloc ((void *) (activeParams[0]), (size_t)NUM_LINKED * (size_t)numCurrentDivisions * sizeof(int));
14214 for (i=1; i<NUM_LINKED; i++)
14215 activeParams[i] = activeParams[0] + i*numCurrentDivisions;
14217 linkTable[0] = (int *) SafeRealloc ((void *) (linkTable[0]), 3 * (size_t)NUM_LINKED * (size_t)numCurrentDivisions * sizeof(int));
14218 tempLinkUnlink[0] = linkTable[0] + NUM_LINKED*numCurrentDivisions;
14219 for (i=1; i<NUM_LINKED; i++)
14221 linkTable[i] = linkTable[0] + i*numCurrentDivisions;
14222 tempLinkUnlink[i] = tempLinkUnlink[0] + i*numCurrentDivisions;
14229 /* SetSpeciespartition: Set speciespartition */
14230 int SetSpeciespartition (int part)
14234 /* Set model partition */
14235 speciespartitionNum = part;
14238 /* Set numSpecies to maximum species a taxon belongs to in partition part */
14239 for (i=0; i<numTaxa; i++)
14241 j = speciespartitionId[i][part];
14242 if (j > numSpecies)
14250 int SetTaxaFromTranslateTable (void)
14257 for (i=0; i<numTranslates; i++)
14259 if (strlen(transFrom[i])>99)
14261 MrBayesPrint ("%s Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, transFrom[i]);
14264 AddString(&taxaNames, numTaxa, transFrom[i]);
14272 void SetUpParms (void)
14274 ParmInfoPtr p = paramTable;
14276 PARAM (0, "NEXUS", DoNexusParm, "NEXUS|\0");
14277 PARAM (1, "Data", DoBeginParm, "\0");
14278 PARAM (2, "Mrbayes", DoBeginParm, "\0");
14279 PARAM (3, "Trees", DoBeginParm, "\0");
14280 PARAM (4, "Ntax", DoDimensionsParm, "\0");
14281 PARAM (5, "Nchar", DoDimensionsParm, "\0");
14282 PARAM (6, "Interleave", DoFormatParm, "Yes|No|\0");
14283 PARAM (7, "Datatype", DoFormatParm, "Dna|Rna|Protein|Restriction|Standard|Continuous|Mixed|\0");
14284 PARAM (8, "Gap", DoFormatParm, "\0");
14285 PARAM (9, "Missing", DoFormatParm, "\0");
14286 PARAM (10, "Matchchar", DoFormatParm, "\0");
14287 PARAM (11, "MatrixInfo", DoMatrixParm, "\0");
14288 PARAM (12, "Filename", DoExecuteParm, "\0");
14289 PARAM (13, "Autoclose", DoSetParm, "Yes|No|\0");
14290 PARAM (14, "Partition", DoSetParm, "\0");
14291 PARAM (15, "Xxxxxxxxxx", DoCharsetParm, "\0");
14292 PARAM (16, "Xxxxxxxxxx", DoPartitionParm, "\0");
14293 PARAM (17, "Seed", DoMcmcParm, "\0");
14294 PARAM (18, "Ngen", DoMcmcParm, "\0");
14295 PARAM (19, "Samplefreq", DoMcmcParm, "\0");
14296 PARAM (20, "Printfreq", DoMcmcParm, "\0");
14297 PARAM (21, "Nchains", DoMcmcParm, "\0");
14298 PARAM (22, "Temp", DoMcmcParm, "\0");
14299 PARAM (23, "Filename", DoMcmcParm, "\0");
14300 PARAM (24, "Burnin", DoMcmcParm, "\0");
14301 PARAM (25, "Starttree", DoMcmcParm, "Random|Current|User|Parsimony|NJ|\0");
14302 PARAM (26, "Nperts", DoMcmcParm, "\0");
14303 PARAM (27, "Savebrlens", DoMcmcParm, "Yes|No|\0");
14304 PARAM (28, "Nucmodel", DoLsetParm, "4by4|Doublet|Codon|Protein|\0");
14305 PARAM (29, "Nst", DoLsetParm, "1|2|6|Mixed|\0");
14306 PARAM (30, "Aamodel", DoLsetParm, "Poisson|Equalin|Jones|Dayhoff|Mtrev|Mtmam|Wag|Rtrev|Cprev|Vt|Blosum|Blossum|LG|\0");
14307 PARAM (31, "Parsmodel", DoLsetParm, "Yes|No|\0");
14308 PARAM (32, "Omegavar", DoLsetParm, "Equal|Ny98|M3|M10|\0");
14309 PARAM (33, "Code", DoLsetParm, "Universal|Vertmt|Invermt|Mycoplasma|Yeast|Ciliate|Echinoderm|Euplotid|Metmt|\0");
14310 PARAM (34, "Coding", DoLsetParm, "All|Variable|Informative|Nosingletons|Noabsencesites|Nopresencesites|Nosingletonpresence|Nosingletonabsence|\0");
14311 PARAM (35, "Seqerror", DoPrsetParm, "\0");
14312 PARAM (36, "Tratiopr", DoPrsetParm, "Beta|Fixed|\0");
14313 PARAM (37, "Revmatpr", DoPrsetParm, "Dirichlet|Fixed|\0");
14314 PARAM (38, "Omegapr", DoPrsetParm, "Dirichlet|Fixed|\0");
14315 PARAM (39, "Statefreqpr", DoPrsetParm, "Dirichlet|Fixed|\0");
14316 PARAM (40, "Ngammacat", DoLsetParm, "\0");
14317 PARAM (41, "Shapepr", DoPrsetParm, "Uniform|Exponential|Fixed|\0");
14318 PARAM (42, "Ratecorrpr", DoPrsetParm, "Uniform|Fixed|\0");
14319 PARAM (43, "Pinvarpr", DoPrsetParm, "Uniform|Fixed|\0");
14320 PARAM (44, "Covswitchpr", DoPrsetParm, "Uniform|Exponential|Fixed|\0");
14321 PARAM (45, "Xxxxxxxxxx", DoExcludeParm, "\0");
14322 PARAM (46, "Xxxxxxxxxx", DoIncludeParm, "\0");
14323 PARAM (47, "Xxxxxxxxxx", DoDeleteParm, "\0");
14324 PARAM (48, "Xxxxxxxxxx", DoRestoreParm, "\0");
14325 PARAM (49, "Xxxxxxxxxx", DoTaxasetParm, "\0");
14326 PARAM (50, "Xxxxxxxxxx", DoHelpParm, "\0");
14327 PARAM (51, "Applyto", DoLsetParm, "\0");
14328 PARAM (52, "Rates", DoLsetParm, "Equal|Gamma|LNorm|Propinv|Invgamma|Adgamma|\0");
14329 PARAM (53, "Covarion", DoLsetParm, "Yes|No|\0");
14330 PARAM (54, "Applyto", DoPrsetParm, "\0");
14331 PARAM (55, "Tratio", DoLinkParm, "\0");
14332 PARAM (56, "Revmat", DoLinkParm, "\0");
14333 PARAM (57, "Omega", DoLinkParm, "\0");
14334 PARAM (58, "Statefreq", DoLinkParm, "\0");
14335 PARAM (59, "Shape", DoLinkParm, "\0");
14336 PARAM (60, "Pinvar", DoLinkParm, "\0");
14337 PARAM (61, "Correlation", DoLinkParm, "\0");
14338 PARAM (62, "Ratemultiplier", DoLinkParm, "\0");
14339 PARAM (63, "Switchrates", DoLinkParm, "\0");
14340 PARAM (64, "Symdirihyperpr", DoPrsetParm, "Uniform|Exponential|Fixed|\0");
14341 PARAM (65, "Xxxxxxxxxx", DoCtypeParm, "\0");
14342 PARAM (66, "Xxxxxxxxxx", DoConstraintParm, "\0");
14343 PARAM (67, "Topologypr", DoPrsetParm, "Uniform|Constraints|Fixed|Speciestree|\0");
14344 PARAM (68, "Brlenspr", DoPrsetParm, "Unconstrained|Clock|Relaxedclock|Fixed|\0");
14345 PARAM (69, "Speciationpr", DoPrsetParm, "Uniform|Exponential|Fixed|\0");
14346 PARAM (70, "Extinctionpr", DoPrsetParm, "Beta|Fixed|\0");
14347 PARAM (71, "Popsizepr", DoPrsetParm, "Lognormal|Uniform|Gamma|Normal|Fixed|\0");
14348 PARAM (72, "Topology", DoLinkParm, "\0");
14349 PARAM (73, "Brlens", DoLinkParm, "\0");
14350 PARAM (74, "Speciationrate", DoLinkParm, "\0");
14351 PARAM (75, "Extinctionrate", DoLinkParm, "\0");
14352 PARAM (76, "Popsize", DoLinkParm, "\0");
14353 PARAM (77, "Ratepr", DoPrsetParm, "Variable|Dirichlet|Fixed|\0");
14354 PARAM (78, "Xxxxxxxxxx", DoOutgroupParm, "\0");
14355 PARAM (79, "Xxxxxxxxxx", DoTreeParm, "\0");
14356 PARAM (80, "Filename", DoSumtParm, "\0");
14357 PARAM (81, "Burnin", DoSumtParm, "\0");
14358 PARAM (82, "Contype", DoSumtParm, "Halfcompat|Allcompat|\0");
14359 PARAM (83, "Xxxxxxxxxx", DoTranslateParm, "\0");
14360 PARAM (84, "Swapfreq", DoMcmcParm, "\0");
14361 PARAM (85, "Start", DoLogParm, "\0");
14362 PARAM (86, "Stop", DoLogParm, "\0");
14363 PARAM (87, "Filename", DoLogParm, "\0");
14364 PARAM (88, "Append", DoLogParm, "\0");
14365 PARAM (89, "Replace", DoLogParm, "\0");
14366 PARAM (90, "Nbetacat", DoLsetParm, "\0");
14367 PARAM (91, "Augment", DoLsetParm, "Yes|No|\0");
14368 PARAM (92, "Xxxxxxxxxx", DoPairsParm, "\0");
14369 PARAM (93, "Xxxxxxxxxx", DoBreaksParm, "\0");
14370 PARAM (94, "Nowarnings", DoSetParm, "Yes|No|\0");
14371 PARAM (95, "Showtreeprobs", DoSumtParm, "Yes|No|\0");
14372 PARAM (96, "Filename", DoSumpParm, "\0");
14373 PARAM (97, "Burnin", DoSumpParm, "\0");
14374 PARAM (98, "Reweight", DoMcmcParm, "\0");
14375 PARAM (99, "Noop", DoMcmcParm, "\0");
14376 PARAM (100, "Ny98omega1pr", DoPrsetParm, "Beta|Fixed|\0");
14377 PARAM (101, "Ny98omega3pr", DoPrsetParm, "Uniform|Exponential|Fixed|\0");
14378 PARAM (102, "Codoncatfreqs", DoPrsetParm, "Dirichlet|Fixed|\0");
14379 PARAM (103, "Sampleprob", DoPrsetParm, "\0");
14380 PARAM (104, "Aamodelpr", DoPrsetParm, "Fixed|Mixed|\0");
14381 PARAM (105, "Aamodel", DoLinkParm, "\0");
14382 PARAM (106, "Filename", DoPlotParm, "\0");
14383 PARAM (107, "Parameter", DoPlotParm, "\0");
14384 PARAM (108, "Match", DoPlotParm, "Perfect|Consistentwith|All|\0");
14385 PARAM (109, "Burnin", DoPlotParm, "\0");
14386 PARAM (110, "Brownscalepr", DoPrsetParm, "Uniform|Gamma|Gammamean|Fixed|\0");
14387 PARAM (111, "Browncorrpr", DoPrsetParm, "Uniform|Fixed|\0");
14388 PARAM (112, "Pbf", DoMcmcParm, "Yes|No|\0");
14389 PARAM (113, "Pbfinitburnin", DoMcmcParm, "\0");
14390 PARAM (114, "Pbfsamplefreq", DoMcmcParm, "\0");
14391 PARAM (115, "Pbfsampletime", DoMcmcParm, "\0");
14392 PARAM (116, "Pbfsampleburnin",DoMcmcParm, "\0");
14393 PARAM (117, "Growthpr", DoPrsetParm, "Uniform|Exponential|Fixed|Normal|\0");
14394 PARAM (118, "Growthrate", DoLinkParm, "\0");
14395 PARAM (119, "Xxxxxxxxxx", DoCalibrateParm, "Unconstrained|Fixed|Uniform|Offsetexponential|Truncatednormal|Lognormal|Offsetlognormal|Gamma|Offsetgamma|\0");
14396 PARAM (120, "Calwaitpr", DoPrsetParm, "Exponential|Fixed|\0"); /* not used but leave it in to not destroy mapping to commands */
14397 PARAM (121, "M3omegapr", DoPrsetParm, "Exponential|Fixed|\0");
14398 PARAM (122, "Applyto", DoReportParm, "\0");
14399 PARAM (123, "Tratio", DoReportParm, "Dirichlet|Ratio|\0");
14400 PARAM (124, "Revmat", DoReportParm, "Dirichlet|Ratio|\0");
14401 PARAM (125, "Ratemult", DoReportParm, "Dirichlet|Scaled|Ratio|\0");
14402 PARAM (126, "Filename", DoManualParm, "\0");
14403 PARAM (127, "Filename1", DoCompareTreeParm, "\0");
14404 PARAM (128, "Filename2", DoCompareTreeParm, "\0");
14405 PARAM (129, "Outputname", DoCompareTreeParm, "\0");
14406 PARAM (130, "Burnin", DoCompareTreeParm, "\0");
14407 PARAM (131, "Ploidy", DoLsetParm, "Haploid|Diploid|Zlinked|\0");
14408 PARAM (132, "Swapadjacent", DoMcmcParm, "Yes|No|\0");
14409 PARAM (133, "Treeagepr", DoPrsetParm, "Fixed|Uniform|Offsetexponential|Truncatednormal|Lognormal|Offsetlognormal|Gamma|Offsetgamma|\0");
14410 PARAM (134, "Ancstates", DoReportParm, "Yes|No|\0");
14411 PARAM (135, "Siterates", DoReportParm, "Yes|No|\0");
14412 PARAM (136, "Possel", DoReportParm, "Yes|No|\0");
14413 PARAM (137, "Plot", DoSumpParm, "Yes|No|\0");
14414 PARAM (138, "Table", DoSumpParm, "Yes|No|\0");
14415 PARAM (139, "Minprob", DoSumpParm, "\0");
14416 PARAM (140, "Printtofile", DoSumpParm, "Yes|No|\0");
14417 PARAM (141, "Outputname", DoSumpParm, "\0");
14418 PARAM (142, "Redirect", DoMcmcParm, "Yes|No|\0");
14419 PARAM (143, "Swapseed", DoMcmcParm, "\0");
14420 PARAM (144, "Runidseed", DoMcmcParm, "\0");
14421 PARAM (145, "Quitonerror", DoSetParm, "Yes|No|\0");
14422 PARAM (146, "Printbrlens", DoSumtParm, "Yes|No|\0");
14423 PARAM (147, "Brlensgeq", DoSumtParm, "\0");
14424 PARAM (148, "Minpartfreq", DoMcmcParm, "\0");
14425 PARAM (149, "Allchains", DoMcmcParm, "Yes|No|\0");
14426 PARAM (150, "Mcmcdiagn", DoMcmcParm, "Yes|No|\0");
14427 PARAM (151, "Diagnfreq", DoMcmcParm, "\0");
14428 PARAM (152, "Nruns", DoMcmcParm, "\0");
14429 PARAM (153, "Stoprule", DoMcmcParm, "Yes|No|\0");
14430 PARAM (154, "Stopval", DoMcmcParm, "\0");
14431 PARAM (155, "Relburnin", DoMcmcParm, "Yes|No|\0");
14432 PARAM (156, "Burninfrac", DoMcmcParm, "\0");
14433 PARAM (157, "Allcomps", DoMcmcParm, "Yes|No|\0");
14434 PARAM (158, "Printall", DoMcmcParm, "Yes|No|\0");
14435 PARAM (159, "Printmax", DoMcmcParm, "\0");
14436 PARAM (160, "Data", DoMcmcParm, "Yes|No|\0");
14437 PARAM (161, "Nruns", DoSumpParm, "\0");
14438 PARAM (162, "Allruns", DoSumpParm, "Yes|No|\0");
14439 PARAM (163, "Nruns", DoSumtParm, "\0");
14440 PARAM (164, "Ntrees", DoSumtParm, "\0");
14441 PARAM (165, "Calctreeprobs", DoSumtParm, "Yes|No|\0");
14442 PARAM (166, "Ordertaxa", DoMcmcParm, "Yes|No|\0");
14443 PARAM (167, "Ordertaxa", DoSumtParm, "Yes|No|\0");
14444 PARAM (168, "Aarevmatpr", DoPrsetParm, "Dirichlet|Fixed|\0");
14445 PARAM (169, "Nswaps", DoMcmcParm, "\0");
14446 PARAM (170, "Autoreplace", DoSetParm, "Yes|No|\0");
14447 PARAM (171, "Npthreads", DoSetParm, "\0");
14448 PARAM (172, "Cppratepr", DoPrsetParm, "Fixed|Exponential|\0");
14449 PARAM (173, "Cppmultdevpr", DoPrsetParm, "Fixed|\0");
14450 PARAM (174, "TK02varpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0");
14451 PARAM (175, "Pfile", DoSumtParm, "\0");
14452 PARAM (176, "Pfile", DoSumtParm, "\0");
14453 PARAM (177, "Autocomplete", DoSumtParm, "Yes|No|\0");
14454 PARAM (178, "Autocomplete", DoSumpParm, "Yes|No|\0");
14455 PARAM (179, "Userlevel", DoSetParm, "Standard|Developer|\0");
14456 PARAM (180, "Allavailable", DoShowmovesParm, "Yes|No|\0");
14457 PARAM (181, "Seed", DoSetParm, "\0");
14458 PARAM (182, "Swapseed", DoSetParm, "\0");
14459 PARAM (183, "Clockratepr", DoPrsetParm, "Fixed|Normal|Lognormal|Exponential|Gamma|\0");
14460 PARAM (184, "Nodeagepr", DoPrsetParm, "Unconstrained|Calibrated|\0");
14461 PARAM (185, "Clockvarpr", DoPrsetParm, "Strict|Cpp|TK02|Igr|Bm|Ibr|Mixed|\0");
14462 PARAM (186, "Xxxxxxxxxx", DoPropsetParm, "\0");
14463 PARAM (187, "Xxxxxxxxxx", DoStartvalsParm, "\0");
14464 PARAM (188, "Usegibbs", DoLsetParm, "Yes|No|\0");
14465 PARAM (189, "Gibbsfreq", DoLsetParm, "\0");
14466 PARAM (190, "Checkpoint", DoMcmcParm, "Yes|No|\0");
14467 PARAM (191, "Checkfreq", DoMcmcParm, "\0");
14468 PARAM (192, "Tree", DoReportParm, "Topology|Brlens|\0");
14469 PARAM (193, "Cpprate", DoLinkParm, "\0");
14470 PARAM (194, "Cppmultdev", DoLinkParm, "\0");
14471 PARAM (195, "Cppevents", DoLinkParm, "\0");
14472 PARAM (196, "TK02var", DoLinkParm, "\0");
14473 PARAM (197, "TK02branchrates",DoLinkParm, "\0");
14474 PARAM (198, "Savetrees", DoMcmcParm, "Yes|No|\0");
14475 PARAM (199, "Diagnstat", DoMcmcParm, "Avgstddev|Maxstddev|\0");
14476 PARAM (200, "Startparams", DoMcmcParm, "Reset|Current|\0");
14477 PARAM (201, "Characters", DoBeginParm, "\0");
14478 PARAM (202, "Startingtrees", DoMcmcParm, "\0");
14479 PARAM (203, "Xxxxxxxxxx", DoUserTreeParm, "\0");
14480 PARAM (204, "Outputname", DoSumtParm, "\0");
14481 PARAM (205, "Table", DoSumtParm, "Yes|No|\0");
14482 PARAM (206, "Summary", DoSumtParm, "Yes|No|\0");
14483 PARAM (207, "Consensus", DoSumtParm, "Yes|No|\0");
14484 PARAM (208, "Minpartfreq", DoSumtParm, "\0");
14485 PARAM (209, "Relburnin", DoSumtParm, "Yes|No|\0");
14486 PARAM (210, "Burninfrac", DoSumtParm, "\0");
14487 PARAM (211, "Relburnin", DoSumpParm, "Yes|No|\0");
14488 PARAM (212, "Burninfrac", DoSumpParm, "\0");
14489 PARAM (213, "Append", DoMcmcParm, "Yes|No|\0");
14490 PARAM (214, "Autotune", DoMcmcParm, "Yes|No|\0");
14491 PARAM (215, "Tunefreq", DoMcmcParm, "\0");
14492 PARAM (216, "Scientific", DoSetParm, "Yes|No|\0");
14493 PARAM (217, "Siteomega", DoReportParm, "Yes|No|\0");
14494 PARAM (218, "Igrvarpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0");
14495 PARAM (219, "Symbols", DoFormatParm, "\0");
14496 PARAM (220, "Equate", DoFormatParm, "\0");
14497 PARAM (221, "Relburnin", DoCompareTreeParm, "Yes|No|\0");
14498 PARAM (222, "Burninfrac", DoCompareTreeParm, "\0");
14499 PARAM (223, "Minpartfreq", DoCompareTreeParm, "\0");
14500 PARAM (224, "Relburnin", DoPlotParm, "Yes|No|\0");
14501 PARAM (225, "Burninfrac", DoPlotParm, "\0");
14502 PARAM (226, "Taxa", DoBeginParm, "\0");
14503 PARAM (227, "Xxxxxxxxxx", DoBeginParm, "\0");
14504 PARAM (228, "Xxxxxxxxxx", DoTaxlabelsParm, "\0");
14505 PARAM (229, "Dir", DoSetParm, "\0");
14506 PARAM (230, "Conformat", DoSumtParm, "Figtree|Simple|\0");
14507 PARAM (231, "Hpd", DoSumpParm, "Yes|No|\0");
14508 PARAM (232, "Hpd", DoSumtParm, "Yes|No|\0");
14509 PARAM (233, "Usebeagle", DoSetParm, "Yes|No|\0");
14510 PARAM (234, "Beagledevice", DoSetParm, "Cpu|Gpu|\0");
14511 PARAM (235, "Beagleprecision",DoSetParm, "Single|Double|\0");
14512 PARAM (236, "Beaglesse", DoSetParm, "Yes|No|\0");
14513 PARAM (237, "Beagleopenmp", DoSetParm, "Yes|No|\0");
14514 PARAM (238, "Beaglethreads", DoSetParm, "Yes|No|\0");
14515 PARAM (239, "Beaglescaling", DoSetParm, "Always|Dynamic|\0");
14516 PARAM (240, "Beaglefreq", DoSetParm, "\0");
14517 PARAM (241, "Popvarpr", DoPrsetParm, "Equal|Variable|\0");
14518 PARAM (242, "Igrvar", DoLinkParm, "\0");
14519 PARAM (243, "Igrbranchrates", DoLinkParm, "\0");
14520 PARAM (244, "Xxxxxxxxxx", DoSpeciespartitionParm, "\0");
14521 PARAM (245, "Speciespartition", DoSetParm, "\0");
14522 PARAM (246, "Revratepr", DoPrsetParm, "Symdir|\0");
14523 PARAM (247, "Samplestrat", DoPrsetParm, "Random|Diversity|Cluster|FossilTip|\0");
14524 PARAM (248, "Burninss", DoSsParm, "\0");
14525 PARAM (249, "Nsteps", DoSsParm, "\0");
14526 PARAM (250, "Alpha", DoSsParm, "\0");
14527 PARAM (251, "Bmvarpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0");
14528 PARAM (252, "Bmvar", DoLinkParm, "\0");
14529 PARAM (253, "Bmbranchrates", DoLinkParm, "\0");
14530 PARAM (254, "Ibrvarpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0");
14531 PARAM (255, "Ibrvar", DoLinkParm, "\0");
14532 PARAM (256, "Ibrbranchlens", DoLinkParm, "\0");
14533 PARAM (257, "FromPrior", DoSsParm, "Yes|No|\0");
14534 PARAM (258, "Filename", DoSumSsParm, "\0");
14535 PARAM (259, "Burnin", DoSumSsParm, "\0");
14536 PARAM (260, "Nruns", DoSumSsParm, "\0");
14537 PARAM (261, "Allruns", DoSumSsParm, "Yes|No|\0");
14538 PARAM (262, "Askmore", DoSumSsParm, "Yes|No|\0");
14539 PARAM (263, "Relburnin", DoSumSsParm, "Yes|No|\0");
14540 PARAM (264, "Burninfrac", DoSumSsParm, "\0");
14541 PARAM (265, "Discardfrac", DoSumSsParm, "\0");
14542 PARAM (266, "Smoothing", DoSumSsParm, "\0");
14543 PARAM (267, "Steptoplot", DoSumSsParm, "\0");
14544 PARAM (268, "Precision", DoSetParm, "\0");
14545 PARAM (269, "Fossilizationpr", DoPrsetParm, "Beta|Fixed|\0");
14546 PARAM (270, "Fossilizationrate", DoLinkParm, "\0");
14547 PARAM (271, "Generatepr", DoPrsetParm, "Variable|Fixed|\0");
14548 PARAM (272, "Mixedvarpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0");
14549 PARAM (273, "Mixedvar", DoLinkParm, "\0");
14550 PARAM (274, "Mixedbrchrates", DoLinkParm, "\0");
14551 PARAM (275, "Beagleresource", DoSetParm, "\0");
14553 /* NOTE: If a change is made to the parameter table, make certain you change
14554 NUMPARAMS (now 276; one more than last index) at the top of this file. */
14555 /* CmdType commands[] */
14559 void ShowNodes (TreeNode *p, int indent, int isThisTreeRooted)
14564 if (p->left == NULL && p->right == NULL && p->anc != NULL)
14566 printf ("%*cN %d (l=%d r=%d a=%d) %1.15lf (%s) scalerNode=%d isDated=%d ",
14567 indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->length, p->label, p->scalerNode, p->isDated);
14569 else if (p->left != NULL && p->right == NULL && p->anc == NULL)
14571 if (isThisTreeRooted == NO)
14573 if (p->label[0] == '\0' || p->label[0] == '\n' || p->label[0] == ' ')
14574 printf ("%*cN %d (l=%d r=%d a=%d) (---) scalerNode=%d ",
14575 indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode);
14577 printf ("%*cN %d (l=%d r=%d a=%d) (%s) scalerNode=%d ",
14578 indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->label, p->scalerNode);
14582 printf ("%*cN %d (l=%d r=%d a=%d) X.XXXXXX scalerNode=%d ",
14583 indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode);
14588 if (p->anc != NULL)
14590 if (p->anc->anc == NULL && isThisTreeRooted == YES)
14591 printf ("%*cN %d (l=%d r=%d a=%d) X.XXXXXX scalerNode=%d ",
14592 indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode);
14594 printf ("%*cN %d (l=%d r=%d a=%d) %1.15lf scalerNode=%d ",
14595 indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->length, p->scalerNode);
14598 if (isThisTreeRooted == YES)
14599 printf ("depth=%1.15lf\n", p->nodeDepth);
14602 ShowNodes (p->left, indent + 2, isThisTreeRooted);
14603 ShowNodes (p->right, indent + 2, isThisTreeRooted);
14608 int StandID (char nuc)
14612 /* Note that if you change how many states are recognized, you need
14613 to look at IsMissing */
14656 else if (n == missingId)
14660 else if (n == gapId)
14669 void State_CODON (char *state, int code, int division)
14671 state[0] = StateCode_NUC4(modelParams[division].codonNucs[code][0]);
14672 state[1] = StateCode_NUC4(modelParams[division].codonNucs[code][1]);
14673 state[2] = StateCode_NUC4(modelParams[division].codonNucs[code][2]);
14678 void State_DOUBLET (char *state, int code)
14680 state[0] = code/4 + 'A';
14681 state[1] = code%4 + 'A';
14686 int StateCode_AA (int n)
14689 return 'A'; /* Ala */
14691 return 'R'; /* Arg */
14693 return 'N'; /* Asn */
14695 return 'D'; /* Asp */
14697 return 'C'; /* Cys */
14699 return 'Q'; /* Gln */
14701 return 'E'; /* Glu */
14703 return 'G'; /* Gly */
14705 return 'H'; /* His */
14707 return 'I'; /* Ile */
14709 return 'L'; /* Leu */
14711 return 'K'; /* Lys */
14713 return 'M'; /* Met */
14715 return 'F'; /* Phe */
14717 return 'P'; /* Pro */
14719 return 'S'; /* Ser */
14721 return 'T'; /* Thr */
14723 return 'W'; /* Trp */
14725 return 'Y'; /* Tyr */
14727 return 'V'; /* Val */
14733 int StateCode_NUC4 (int n)
14747 int StateCode_Std (int n)
14749 if (n <= 9 && n >= 0)
14755 void WhatVariableExp (BitsLong exp, char *st)
14762 strcat(st, " nothing");
14765 if ((exp & Expecting(COMMAND)) == Expecting(COMMAND))
14767 strcat(st, " command");
14770 if ((exp & Expecting(PARAMETER)) == Expecting(PARAMETER))
14774 strcat(st, " parameter");
14777 if ((exp & Expecting(EQUALSIGN)) == Expecting(EQUALSIGN))
14784 if ((exp & Expecting(COLON)) == Expecting(COLON))
14791 if ((exp & Expecting(SEMICOLON)) == Expecting(SEMICOLON))
14798 if ((exp & Expecting(COMMA)) == Expecting(COMMA))
14805 if ((exp & Expecting(POUNDSIGN)) == Expecting(POUNDSIGN))
14812 if ((exp & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK))
14819 if ((exp & Expecting(DASH)) == Expecting(DASH))
14826 if ((exp & Expecting(LEFTPAR)) == Expecting(LEFTPAR))
14833 if ((exp & Expecting(RIGHTPAR)) == Expecting(RIGHTPAR))
14840 if ((exp & Expecting(LEFTCOMMENT)) == Expecting(LEFTCOMMENT))
14847 if ((exp & Expecting(RIGHTCOMMENT)) == Expecting(RIGHTCOMMENT))
14854 if ((exp & Expecting(ALPHA)) == Expecting(ALPHA))
14858 strcat(st, " <name>");
14861 if ((exp & Expecting(NUMBER)) == Expecting(NUMBER))
14865 strcat(st, " <number>");
14868 if ((exp & Expecting(RETURNSYMBOL)) == Expecting(RETURNSYMBOL))
14872 strcat(st, " return");
14875 if ((exp & Expecting(ASTERISK)) == Expecting(ASTERISK))
14882 if ((exp & Expecting(BACKSLASH)) == Expecting(BACKSLASH))
14889 if ((exp & Expecting(BACKSLASH)) == Expecting(BACKSLASH))
14896 if ((exp & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK))
14903 if ((exp & Expecting(PERCENT)) == Expecting(PERCENT))
14910 if ((exp & Expecting(LEFTCURL)) == Expecting(LEFTCURL))
14917 if ((exp & Expecting(RIGHTCURL)) == Expecting(RIGHTCURL))
14924 if ((exp & Expecting(WEIRD)) == Expecting(WEIRD))
14928 strcat(st, " <whatever>");
14931 if ((exp & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR))
14938 if ((exp & Expecting(UNKNOWN_TOKEN_TYPE)) == Expecting(UNKNOWN_TOKEN_TYPE))
14942 strcat(st, " no clue");
14949 char WhichAA (int x)
14971 else if (x == 1024)
14973 else if (x == 2048)
14975 else if (x == 4096)
14977 else if (x == 8192)
14979 else if (x == 16384)
14981 else if (x == 32768)
14983 else if (x == 65536)
14985 else if (x == 131072)
14987 else if (x == 262144)
14989 else if (x == 524288)
14991 else if (x > 0 && x < 524288)
14993 else if (x == MISSING)
15002 MrBFlt WhichCont (int x)
15004 return ((MrBFlt)(x / 1000.0));
15008 char WhichNuc (int x)
15040 else if (x == MISSING)
15049 char WhichRes (int x)
15057 else if (x == MISSING)
15066 char WhichStand (int x)
15088 else if (x > 0 && x < 512)
15090 else if (x == MISSING)