/*
* MrBayes 2.0
*
* John P. Huelsenbeck
* Department of Biology
* University of Rochester
* Rochester, NY 14627
*
* johnh@brahms.biology.rochester.edu
*
* Fredrik Ronquist
* Dept. Systematic Zoology
* Evolutionary Biology Centre
* Uppsala University
* Norbyv. 18D, SE-752 36 Uppsala, Sweden
*
* fredrik.ronquist@ebc.uu.se
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include "jph.h"
#include "tree.h"
#include "command.h"
#include "mcmc.h"
#define NUMCOMMANDS 176
#define NUMTOKENCHARS 14
#define HIERARCHYSIZE 610
#define SCREENWIDTH 60
#define SCREENWIDTH2 61
#define SCREENHEIGTH 15
#define HEADER_SIZE 1000
#define MAX_PARTITIONS 10000
#define NO_ACTION -1
#define ERROR_ACTION -2
#define EQUALSIGN 1
#define COLON 2
#define SEMICOLON 3
#define COMMA 4
#define POUNDSIGN 5
#define QUESTIONMARK 6
#define DASH 7
#define LEFTPAR 8
#define RIGHTPAR 9
#define LEFTCOMMENT 10
#define RIGHTCOMMENT 11
#define ALPHA 12
#define NUMBER 13
#define RETURNSYMBOL 14
#define ASTERISK 15
#define BACKSLASH 16
#define FORWARDSLASH 17
#define EXCLAMATIONMARK 18
#define PERCENT 19
#define AMPERSTAND 20
#define TILDE 21
#define PLUS 22
#define CARAT 23
#define DOLLARSIGN 24
#define ATSIGN 25
#define PIPESIGN 26
#define LEFTCURLY 27
#define RIGHTCURLY 28
#define UNKNOWN_TOKEN_TYPE 29
#define ANYTOKEN 30
#define CMD_EXECUTE 0
#define CMD_QUIT 1
#define CMD_ENTER_INPUT_FILE_NAME1 2
#define CMD_ENTER_INPUT_FILE_NAME2 3
#define CMD_INIT_NTAX 4
#define CMD_INIT_NCHAR 5
#define CMD_INIT_DATA_BLOCK 6
#define CMD_ALLOC_MATRIX 7
#define CMD_INIT_GAPCHAR 8
#define CMD_INIT_MATCHCHAR 9
#define CMD_INIT_MISSINGCHAR 10
#define CMD_INIT_INTERLEAVE 11
#define CMD_INIT_DATATYPE 12
#define CMD_EXIT_DATA_BLOCK 13
#define CMD_INIT_READ_MATRIX 14
#define CMD_FILL_MATRIX 15
#define CMD_FINISH_READ_MATRIX 16
#define CMD_ENTER_HELP_Q 17
#define CMD_GET_USER_SOME_HELP 18
#define CMD_INIT_HELP 19
#define CMD_SET_NST 20
#define CMD_SET_RATES 21
#define CMD_SET_BASE_FREQ 22
#define CMD_SET_CLOCK 23
#define CMD_END_NST 24
#define CMD_INIT_TRATIO 25
#define CMD_INIT_REVRATES 26
#define CMD_INIT_REVRATES2 27
#define CMD_INIT_REVRATES3 28
#define CMD_INIT_NONREVRATES 29
#define CMD_INIT_NONREVRATES2 30
#define CMD_INIT_NONREVRATES3 31
#define CMD_INIT_SHAPE 32
#define CMD_INIT_SITERATES 33
#define CMD_INIT_SITERATES2 34
#define CMD_INIT_PARTITION 35
#define CMD_INIT_CHARSET_NAME 36
#define CMD_INIT_CHARSET_NAME2 37
#define CMD_INIT_CHARSET 38
#define CMD_INIT_CHARSET2 39
#define CMD_ENTER_MRBAYES_BLOCK 40
#define CMD_EXIT_MRBAYES_BLOCK 41
#define CMD_INIT_EXCLUDE 42
#define CMD_EXCLUDE 43
#define CMD_EXCLUDE2 44
#define CMD_EXCLUDE3 45
#define CMD_EXCLUDE4 46
#define CMD_DEF_PARTITION 47
#define CMD_PARTITION 48
#define CMD_PARTITION2 49
#define CMD_PARTITION3 50
#define CMD_PARTITION4 51
#define CMD_PARTITION5 52
#define CMD_PARTITION6 53
#define CMD_DEF_OUTGROUP1 54
#define CMD_DEF_OUTGROUP2 55
#define CMD_SHOW_CHAR_STAT 56
#define CMD_CALIBRATION1 57
#define CMD_CALIBRATION2 58
#define CMD_CALIBRATION3 59
#define CMD_CALIBRATION4 60
#define CMD_CALIBRATION5 61
#define CMD_CALIBRATION6 62
#define CMD_CALIBRATION7 63
#define CMD_CONSTRAINT1 64
#define CMD_CONSTRAINT2 65
#define CMD_CONSTRAINT3 66
#define CMD_CONSTRAINT4 67
#define CMD_CONSTRAINT5 68
#define CMD_INIT_INCLUDE 69
#define CMD_INCLUDE 70
#define CMD_INCLUDE2 71
#define CMD_INCLUDE3 72
#define CMD_INCLUDE4 73
#define CMD_DELETE1 74
#define CMD_DELETE2 75
#define CMD_DELETE3 76
#define CMD_RESTORE1 77
#define CMD_RESTORE2 78
#define CMD_RESTORE3 79
#define CMD_MCMC 80
#define CMD_MCMC1 81
#define CMD_MCMC2 82
#define CMD_MCMC3 83
#define CMD_MCMC4 84
#define CMD_MCMC5 85
#define CMD_MCMC6 86
#define CMD_MCMC7 87
#define CMD_MCMC8 88
#define CMD_MCMC9 89
#define CMD_PRIOR1 90
#define CMD_PRIOR2 91
#define CMD_PRIOR3 92
#define CMD_PRIOR4 93
#define CMD_PRIOR5 94
#define CMD_PRIOR6 95
#define CMD_PRIOR7 96
#define CMD_PRIOR8 97
#define CMD_PRIOR9 98
#define CMD_PRIOR10 99
#define CMD_PRIOR11 100
#define CMD_PRIOR12 101
#define CMD_PRIOR13 102
#define CMD_PRIOR14 103
#define CMD_PRIOR15 104
#define CMD_PRIOR16 105
#define CMD_PRIOR17 106
#define CMD_PRIOR18 107
#define CMD_PRIOR19 108
#define CMD_PRIOR20 109
#define CMD_PRIOR21 110
#define CMD_PRIOR22 111
#define CMD_PRIOR23 112
#define CMD_PRIOR24 113
#define CMD_PRIOR25 114
#define CMD_PRIOR26 115
#define CMD_PRIOR27 116
#define CMD_TREE 117
#define CMD_TREE1 118
#define CMD_TREE2 119
#define CMD_TREE3 120
#define CMD_TREE4 121
#define CMD_TREE5 122
#define CMD_TREE6 123
#define CMD_TREE7 124
#define CMD_TREE8 125
#define CMD_SHOWUSERTREE 126
#define CMD_INIT_ENFORCECAL 127
#define CMD_INIT_ENFORCECON 128
#define CMD_INIT_INFERANC 129
#define CMD_INIT_NCAT 130
#define CMD_ROOT_TREE 131
#define CMD_DEROOT_TREE 132
#define CMD_SHOWNODES 133
#define CMD_SAVEBRLENS 134
#define CMD_SET_SEQ_ERROR 135
#define CMD_SET_SP_RATE 136
#define CMD_SET_EX_RATE 137
#define CMD_SET_SAMP_FRAC 138
#define CMD_SUMT_FILENAME 139
#define CMD_SUMT_BURN 140
#define CMD_SUMT_READFILE 141
#define CMD_TRANS_INIT 142
#define CMD_TRANS_NEW_NM 143
#define CMD_TRANS_OLD_NM 144
#define CMD_TRANS_COMMA 145
#define CMD_TRANS_END 146
#define CMD_SUM_TREE 147
#define CMD_SUM_TREE1 148
#define CMD_SUM_TREE2 149
#define CMD_SUM_TREE3 150
#define CMD_SUM_TREE4 151
#define CMD_SUM_TREE5 152
#define CMD_SUM_TREE6 153
#define CMD_SUM_TREE7 154
#define CMD_SUM_TREE8 155
#define CMD_INIT_TREE_BLK 156
#define CMD_SUM_TREE_END 157
#define CMD_SUMT_HALFCOMP 158
#define CMD_SUMT_ALLCOMP 159
#define CMD_SUMP_FILENAME 160
#define CMD_SUMP_BURN 161
#define CMD_SUMP_READFILE 162
#define CMD_SUM_PARM1 163
#define CMD_SUM_PARM2 164
#define CMD_SUM_PARM3 165
#define CMD_SUM_PARM4 166
#define CMD_SUM_PARM5 167
#define CMD_SUM_PARM6 168
#define CMD_SUM_PARM7 169
#define CMD_SUM_PARM8 170
#define CMD_SUM_PARM9 171
#define CMD_SUM_PARM10 172
#define CMD_AUTOCLOSE1 173
#define CMD_AUTOCLOSE2 174
#define CMD_NPERB 175
#define CMD_MCMCP 176
#define CMD_SET_AAMODEL1 177
#define CMD_SET_AAMODEL2 178
#define CMD_SET_AAMODEL3 179
#define CMD_SET_AAMODEL4 180
#define CMD_SET_AAMODEL5 181
#define CMD_SET_ANCFILE1 182
#define CMD_SET_ANCFILE2 183
#define CMD_SET_CODON1 184
#define CMD_SET_CODON2 185
#define CMD_SET_OMEGAVAR1 186
#define CMD_SET_OMEGAVAR2 187
#define CMD_SET_OMEGAVAR3 188
#define CMD_SET_OMEGAVAR4 189
#define CMD_SET_OMEGAVAR5 190
#define CMD_SET_OMEGA 191
#define CMD_OMEGAPR1 192
#define CMD_OMEGAPR2 193
#define CMD_OMEGAPR3 194
#define CMD_OMEGAPR4 195
#define CMD_OMEGAPR5 196
#define CMD_OMEGAPR6 197
#define CMD_SET_CODE 198
#define CMD_INFERSEL_YES 199
#define CMD_INFERSEL_NO 200
#define CMD_INIT_LAG1 201
#define CMD_INIT_LAG2 202
#define CMD_SET_LAG_PR1 203
#define CMD_SET_LAG_PR2 204
#define CMD_SET_LAG_PR3 205
#define CMD_SET_LAG_PR4 206
#define CMD_SET_INFERRATES1 207
#define CMD_SET_INFERRATES2 208
#define CMD_SET_COVARION1 209
#define CMD_SET_COVARION2 210
#define CMD_SET_PROPS1 211
#define CMD_SET_PROPS2 212
#define CMD_SET_COVTYPE 213
#define CMD_SET_CODING 214
#define CMD_SET_STATE_PR1 215
#define CMD_SET_STATE_PR2 216
#define CMD_SET_MOVE_PROPS 217
#define CMD_SET_MCMC_BURN 218
#define CMD_SET_CYCLEFREQ 219
#define CMD_SET_CALCPSEUDOBF 220
#define CMD_SET_PARS_CRIT 221
#define CMD_SET_TYPESET1 222
#define CMD_SET_TYPESET2 223
#define CMD_SET_TYPESET3 224
#define CMD_SET_TYPESET4 225
#define CMD_SET_TYPESET5 226
#define CMD_SET_TYPESET6 227
#define CMD_SET_TYPESET7 228
#define CMD_SET_TYPESET8 229
#define CMD_SET_TYPESET9 230
#define CMD_SET_TYPESET10 231
#define CMD_SET_TYPESET11 232
#define CMD_SET_STATESSET1 233
#define CMD_SET_STATESSET2 234
#define CMD_SET_STATESSET3 235
#define CMD_SET_STATESSET4 236
#define CMD_SET_STATESSET5 237
#define CMD_SET_STATESSET6 238
#define CMD_SET_STATESSET7 239
#define CMD_SET_STATESSET8 240
#define CMD_SET_STATESSET9 241
#define CMD_SET_STATESSET10 242
#define CMD_SET_STATESSET11 243
#define CMD_SET_ASSUME1 244
#define CMD_SET_ASSUME2 245
#define CONTREE
typedef struct cmdNode
{
struct cmdNode *parent, *left, *sib, *rNde;
int index, cmd, action;
char cmdName[100];
}
command_list;
typedef struct conNode
{
struct conNode *left, *leftSib, *rightSib, *anc;
int index;
char label[100];
double length;
}
ConTreeNode;
#if defined (CONTREE)
typedef struct pnode
{
struct pnode *left, *sib, *anc;
int x, y, mark, index;
double length, support, f;
char *label;
unsigned int *partition;
} PolyNode;
#endif
char ChangeCase (char c);
void CleanExit (void);
int DerootSumTree (TreeNode *r);
int Dex(command_list *p);
int Dex3 (ConTreeNode *p);
void DisplayBits (unsigned value);
int DoAction (int actionType);
void ErrorExit (void);
void GetToken (int *tokenType);
void GetUserDownPass (TreeNode *p, TreeNode **x, int *y);
void GetUserHelp (void);
int IsCommandValid (int commdandNumber);
int IsIn (char ch, char s[]);
int IsWhite (char c);
int NucID (char nuc);
int ParseFile (void);
int ParseToken (int tokenType);
void PrepareToken (void);
int ProtID (char aa);
void ReadInTempToken (char tempToken[NUMTOKENCHARS], int i);
int ReadNexusFile (void);
int RealloateTreeParts (void);
int ResID (char nuc);
int RootSumTree (TreeNode *p);
int SetBits (int n);
int ShowTree (TreeNode *r, int isThisTreeRooted);
void SortParts (int *item, int count);
void SortParts2 (int *item, int left, int right);
int StandID (char nuc);
int SummarizeParams (void);
int SummarizeTrees (void);
# if defined (CONTREE)
int FirstTaxonInPartition (unsigned int *partition, int length);
void FlipBits(unsigned int *partition, int length, unsigned int lastMask);
void GetConDownPass (PolyNode **downPass, PolyNode *p, int *i);
int IsPartCompatible (unsigned int *smaller, unsigned int *larger, int length);
int IsPartNested (unsigned int *smaller, unsigned int *larger, int length);
int ShowConTree (FILE *fp, int nNodes, PolyNode *root, int screenWidth);
int ShowConPhylogram (FILE *fp, int nNodes, PolyNode *root, int screenWidth);
void WriteConTree (PolyNode *p, FILE *fp);
# else
void SortCompatParts (int *item, unsigned *item2, double *item3, int count);
void SortCompatParts2 (int *item, unsigned *item2, double *item3, int left, int right);
void WriteConTreeToScreen (ConTreeNode *p, FILE *fp);
# endif
extern int nTaxa, nChar, *origDataMatrix, isNtaxaInitialized, isNcharInitialized, isMatrixAllocated,
dataType, *excludedSites, *sitePartitions, *charType, *charNStates,
molecularClock, *calibrations, *constraints, nConstraints, nCalibrations,
*excludedTaxa, nGen, sampleFreq, printFreq, numChains, isUserTreeDefined, isTreeRooted,
enforceConstraints, enforceCalibrations, inferAncStates, nRateCats, isPartitionDefined, nPartitions,
outgroupNum, saveBrlens, burnIn, consensusType, paramBurn, autoclose, nPerturbations, userBrlensDef,
aaModelType, saveAncFiles, enforceCodonModel, aaCode, inferPoseSel, lagNumber, inferRates, useCovarion,
mcmcBurn, cycleFreq, calcPseudoBf, useParsCriterion;
extern long int randomSeed;
extern char *taxonLabels, subModel[20], baseFreqModel[20], ratesModel[20], clockModel[20], partitionName[50], defPartitionName[50],
tRatioModel[20], revRatesModel[20], nonRevRatesModel[20], shapeModel[20], siteRatesModel[20],
calibrationLabels[32][100], constraintLabels[32][100], outFile[100], qmatprModel[20], basefreqprModel[20],
brlenprModel[20], shapeprModel[20], siterateprModel[20], startingTreeModel[20], sumTreeFile[100], sumParmFile[100],
omegaRatioModel[20], codonModelType[20], omegaprModel[20], lagModel[20], lagprModel[20], covarionModelType[20],
codingType[20], stateFreqPrModel[20];
extern double revRates[6], nonRevRates[12], shape, tRatio, siteRates[50], calibrationTimes[32][2], chainTemp,
qmatprExp, qmatprUni[2], basefreqprDir, brlenprExp, brlenprUni[2], shapeprExp, shapeprUni[2],
siterateprExp, siterateprUni[2], seqErrorProb, speciationRate, extinctionRate, samplingFraction,
omegaRatio, omegaprUni[2], omegaprExp, lagprUni[2], lagprExp,
qMatWinProp, piAlphaProp, rateWinProp, tuningProp, clockTuneProp, timeTuneProp, mTuneProp,
extendPProp, wormTuneProp, bdWinProp, omegaWinProp, rhoWinProp, omegaAlphaProp, invSlideProp,
switchWinProp, alphaWinProp, nodeTimeTuneProp, reconLimProp, tbrExtendPProp, tbrTuneProp, blTuneProp,
statefreqprDir, moveRates[100];
extern TreeNode *userTree, *userTreeRoot;
static int expectedCommands[HIERARCHYSIZE], isInterleaved, *matrixCounter, returnEncountered,
whichTaxon, isFirstInterleavedBlock, lineNumber, generalHelp, globalInt, *charSet, nCharSets,
charSetFrom, charSetTo, charSetWait, charSetFreq, charSetSlashWait, charSetPotWait,
whichPartition, isFirstNode, nextAvailableNode, intNodeNum, transNumber, isSumTreeRooted,
isTranslated, numSumTrees, nUnsignedNeeded, numTreePartsFound, *numFoundOfThisPart, numSumTreesSampled,
foundBrlens, nColumns, headerSize, tempNumColumns, curNumRows, whichRow, whichColumn, numPartsAllocated,
changeToLower, *typeDef, nTypeDefs, charOrdering, *nStatesDef, nNStatesDefs, nCharStates;
static unsigned *treeBits, *treePartsFound, *taxonMask, propSet;
static double *aBrlens, *aOldBrlens, *sBrlens, *paramInfo;
static command_list cmdList[HIERARCHYSIZE], *cmdRoot, *cmdPtr;
static TreeNode *pPtr, *qPtr, *sumTree, *sumTreeRoot, **sumTreeDP;
#if !defined (CONTREE)
static ConTreeNode *constraintTree;
#endif
static char *tokenP, token[STRING_LENGTH], tokenType, inFile[100], *headerNames,
gapChar, matchChar, missingChar, helpRequest[100], charSetLabels[50][100], typeDefLabels[50][100],
nStatesDefLabels[50][100], *transNewNames, *transOldNames;
static char validTokens[NUMCOMMANDS][NUMTOKENCHARS] =
{ "execute", /* 0 */
"begin", /* 1 */
"end", /* 2 */
"mrbayes", /* 3 */
"data", /* 4 */
"trees", /* 5 */
"help", /* 6 */
"quit", /* 7 */
"lset", /* 8 */
"nst", /* 9 */
"basefreq", /* 10 */
"rates", /* 11 */
"dimensions", /* 12 */
"ntax", /* 13 */
"nchar", /* 14 */
"format", /* 15 */
"datatype", /* 16 */
"yes", /* 17 */
"no", /* 18 */
"dna", /* 19 */
"rna", /* 20 */
"protein", /* 21 */
"interleave", /* 22 */
"gap", /* 23 */
"matchchar", /* 24 */
"missing", /* 25 */
"matrix", /* 26 */
"nexus", /* 27 */
"equal", /* 28 */
"gamma", /* 29 */
"sitespec", /* 30 */
"covarion", /* 31 */
"clock", /* 32 */
"unconstrained", /* 33 */
"relaxed", /* 34 */
"strict", /* 35 */
"empirical", /* 36 */
"estimate", /* 37 */
"tratio", /* 38 */
"revmat", /* 39 */
"nonrevmat", /* 40 */
"shape", /* 41 */
"sitepartition", /* 42 */
"siterates", /* 43 */
"partition", /* 44 */
"charset", /* 45 */
"exclude", /* 46 */
"outgroup", /* 47 */
"charstat", /* 48 */
"calibration", /* 49 */
"constraint", /* 50 */
"compchar", /* 51 */
"all", /* 52 */
"include", /* 53 */
"delete", /* 54 */
"restore", /* 55 */
"mcmc", /* 56 */
"seed", /* 57 */
"ngen", /* 58 */
"samplefreq", /* 59 */
"printfreq", /* 60 */
"nchains", /* 61 */
"temp", /* 62 */
"filename", /* 63 */
"prset", /* 64 */
"qmatpr", /* 65 */
"fixed", /* 66 */
"exp", /* 67 */
"uni", /* 68 */
"basefreqpr", /* 69 */
"dir", /* 70 */
"brlenpr", /* 71 */
"bd", /* 72 */
"shapepr", /* 73 */
"siteratepr", /* 74 */
"startingtree", /* 75 */
"random", /* 76 */
"user", /* 77 */
"usertree", /* 78 */
"showtree", /* 79 */
"enforcecal", /* 80 */
"enforcecon", /* 81 */
"inferanc", /* 82 */
"root", /* 83 */
"deroot", /* 84 */
"ncat", /* 85 */
"shownodes", /* 86 */
"savebrlens", /* 87 */
"seqerror", /* 88 */
"sumt", /* 89 */
"sump", /* 90 */
"burnin", /* 91 */
"tree", /* 92 */
"translate", /* 93 */
"contype", /* 94 */
"halfcompat", /* 95 */
"allcompat", /* 96 */
"bayesparams", /* 97 */
"header", /* 98 */
"set", /* 99 */
"autoclose", /* 100 */
"mcmcp", /* 101 */
"nperbs", /* 102 */
"aamodel", /* 103 */
"poisson", /* 104 */
"equalin", /* 105 */
"jones", /* 106 */
"dayhoff", /* 107 */
"gtr", /* 108 */
"omegapr", /* 109 */
"ancfile", /* 110 */
"enforcecodon", /* 111 */
"omegavar", /* 112 */
"ny98", /* 113 */
"omega", /* 114 */
"code", /* 115 */
"universal", /* 116 */
"vertmt", /* 117 */
"mycoplasma", /* 118 */
"yeast", /* 119 */
"ciliates", /* 120 */
"metmt", /* 121 */
"inferpossel", /* 122 */
"adgamma", /* 123 */
"ac1ny98", /* 124 */
"ac2ny98", /* 125 */
"lag", /* 126 */
"lagpr", /* 127 */
"invariant", /* 128 */
"invgamma", /* 129 */
"ssgamma", /* 130 */
"ssadgamma", /* 131 */
"inferrates", /* 132 */
"covny98", /* 133 */
"restriction", /* 134 */
"qmatwin", /* 135 */
"pialpha", /* 136 */
"ratewin", /* 137 */
"tuning", /* 138 */
"clocktune", /* 139 */
"timetune", /* 140 */
"mtune", /* 141 */
"extendp", /* 142 */
"wormtune", /* 143 */
"bdwin", /* 144 */
"omegawin", /* 145 */
"omegaalpha", /* 146 */
"rhowin", /* 147 */
"invslide", /* 148 */
"switchwin", /* 149 */
"alphawin", /* 150 */
"props", /* 151 */
"reconlim", /* 152 */
"covtype", /* 153 */
"ts98", /* 154 */
"gcswitch", /* 155 */
"tbrextendp", /* 156 */
"tbrtune", /* 157 */
"bltune", /* 158 */
"standard", /* 159 */
"mixed", /* 160 */
"coding", /* 161 */
"variable", /* 162 */
"informative", /* 163 */
"noabsence", /* 164 */
"nopresence", /* 165 */
"statefreqpr", /* 166 */
"setmoveprops", /* 167 */
"cyclefreq", /* 168 */
"calcpseudobf", /* 169 */
"parsmodel", /* 170 */
"typeset", /* 171 */
"nstatesset", /* 172 */
"ord", /* 173 */
"unord", /* 174 */
"assume"}; /* 175 */
#if defined(__MWERKS__)
# pragma optimization_level 1
#endif
char ChangeCase (char c)
{
int x;
x = tolower(c);
return (x);
}
void CleanExit (void)
{
if (isMatrixAllocated == YES)
{
free (origDataMatrix);
free (taxonLabels);
free (excludedSites);
free (sitePartitions);
free (matrixCounter);
free (charSet);
free (calibrations);
free (constraints);
free (excludedTaxa);
free (userTree);
free (sumTree);
free (transOldNames);
free (transNewNames);
free (charType);
free (charNStates);
free (typeDef);
free (nStatesDef);
}
nTaxa = nChar = 0;
isMatrixAllocated = NO;
isNtaxaInitialized = NO;
isNcharInitialized = NO;
}
int Dex(command_list *p)
{
if (p == NULL)
return (-1);
else
return (p->index);
}
int Dex2 (TreeNode *p)
{
return (p == NULL) ? -1 : p->index;
}
int Dex3 (ConTreeNode *p)
{
return (p == NULL) ? -1 : p->index;
}
int DerootTree (TreeNode *p)
{
int i, nNodes, isMarked;
double tempBrLen;
TreeNode **downPass, *lft, *m1, *m2, *um1, *um2, *out;
if (isTreeRooted == NO)
{
printf (" ERROR: Tree is already unrooted\n");
return (ERROR);
}
else
nNodes = 2 * nTaxa;
/* bring the outgroup around to the first right position */
downPass = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!downPass)
{
printf (" ERROR: Could not allocate downPass\n");
return (ERROR);
}
i = 0;
GetUserDownPass (userTreeRoot, downPass, &i);
isMarked = NO;
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->index == outgroupNum)
{
p->marked = YES;
isMarked = YES;
}
else
p->marked = NO;
}
if (isMarked == NO)
{
printf (" ERROR: Could not find outgroup taxon\n");
return (ERROR);
}
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->left != NULL && p->right != NULL)
if (p->left->marked == YES || p->right->marked == YES)
p->marked = YES;
}
free (downPass);
lft = userTreeRoot->left;
while (lft->left->index != outgroupNum && lft->right->index != outgroupNum)
{
if (lft->left->marked == YES && lft->right->marked == NO)
{
m1 = lft->left;
um1 = lft->right;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m2;
lft->right = m1;
m2->anc = lft;
m1->left = um2;
m1->right = um1;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else if (lft->left->marked == NO && lft->right->marked == YES)
{
m1 = lft->right;
um1 = lft->left;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m1;
lft->right = m2;
m2->anc = lft;
m1->left = um1;
m1->right = um2;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
/* make certain outgroup is to the right of the root */
if (userTreeRoot->left->left->index == outgroupNum)
{
m1 = userTreeRoot->left->left;
m2 = userTreeRoot->left->right;
lft = userTreeRoot->left;
lft->left = m2;
lft->right = m1;
}
/* now, take outgroup and make it point down */
m1 = userTreeRoot;
m2 = userTreeRoot->left;
lft = userTreeRoot->left->left;
out = userTreeRoot->left->right;
tempBrLen = out->length;
if (tempBrLen < 0.0)
tempBrLen = 0.0;
lft->anc = out;
out->left = lft;
out->right = NULL;
out->anc = NULL;
lft->length += tempBrLen;
m1->left = NULL;
m2->left = NULL;
m1->right = NULL;
m2->right = NULL;
m1->anc = NULL;
m2->anc = NULL;
userTreeRoot = out;
isTreeRooted = NO;
/* reindex internal nodes of tree */
i = nTaxa;
FinishTree (userTreeRoot, &i, NO);
return (NO_ERROR);
}
int DerootSumTree (TreeNode *p)
{
int i, nNodes, isMarked;
double tempBrLen;
TreeNode **downPass, *lft, *m1, *m2, *um1, *um2, *out;
if (isSumTreeRooted == NO)
{
printf (" ERROR: Tree is already unrooted\n");
return (ERROR);
}
else
nNodes = 2 * nTaxa;
/* bring the outgroup around to the first right position */
downPass = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!downPass)
{
printf (" ERROR: Could not allocate downPass\n");
return (ERROR);
}
i = 0;
GetUserDownPass (sumTreeRoot, downPass, &i);
isMarked = NO;
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->index == outgroupNum)
{
p->marked = YES;
isMarked = YES;
}
else
p->marked = NO;
}
if (isMarked == NO)
{
printf (" ERROR: Could not find outgroup taxon\n");
return (ERROR);
}
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->left != NULL && p->right != NULL)
if (p->left->marked == YES || p->right->marked == YES)
p->marked = YES;
}
free (downPass);
lft = sumTreeRoot->left;
while (lft->left->index != outgroupNum && lft->right->index != outgroupNum)
{
if (lft->left->marked == YES && lft->right->marked == NO)
{
m1 = lft->left;
um1 = lft->right;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m2;
lft->right = m1;
m2->anc = lft;
m1->left = um2;
m1->right = um1;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else if (lft->left->marked == NO && lft->right->marked == YES)
{
m1 = lft->right;
um1 = lft->left;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m1;
lft->right = m2;
m2->anc = lft;
m1->left = um1;
m1->right = um2;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
/* make certain outgroup is to the right of the root */
if (sumTreeRoot->left->left->index == outgroupNum)
{
m1 = sumTreeRoot->left->left;
m2 = sumTreeRoot->left->right;
lft = sumTreeRoot->left;
lft->left = m2;
lft->right = m1;
}
/* now, take outgroup and make it point down */
m1 = sumTreeRoot;
m2 = sumTreeRoot->left;
lft = sumTreeRoot->left->left;
out = sumTreeRoot->left->right;
tempBrLen = out->length;
if (tempBrLen < 0.0)
tempBrLen = 0.0;
lft->anc = out;
out->left = lft;
out->right = NULL;
out->anc = NULL;
lft->length += tempBrLen;
m1->left = NULL;
m2->left = NULL;
m1->right = NULL;
m2->right = NULL;
m1->anc = NULL;
m2->anc = NULL;
sumTreeRoot = out;
isSumTreeRooted = NO;
/* reindex internal nodes of tree */
i = nTaxa;
FinishTree (sumTreeRoot, &i, NO);
return (NO_ERROR);
}
void DisplayBits (unsigned value)
{
int unsignedIntSize;
unsigned c, displayMask;
unsignedIntSize = sizeof (unsigned);
displayMask = 1 << (8*unsignedIntSize-1);
//printf ("%10u = ", value);
for (c=1; c<=8*unsignedIntSize; c++)
{
putchar (value & displayMask ? '1' : '0');
value <<= 1;
if (c % 8 == 0)
putchar (' ');
}
//putchar ('\n');
}
int DoAction (int actionType)
{
int i, j, k, l, nuc, tempInt, tempInt2, foundSet, nNodes, offSet,
foundPartition, allSame, nextConNode, isCompat,
whichIsX, whichIsY, numY[SCREENWIDTH], unsignedIntsize;
unsigned x, y, lastMask;
long int tempLongInt;
double tempD, *tempInfo, a, aOld, s, minX, minY, maxX, maxY,
meanY[SCREENWIDTH];
char tempString[100], tempString2[100], conFile[100];
TreeNode *p;
FILE *fp;
# if defined (CONTREE)
PolyNode *conRoot, *cp, *q, *r, *ql, *pl, *conNodes;
int targetNode, nBits;
double freq;
unsigned int *partition, *ingroupPartition, *outgroupPartition;
# else
ConTreeNode *conRoot, *cp, *cl, *cr, *cn, *cq, **taxaInConstraint, **taxaNotInConstraint;
unsigned *compatParts, *tempParts;
int nTaxaInConstraint, nTaxaNotInConstraint, nCompatParts, nSame1, nSame2, *numOnes;
double *partLengths;
# endif
switch (actionType)
{
case CMD_QUIT:
printf (" Quitting program\n\n");
CleanExit();
exit (0);
break;
case CMD_EXECUTE:
printf (" Executing file named \"%s\"\n", inFile);
if (ReadNexusFile () == ERROR)
{
printf (" Could not execute file\n");
ErrorExit ();
return (ERROR);
}
break;
case CMD_ENTER_INPUT_FILE_NAME1:
changeToLower = NO;
break;
case CMD_ENTER_INPUT_FILE_NAME2:
changeToLower = YES;
strcpy (inFile, token);
strcpy (outFile, inFile);
strcat (outFile, ".out");
strcpy (sumTreeFile, token);
strcat (sumTreeFile, ".out.t");
strcpy (sumParmFile, token);
strcat (sumParmFile, ".out.bp");
break;
case CMD_INIT_NTAX:
sscanf (token, "%d", &tempInt);
nTaxa = tempInt;
isNtaxaInitialized = YES;
break;
case CMD_INIT_NCHAR:
sscanf (token, "%d", &tempInt);
nChar = tempInt;
isNcharInitialized = YES;
break;
case CMD_INIT_DATA_BLOCK:
if (isMatrixAllocated == YES)
{
free (origDataMatrix);
free (taxonLabels);
free (excludedSites);
free (sitePartitions);
free (matrixCounter);
free (charSet);
free (calibrations);
free (constraints);
free (excludedTaxa);
free (userTree);
free (charType);
free (charNStates);
free (typeDef);
free (nStatesDef);
nTaxa = nChar = 0;
}
isMatrixAllocated = NO;
isNtaxaInitialized = NO;
isNcharInitialized = NO;
isUserTreeDefined = NO;
isInterleaved = NO;
gapChar = 0;
matchChar = 0;
missingChar = 0;
dataType = -1;
printf (" Entering data block\n");
break;
case CMD_ALLOC_MATRIX:
if (isMatrixAllocated == NO && isNtaxaInitialized == YES && isNcharInitialized == YES)
{
nCharStates = 4;
origDataMatrix = (int *)malloc((size_t) (nTaxa * nChar * sizeof(int)));
if (!origDataMatrix)
{
printf (" ERROR: Could not allocate origDataMatrix\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nTaxa*nChar; i++)
origDataMatrix[i] = 0;
taxonLabels = (char *)malloc((size_t) (nTaxa * 100 * sizeof(char)));
if (!taxonLabels)
{
printf (" ERROR: Could not allocate taxonLabels\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nTaxa*100; i++)
taxonLabels[i] = ' ';
taxonLabels[nTaxa*100-1] = '\0';
transNewNames = (char *)malloc((size_t) (nTaxa * 100 * sizeof(char)));
if (!transNewNames)
{
printf (" ERROR: Could not allocate transNewNames\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nTaxa*100; i++)
transNewNames[i] = ' ';
transNewNames[nTaxa*100-1] = '\0';
transOldNames = (char *)malloc((size_t) (nTaxa * 100 * sizeof(char)));
if (!transOldNames)
{
printf (" ERROR: Could not allocate transOldNames\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nTaxa*100; i++)
transOldNames[i] = ' ';
transOldNames[nTaxa*100-1] = '\0';
excludedSites = (int *)malloc((size_t) (nChar * sizeof(int)));
if (!excludedSites)
{
printf (" ERROR: Could not allocate excludedSites\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nChar; i++)
excludedSites[i] = NO;
sitePartitions = (int *)malloc((size_t) (nChar * sizeof(int)));
if (!sitePartitions)
{
printf (" ERROR: Could not allocate sitePartitions\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nChar; i++)
sitePartitions[i] = 0;
matrixCounter = (int *)malloc((size_t) (nTaxa * sizeof(int)));
if (!matrixCounter)
{
printf (" ERROR: Could not allocate matrixCounter\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nTaxa; i++)
matrixCounter[i] = 0;
charSet = (int *)malloc((size_t) (nChar * sizeof(int)));
if (!charSet)
{
printf (" ERROR: Could not allocate charSet\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nChar; i++)
charSet[i] = 0;
nCharSets = 0;
typeDef = (int *)malloc((size_t) (nChar * sizeof(int)));
if (!typeDef)
{
printf (" ERROR: Could not allocate typeDef\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nChar; i++)
typeDef[i] = UNORDERED;
nTypeDefs = 0;
nStatesDef = (int *)malloc((size_t) (nChar * sizeof(int)));
if (!nStatesDef)
{
printf (" ERROR: Could not allocate nStatesDef\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nChar; i++)
nStatesDef[i] = 4;
nNStatesDefs = 0;
charType = (int *)malloc((size_t) (nChar * sizeof(int)));
if (!charType)
{
printf (" ERROR: Could not allocate charType\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nChar; i++)
charType[i] = UNORDERED;
charNStates = (int *)malloc((size_t) (nChar * sizeof(int)));
if (!charNStates)
{
printf (" ERROR: Could not allocate charNStates\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nChar; i++)
charNStates[i] = 4;
calibrations = (int *)malloc((size_t) (nTaxa * sizeof(int)));
if (!calibrations)
{
printf (" ERROR: Could not allocate calibrations\n");
ErrorExit ();
return (ERROR);
}
nCalibrations = 0;
for (i=0; i<nTaxa; i++)
calibrations[i] = 0;
constraints = (int *)malloc((size_t) (nTaxa * sizeof(int)));
if (!constraints)
{
printf (" ERROR: Could not allocate constraints\n");
ErrorExit ();
return (ERROR);
}
nConstraints = 0;
for (i=0; i<nTaxa; i++)
constraints[i] = 0;
excludedTaxa = (int *)malloc((size_t) (nTaxa * sizeof(int)));
if (!excludedTaxa)
{
printf (" ERROR: Could not allocate excludedTaxa\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<nTaxa; i++)
excludedTaxa[i] = NO;
userTree = (TreeNode *)malloc((size_t) (2 * nTaxa * sizeof(TreeNode)));
if (!userTree)
{
printf (" ERROR: Could not allocate userTree\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
{
userTree[i].left = NULL;
userTree[i].right = NULL;
userTree[i].anc = NULL;
userTree[i].memoryIndex = i;
userTree[i].index = i;
userTree[i].upDateCl = NO;
userTree[i].length = 0.0;
userTree[i].marked = NO;
strcpy (userTree[i].label, "no name");
strcpy (userTree[i].calibrationName, "no name");
strcpy (userTree[i].constraintName, "no name");
}
sumTree = (TreeNode *)malloc((size_t) (2 * nTaxa * sizeof(TreeNode)));
if (!sumTree)
{
printf (" ERROR: Could not allocate sumTree\n");
ErrorExit ();
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
{
sumTree[i].left = NULL;
sumTree[i].right = NULL;
sumTree[i].anc = NULL;
sumTree[i].memoryIndex = i;
sumTree[i].index = i;
sumTree[i].upDateCl = NO;
sumTree[i].length = 0.0;
sumTree[i].marked = NO;
strcpy (sumTree[i].label, "no name");
strcpy (sumTree[i].calibrationName, "no name");
strcpy (sumTree[i].constraintName, "no name");
}
isMatrixAllocated = YES;
outgroupNum = 0;
isPartitionDefined = NO;
printf (" Data matrix has %d taxa and %d characters\n", nTaxa, nChar);
}
else
{
printf (" ERROR allocating matrix\n");
ErrorExit ();
return (ERROR);
}
break;
case CMD_INIT_GAPCHAR:
if (strlen(token) == 1)
{
if (dataType == DNA || dataType == RNA)
{
if (NucID (token[0]) != -1)
{
printf (" ERROR: Invalid gap character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
gapChar = token[0];
printf (" Gaps are coded as %c\n", gapChar);
}
}
else if (dataType == PROTEIN)
{
if (ProtID (token[0]) != -1)
{
printf (" ERROR: Invalid gap character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
gapChar = token[0];
printf (" Gaps are coded as %c\n", gapChar);
}
}
else if (dataType == RESTRICTION)
{
if (ResID (token[0]) != -1)
{
printf (" ERROR: Invalid gap character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
gapChar = token[0];
printf (" Gaps are coded as %c\n", gapChar);
}
}
else if (dataType == STANDARD)
{
if (StandID (token[0]) != -1)
{
printf (" ERROR: Invalid gap character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
gapChar = token[0];
printf (" Gaps are coded as %c\n", gapChar);
}
}
else
{
printf (" ERROR: Undefined data type\n");
ErrorExit ();
return (ERROR);
}
}
else
{
printf (" ERROR: gap character is too long (line %d)\n", lineNumber);
ErrorExit ();
return (ERROR);
}
break;
case CMD_INIT_MATCHCHAR:
if (strlen(token) == 1)
{
if (dataType == DNA || dataType == RNA)
{
if (NucID (token[0]) != -1)
{
printf (" ERROR: Invalid matchchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
matchChar = token[0];
printf (" Matching characters are coded as %c\n", matchChar);
}
}
else if (dataType == PROTEIN)
{
if (ProtID (token[0]) != -1)
{
printf (" ERROR: Invalid matchchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
matchChar = token[0];
printf (" Matching characters are coded as %c\n", matchChar);
}
}
else if (dataType == RESTRICTION)
{
if (ResID (token[0]) != -1)
{
printf (" ERROR: Invalid matchchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
matchChar = token[0];
printf (" Matching characters are coded as %c\n", matchChar);
}
}
else if (dataType == STANDARD)
{
if (StandID (token[0]) != -1)
{
printf (" ERROR: Invalid matchchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
else
{
matchChar = token[0];
printf (" Matching characters are coded as %c\n", matchChar);
}
}
else
{
printf (" ERROR: Undefined data type\n");
ErrorExit ();
return (ERROR);
}
}
else
{
printf (" ERROR: matchchar is too long (line %d)\n", lineNumber);
ErrorExit ();
return (ERROR);
}
break;
case CMD_INIT_MISSINGCHAR:
if (strlen(token) == 1)
{
if (dataType == DNA || dataType == RNA)
{
if (NucID (token[0]) != -1)
{
printf (" ERROR: Invalid missingchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
}
else if (dataType == PROTEIN)
{
if (ProtID (token[0]) != -1)
{
printf (" ERROR: Invalid missingchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
}
else if (dataType == RESTRICTION)
{
if (ResID (token[0]) != -1)
{
printf (" ERROR: Invalid missingchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
}
else if (dataType == STANDARD)
{
if (StandID (token[0]) != -1)
{
printf (" ERROR: Invalid missingchar character %c (line %d)\n", token[0], lineNumber);
ErrorExit ();
return (ERROR);
}
}
missingChar = token[0];
printf (" Missing states are coded as %c\n", missingChar);
}
else
{
printf (" ERROR: missing character is too long (line %d)\n", lineNumber);
ErrorExit ();
return (ERROR);
}
break;
case CMD_INIT_INTERLEAVE:
if (token[0] == 'y')
{
isInterleaved = YES;
printf (" Data matrix is interleaved\n");
}
else
{
isInterleaved = NO;
printf (" Data matrix is not interleaved\n");
}
break;
case CMD_INIT_DATATYPE:
if (token[0] == 'd' && token[1] == 'n')
{
dataType = DNA;
nCharStates = 4;
}
else if (token[0] == 'r' && token[1] == 'n')
{
dataType = RNA;
nCharStates = 4;
}
else if (token[0] == 'p' && token[1] == 'r')
{
dataType = PROTEIN;
basefreqprDir = 20.0;
nCharStates = 20;
}
else if (token[0] == 'r' && token[1] == 'e')
{
dataType = RESTRICTION;
strcpy (codingType, "noabsence");
nCharStates = 2;
}
else if (token[0] == 's' && token[1] == 't')
{
dataType = STANDARD;
strcpy (codingType, "variable");
nCharStates = 2;
}
else if (token[0] == 'm' && token[1] == 'i')
{
dataType = MIXED;
}
for (i=0; i<nChar; i++)
{
charNStates[i] = nCharStates;
nStatesDef[i] = nCharStates;
}
printf (" Data matrix contains %s character states\n", token);
break;
case CMD_EXIT_DATA_BLOCK:
printf (" Exiting data block\n");
break;
case CMD_INIT_READ_MATRIX:
for (i=0; i<nTaxa; i++)
matrixCounter[i] = 0;
whichTaxon = 0;
isFirstInterleavedBlock = YES;
break;
case CMD_FILL_MATRIX:
if (isMatrixAllocated == YES)
{
if (returnEncountered == YES)
{
if (whichTaxon >= nTaxa)
{
if (isInterleaved == YES)
whichTaxon = 0;
else
{
printf (" ERROR: Too many taxa (line %d)\n", lineNumber);
ErrorExit ();
return (ERROR);
}
}
if (isFirstInterleavedBlock == YES)
{
i = 0;
while (token[i] != '\0')
{
taxonLabels[whichTaxon*100+i] = token[i];
i++;
}
taxonLabels[whichTaxon*100+i] = '|';
returnEncountered = NO;
whichTaxon++;
taxonLabels[nTaxa*100-1] = '\0';
}
else
{
i = 0;
while (taxonLabels[whichTaxon*100+i] != '|')
{
tempString[i] = taxonLabels[whichTaxon*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
printf (" ERROR: Taxon names don't match across interleaved blocks (line %d)\n", lineNumber);
ErrorExit ();
return (ERROR);
}
}
}
else
{
i = 0;
while (token[i] != '\0')
{
if (matrixCounter[whichTaxon-1] == nChar)
{
printf (" ERROR: Too many characters (line %d)\n", lineNumber);
ErrorExit ();
return (ERROR);
}
//printf ("%2d %2d -- %c\n", whichTaxon, matrixCounter[whichTaxon-1], token[i]);
if (token[i] == matchChar)
{
if (whichTaxon - 1 == 0)
{
printf (" ERROR: Matching characters (%c) cannot be in first taxon (line %d)\n",
matchChar, lineNumber);
ErrorExit ();
return (ERROR);
}
origDataMatrix[(whichTaxon-1)*nChar+matrixCounter[whichTaxon-1]] =
origDataMatrix[(0)*nChar+matrixCounter[whichTaxon-1]];
matrixCounter[whichTaxon-1]++;
}
else
{
if (dataType == DNA || dataType == RNA)
nuc = NucID (token[i]);
else if (dataType == PROTEIN)
nuc = ProtID (token[i]);
else if (dataType == RESTRICTION)
nuc = ResID (token[i]);
else if (dataType == STANDARD)
nuc = StandID (token[i]);
else if (dataType == MIXED)
{
nuc = 0;
printf (" ERROR: Unrecognized data type\n");
ErrorExit ();
return (ERROR);
}
else
{
printf (" ERROR: Unrecognized data type\n");
ErrorExit ();
return (ERROR);
}
if (nuc != -1)
{
origDataMatrix[(whichTaxon-1)*nChar+matrixCounter[whichTaxon-1]] = nuc;
matrixCounter[whichTaxon-1]++;
}
else
{
printf (" ERROR: Unrecognized character state %c (line %d)\n", token[i], lineNumber);
ErrorExit ();
return (ERROR);
}
}
i++;
}
}
}
else
{
printf (" ERROR: Cannot read in matrix because it is not allocated\n");
}
break;
case CMD_FINISH_READ_MATRIX:
for (i=0; i<nTaxa-1; i++)
{
for (j=i+1; j<nTaxa; j++)
{
k = 0;
while (taxonLabels[i*100+k] != '|')
{
tempString[k] = taxonLabels[i*100+k];
k++;
}
tempString[k] = '\0';
k = 0;
while (taxonLabels[j*100+k] != '|')
{
tempString2[k] = taxonLabels[j*100+k];
k++;
}
tempString2[k] = '\0';
if (!strcmp(tempString, tempString2))
{
printf ("\n ERROR: Taxa %d and %d have the same name. The taxon names\n", i+1, j+1);
printf (" must all be different.\n\n");
ErrorExit ();
return (ERROR);
}
}
}
tempInt = NO;
for (i=0; i<nTaxa; i++)
{
if (matrixCounter[i] != nChar)
{
printf (" ERROR: Too few characters for taxon %d\n", i+1);
tempInt = YES;
}
}
if (whichTaxon != nTaxa)
{
printf (" ERROR: Too few taxa in matrix (expecting %d taxa)\n", nTaxa);
tempInt = YES;
}
if (tempInt == YES)
{
ErrorExit ();
return (ERROR);
}
else
printf (" Matrix successfully read\n");
# if 0
{
int j;
for (j=0; j<nTaxa; j++)
{
printf (" ");
i = 0;
while (taxonLabels[j*100+i] != '|')
{
printf ("%c", taxonLabels[j*100+i]);
i++;
}
printf (" -> ");
for (i=0; i<nChar; i++)
printf ("%2d ", origDataMatrix[j*nChar+i]);
printf ("\n");
}
}
# endif
break;
case CMD_ENTER_HELP_Q:
generalHelp = NO;
strcpy (helpRequest, token);
break;
case CMD_GET_USER_SOME_HELP:
GetUserHelp ();
break;
case CMD_INIT_HELP:
generalHelp = YES;
break;
case CMD_SET_NST:
sscanf (token, "%d", &tempInt);
if (tempInt == 1 || tempInt == 2 || tempInt == 6 || tempInt == 12)
{
printf (" Setting nst=%d\n", tempInt);
strcpy (subModel, token);
}
else
printf (" ERROR: Invalid number of substitution parameters\n");
break;
case CMD_SET_RATES:
strcpy (ratesModel, token);
printf (" Setting rates=%s\n", token);
break;
case CMD_SET_BASE_FREQ:
strcpy (baseFreqModel, token);
printf (" Setting basefreq=%s\n", token);
break;
case CMD_SET_CLOCK:
strcpy (clockModel, token);
printf (" Setting clock=%s\n", token);
break;
case CMD_END_NST:
break;
case CMD_INIT_TRATIO:
if (token[0] == 'e')
{
strcpy(tRatioModel, token);
tRatio = 1.0;
}
else
{
strcpy (tRatioModel, "user defined");
sscanf (token, "%lf", &tempD);
tRatio = tempD;
}
printf (" Setting tratio = %lf\n", tRatio);
break;
case CMD_INIT_REVRATES:
if (token[0] == 'e')
{
strcpy(revRatesModel, token);
tRatio = 1.0;
}
else
{
globalInt = 0;
strcpy (revRatesModel, "user defined");
}
printf (" Setting rates of reversible model\n", tRatio);
break;
case CMD_INIT_REVRATES2:
if (globalInt > 5)
{
printf (" ERROR: Too many user rates assigned\n");
return (ERROR);
}
else
{
sscanf (token, "%lf", &tempD);
revRates[globalInt++] = tempD;
}
break;
case CMD_INIT_REVRATES3:
if (globalInt != 6)
{
printf (" ERROR: Incorrect number of rates assigned\n");
return (ERROR);
}
else
{
for (i=0; i<5; i++)
revRates[i] /= revRates[5];
revRates[5] = 1.0;
}
break;
case CMD_INIT_NONREVRATES:
if (token[0] == 'e')
{
strcpy(nonRevRatesModel, token);
tRatio = 1.0;
}
else
{
globalInt = 0;
strcpy (nonRevRatesModel, "user defined");
}
printf (" Setting rates of non-reversible model\n", tRatio);
break;
case CMD_INIT_NONREVRATES2:
if (globalInt > 11)
{
printf (" ERROR: Too many user rates assigned\n");
return (ERROR);
}
else
{
sscanf (token, "%lf", &tempD);
nonRevRates[globalInt++] = tempD;
}
break;
case CMD_INIT_NONREVRATES3:
if (globalInt != 12)
{
printf (" ERROR: Incorrect number of rates assigned\n");
return (ERROR);
}
else
{
for (i=0; i<11; i++)
nonRevRates[i] /= nonRevRates[11];
nonRevRates[11] = 1.0;
}
break;
case CMD_INIT_SHAPE:
if (token[0] == 'e')
{
strcpy(shapeModel, token);
shape = 0.5;
}
else
{
sscanf (token, "%lf", &tempD);
shape = tempD;
strcpy (shapeModel, "user defined");
}
printf (" Setting gamma shape parameter = %lf\n", shape);
break;
case CMD_INIT_PARTITION:
strcpy(partitionName, token);
break;
case CMD_INIT_SITERATES:
if (token[0] == 'e')
{
strcpy(siteRatesModel, token);
}
else
{
globalInt = 0;
strcpy (siteRatesModel, "user defined");
}
printf (" Setting rates for partitions\n");
break;
case CMD_INIT_SITERATES2:
if (globalInt > 49)
{
printf (" ERROR: Too many site rates assigned\n");
return (ERROR);
}
else
{
sscanf (token, "%lf", &tempD);
siteRates[globalInt++] = tempD;
}
break;
case CMD_INIT_CHARSET_NAME:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
i = 0;
while (token[i] != '\0')
{
charSetLabels[nCharSets][i] = token[i];
i++;
}
charSetLabels[nCharSets][i] = '|';
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetPotWait = YES;
charSetFreq = 1;
printf (" Assigning character set \"");
i = 0;
while (charSetLabels[nCharSets][i] != '|')
{
printf ("%c", charSetLabels[nCharSets][i]);
i++;
}
printf ("\"\n");
nCharSets++;
break;
case CMD_INIT_CHARSET_NAME2:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
printf (" ERROR: You cannot use charset names that are digits\n");
return (ERROR);
break;
case CMD_INIT_CHARSET:
if (token[0] == '-')
{
charSetWait = YES;
charSetPotWait = YES;
}
else if (token[0] == '\\')
{
charSetSlashWait = YES;
charSetPotWait = YES;
}
else
{
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
charSet[i] += (int)pow(2.0, (double)nCharSets);
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
sscanf (token, "%d", &tempInt);
if (charSetSlashWait == YES && charSetWait == YES)
{
printf (" ERROR: Problem assigning character set\n");
return (ERROR);
}
if (charSetSlashWait == YES)
{
charSetFreq = tempInt;
charSetSlashWait = NO;
charSetPotWait = NO;
}
else if (charSetWait == YES)
{
charSetTo = tempInt;
charSetWait = NO;
charSetPotWait = NO;
}
else
{
if (charSetWait == NO)
{
charSetFrom = tempInt;
charSetTo = tempInt;
charSetPotWait = NO;
}
else
{
charSetTo = tempInt;
charSetPotWait = NO;
}
}
}
break;
case CMD_INIT_CHARSET2:
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
charSet[i] += (int)pow(2.0, (double)nCharSets);
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
# if 0
for (i=0; i<nChar; i++)
printf ("%d ", charSet[i]);
printf("\n");
# endif
break;
case CMD_ENTER_MRBAYES_BLOCK:
printf (" Entering MrBayes block\n");
break;
case CMD_EXIT_MRBAYES_BLOCK:
printf (" Exiting MrBayes block\n");
break;
case CMD_INIT_EXCLUDE:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetPotWait = YES;
printf (" Excluding characters ");
break;
case CMD_EXCLUDE:
if (token[0] == '-')
{
charSetWait = YES;
charSetPotWait = YES;
printf ("to ");
}
else
{
if (charSetWait == NO && charSetPotWait == NO)
{
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
excludedSites[i] = YES;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetPotWait = YES;
}
sscanf (token, "%d", &tempInt);
printf ("%d ", tempInt);
if (charSetWait == YES)
{
charSetTo = tempInt;
charSetWait = NO;
charSetPotWait = NO;
}
else
{
if (charSetWait == NO)
{
charSetFrom = tempInt;
charSetTo = tempInt;
charSetPotWait = NO;
}
else
{
charSetTo = tempInt;
charSetPotWait = NO;
}
}
}
break;
case CMD_EXCLUDE2:
foundSet = NO;
for (i=0; i<nCharSets; i++)
{
j = 0;
while (charSetLabels[i][j] != '|')
{
tempString[j] = charSetLabels[i][j];
j++;
}
tempString[j] = '\0';
if (!strcmp(tempString, token))
{
printf ("in character set \"%s\" ", token);
foundSet = YES;
//printf ("match at %s %s\n", token, tempString);
tempInt = (int)pow(2.0, (double)(i+1));
for (j=0; j<nChar; j++)
{
tempInt2 = tempInt & charSet[j];
if (tempInt == tempInt2)
{
excludedSites[j] = YES;
}
}
}
}
if (foundSet == NO)
{
printf ("\n ERROR: Could not find character set %s\n", token);
return (ERROR);
}
break;
case CMD_EXCLUDE3:
if (charSetWait == NO && charSetPotWait == NO)
{
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (excludedSites[i] == YES)
printf ("\n WARNING: Site %d already excluded\n", i+1);
else
excludedSites[i] = YES;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetPotWait = YES;
}
printf ("\n");
# if 0
for (i=0; i<nChar; i++)
printf ("%d", excludedSites[i]);
printf ("\n");
# endif
break;
case CMD_EXCLUDE4:
for (i=0; i<nChar; i++)
{
excludedSites[i] = YES;
}
break;
case CMD_DEF_PARTITION:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
strcpy (defPartitionName, token);
printf (" Defining partition called \"%s\"\n", defPartitionName);
break;
case CMD_PARTITION:
printf (" ERROR: Cannot use digit for partition name\n");
return (ERROR);
break;
case CMD_PARTITION2:
sscanf (token, "%d", &tempInt);
nPartitions = tempInt;
printf (" Number of partitions = %d\n", nPartitions);
whichPartition = 0;
break;
case CMD_PARTITION3:
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetPotWait = YES;
charSetFreq = 1;
whichPartition++;
if (whichPartition > nPartitions)
{
printf (" ERROR: You exceeded the %d partitions you specified.\n", nPartitions);
return (ERROR);
}
break;
case CMD_PARTITION4:
if (token[0] == '-')
{
charSetWait = YES;
charSetPotWait = YES;
}
else if (token[0] == '\\')
{
charSetSlashWait = YES;
charSetPotWait = YES;
}
else
{
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
sitePartitions[i] = whichPartition;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
sscanf (token, "%d", &tempInt);
if (charSetSlashWait == YES && charSetWait == YES)
{
printf (" ERROR: Problem assigning character set\n");
return (ERROR);
}
if (charSetSlashWait == YES)
{
charSetFreq = tempInt;
charSetSlashWait = NO;
charSetPotWait = NO;
}
else if (charSetWait == YES)
{
charSetTo = tempInt;
charSetWait = NO;
charSetPotWait = NO;
}
else
{
if (charSetWait == NO)
{
charSetFrom = tempInt;
charSetTo = tempInt;
charSetPotWait = NO;
}
else
{
charSetTo = tempInt;
charSetPotWait = NO;
}
}
}
break;
case CMD_PARTITION5:
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
sitePartitions[i] = whichPartition;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
if (token[0] == ';')
{
if (whichPartition != nPartitions)
{
printf (" ERROR: An incorrect number of partitions are defined.\n", nPartitions);
return (ERROR);
}
isPartitionDefined = YES;
}
if (token[0] == ',')
{
whichPartition++;
if (whichPartition > nPartitions)
{
printf (" ERROR: You exceeded the %d partitions you specified.\n", nPartitions);
return (ERROR);
}
}
else
{
for (i=0; i<nChar; i++)
{
if (excludedSites[i] == NO && sitePartitions[i] == 0)
{
printf (" ERROR: Site %d is not assigned to a partition\n", i+1);
return (ERROR);
}
}
}
# if 0
for (i=0; i<nChar; i++)
printf ("%d ", sitePartitions[i]);
printf("\n");
# endif
break;
case CMD_PARTITION6:
foundSet = NO;
for (i=0; i<nCharSets; i++)
{
j = 0;
while (charSetLabels[i][j] != '|')
{
tempString[j] = charSetLabels[i][j];
j++;
}
tempString[j] = '\0';
if (!strcmp(tempString, token))
{
foundSet = YES;
//printf ("match at %s %s\n", token, tempString);
tempInt = (int)pow(2.0, (double)(i+1));
for (j=0; j<nChar; j++)
{
tempInt2 = tempInt & charSet[j];
if (tempInt == tempInt2)
{
sitePartitions[j] = whichPartition;
}
}
}
}
if (foundSet == NO)
{
printf (" ERROR: Could not find charset %s\n", token);
return (ERROR);
}
break;
case CMD_DEF_OUTGROUP1:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString[i] = taxonLabels[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
if (tempInt == YES)
{
outgroupNum = j;
printf (" Setting outgroup to species %s\n", tempString);
}
else
{
printf (" ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
if (isUserTreeDefined == YES)
{
if (isTreeRooted == YES)
{
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
}
else
{
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
}
}
break;
case CMD_DEF_OUTGROUP2:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
sscanf (token, "%d", &tempInt);
if (tempInt <= 0 || tempInt > nTaxa)
{
printf (" ERROR: Outgroup number out of range\n");
return (ERROR);
}
else
{
tempInt--;
outgroupNum = tempInt;
printf (" Setting outgroup to species \"");
i = 0;
while (taxonLabels[outgroupNum*100+i] != '|')
{
printf ("%c", taxonLabels[outgroupNum*100+i]);
i++;
}
printf ("\"\n");
}
if (isUserTreeDefined == YES)
{
if (isTreeRooted == YES)
{
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
}
else
{
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
}
}
break;
case CMD_SHOW_CHAR_STAT:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
printf (" site included/excluded partition number\n");
printf (" ------------------------------------------------\n");
for (i=0; i<nChar; i++)
{
printf ("%5d ", i+1);
if (excludedSites[i] == YES)
printf (" excluded ");
else
printf (" included ");
if (isPartitionDefined == YES)
printf (" %5d ", sitePartitions[i]);
else
printf (" no partition");
if (charType[i] == ORDERED)
printf (" ord ");
else
printf (" unord ");
printf (" %2d ", charNStates[i]);
printf ("\n");
}
break;
case CMD_CALIBRATION1:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nCalibrations >= 31)
{
printf (" ERROR: Too many calibrations (32 maximum)\n");
return (ERROR);
}
printf (" Reading calibration \"%s\"\n", token);
i = 0;
while (token[i] != '\0')
{
calibrationLabels[nCalibrations][i] = token[i];
i++;
}
calibrationLabels[nCalibrations][i] = '|';
break;
case CMD_CALIBRATION2:
printf (" ERROR: Calibration label cannot be a number\n");
break;
case CMD_CALIBRATION3:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nCalibrations >= 31)
{
printf (" ERROR: Too many calibrations (32 maximum)\n");
return (ERROR);
}
sscanf (token, "%lf", &tempD);
calibrationTimes[nCalibrations][0] = tempD;
break;
case CMD_CALIBRATION4:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nCalibrations >= 31)
{
printf (" ERROR: Too many calibrations (32 maximum)\n");
return (ERROR);
}
sscanf (token, "%lf", &tempD);
calibrationTimes[nCalibrations][1] = tempD;
break;
case CMD_CALIBRATION5:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nCalibrations >= 31)
{
printf (" ERROR: Too many calibrations (32 maximum)\n");
return (ERROR);
}
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString[i] = taxonLabels[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
if (tempInt == YES)
{
calibrations[j] += (int)pow(2.0, (double)(nCalibrations));
}
else
{
printf (" ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
break;
case CMD_CALIBRATION6:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nCalibrations >= 31)
{
printf (" ERROR: Too many calibrations (32 maximum)\n");
return (ERROR);
}
sscanf (token, "%d", &tempInt);
tempInt--;
if (tempInt < 0 || tempInt >= nTaxa)
{
printf (" ERROR: Taxon number is out of range\n");
}
else
{
calibrations[tempInt] += (int)pow(2.0, (double)(nCalibrations));
}
break;
case CMD_CALIBRATION7:
# if 0
i = 0;
while (calibrationLabels[nCalibrations][i] != '|')
{
printf ("%c", calibrationLabels[nCalibrations][i]);
i++;
}
printf (" (%lf %lf) -> ", calibrationTimes[nCalibrations][0], calibrationTimes[nCalibrations][1]);
for (i=0; i<nTaxa; i++)
printf ("%2d ", calibrations[i]);
printf ("\n");
# endif
nCalibrations++;
break;
case CMD_CONSTRAINT1:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nConstraints >= 31)
{
printf (" ERROR: Too many constraints (32 maximum)\n");
return (ERROR);
}
printf (" Reading constraint \"%s\"\n", token);
i = 0;
while (token[i] != '\0')
{
constraintLabels[nConstraints][i] = token[i];
i++;
}
constraintLabels[nConstraints][i] = '|';
break;
case CMD_CONSTRAINT2:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nConstraints >= 31)
{
printf (" ERROR: Too many constraints (32 maximum)\n");
return (ERROR);
}
printf (" ERROR: Constraint label cannot be a number\n");
break;
case CMD_CONSTRAINT3:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nConstraints >= 31)
{
printf (" ERROR: Too many constraints (32 maximum)\n");
return (ERROR);
}
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString[i] = taxonLabels[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
if (tempInt == YES)
{
constraints[j] += (int)pow(2.0, (double)(nConstraints));
}
else
{
printf (" ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
break;
case CMD_CONSTRAINT4:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nConstraints >= 31)
{
printf (" ERROR: Too many constraints (32 maximum)\n");
return (ERROR);
}
sscanf (token, "%d", &tempInt);
tempInt--;
if (tempInt < 0 || tempInt >= nTaxa)
{
printf (" ERROR: Taxon number is out of range\n");
}
else
{
constraints[tempInt] += (int)pow(2.0, (double)(nConstraints));
}
break;
case CMD_CONSTRAINT5:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (nConstraints >= 31)
{
printf (" ERROR: Too many constraints (32 maximum)\n");
return (ERROR);
}
# if 0
i = 0;
while (constraintLabels[nConstraints][i] != '|')
{
printf ("%c", constraintLabels[nConstraints][i]);
i++;
}
printf (" -> ");
for (i=0; i<nTaxa; i++)
printf ("%2d ", constraints[i]);
printf ("\n");
# endif
nConstraints++;
break;
case CMD_INIT_INCLUDE:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetPotWait = YES;
printf (" Including characters ");
break;
case CMD_INCLUDE:
if (token[0] == '-')
{
charSetWait = YES;
charSetPotWait = YES;
printf ("to ");
}
else
{
if (charSetWait == NO && charSetPotWait == NO)
{
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
excludedSites[i] = NO;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetPotWait = YES;
}
sscanf (token, "%d", &tempInt);
printf ("%d ", tempInt);
if (charSetWait == YES)
{
charSetTo = tempInt;
charSetWait = NO;
charSetPotWait = NO;
}
else
{
if (charSetWait == NO)
{
charSetFrom = tempInt;
charSetTo = tempInt;
charSetPotWait = NO;
}
else
{
charSetTo = tempInt;
charSetPotWait = NO;
}
}
}
break;
case CMD_INCLUDE2:
for (i=0; i<nCharSets; i++)
{
j = 0;
while (charSetLabels[i][j] != '|')
{
tempString[j] = charSetLabels[i][j];
j++;
}
tempString[j] = '\0';
if (!strcmp(tempString, token))
{
printf ("in character set \"%s\" ", token);
//printf ("match at %s %s\n", token, tempString);
tempInt = (int)pow(2.0, (double)(i+1));
for (j=0; j<nChar; j++)
{
tempInt2 = tempInt & charSet[j];
if (tempInt == tempInt2)
{
excludedSites[j] = NO;
}
}
}
}
break;
case CMD_INCLUDE3:
if (charSetWait == NO && charSetPotWait == NO)
{
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
excludedSites[i] = NO;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetPotWait = YES;
}
printf ("\n");
# if 0
for (i=0; i<nChar; i++)
printf ("%d", excludedSites[i]);
printf ("\n");
# endif
break;
case CMD_INCLUDE4:
for (i=0; i<nChar; i++)
{
excludedSites[i] = NO;
}
break;
case CMD_DELETE1:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString[i] = taxonLabels[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
if (tempInt == YES)
{
excludedTaxa[j] = YES;
printf (" Excluded taxon %s\n", token);
}
else
{
printf (" ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
break;
case CMD_DELETE2:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
sscanf (token, "%d", &tempInt);
tempInt--;
if (tempInt < 0 || tempInt >= nTaxa)
{
printf (" ERROR: Taxon number is out of range\n");
}
else
{
excludedTaxa[tempInt] = YES;
printf (" Excluded taxon ");
i = 0;
while (taxonLabels[tempInt*100+i] != '|')
{
printf ("%c", taxonLabels[tempInt*100+i]);
i++;
}
printf ("\n");
}
break;
case CMD_DELETE3:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
printf (" Excluded all taxa\n", token);
for (i=0; i<nTaxa; i++)
excludedTaxa[i] = YES;
break;
case CMD_RESTORE1:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString[i] = taxonLabels[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
if (tempInt == YES)
{
excludedTaxa[j] = NO;
printf (" Included taxon %s\n", token);
}
else
{
printf (" ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
break;
case CMD_RESTORE2:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
sscanf (token, "%d", &tempInt);
tempInt--;
if (tempInt < 0 || tempInt >= nTaxa)
{
printf (" ERROR: Taxon number is out of range\n");
}
else
{
excludedTaxa[tempInt] = NO;
printf (" Included taxon ");
i = 0;
while (taxonLabels[tempInt*100+i] != '|')
{
printf ("%c", taxonLabels[tempInt*100+i]);
i++;
}
printf ("\n");
}
break;
case CMD_RESTORE3:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
printf (" Included all taxa\n", token);
for (i=0; i<nTaxa; i++)
excludedTaxa[i] = NO;
break;
case CMD_MCMC:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
break;
case CMD_MCMC1:
sscanf (token, "%ld", &tempLongInt);
randomSeed = tempLongInt;
break;
case CMD_MCMC2:
sscanf (token, "%d", &tempInt);
nGen = tempInt;
break;
case CMD_MCMC3:
sscanf (token, "%d", &tempInt);
sampleFreq = tempInt;
break;
case CMD_MCMC4:
sscanf (token, "%d", &tempInt);
printFreq = tempInt;
break;
case CMD_MCMC5:
sscanf (token, "%d", &tempInt);
numChains = tempInt;
break;
case CMD_MCMC6:
sscanf (token, "%lf", &tempD);
chainTemp = tempD;
break;
case CMD_MCMC7:
strcpy (outFile, token);
break;
case CMD_MCMC8:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (RunChain () == ERROR)
return (ERROR);
break;
case CMD_MCMC9:
if (token[0] == 'r')
strcpy (startingTreeModel, "random");
else
strcpy (startingTreeModel, "user");
break;
case CMD_PRIOR1:
strcpy (qmatprModel, "fixed");
printf (" Fixing prior for Q matrix\n");
break;
case CMD_PRIOR2:
strcpy (qmatprModel, "exponential");
printf (" Exponential prior for Q matrix\n");
break;
case CMD_PRIOR3:
strcpy (qmatprModel, "uniform");
printf (" Uniform prior for Q matrix\n");
break;
case CMD_PRIOR4:
sscanf (token, "%lf", &tempD);
if (tempD <= 0.0)
{
printf (" ERROR: Exponential parameter must be positive\n");
return (ERROR);
}
qmatprExp = tempD;
break;
case CMD_PRIOR5:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Lower bound on uniform must be positive\n");
return (ERROR);
}
qmatprUni[0] = tempD;
break;
case CMD_PRIOR6:
sscanf (token, "%lf", &tempD);
if (tempD <= qmatprUni[0])
{
printf (" ERROR: Upper bound on uniform must be greater than lower bound\n");
return (ERROR);
}
qmatprUni[1] = tempD;
break;
case CMD_PRIOR7:
strcpy (basefreqprModel, "fixed");
printf (" Fixing prior for base frequencies\n");
break;
case CMD_PRIOR8:
strcpy (basefreqprModel, "dirichlet");
printf (" Dirichlet prior for base frequencies\n");
break;
case CMD_PRIOR9:
sscanf (token, "%lf", &tempD);
if (tempD <= 0.0)
{
printf (" ERROR: Dirichlet parameter must be positive\n");
return (ERROR);
}
basefreqprDir = tempD;
break;
case CMD_PRIOR10:
strcpy (brlenprModel, "uniform");
printf (" Uniform prior on branch lengths\n");
break;
case CMD_PRIOR11:
strcpy (brlenprModel, "exponential");
printf (" Exponential prior on branch lengths\n");
break;
case CMD_PRIOR12:
strcpy (brlenprModel, "birth-death");
printf (" Birth-death prior on branch lengths\n");
break;
case CMD_PRIOR13:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Lower bound on uniform must be positive\n");
return (ERROR);
}
brlenprUni[0] = tempD;
break;
case CMD_PRIOR14:
sscanf (token, "%lf", &tempD);
if (tempD <= brlenprUni[0])
{
printf (" ERROR: Upper bound on uniform must be greater than lower bound\n");
return (ERROR);
}
brlenprUni[1] = tempD;
break;
case CMD_PRIOR15:
sscanf (token, "%lf", &tempD);
if (tempD <= 0.0)
{
printf (" ERROR: Exponential parameter must be positive\n");
return (ERROR);
}
brlenprExp = tempD;
break;
case CMD_PRIOR16:
strcpy (shapeprModel, "fixed");
printf (" Fixing gamma shape parameter\n");
break;
case CMD_PRIOR17:
strcpy (shapeprModel, "uniform");
printf (" Uniform prior on shape parameter\n");
break;
case CMD_PRIOR18:
strcpy (shapeprModel, "exponential");
printf (" Exponential prior on shape parameter\n");
break;
case CMD_PRIOR19:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Lower bound on uniform must be positive\n");
return (ERROR);
}
shapeprUni[0] = tempD;
break;
case CMD_PRIOR20:
sscanf (token, "%lf", &tempD);
if (tempD <= shapeprUni[0])
{
printf (" ERROR: Upper bound on uniform must be greater than lower bound\n");
return (ERROR);
}
shapeprUni[1] = tempD;
break;
case CMD_PRIOR21:
sscanf (token, "%lf", &tempD);
if (tempD <= 0.0)
{
printf (" ERROR: Exponential parameter must be positive\n");
return (ERROR);
}
shapeprExp = tempD;
break;
case CMD_PRIOR22:
strcpy (siterateprModel, "fixed");
printf (" Fixing site rates\n");
break;
case CMD_PRIOR23:
strcpy (siterateprModel, "uniform");
printf (" Uniform prior on site rates\n");
break;
case CMD_PRIOR24:
strcpy (siterateprModel, "exponential");
printf (" Exponential prior on site rates\n");
break;
case CMD_PRIOR25:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Lower bound on uniform must be positive\n");
return (ERROR);
}
siterateprUni[0] = tempD;
break;
case CMD_PRIOR26:
sscanf (token, "%lf", &tempD);
if (tempD <= siterateprUni[0])
{
printf (" ERROR: Upper bound on uniform must be greater than lower bound\n");
return (ERROR);
}
siterateprUni[1] = tempD;
break;
case CMD_PRIOR27:
sscanf (token, "%lf", &tempD);
if (tempD <= 0.0)
{
printf (" ERROR: Exponential parameter must be positive\n");
return (ERROR);
}
siterateprExp = tempD;
break;
case CMD_TREE:
/* = */
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
if (isUserTreeDefined == YES)
{
printf (" ERROR: User tree already defined\n");
return (ERROR);
}
isFirstNode = YES;
pPtr = qPtr = &userTree[0];
nextAvailableNode = 0;
userBrlensDef = NO;
break;
case CMD_TREE1:
/* ( */
if (isFirstNode == YES)
{
pPtr = &userTree[nextAvailableNode];
nextAvailableNode++;
isFirstNode = NO;
userTreeRoot = pPtr;
}
else
{
if (nextAvailableNode+1 >= 2*nTaxa)
{
printf (" ERROR: Too many nodes in tree\n");
return (ERROR);
}
if (pPtr->left == NULL)
{
pPtr = &userTree[nextAvailableNode];
nextAvailableNode++;
qPtr->left = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->right == NULL)
{
pPtr = &userTree[nextAvailableNode];
nextAvailableNode++;
qPtr->right = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->anc == NULL)
{
pPtr = &userTree[nextAvailableNode];
nextAvailableNode++;
qPtr->anc = pPtr;
pPtr->left = qPtr;
qPtr = pPtr;
userTreeRoot = pPtr;
pPtr->marked = YES;
}
else
{
printf ("\n ERROR: Tree is not bifurcating\n");
return (ERROR);
}
}
break;
case CMD_TREE2:
/* <name> */
if (nextAvailableNode+1 >= 2*nTaxa)
{
printf ("\n ERROR: Too many nodes in tree\n");
return (ERROR);
}
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString[i] = taxonLabels[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
if (tempInt == YES)
{
if (pPtr->left == NULL)
{
pPtr = &userTree[nextAvailableNode];
strcpy (pPtr->label, token);
pPtr->index = j;
nextAvailableNode++;
qPtr->left = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->right == NULL)
{
pPtr = &userTree[nextAvailableNode];
strcpy (pPtr->label, token);
pPtr->index = j;
nextAvailableNode++;
qPtr->right = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->anc == NULL)
{
pPtr = &userTree[nextAvailableNode];
strcpy (pPtr->label, token);
pPtr->index = j;
nextAvailableNode++;
qPtr->anc = pPtr;
pPtr->left = qPtr;
qPtr = pPtr;
userTreeRoot = pPtr;
pPtr->marked = YES;
}
else
{
printf ("\n ERROR: Tree is not bifurcating\n");
return (ERROR);
}
}
else
{
printf ("\n ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
break;
case CMD_TREE3:
/* <number> */
if (nextAvailableNode+1 >= 2*nTaxa)
{
printf ("\n ERROR: Too many nodes in tree\n");
return (ERROR);
}
sscanf (token, "%d", &tempInt);
tempInt--;
if (tempInt < 0 || tempInt >= nTaxa)
{
printf ("\n ERROR: Taxon number is out of range\n");
}
else
{
if (pPtr->left == NULL)
{
pPtr = &userTree[nextAvailableNode];
i = 0;
while (taxonLabels[tempInt*100+i] != '|')
{
pPtr->label[i] = taxonLabels[tempInt*100+i];
i++;
}
pPtr->label[i] = '\0';
pPtr->index = tempInt;
nextAvailableNode++;
qPtr->left = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->right == NULL)
{
pPtr = &userTree[nextAvailableNode];
i = 0;
while (taxonLabels[tempInt*100+i] != '|')
{
pPtr->label[i] = taxonLabels[tempInt*100+i];
i++;
}
pPtr->label[i] = '\0';
pPtr->index = tempInt;
nextAvailableNode++;
qPtr->right = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->anc == NULL)
{
pPtr = &userTree[nextAvailableNode];
i = 0;
while (taxonLabels[tempInt*100+i] != '|')
{
pPtr->label[i] = taxonLabels[tempInt*100+i];
i++;
}
pPtr->label[i] = '\0';
pPtr->index = tempInt;
nextAvailableNode++;
qPtr->anc = pPtr;
pPtr->left = qPtr;
qPtr = pPtr;
userTreeRoot = pPtr;
pPtr->marked = YES;
}
else
{
printf ("\n ERROR: Tree is not bifurcating\n");
return (ERROR);
}
}
break;
case CMD_TREE4:
/* ) */
if (pPtr->marked == NO)
{
if (pPtr->anc != NULL)
{
pPtr = pPtr->anc;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go down\n");
return (ERROR);
}
}
else
{
if (pPtr->left != NULL)
{
pPtr = pPtr->left;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go up\n");
return (ERROR);
}
}
break;
case CMD_TREE5:
/* , */
if (pPtr->marked == NO)
{
if (pPtr->anc != NULL)
{
pPtr = pPtr->anc;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go down\n");
return (ERROR);
}
}
else
{
if (pPtr->left != NULL)
{
pPtr = pPtr->left;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go up\n");
return (ERROR);
}
}
break;
case CMD_TREE6:
/* : */
break;
case CMD_TREE7:
/* ; */
if (pPtr != &userTree[0])
{
printf ("\n ERROR: Something wrong with user tree\n");
return (ERROR);
}
if (pPtr->anc == NULL)
isTreeRooted = YES;
else
isTreeRooted = NO;
if (isTreeRooted == YES)
{
printf (" User tree defined (rooted)\n");
pPtr = &userTree[nextAvailableNode];
nextAvailableNode++;
pPtr->left = qPtr;
qPtr->anc = pPtr;
userTreeRoot = pPtr;
}
else
{
printf (" User tree defined (unrooted)\n");
}
i = nTaxa;
if (isTreeRooted == YES)
FinishTree (userTreeRoot, &i, YES);
else
FinishTree (userTreeRoot, &i, NO);
isUserTreeDefined = YES;
if (isTreeRooted == YES)
{
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
}
else
{
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
}
break;
case CMD_TREE8:
/* <branch length> */
sscanf (token, "%lf", &tempD);
if (pPtr->marked == NO)
pPtr->length = tempD;
else
{
if (pPtr->left != NULL)
pPtr->left->length = tempD;
else
{
printf (" ERROR: Cannot assign branch length to left node\n");
printf ("token = %s\n", token);
return (ERROR);
}
}
userBrlensDef = YES;
break;
case CMD_SHOWUSERTREE:
if (isUserTreeDefined == NO)
{
printf (" ERROR: No user tree defined\n");
}
else
{
if (isTreeRooted == YES)
printf ("\n Tree is rooted:\n\n");
else
printf ("\n Tree is unrooted:\n\n");
if (ShowTree (userTreeRoot, isTreeRooted) == ERROR)
{
return (ERROR);
}
else
printf ("\n");
}
break;
case CMD_INIT_ENFORCECAL:
if (token[0] == 'y')
enforceCalibrations = YES;
else
enforceCalibrations = NO;
printf (" Setting enforcecal=%s\n", token);
break;
case CMD_INIT_ENFORCECON:
if (token[0] == 'y')
enforceConstraints = YES;
else
enforceConstraints = NO;
printf (" Setting enforcecon=%s\n", token);
break;
case CMD_INIT_INFERANC:
if (token[0] == 'y')
inferAncStates = YES;
else
inferAncStates = NO;
printf (" Setting inferanc=%s\n", token);
break;
case CMD_INIT_NCAT:
sscanf (token, "%d", &tempInt);
nRateCats = tempInt;
printf (" Setting ncat=%d\n", nRateCats);
break;
case CMD_ROOT_TREE:
if (isUserTreeDefined == NO)
{
printf (" ERROR: No user tree defined\n");
}
else
{
if (isTreeRooted == YES)
{
printf ("\n WARNING: Tree is already rooted\n");
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
}
else
{
printf (" Rooting tree\n");
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
}
}
break;
case CMD_DEROOT_TREE:
if (isUserTreeDefined == NO)
{
printf (" ERROR: No user tree defined\n");
}
else
{
if (isTreeRooted == YES)
{
printf (" Derooting tree\n");
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
}
else
{
printf (" WARNING: Tree is already unrooted\n");
if (RootTree (userTreeRoot) == ERROR)
return (ERROR);
if (DerootTree (userTreeRoot) == ERROR)
return (ERROR);
}
}
break;
case CMD_SHOWNODES:
if (isUserTreeDefined == NO)
{
printf (" ERROR: No user tree defined\n");
}
else
{
if (isTreeRooted == YES)
printf ("\n Tree is rooted:\n\n");
else
printf ("\n Tree is unrooted:\n\n");
ShowNodes (userTreeRoot, 2, isTreeRooted);
}
break;
case CMD_SAVEBRLENS:
if (token[0] == 'y')
saveBrlens = YES;
else
saveBrlens = NO;
break;
case CMD_SET_SEQ_ERROR:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0 || tempD > 1.0)
{
printf (" ERROR: Error probability must be between 0 and 1\n");
return (ERROR);
}
seqErrorProb = tempD;
printf (" Setting sequencing error probability\n");
break;
case CMD_SET_SP_RATE:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Speciation rate must be greater than zero\n");
return (ERROR);
}
speciationRate = tempD;
printf (" Setting speciation rate\n");
break;
case CMD_SET_EX_RATE:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Extinction rate must be greater than zero\n");
return (ERROR);
}
extinctionRate = tempD;
printf (" Setting extinction rate\n");
break;
case CMD_SET_SAMP_FRAC:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Taxon sampling fraction must be between 0 and 1.\n");
return (ERROR);
}
samplingFraction = tempD;
printf (" Setting taxon sampling fraction\n");
break;
case CMD_SUMT_FILENAME:
strcpy (sumTreeFile, token);
break;
case CMD_SUMT_BURN:
sscanf (token, "%d", &tempInt);
burnIn = tempInt;
break;
case CMD_SUMT_READFILE:
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
else
{
foundBrlens = NO;
if (SummarizeTrees () == ERROR)
{
printf (" Could not execute file\n");
ErrorExit ();
return (ERROR);
}
}
break;
case CMD_TRANS_INIT:
transNumber = 0;
//printf (" Reading translation table\n");
break;
case CMD_TRANS_NEW_NM:
//printf (" %s", token);
i = 0;
while (token[i] != '\0')
{
transNewNames[transNumber*100+i] = token[i];
i++;
}
transNewNames[transNumber*100+i] = '|';
break;
case CMD_TRANS_OLD_NM:
//printf (" = %s\n", token);
i = 0;
while (token[i] != '\0')
{
transOldNames[transNumber*100+i] = token[i];
i++;
}
transOldNames[transNumber*100+i] = '|';
break;
case CMD_TRANS_COMMA:
transNumber++;
break;
case CMD_TRANS_END:
transNumber++;
/*for (j=0; j<transNumber; j++)
{
printf (" ");
i = 0;
while (transOldNames[j*100+i] != '|')
{
printf ("%c", transOldNames[j*100+i]);
i++;
}
printf (" -> ");
i = 0;
while (transNewNames[j*100+i] != '|')
{
printf ("%c", transNewNames[j*100+i]);
i++;
}
printf ("\n");
}*/
isTranslated = YES;
break;
case CMD_SUM_TREE:
/* = */
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
{
sumTree[i].left = NULL;
sumTree[i].right = NULL;
sumTree[i].anc = NULL;
sumTree[i].memoryIndex = i;
sumTree[i].index = i;
sumTree[i].upDateCl = NO;
sumTree[i].length = 0.0;
sumTree[i].marked = NO;
strcpy (sumTree[i].label, "no name");
strcpy (sumTree[i].calibrationName, "no name");
strcpy (sumTree[i].constraintName, "no name");
}
isFirstNode = YES;
pPtr = qPtr = &sumTree[0];
nextAvailableNode = 0;
break;
case CMD_SUM_TREE1:
/* ( */
if (isFirstNode == YES)
{
pPtr = &sumTree[nextAvailableNode];
nextAvailableNode++;
isFirstNode = NO;
sumTreeRoot = pPtr;
}
else
{
if (nextAvailableNode+1 >= 2*nTaxa)
{
printf (" ERROR: Too many nodes in tree\n");
return (ERROR);
}
if (pPtr->left == NULL)
{
pPtr = &sumTree[nextAvailableNode];
nextAvailableNode++;
qPtr->left = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->right == NULL)
{
pPtr = &sumTree[nextAvailableNode];
nextAvailableNode++;
qPtr->right = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->anc == NULL)
{
pPtr = &sumTree[nextAvailableNode];
nextAvailableNode++;
qPtr->anc = pPtr;
pPtr->left = qPtr;
qPtr = pPtr;
sumTreeRoot = pPtr;
pPtr->marked = YES;
}
else
{
printf ("\n ERROR: Tree is not bifurcating\n");
return (ERROR);
}
}
break;
case CMD_SUM_TREE2:
/* <name> */
if (nextAvailableNode+1 >= 2*nTaxa)
{
printf ("\n ERROR: Too many nodes in tree\n");
return (ERROR);
}
if (isTranslated == YES)
{
/* need to use translate table */
/* first, find the name from the tree in the list of new labels */
tempInt = NO;
for (j=0; j<transNumber; j++)
{
i = 0;
while (transNewNames[j*100+i] != '|')
{
tempString[i] = transNewNames[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
/* second, get the translated name (the old name is now in tempString) */
if (tempInt == YES)
{
i = 0;
while (transOldNames[j*100+i] != '|')
{
tempString[i] = transOldNames[j*100+i];
i++;
}
tempString[i] = '\0';
}
else
{
printf ("\n ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
/* third, find the old name in the list of taxon labels */
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString2[i] = taxonLabels[j*100+i];
i++;
}
tempString2[i] = '\0';
if (!strcmp(tempString2, tempString))
{
tempInt = YES;
break;
}
}
if (tempInt == NO)
{
printf ("\n ERROR: Taxon name \"%s\" is not found\n", tempString);
return (ERROR);
}
}
else
{
/* no translate table */
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString[i] = taxonLabels[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
if (tempInt == NO)
{
printf ("\n ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
}
/* add the node to the tree */
if (pPtr->left == NULL)
{
pPtr = &sumTree[nextAvailableNode];
strcpy (pPtr->label, tempString);
pPtr->index = j;
nextAvailableNode++;
qPtr->left = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->right == NULL)
{
pPtr = &sumTree[nextAvailableNode];
strcpy (pPtr->label, tempString);
pPtr->index = j;
nextAvailableNode++;
qPtr->right = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->anc == NULL)
{
pPtr = &sumTree[nextAvailableNode];
strcpy (pPtr->label, tempString);
pPtr->index = j;
nextAvailableNode++;
qPtr->anc = pPtr;
pPtr->left = qPtr;
qPtr = pPtr;
sumTreeRoot = pPtr;
pPtr->marked = YES;
}
else
{
printf ("\n ERROR: Tree is not bifurcating\n");
return (ERROR);
}
break;
case CMD_SUM_TREE3:
/* <number> */
if (nextAvailableNode+1 >= 2*nTaxa)
{
printf ("\n ERROR: Too many nodes in tree\n");
return (ERROR);
}
if (isTranslated == YES)
{
/* need to use translate table */
/* first, find the name from the tree in the list of new labels */
tempInt = NO;
for (j=0; j<transNumber; j++)
{
i = 0;
while (transNewNames[j*100+i] != '|')
{
tempString[i] = transNewNames[j*100+i];
i++;
}
tempString[i] = '\0';
if (!strcmp(tempString, token))
{
tempInt = YES;
break;
}
}
/* second, get the translated name (the old name is now in tempString) */
if (tempInt == YES)
{
i = 0;
while (transOldNames[j*100+i] != '|')
{
tempString[i] = transOldNames[j*100+i];
i++;
}
tempString[i] = '\0';
}
else
{
printf ("\n ERROR: Taxon name \"%s\" is not found\n", token);
return (ERROR);
}
/* third, find the old name in the list of taxon labels */
tempInt = NO;
for (j=0; j<nTaxa; j++)
{
i = 0;
while (taxonLabels[j*100+i] != '|')
{
tempString2[i] = taxonLabels[j*100+i];
i++;
}
tempString2[i] = '\0';
if (!strcmp(tempString2, tempString))
{
tempInt = YES;
break;
}
}
if (tempInt == NO)
{
printf ("\n ERROR: Taxon name \"%s\" is not found\n", tempString);
return (ERROR);
}
tempInt = j;
}
else
{
/* no translation table */
sscanf (token, "%d", &tempInt);
tempInt--;
if (tempInt < 0 || tempInt >= nTaxa)
{
printf ("\n ERROR: Taxon number is out of range\n");
}
i = 0;
while (taxonLabels[tempInt*100+i] != '|')
{
tempString[i] = taxonLabels[tempInt*100+i];
i++;
}
tempString[i] = '\0';
}
/* add node */
if (pPtr->left == NULL)
{
pPtr = &sumTree[nextAvailableNode];
strcpy (pPtr->label, tempString);
pPtr->index = tempInt;
nextAvailableNode++;
qPtr->left = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->right == NULL)
{
pPtr = &sumTree[nextAvailableNode];
strcpy (pPtr->label, tempString);
pPtr->index = tempInt;
nextAvailableNode++;
qPtr->right = pPtr;
pPtr->anc = qPtr;
qPtr = pPtr;
}
else if (pPtr->anc == NULL)
{
pPtr = &sumTree[nextAvailableNode];
strcpy (pPtr->label, tempString);
pPtr->index = tempInt;
nextAvailableNode++;
qPtr->anc = pPtr;
pPtr->left = qPtr;
qPtr = pPtr;
sumTreeRoot = pPtr;
pPtr->marked = YES;
}
else
{
printf ("\n ERROR: Tree is not bifurcating\n");
return (ERROR);
}
break;
case CMD_SUM_TREE4:
/* ) */
if (pPtr->marked == NO)
{
if (pPtr->anc != NULL)
{
pPtr = pPtr->anc;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go down\n");
return (ERROR);
}
}
else
{
if (pPtr->left != NULL)
{
pPtr = pPtr->left;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go up\n");
return (ERROR);
}
}
break;
case CMD_SUM_TREE5:
/* , */
if (pPtr->marked == NO)
{
if (pPtr->anc != NULL)
{
pPtr = pPtr->anc;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go down\n");
return (ERROR);
}
}
else
{
if (pPtr->left != NULL)
{
pPtr = pPtr->left;
qPtr = pPtr;
}
else
{
printf ("\n ERROR: Cannot go up\n");
return (ERROR);
}
}
break;
case CMD_SUM_TREE6:
/* : */
break;
case CMD_SUM_TREE7:
/* ; */
numSumTrees++;
if (numSumTrees % 1000 == 0)
printf (" Reading tree %d\n", numSumTrees);
//printf ("Reading tree %d\n", numSumTrees);
if (pPtr != &sumTree[0])
{
printf ("\n ERROR: Something wrong with user tree\n");
return (ERROR);
}
if (pPtr->anc == NULL)
isSumTreeRooted = YES;
else
isSumTreeRooted = NO;
if (isSumTreeRooted == YES)
{
//printf (" Tree read (rooted) %d\n", numSumTrees);
pPtr = &sumTree[nextAvailableNode];
nextAvailableNode++;
pPtr->left = qPtr;
qPtr->anc = pPtr;
sumTreeRoot = pPtr;
}
else
{
//printf (" Tree read (unrooted) %d\n", numSumTrees);
}
i = nTaxa;
if (isSumTreeRooted == YES)
FinishTree (sumTreeRoot, &i, YES);
else
FinishTree (sumTreeRoot, &i, NO);
if (isSumTreeRooted == YES)
{
if (DerootSumTree (sumTreeRoot) == ERROR)
return (ERROR);
if (RootSumTree (sumTreeRoot) == ERROR)
return (ERROR);
}
else
{
if (RootSumTree (sumTreeRoot) == ERROR)
return (ERROR);
if (DerootSumTree (sumTreeRoot) == ERROR)
return (ERROR);
}
# if 0
if (ShowTree (sumTreeRoot, isSumTreeRooted) == ERROR)
{
printf (" ERROR: Could not show tree\n");
return (ERROR);
}
# endif
/* allocate space for down pass sequence, if this is the first tree read in */
if (isSumTreeRooted == YES)
nNodes = 2 * nTaxa;
else
nNodes = 2 * nTaxa - 2;
if (numSumTrees == 1)
{
sumTreeDP = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!sumTreeDP)
{
printf (" ERROR: Could not allocate sumTreeDP\n");
return (ERROR);
}
}
/* set up bits, if this is the first tree read in */
if (numSumTrees == 1)
{
if (SetBits (nTaxa) == ERROR)
return (ERROR);
}
/* get size of unsigned */
unsignedIntsize = sizeof(unsigned);
/* get down pass sequence */
i = 0;
GetUserDownPass (sumTreeRoot, sumTreeDP, &i);
/* pass down tree, assigning bits for each node */
for (i=0; i<nNodes; i++)
{
p = sumTreeDP[i];
for (j=0; j<nUnsignedNeeded; j++)
treeBits[(p->index)*nUnsignedNeeded + j] = 0;
if (p->left == NULL && p->right == NULL && p->anc != NULL)
{
offSet = 0;
while ((p->index+1) > unsignedIntsize*8*(offSet+1))
offSet++;
x = 1 << (p->index - offSet*unsignedIntsize*8);
treeBits[(p->index)*nUnsignedNeeded + offSet] = x;
}
else if (p->left != NULL && p->right == NULL && p->anc == NULL && isSumTreeRooted == NO)
{
offSet = 0;
while ((p->index+1) > unsignedIntsize*8*(offSet+1))
offSet++;
x = 1;
x <<= (p->index - offSet*unsignedIntsize*8);
treeBits[(p->index)*nUnsignedNeeded + offSet] = x;
}
else if (p->left != NULL && p->right != NULL && p->anc != NULL)
{
for (j=0; j<nUnsignedNeeded; j++)
{
treeBits[(p->index)*nUnsignedNeeded + j] =
treeBits[(p->left->index)*nUnsignedNeeded + j] | treeBits[(p->right->index)*nUnsignedNeeded + j];
}
}
/*printf ("%4d: ", p->index);
for (j=nUnsignedNeeded-1; j>=0; j--)
DisplayBits (treeBits[(p->index)*nUnsignedNeeded + j]);
printf ("\n");*/
}
/* flip bits, if necessary (first taxon is always 0) */
if (isSumTreeRooted == NO)
{
for (i=0; i<nNodes; i++)
{
x = treeBits[i * nUnsignedNeeded + 0];
y = 1;
if ((x & y) == 1)
{
//printf ("flipping bits:\n");
for (j=0; j<nUnsignedNeeded; j++)
{
x = treeBits[i * nUnsignedNeeded + j];
y = taxonMask[j];
treeBits[i * nUnsignedNeeded + j] = x ^ y;
/*printf ("%4d: ", p->index);
for (j=nUnsignedNeeded-1; j>=0; j--)
DisplayBits (treeBits[(p->index)*nUnsignedNeeded + j]);
printf ("\n");*/
}
}
}
}
/* tally each partition and branch length */
if (numSumTrees > burnIn)
{
numSumTreesSampled++;
for (i=0; i<nNodes; i++)
{
p = sumTreeDP[i];
if (p->anc != NULL)
{
if (p->anc->anc != NULL)
{
foundPartition = NO;
for (k=0; k<numTreePartsFound; k++)
{
allSame = YES;
for (j=0; j<nUnsignedNeeded; j++)
{
if (treeBits[(p->index)*nUnsignedNeeded + j] != treePartsFound[k*nUnsignedNeeded + j])
{
allSame = NO;
break;
}
}
if (allSame == YES)
{
numFoundOfThisPart[k]++;
foundPartition = YES;
aOldBrlens[k] = aBrlens[k];
aBrlens[k] = aOldBrlens[k] + (p->length - aOldBrlens[k]) / (numFoundOfThisPart[k]);
sBrlens[k] = sBrlens[k] + (p->length - aOldBrlens[k]) * (p->length - aOldBrlens[k]);
break;
}
}
if (foundPartition == NO)
{
if (numTreePartsFound+1 == numPartsAllocated)
{
if (RealloateTreeParts () == ERROR)
{
printf (" ERROR: Could not increase size of partitions.\n");
return (ERROR);
}
}
for (j=0; j<nUnsignedNeeded; j++)
treePartsFound[numTreePartsFound*nUnsignedNeeded + j] = treeBits[(p->index)*nUnsignedNeeded + j];
numFoundOfThisPart[numTreePartsFound] = 1;
aBrlens[numTreePartsFound] = p->length;
sBrlens[numTreePartsFound] = 0.0;
numTreePartsFound++;
}
}
}
else
{
if (isSumTreeRooted == NO)
{
foundPartition = NO;
for (k=0; k<numTreePartsFound; k++)
{
allSame = YES;
for (j=0; j<nUnsignedNeeded; j++)
{
if (treeBits[(p->index)*nUnsignedNeeded + j] != treePartsFound[k*nUnsignedNeeded + j])
{
allSame = NO;
break;
}
}
if (allSame == YES)
{
numFoundOfThisPart[k]++;
foundPartition = YES;
aOldBrlens[k] = aBrlens[k];
aBrlens[k] = aOldBrlens[k] + (p->left->length - aOldBrlens[k]) / (numFoundOfThisPart[k]);
sBrlens[k] = sBrlens[k] + (p->left->length - aOldBrlens[k]) * (p->left->length - aOldBrlens[k]);
break;
}
}
if (foundPartition == NO)
{
if (numTreePartsFound+1 == numPartsAllocated)
{
if (RealloateTreeParts () == ERROR)
{
printf (" ERROR: Could not increase size of partitions.\n");
return (ERROR);
}
}
for (j=0; j<nUnsignedNeeded; j++)
treePartsFound[numTreePartsFound*nUnsignedNeeded + j] = treeBits[(p->index)*nUnsignedNeeded + j];
numFoundOfThisPart[numTreePartsFound] = 1;
aBrlens[numTreePartsFound] = p->left->length;
sBrlens[numTreePartsFound] = 0.0;
numTreePartsFound++;
}
}
}
}
}
# if 0
printf (" Tree %d:\n", numSumTrees);
if (ShowTree (sumTreeRoot, isSumTreeRooted) == ERROR)
{
return (ERROR);
}
# endif
# if 0
ShowNodes (sumTreeRoot, 2, isSumTreeRooted);
# endif
break;
case CMD_SUM_TREE8:
/* <branch length> */
sscanf (token, "%lf", &tempD);
if (pPtr->marked == NO)
pPtr->length = tempD;
else
{
if (pPtr->left != NULL)
pPtr->left->length = tempD;
else
{
printf (" ERROR: Cannot assign branch length to left node\n");
printf ("token = %s\n", token);
return (ERROR);
}
}
foundBrlens = YES;
break;
case CMD_INIT_TREE_BLK:
isTranslated = NO;
numSumTrees = 0;
numSumTreesSampled = 0;
break;
case CMD_SUM_TREE_END:
printf (" Read %d trees from file, %d of which were sampled\n", numSumTrees, numSumTreesSampled);
if (numSumTreesSampled == 0)
{
printf ("\n ERROR: No trees read in.\n\n", conFile);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
unsignedIntsize = sizeof(unsigned);
/* sort partitions */
SortParts (numFoundOfThisPart, numTreePartsFound);
/* print partitions */
strcpy (conFile, sumTreeFile);
strcat (conFile, ".parts");
if ((fp = fopen (conFile, "w")) == NULL)
{
printf ("\n ERROR: Could not open file \"%s\"\n\n", conFile);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
printf ("\n");
printf (" General explanation:\n\n");
printf (" A taxon bipartition is specified by removing a\n");
printf (" branch, dividing the species into those to the\n");
printf (" left and those to the right of the branch. Here,\n");
printf (" taxa to one side of the removed branch are denoted\n");
printf (" \".\" and those to the other side are denoted \"*\".\n");
printf (" The output includes the bipartition number (sorted\n");
printf (" from highest to lowest probability), bipartition\n");
printf (" (e.g., ...**..), number of times the bipartition\n");
printf (" was observed, the posterior probability of the \n");
printf (" bipartition, and, if branch lengths were recorded \n");
printf (" on the trees in the file, the average and variance\n");
printf (" of the branch lengths. Each \".\" or \"*\" in the\n");
printf (" bipartition represents a taxon that is to the left \n");
printf (" or right of the removed branch. A list of the taxa \n");
printf (" in the bipartitions is listed before the list of \n");
printf (" bipartitions. \n\n");
printf (" List of taxa in bipartitions:\n\n");
for (k=0; k<nTaxa; k++)
{
printf (" %4d -- ", k+1);
i = 0;
while (taxonLabels[k*100+i] != '|')
{
printf ("%c", taxonLabels[k*100+i]);
i++;
}
printf ("\n");
}
printf ("\n");
printf (" List of taxon bipartitions found in tree file:\n\n");
fprintf (fp, " General explanation:\n\n");
fprintf (fp, " A taxon bipartition is specified by removing a\n");
fprintf (fp, " branch, dividing the species into those to the\n");
fprintf (fp, " left and those to the right of the branch. Here,\n");
fprintf (fp, " taxa to one side of the removed branch are denoted\n");
fprintf (fp, " \".\" and those to the other side are denoted \"*\".\n");
fprintf (fp, " The output includes the bipartition number (sorted\n");
fprintf (fp, " from highest to lowest probability), bipartition\n");
fprintf (fp, " (e.g., ...**..), number of times the bipartition\n");
fprintf (fp, " was observed, the posterior probability of the \n");
fprintf (fp, " bipartition, and, if branch lengths were recorded \n");
fprintf (fp, " on the trees in the file, the average and variance\n");
fprintf (fp, " of the branch lengths. Each \".\" or \"*\" in the\n");
fprintf (fp, " bipartition represents a taxon that is to the left \n");
fprintf (fp, " or right of the removed branch. A list of the taxa \n");
fprintf (fp, " in the bipartitions is listed before the list of \n");
fprintf (fp, " bipartitions. \n\n");
fprintf (fp, " List of taxa in bipartitions:\n\n");
for (k=0; k<nTaxa; k++)
{
fprintf (fp, " %4d -- ", k+1);
i = 0;
while (taxonLabels[k*100+i] != '|')
{
fprintf (fp, "%c", taxonLabels[k*100+i]);
i++;
}
fprintf (fp, "\n");
}
fprintf (fp, "\n");
fprintf (fp, " List of taxon bipartitions found in tree file:\n\n");
for (k=0; k<numTreePartsFound; k++)
{
printf (" %4d -- ", k+1);
fprintf (fp, "%d\t", k+1);
offSet = 0;
x = 1;
for (j=0; j<nTaxa; j++)
{
if (treePartsFound[k*nUnsignedNeeded + offSet] & x)
{
printf ("*");
fprintf (fp, "*");
}
else
{
printf (".");
fprintf (fp, ".");
}
x <<= 1;
if (j+1 >= unsignedIntsize*8*(offSet+1))
{
offSet++;
x = 1;
}
}
if (foundBrlens == YES)
{
printf (" -- %5d %1.6lf %1.8lf (%1.8lf)\n",
numFoundOfThisPart[k], (double)numFoundOfThisPart[k]/numSumTreesSampled, aBrlens[k], (double)sBrlens[k]/(numSumTreesSampled-1));
fprintf (fp, "\t%d\t%1.6lf\t%1.8lf\t%1.8lf\n",
numFoundOfThisPart[k], (double)numFoundOfThisPart[k]/numSumTreesSampled, aBrlens[k], (double)sBrlens[k]/(numSumTreesSampled-1));
}
else
{
printf (" -- %5d %1.6lf\n",
numFoundOfThisPart[k], (double)numFoundOfThisPart[k]/numSumTreesSampled);
fprintf (fp, "\t%d\t%1.6lf\n",
numFoundOfThisPart[k], (double)numFoundOfThisPart[k]/numSumTreesSampled);
}
}
# if !defined (CONTREE)
fclose (fp);
# endif
# if defined (CONTREE)
/* allocate space for consensus tree nodes */
conNodes = (PolyNode *)malloc((size_t) (2 * nTaxa * sizeof(PolyNode)));
if (!conNodes)
{
printf (" ERROR: Could not allocate conNodes\n");
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
fclose(fp);
ErrorExit ();
return (ERROR);
}
/* transform taxonLabels */
for (i=0; i<nTaxa*100; i++)
if (taxonLabels[i] == '|')
taxonLabels[i] = '\0';
/* initialize terminal consensus nodes */
for (i=0; i<nTaxa; i++)
{
conNodes[i].left = NULL;
conNodes[i].sib = NULL;
conNodes[i].index = i;
conNodes[i].label = &taxonLabels[i*100];
}
# else
constraintTree = (ConTreeNode *)malloc((size_t) (2 * nTaxa * sizeof(ConTreeNode)));
if (!constraintTree)
{
printf (" ERROR: Could not allocate constraintTree\n");
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
taxaInConstraint = (ConTreeNode **)malloc((size_t) (nTaxa * sizeof(ConTreeNode *)));
if (!taxaInConstraint)
{
printf (" ERROR: Could not allocate taxaInConstraint\n");
free (constraintTree);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
taxaNotInConstraint = (ConTreeNode **)malloc((size_t) (nTaxa * sizeof(ConTreeNode *)));
if (!taxaNotInConstraint)
{
printf (" ERROR: Could not allocate taxaNotInConstraint\n");
free (constraintTree);
free (taxaInConstraint);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
{
constraintTree[i].left = NULL;
constraintTree[i].leftSib = NULL;
constraintTree[i].rightSib = NULL;
constraintTree[i].anc = NULL;
constraintTree[i].index = i;
constraintTree[i].length = 0.0;
strcpy (constraintTree[i].label, "no name");
}
for (i=0; i<nTaxa; i++)
taxaInConstraint[i] = taxaInConstraint[i] = NULL;
compatParts = (unsigned *)malloc((size_t) (2 * nTaxa * nUnsignedNeeded * sizeof(unsigned)));
if (!compatParts)
{
printf (" ERROR: Could not allocate compatParts\n");
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
for (i=0; i<2*nTaxa*nUnsignedNeeded; i++)
compatParts[i] = 0;
tempParts = (unsigned *)malloc((size_t) (nUnsignedNeeded * sizeof(unsigned)));
if (!tempParts)
{
printf (" ERROR: Could not allocate tempParts\n");
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
for (i=0; i<nUnsignedNeeded; i++)
tempParts[i] = 0;
numOnes = (int *)malloc((size_t) (2 * nTaxa * sizeof(int)));
if (!numOnes)
{
printf (" ERROR: Could not allocate numOnes\n");
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (tempParts);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
numOnes[i] = 0;
partLengths = (double *)malloc((size_t) (2 * nTaxa * sizeof(double)));
if (!partLengths)
{
printf (" ERROR: Could not allocate numOnes\n");
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (tempParts);
free (numOnes);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
partLengths[i] = 0.0;
#endif
#if defined (CONTREE)
// allocate space for ingroup and outgroup partitions
outgroupPartition = (unsigned int *) calloc (2 * nUnsignedNeeded, sizeof(unsigned int));
ingroupPartition = outgroupPartition + nUnsignedNeeded;
if (!outgroupPartition)
{
printf (" ERROR: Could not allocate outgroupPartition and ingroupPartition\n");
free (conNodes);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
fclose (fp);
ErrorExit();
return ERROR;
}
// set lastMask - needed to trim last element in partition
// this could be done when a new matrix is read in
// and adjusted when taxa are deleted or restored
j = nTaxa % (unsignedIntsize * 8);
lastMask = 1;
for (i=1; i<j; i++)
lastMask |= (lastMask<<1);
// set ingroup and outgroup partitions
// this could be done when a new matrix is read in
// and adjusted when an outgroup command is issued
// this mechanism allows multiple taxa in outgroup
x = 1;
x <<= outgroupNum % (unsignedIntsize * 8);
i = outgroupNum / (unsignedIntsize * 8);
outgroupPartition[i] = x;
for (i = 0; i < nUnsignedNeeded; i++)
ingroupPartition[i] = outgroupPartition[i];
FlipBits(ingroupPartition, nUnsignedNeeded, lastMask);
/* create bush */
/* ->x counts number of subtended terminals */
/* make sure conRoot->left is in outgroup */
conRoot = &conNodes[nTaxa];
conRoot->anc = conRoot->sib = NULL;
conRoot->x = nTaxa;
j = FirstTaxonInPartition(outgroupPartition, nUnsignedNeeded);
conRoot->left = cp = &conNodes[j];
cp->anc = conRoot;
cp->x = 1;
for (i=0; i<nTaxa; i++)
{
if (i != j)
{
cp->sib = &conNodes[i];
cp = cp->sib;
cp->anc = conRoot;
cp->x = 1;
}
}
cp->sib = NULL;
/* resolve bush according to partitions */
/* partitions may include incompatible ones */
/* partitions should be sorted from more frequent to less frequent */
/* for quit test to work when a 50% maj rule tree is requested */
nextConNode = nTaxa + 1;
if (isSumTreeRooted)
targetNode = 2*nTaxa - 2;
else
targetNode = 2*nTaxa - 3;
for (i=0; i<numTreePartsFound; i++)
{
// calculate frequency and test if time to quit
if (nextConNode > targetNode)
break;
freq = (double)numFoundOfThisPart[i]/ (double)numSumTreesSampled;
if (freq < 0.50 && consensusType == HALF_COMPAT)
break;
// get partition
partition = &treePartsFound[i*nUnsignedNeeded];
// flip bits if necessary
if(!isSumTreeRooted)
{
if (!IsPartNested(partition, ingroupPartition, nUnsignedNeeded)
&& !IsPartCompatible(partition, ingroupPartition, nUnsignedNeeded))
FlipBits(partition, nUnsignedNeeded, lastMask);
}
// count bits in this partition
for (j=nBits=0; j<nUnsignedNeeded; j++)
{
x = partition[j];
for (x = partition[j]; x != 0; x &= (x - 1))
nBits++;
}
// flip this partition if it leaves single outgroup outside
if (nBits == nTaxa - 1 && !isSumTreeRooted)
{
nBits = 1;
FlipBits(partition, nUnsignedNeeded, lastMask);
}
if (nBits > 1)
// this is an informative partition
{
// find anc of partition
j = FirstTaxonInPartition (partition, nUnsignedNeeded);
for (cp = &conNodes[j]; cp!=NULL; cp = cp->anc)
if (cp->x > nBits)
break;
// do not include if incompatible with ancestor
// or any of descendants
// do not check terminals or root because it is
// redundant and partitions have not been set for those
isCompat = YES;
if (cp->anc != NULL && !IsPartCompatible(partition, cp->partition, nUnsignedNeeded))
isCompat = NO;
for (q=cp->left; q!=NULL; q=q->sib)
{
if (q->x > 1 && !IsPartCompatible(q->partition, partition, nUnsignedNeeded))
isCompat = NO;
if (isCompat == NO)
break;
}
if (isCompat == NO)
continue;
// set new node
q = &conNodes[nextConNode++];
q->length = aBrlens[i];
q->support = freq * 100;
q->x = nBits;
q->partition = partition;
// go through descendants of anc
ql = pl = NULL;
for (r=cp->left; r!=NULL; r=r ->sib)
{
// test if r is in the new partition or not
if ((r->x > 1 && IsPartNested(r->partition, partition, nUnsignedNeeded))
|| (r->x == 1 && (partition[r->index / (unsignedIntsize * 8)] & (1 << (r->index % (unsignedIntsize * 8)))) != 0))
{
// r is in the partition
if (ql == NULL)
q->left = r;
else
ql->sib = r;
ql = r;
r->anc = q;
}
else
{
// r is not in the partition
if (pl == NULL)
cp->left = r;
else
pl->sib = r;
pl = r;
}
}
// terminate new sib-node chain
ql->sib = NULL;
// new node is last in old sib-node chain
pl->sib = q;
q->sib = NULL;
q->anc = cp;
}
else
// singleton partition
{
j = FirstTaxonInPartition(partition, nUnsignedNeeded);
q = &conNodes[j];
q->length = aBrlens[i];
q->support = freq * 100;
}
}
/* draw tree to stdout and fp */
fprintf(fp,"\nClade credibility values:\n\n");
printf("\nClade credibility values:\n\n");
ShowConTree (stdout, nextConNode, conRoot, 80);
ShowConTree (fp, nextConNode, conRoot, 80);
if (foundBrlens == YES)
{
fprintf(fp,"Phylogram:\n\n");
printf("Phylogram:\n\n");
ShowConPhylogram (stdout, nextConNode, conRoot, 80);
ShowConPhylogram (fp, nextConNode, conRoot, 80);
}
fclose (fp);
/* reset taxonLabels */
for (i=0; i<nTaxa*100; i++)
if (taxonLabels[i] == '\0')
taxonLabels[i] = '|';
#else
/* make a list of compatible partitions */
nCompatParts = 0;
for (k=0; k<numTreePartsFound; k++)
{
if (k == 0)
{
for (j=0; j<nUnsignedNeeded; j++)
compatParts[nCompatParts*nUnsignedNeeded + j] = treePartsFound[k*nUnsignedNeeded + j];
partLengths[nCompatParts] = aBrlens[k];
nCompatParts++;
}
else
{
for (i=0; i<nCompatParts; i++)
{
for (j=0; j<nUnsignedNeeded; j++)
tempParts[j] = treePartsFound[k*nUnsignedNeeded + j] & compatParts[i*nUnsignedNeeded + j];
isCompat = YES;
for (j=0; j<nUnsignedNeeded; j++)
if (tempParts[j] != 0)
isCompat = NO;
nSame1 = 0;
for (j=0; j<nUnsignedNeeded; j++)
if (tempParts[j] == treePartsFound[k*nUnsignedNeeded + j])
nSame1++;
nSame2 = 0;
for (j=0; j<nUnsignedNeeded; j++)
if (tempParts[j] == compatParts[i*nUnsignedNeeded + j])
nSame2++;
if (isCompat == NO && nSame1 == nUnsignedNeeded)
isCompat = YES;
if (isCompat == NO && nSame2 == nUnsignedNeeded)
isCompat = YES;
if ((double)numFoundOfThisPart[k]/numSumTreesSampled < 0.50 && consensusType == HALF_COMPAT)
isCompat = NO;
if (isCompat == NO)
break;
}
if (isCompat == YES)
{
if (nCompatParts >= 2*nTaxa)
{
printf (" ERROR: Too many compatible partitions found.\n");
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (tempParts);
free (numOnes);
free (partLengths);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
for (j=0; j<nUnsignedNeeded; j++)
compatParts[nCompatParts*nUnsignedNeeded + j] = treePartsFound[k*nUnsignedNeeded + j];
partLengths[nCompatParts] = aBrlens[k];
nCompatParts++;
}
}
}
/* count the number of ones in each partition */
for (i=0; i<nCompatParts; i++)
{
offSet = 0;
x = 1;
k = 0;
for (j=0; j<nTaxa; j++)
{
if (compatParts[i*nUnsignedNeeded + offSet] & x)
k++;
x <<= 1;
if (j+1 >= unsignedIntsize*8*(offSet+1))
{
offSet++;
x = 1;
}
}
numOnes[i] = k;
}
/* sort partitions from largest to smallest */
SortCompatParts (numOnes, compatParts, partLengths, nCompatParts);
# if 0
for (k=0; k<nCompatParts; k++)
{
printf ("%4d -- ", k+1);
offSet = 0;
x = 1;
for (j=0; j<nTaxa; j++)
{
if (compatParts[k*nUnsignedNeeded + offSet] & x)
printf ("*");
else
printf (".");
x <<= 1;
if (j+1 >= unsignedIntsize*8*(offSet+1))
{
offSet++;
x = 1;
}
}
printf (" -- %5d %lf\n",
numOnes[k], partLengths[k]);
}
# endif
/* set up initial star tree */
conRoot = &constraintTree[2*nTaxa-1];
cq = NULL;
for (i=0; i<nTaxa; i++)
{
cp = &constraintTree[i];
cp->length = 0.0;
cp->anc = conRoot;
if (cq != NULL)
cq->rightSib = cp;
else
cp->anc->left = cp;
cq = cp;
}
nextConNode = nTaxa;
/* build up constraint tree with compatible partitions */
for (i=0; i<nCompatParts; i++)
{
/* make a list of taxa in constraint */
nTaxaInConstraint = 0;
for (j=0; j<nTaxa; j++)
{
offSet = 0;
x = 1;
for (j=0; j<nTaxa; j++)
{
if (compatParts[i*nUnsignedNeeded + offSet] & x)
{
taxaInConstraint[nTaxaInConstraint] = &constraintTree[j];
nTaxaInConstraint++;
}
x <<= 1;
if (j+1 >= unsignedIntsize*8*(offSet+1))
{
offSet++;
x = 1;
}
}
}
# if 0
printf ("in: ");
for (j=0; j<nTaxaInConstraint; j++)
printf ("%d ", taxaInConstraint[j]->index);
printf ("\n");
# endif
/* get pointer to ancestor */
cp = taxaInConstraint[0]->anc;
isCompat = YES;
for (j=0; j<nTaxaInConstraint; j++)
{
if (taxaInConstraint[j]->anc != cp)
{
isCompat = NO;
break;
}
}
if (isCompat == NO)
{
printf (" ERROR: Strange incompatibility in consensus tree found.\n");
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (tempParts);
free (numOnes);
free (partLengths);
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
//printf ("cp = %d (", cp->index);
/* get old left-most node */
cl = cp->left;
/* get old right-most node */
for (cq = cp->left; cq != NULL; cq = cq->rightSib)
{
if (cq != NULL)
if (cq->rightSib == NULL)
cr = cq;
//printf ("%d ", cq->index);
}
//printf (")\n");
//printf ("cr = %d\n", cr->index);
/* make a list of nodes not in constraint */
nTaxaNotInConstraint = 0;
for (cq = cp->left; cq != NULL; cq = cq->rightSib)
{
tempInt = NO;
for (j=0; j<nTaxaInConstraint; j++)
{
if (taxaInConstraint[j] == cq)
{
tempInt = YES;
break;
}
}
if (tempInt == NO)
{
taxaNotInConstraint[nTaxaNotInConstraint++] = cq;
}
}
# if 0
printf ("not in: ");
for (j=0; j<nTaxaNotInConstraint; j++)
printf ("%d ", taxaNotInConstraint[j]->index);
printf ("\n");
# endif
/* set up constraint */
if (numOnes[i] > 1)
{
/* get new node */
if (nextConNode + 1 < 2*nTaxa - 1)
{
cn = &constraintTree[nextConNode++];
cn->length = partLengths[i];
}
else
{
printf ("new = PROBLEM!\n");
}
cp->left = cn;
cn->anc = cp;
if (nTaxaNotInConstraint == 0)
cn->rightSib = NULL;
else
{
cn->rightSib = taxaNotInConstraint[0];
for (j=0; j<nTaxaNotInConstraint; j++)
{
cq = taxaNotInConstraint[j];
if (j+1 < nTaxaNotInConstraint)
cq->rightSib = taxaNotInConstraint[j+1];
else
cq->rightSib = NULL;
}
}
cn->left = taxaInConstraint[0];
for (j=0; j<nTaxaInConstraint; j++)
{
cq = taxaInConstraint[j];
cq->anc = cn;
if (j+1 < nTaxaInConstraint)
cq->rightSib = taxaInConstraint[j+1];
else
cq->rightSib = NULL;
}
}
else
{
offSet = 0;
x = 1;
for (j=0; j<nTaxa; j++)
{
if (compatParts[i*nUnsignedNeeded + offSet] & x)
{
cn = &constraintTree[j];
cn->length = partLengths[i];
break;
}
x <<= 1;
if (j+1 >= unsignedIntsize*8*(offSet+1))
{
offSet++;
x = 1;
}
}
}
}
/*for (i=0; i<2*nTaxa; i++)
{
cp = &constraintTree[i];
printf ("%4d (%d %d %d)\n",
Dex3(cp), Dex3(cp->left), Dex3(cp->rightSib), Dex3(cp->anc));
}
printf ("conRoot = %d\n", conRoot->index);*/
#endif
/* write constraint tree */
strcpy (conFile, sumTreeFile);
strcat (conFile, ".con");
if ((fp = fopen (conFile, "w")) == NULL)
{
printf ("\n ERROR: Could not open file \"%s\"\n\n", conFile);
# if !defined (CONTREE)
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (tempParts);
free (numOnes);
free (partLengths);
# else
free (conNodes);
free (outgroupPartition);
# endif
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
ErrorExit ();
return (ERROR);
}
fprintf (fp, "#NEXUS\n\n");
fprintf (fp, "begin trees;\n");
if (isTranslated == YES)
{
fprintf (fp, "translate\n");
for (j=0; j<transNumber; j++)
{
fprintf (fp, " ");
i = 0;
# if defined (CONTREE) /* correct order in translate block! */
//while (transNewNames[j*100+i] != '|')
while (transOldNames[j*100+i] != '|')
# else
while (transOldNames[j*100+i] != '|')
# endif
{
fprintf (fp, "%c", transOldNames[j*100+i]);
i++;
}
fprintf (fp, " ");
i = 0;
# if defined (CONTREE) /* correct order in translate block! */
//while (transOldNames[j*100+i] != '|')
while (transNewNames[j*100+i] != '|')
# else
while (transNewNames[j*100+i] != '|')
# endif
{
fprintf (fp, "%c", transNewNames[j*100+i]);
i++;
}
if (j == transNumber - 1)
fprintf (fp, ";\n");
else
fprintf (fp, ",\n");
}
}
else
{
fprintf (fp, "translate\n");
for (j=0; j<nTaxa; j++)
{
fprintf (fp, " ");
fprintf (fp, "%d ", j+1);
i = 0;
while (taxonLabels[j*100+i] != '|')
{
fprintf (fp, "%c", taxonLabels[j*100+i]);
i++;
}
if (j == transNumber - 1)
fprintf (fp, ";\n");
else
fprintf (fp, ",\n");
}
}
if (consensusType == HALF_COMPAT)
fprintf (fp, " tree con_50_majrule = ");
else
fprintf (fp, " tree con_all_compat = ");
# if defined (CONTREE)
WriteConTree (conRoot, fp);
# else
WriteConTreeToScreen (conRoot, fp);
# endif
fprintf (fp, ";\n");
fprintf (fp, "end;\n");
fclose (fp);
# if defined (CONTREE)
free (conNodes);
free (outgroupPartition);
# else
free (constraintTree);
free (taxaNotInConstraint);
free (taxaInConstraint);
free (compatParts);
free (tempParts);
free (numOnes);
free (partLengths);
# endif
free (sumTreeDP);
free (treeBits);
free (treePartsFound);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
free (taxonMask);
break;
case CMD_SUMT_HALFCOMP:
consensusType = HALF_COMPAT;
break;
case CMD_SUMT_ALLCOMP:
consensusType = ALL_COMPAT;
break;
case CMD_SUMP_FILENAME:
strcpy (sumParmFile, token);
break;
case CMD_SUMP_BURN:
sscanf (token, "%d", &tempInt);
paramBurn = tempInt;
break;
case CMD_SUMP_READFILE:
if (SummarizeParams () == ERROR)
{
printf (" Could not execute file\n");
ErrorExit ();
return (ERROR);
}
break;
case CMD_SUM_PARM1:
nColumns = headerSize = 0;
headerNames = (char *)malloc((size_t) (HEADER_SIZE * sizeof(char)));
if (!headerNames)
{
printf (" ERROR: Could not allocate headerNames\n");
ErrorExit ();
return (ERROR);
}
break;
case CMD_SUM_PARM2:
/* allocate temporary vector */
tempInfo = (double *)malloc((size_t) (whichRow * nColumns * sizeof(double)));
if (!tempInfo)
{
printf (" ERROR: Could not allocate tempInfo\n");
free (headerNames);
free (paramInfo);
ErrorExit ();
return (ERROR);
}
/* lets make a x-y plot showing time vs. lnL */
i = 0;
for (j=0; j<nColumns; j++)
{
k = 0;
while (headerNames[i] != '|' && headerNames[i] != '\0')
tempString[k++] = headerNames[i++];
tempString[k] = '\0';
i++;
//printf ("%s\n", tempString);
if (!strcmp(tempString, "gen"))
whichIsX = j;
if (!strcmp(tempString, "lnl"))
whichIsY = j;
}
minX = minY = 1000000000.0;
maxX = maxY = -1000000000.0;
for (i=0; i<whichRow; i++)
{
if (paramInfo[i * nColumns + whichIsX] < minX)
minX = paramInfo[i * nColumns + whichIsX];
if (paramInfo[i * nColumns + whichIsY] < minY)
minY = paramInfo[i * nColumns + whichIsY];
if (paramInfo[i * nColumns + whichIsX] > maxX)
maxX = paramInfo[i * nColumns + whichIsX];
if (paramInfo[i * nColumns + whichIsY] > maxY)
maxY = paramInfo[i * nColumns + whichIsY];
}
//printf ("%lf %lf %lf %lf\n", minX, maxX, minY, maxY);
for (i=0; i<SCREENWIDTH; i++)
{
numY[i] = 0;
meanY[i] = 0.0;
}
for (i=0; i<whichRow; i++)
{
k = (int)(((paramInfo[i * nColumns + whichIsX]) / (maxX - minX)) * SCREENWIDTH);
if (k >= SCREENWIDTH)
k = SCREENWIDTH - 1;
meanY[k] += paramInfo[i * nColumns + whichIsY];
numY[k]++;
}
printf ("\n\n +");
for (i=0; i<SCREENWIDTH; i++)
printf ("-");
printf ("+ %1.2lf\n", maxY);
for (j=SCREENHEIGTH-1; j>=0; j--)
{
printf (" |");
for (i=0; i<SCREENWIDTH; i++)
{
if (numY[i] > 0)
{
if (meanY[i] / numY[i] > (((maxY - minY)/SCREENHEIGTH)*j)+minY &&
meanY[i] / numY[i] <= (((maxY - minY)/SCREENHEIGTH)*(j+1))+minY)
printf ("*");
else
printf (" ");
}
else
{
printf (" ");
}
}
printf ("|\n");
}
printf (" +");
for (i=0; i<SCREENWIDTH; i++)
{
if (i % (SCREENWIDTH/10) == 0 && i != 0)
printf ("+");
else
printf ("-");
}
printf ("+ %1.2lf\n", minY);
printf (" ^");
for (i=0; i<SCREENWIDTH; i++)
printf (" ");
printf ("^\n");
printf (" %1.0lf", minX);
for (i=0; i<SCREENWIDTH; i++)
printf (" ");
printf ("%1.0lf\n\n", maxX);
printf (" Above is a rough plot of the generation (x-axis) versus the log\n");
printf (" probability of observing the data (y-axis). You can use this\n");
printf (" graph to determine what the burn-in for your analysis should be.\n");
printf (" When the log probability starts to plateau you may be at station-\n");
printf (" arity. Sample trees and parameters after the log probability\n");
printf (" plateaus. Of course, this is not a guarantee that you are at \n");
printf (" stationarity. When possible, run multiple chains starting from \n");
printf (" random trees; if the inferences you make for independent chains\n");
printf (" are the same, this is reasonable evidence that the chains have \n");
printf (" converged. Remember that the burn in is the number of samples\n");
printf (" to discard. There are a total of ngen / samplefreq samples taken\n");
printf (" during a MCMC analysis.\n\n");
printf (" Below is information on the parameters of your evolutionary model.\n");
printf (" The columns give the mean, variance, and 95 percent credible interval\n");
printf (" for each parameter.\n\n\n");
l = 0;
for (j=0; j<nColumns; j++)
{
/* put the contents of a column into a temporary vector */
k = 0;
for (i=0; i<whichRow; i++)
{
if (i >= paramBurn)
tempInfo[k++] = paramInfo[i * nColumns + j];
}
/* sort the contents of the vector */
SortVector (tempInfo, k);
/*for (i=0; i<k; i++)
printf ("%d %lf\n", i, tempInfo[i]);*/
/* get the mean and variance */
a = 0.0;
aOld = 0.0;
s = 0.0;
for (i=0; i<k; i++)
{
if (i == 0)
{
a = tempInfo[i];
s = 0;
}
else
{
aOld = a;
a = aOld + (tempInfo[i] - aOld) / (i+1);
s = s + (tempInfo[i] - aOld) * (tempInfo[i] - aOld);
}
}
/* print to the screen */
if (j == 0)
printf (" mean variance (95 percent ci) -- parameter\n");
//printf ("%d %d\n", (int)(k*0.025), (int)(k*0.975));
printf (" %lf %lf (%lf %lf) -- ", a, s / (k-1), tempInfo[(int)(k*0.025)], tempInfo[(int)(k*0.975)]);
while (headerNames[l] != '|' && headerNames[l] != '\0')
{
printf ("%c", headerNames[l]);
l++;
}
l++;
printf ("\n");
}
free (tempInfo);
free (headerNames);
free (paramInfo);
break;
case CMD_SUM_PARM3:
i = 0;
while (token[i] != '\0')
{
if (headerSize >= HEADER_SIZE)
{
printf (" ERROR: The header is too large\n");
free (headerNames);
ErrorExit ();
}
headerNames[headerSize++] = token[i];
i++;
}
nColumns++;
break;
case CMD_SUM_PARM4:
if (headerSize >= HEADER_SIZE)
{
printf (" ERROR: The header is too large\n");
free (headerNames);
ErrorExit ();
}
headerNames[headerSize++] = '|';
break;
case CMD_SUM_PARM5:
if (headerSize+2 >= HEADER_SIZE)
{
printf (" ERROR: The header is too large\n");
free (headerNames);
ErrorExit ();
}
headerNames[headerSize++] = '|';
headerNames[headerSize++] = '\0';
//printf ("header = %s\n", headerNames);
/* allocate memory for data */
paramInfo = (double *)malloc((size_t) (100 * nColumns * sizeof(double)));
if (!paramInfo)
{
printf (" ERROR: Could not allocate paramInfo\n");
free (headerNames);
ErrorExit ();
return (ERROR);
}
curNumRows = 100;
//printf ("number of columns = %d\n", nColumns);
whichColumn = whichRow = 0;
break;
case CMD_SUM_PARM6:
/* data */
tempNumColumns = 0;
break;
case CMD_SUM_PARM7:
sscanf (token, "%lf", &tempD);
if (whichRow == curNumRows)
{
/* reallocate paraminfo */
curNumRows += 100;
paramInfo = (double *)realloc(paramInfo, (size_t) (curNumRows * nColumns * sizeof(double)));
if (!paramInfo)
{
printf (" ERROR: Could not allocate paramInfo\n");
free (headerNames);
free (paramInfo);
ErrorExit ();
return (ERROR);
}
}
if (whichColumn == nColumns)
{
printf (" ERROR: Too many columns\n");
free (headerNames);
free (paramInfo);
ErrorExit ();
return (ERROR);
}
paramInfo[whichRow * nColumns + whichColumn] = tempD;
whichColumn++;
break;
case CMD_SUM_PARM8:
break;
case CMD_SUM_PARM9:
whichColumn = 0;
whichRow++;
break;
case CMD_SUM_PARM10:
sscanf (token, "%lf", &tempD);
if (whichRow == curNumRows)
{
/* reallocate paraminfo */
curNumRows += 100;
paramInfo = (double *)realloc(paramInfo, (size_t) (curNumRows * nColumns * sizeof(double)));
if (!paramInfo)
{
printf (" ERROR: Could not allocate paramInfo\n");
free (headerNames);
free (paramInfo);
ErrorExit ();
return (ERROR);
}
}
if (whichColumn == nColumns)
{
printf (" ERROR: Too many columns\n");
free (headerNames);
free (paramInfo);
ErrorExit ();
return (ERROR);
}
paramInfo[whichRow * nColumns + whichColumn] = tempD * (-1.0);
whichColumn++;
break;
case CMD_AUTOCLOSE1:
autoclose = YES;
printf (" Setting autoclose=yes\n");
break;
case CMD_AUTOCLOSE2:
autoclose = NO;
printf (" Setting autoclose=no\n");
break;
case CMD_NPERB:
sscanf (token, "%d", &tempInt);
nPerturbations = tempInt;
break;
case CMD_MCMCP:
printf (" Setting chain parameters\n");
break;
case CMD_SET_AAMODEL1:
aaModelType = POISSON;
printf (" Setting aamodel=poisson\n");
break;
case CMD_SET_AAMODEL2:
aaModelType = EQUALIN;
printf (" Setting aamodel=equalin\n");
break;
case CMD_SET_AAMODEL3:
aaModelType = JONES;
printf (" Setting aamodel=jones\n");
break;
case CMD_SET_AAMODEL4:
aaModelType = DAYHOFF;
printf (" Setting aamodel=dayhoff\n");
break;
case CMD_SET_AAMODEL5:
aaModelType = GTR;
printf (" Setting aamodel=gtr\n");
break;
case CMD_SET_ANCFILE1:
saveAncFiles = YES;
printf (" Setting ancfile=yes\n");
break;
case CMD_SET_ANCFILE2:
saveAncFiles = NO;
printf (" Setting ancfile=no\n");
break;
case CMD_SET_CODON1:
enforceCodonModel = YES;
printf (" Setting enforcecodon=yes\n");
break;
case CMD_SET_CODON2:
enforceCodonModel = NO;
printf (" Setting enforcecodon=no\n");
break;
case CMD_SET_OMEGAVAR1:
strcpy (codonModelType, token);
printf (" Setting omegavar=equal\n");
break;
case CMD_SET_OMEGAVAR2:
strcpy (codonModelType, token);
printf (" Setting omegavar=ny98\n");
break;
case CMD_SET_OMEGAVAR3:
strcpy (codonModelType, token);
printf (" Setting omegavar=ac1ny98\n");
break;
case CMD_SET_OMEGAVAR4:
strcpy (codonModelType, token);
printf (" Setting omegavar=ac2ny98\n");
break;
case CMD_SET_OMEGAVAR5:
strcpy (codonModelType, token);
printf (" Setting omegavar=covny98\n");
break;
case CMD_SET_OMEGA:
if (token[0] == 'e')
{
strcpy(omegaRatioModel, token);
omegaRatio = 1.0;
}
else
{
strcpy (omegaRatioModel, "user defined");
sscanf (token, "%lf", &tempD);
omegaRatio = tempD;
}
printf (" Setting omega = %lf\n", omegaRatio);
break;
case CMD_OMEGAPR1:
strcpy (omegaprModel, "fixed");
printf (" Fixing omega\n");
break;
case CMD_OMEGAPR2:
strcpy (omegaprModel, "uniform");
printf (" Uniform prior on omega\n");
break;
case CMD_OMEGAPR3:
sscanf (token, "%lf", &tempD);
if (tempD < 0.0)
{
printf (" ERROR: Lower bound on uniform must be positive\n");
return (ERROR);
}
omegaprUni[0] = tempD;
break;
case CMD_OMEGAPR4:
sscanf (token, "%lf", &tempD);
if (tempD <= omegaprUni[0])
{
printf (" ERROR: Upper bound on uniform must be greater than lower bound\n");
return (ERROR);
}
omegaprUni[1] = tempD;
break;
case CMD_OMEGAPR5:
strcpy (omegaprModel, "exponential");
printf (" Exponential prior on omega\n");
break;
case CMD_OMEGAPR6:
sscanf (token, "%lf", &tempD);
if (tempD <= 0.0)
{
printf (" ERROR: Parameter of exponential must be greater than 0.\n");
return (ERROR);
}
omegaprExp = tempD;
break;
case CMD_SET_CODE:
if (token[0] == 'u')
aaCode = UNIV;
else if (token[0] == 'v')
aaCode = VERTMT;
else if (token[0] == 'm' && token[1] == 'y')
aaCode = MYCO;
else if (token[0] == 'y')
aaCode = YEAST;
else if (token[0] == 'c')
aaCode = CILIATES;
else
aaCode = METMT;
printf (" Setting code to %s\n", token);
break;
case CMD_INFERSEL_YES:
printf (" Setting inferpossel=yes\n");
inferPoseSel = YES;
break;
case CMD_INFERSEL_NO:
printf (" Setting inferpossel=no\n");
inferPoseSel = NO;
break;
case CMD_INIT_LAG1:
strcpy (lagModel, "user defined");
sscanf (token, "%d", &tempInt);
lagNumber = tempInt;
printf (" Setting user-defined lag of %d\n", lagNumber);
break;
case CMD_INIT_LAG2:
strcpy (lagModel, token);
printf (" Estimating lag\n");
break;
case CMD_SET_LAG_PR1:
strcpy (lagprModel, "fixed");
printf (" Fixing lag\n");
strcpy (lagprModel, "fixed");
break;
case CMD_SET_LAG_PR2:
sscanf (token, "%lf", &tempD);
lagprUni[0] = tempD;
break;
case CMD_SET_LAG_PR3:
sscanf (token, "%lf", &tempD);
if (tempD <= lagprUni[0])
{
printf (" ERROR: Upper bound on uniform must be greater than lower bound\n");
return (ERROR);
}
lagprUni[1] = tempD;
printf (" Uniform (%1.3lf, %1.3lf) prior on lag\n", lagprUni[0], lagprUni[1]);
strcpy (lagprModel, "uniform");
break;
case CMD_SET_LAG_PR4:
sscanf (token, "%lf", &tempD);
if (tempD <= 0.0)
{
printf (" ERROR: Exponential parameter must be greater than 0\n");
return (ERROR);
}
lagprExp = tempD;
printf (" Exponential (%1.3lf) prior on lag\n", lagprExp);
strcpy (lagprModel, "exponential");
break;
case CMD_SET_INFERRATES1:
printf (" Setting inferrates=yes\n");
inferRates = YES;
break;
case CMD_SET_INFERRATES2:
printf (" Setting inferrates=no\n");
inferRates = NO;
break;
case CMD_SET_COVARION1:
printf (" Setting covarion=yes\n");
useCovarion = YES;
break;
case CMD_SET_COVARION2:
printf (" Setting covarion=no\n");
useCovarion = NO;
break;
case CMD_SET_PROPS1:
printf (" Setting %s\n", token);
if (!strcmp("qmatwin", token))
propSet = 0;
else if (!strcmp("pialpha", token))
propSet = 1;
else if (!strcmp("ratewin", token))
propSet = 2;
else if (!strcmp("tuning", token))
propSet = 3;
else if (!strcmp("clocktune", token))
propSet = 4;
else if (!strcmp("timetune", token))
propSet = 5;
else if (!strcmp("mtune", token))
propSet = 6;
else if (!strcmp("extendp", token))
propSet = 7;
else if (!strcmp("wormtune", token))
propSet = 8;
else if (!strcmp("bdwin", token))
propSet = 9;
else if (!strcmp("omegawin", token))
propSet = 10;
else if (!strcmp("rhowin", token))
propSet = 11;
else if (!strcmp("omegaalpha", token))
propSet = 12;
else if (!strcmp("invslide", token))
propSet = 13;
else if (!strcmp("switchwin", token))
propSet = 14;
else if (!strcmp("alphawin", token))
propSet = 15;
else if (!strcmp("reconlim", token))
propSet = 16;
else if (!strcmp("tbrextendp", token))
propSet = 17;
else if (!strcmp("tbrtune", token))
propSet = 18;
else if (!strcmp("bltune", token))
propSet = 19;
break;
case CMD_SET_PROPS2:
sscanf (token, "%lf", &tempD);
if (propSet == 0)
qMatWinProp = tempD;
else if (propSet == 1)
piAlphaProp = tempD;
else if (propSet == 2)
rateWinProp = tempD;
else if (propSet == 3)
tuningProp = tempD;
else if (propSet == 4)
clockTuneProp = tempD;
else if (propSet == 5)
timeTuneProp = tempD;
else if (propSet == 6)
mTuneProp = tempD;
else if (propSet == 7)
extendPProp = tempD;
else if (propSet == 8)
wormTuneProp = tempD;
else if (propSet == 9)
bdWinProp = tempD;
else if (propSet == 10)
omegaWinProp = tempD;
else if (propSet == 11)
rhoWinProp = tempD;
else if (propSet == 12)
omegaAlphaProp = tempD;
else if (propSet == 13)
invSlideProp = tempD;
else if (propSet == 14)
switchWinProp = tempD;
else if (propSet == 15)
alphaWinProp = tempD;
else if (propSet == 16)
reconLimProp = tempD;
else if (propSet == 17)
tbrExtendPProp = tempD;
else if (propSet == 18)
tbrTuneProp = tempD;
else if (propSet == 19)
blTuneProp = tempD;
break;
case CMD_SET_COVTYPE:
strcpy (covarionModelType, token);
printf (" Setting covtype=%s\n", covarionModelType);
break;
case CMD_SET_CODING:
strcpy (codingType, token);
printf (" Setting coding=%s\n", codingType);
break;
case CMD_SET_STATE_PR1:
strcpy (stateFreqPrModel, "fixed");
printf (" State frequencies fixed\n");
break;
case CMD_SET_STATE_PR2:
sscanf (token, "%lf", &tempD);
statefreqprDir = tempD;
strcpy (stateFreqPrModel, "dirichlet");
printf (" State frequencies follow a dirichlet(%lf)\n", tempD);
break;
case CMD_SET_MOVE_PROPS:
printf (" Setting move rates\n\n");
for (;;)
{
printf (" 1: %1.2lf = relative probability of changes to Q matrix\n", moveRates[0]);
printf (" 2: %1.2lf = relative probability of changes to base frequencies\n", moveRates[1]);
printf (" 3: %1.2lf = relative probability of changes to gamma shape\n", moveRates[2]);
printf (" 4: %1.2lf = relative probability of changes to site rates\n", moveRates[3]);
printf (" 5: %1.2lf = relative probability of changes to tree (stochastic NNI)\n", moveRates[4]);
printf (" 6: %1.2lf = relative probability of changes to clock tree\n", moveRates[5]);
printf (" 7: %1.2lf = relative probability of changes to time constrained tree\n", moveRates[6]);
printf (" 8: %1.2lf = relative probability of changes to tree height\n", moveRates[7]);
printf (" 9: %1.2lf = relative probability of changes to tree (one worm)\n", moveRates[8]);
printf (" 10: %1.2lf = relative probability of changes to node time\n", moveRates[9]);
printf (" 11: %1.2lf = relative probability of changes to bd parameters\n", moveRates[10]);
printf (" 12: %1.2lf = relative probability of changes to omega\n", moveRates[11]);
printf (" 13: %1.2lf = relative probability of changes to omega probabilities\n", moveRates[12]);
printf (" 14: %1.2lf = relative probability of changes to auto correlation\n", moveRates[13]);
printf (" 15: %1.2lf = relative probability of changes to lag\n", moveRates[14]);
printf (" 16: %1.2lf = relative probability of changes to tree (stochastic SPR)\n", moveRates[15]);
printf (" 17: %1.2lf = relative probability of changes to proportion invariant\n", moveRates[16]);
printf (" 18: %1.2lf = relative probability of changes to covarion parameter\n", moveRates[17]);
printf (" 19: %1.2lf = relative probability of hanges to tree (TBR1)\n", moveRates[18]);
printf (" 20: %1.2lf = relative probability of changes to GC swith parameters\n", moveRates[19]);
printf (" 21: %1.2lf = relative probability of changes to tree (TBR2)\n", moveRates[20]);
printf (" 22: %1.2lf = relative probability of changes to a branch length\n", moveRates[21]);
printf (" 23: %1.2lf = relative probability of changes to tree (eraser)\n", moveRates[22]);
printf (" 24: %1.2lf = relative probability of changes to tree (biased SPR)\n", moveRates[23]);
printf (" 25: %1.2lf = relative probability of changes to tree (biased TBR)\n", moveRates[24]);
printf ("\n");
printf (" Which move do you wish to change (0 to exit): ");
tempInt = (int)EnterNum ();
if (tempInt == 0)
break;
else if (tempInt < 0 || tempInt > 25)
{
printf (" You must enter a number between 0 and 25\n\n");
}
else
{
printf (" Enter new relative proposal probability: ");
tempD = EnterNum ();
moveRates[tempInt - 1] = tempD;
}
}
break;
case CMD_SET_MCMC_BURN:
sscanf (token, "%d", &tempInt);
mcmcBurn = tempInt;
break;
case CMD_SET_CYCLEFREQ:
sscanf (token, "%d", &tempInt);
cycleFreq = tempInt;
break;
case CMD_SET_CALCPSEUDOBF:
if (!strcmp("yes", token))
calcPseudoBf = YES;
else
calcPseudoBf = NO;
break;
case CMD_SET_PARS_CRIT:
printf (" Setting parsmodel=%s\n", token);
if (!strcmp("yes", token))
useParsCriterion = YES;
else
useParsCriterion = NO;
break;
case CMD_SET_TYPESET1:
//printf ("typset1 (%s)\n", token);
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
break;
case CMD_SET_TYPESET2:
//printf ("typset2 (%s)\n", token);
i = 0;
while (token[i] != '\0')
{
typeDefLabels[nTypeDefs][i] = token[i];
i++;
}
typeDefLabels[nTypeDefs][i] = '|';
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetPotWait = YES;
charSetFreq = 1;
printf (" Assigning typeset set \"");
i = 0;
while (typeDefLabels[nTypeDefs][i] != '|')
{
printf ("%c", typeDefLabels[nTypeDefs][i]);
i++;
}
printf ("\"\n");
if (nTypeDefs > 0)
{
typeDef = (int *)realloc(typeDef, (size_t) ((nTypeDefs+1) * nChar * sizeof(int)));
if (!typeDef)
{
printf (" ERROR: Could not reallocate typeDef\n");
return (ERROR);
}
for (i=nTypeDefs*nChar; i<(nTypeDefs+1)*nChar; i++)
typeDef[i] = UNORDERED;
}
break;
case CMD_SET_TYPESET3:
//printf ("typset3 (%s)\n", token);
printf (" ERROR: You cannot use typeset names that are digits\n");
return (ERROR);
break;
case CMD_SET_TYPESET4:
//printf ("typset4 (%s)\n", token);
if (!strcmp("ord", token))
charOrdering = ORDERED;
else
charOrdering = UNORDERED;
break;
case CMD_SET_TYPESET5:
//printf ("typset5 (%s)\n", token);
break;
case CMD_SET_TYPESET6:
//printf ("typset6 (%s)\n", token);
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
typeDef[nTypeDefs*nChar + i] = charOrdering;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
sscanf (token, "%d", &tempInt);
if (tempInt <= 0 || tempInt > nChar)
{
printf (" ERROR: Number (%d) out of range\n", tempInt);
return (ERROR);
}
if (charSetSlashWait == YES && charSetWait == YES)
{
printf (" ERROR: Problem assigning character set\n");
return (ERROR);
}
if (charSetSlashWait == YES)
{
charSetFreq = tempInt;
charSetSlashWait = NO;
charSetPotWait = NO;
}
else if (charSetWait == YES)
{
charSetTo = tempInt;
charSetWait = NO;
charSetPotWait = NO;
}
else
{
if (charSetWait == NO)
{
charSetFrom = tempInt;
charSetTo = tempInt;
charSetPotWait = NO;
}
else
{
charSetTo = tempInt;
charSetPotWait = NO;
}
}
break;
case CMD_SET_TYPESET7:
//printf ("typset7 (%s)\n", token);
charSetWait = YES;
charSetPotWait = YES;
break;
case CMD_SET_TYPESET8:
//printf ("typset8 (%s)\n", token);
charSetSlashWait = YES;
charSetPotWait = YES;
break;
case CMD_SET_TYPESET9:
//printf ("typset9 (%s)\n", token);
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
typeDef[nTypeDefs*nChar + i] = charOrdering;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
/*for (i=0; i<(nTypeDefs+1)*nChar; i++)
{
printf ("%d", typeDef[i]);
}
printf ("\n");*/
nTypeDefs++;
break;
case CMD_SET_TYPESET10:
//printf ("typset10 (%s)\n", token);
foundSet = NO;
for (i=0; i<nCharSets; i++)
{
j = 0;
while (charSetLabels[i][j] != '|')
{
tempString[j] = charSetLabels[i][j];
j++;
}
tempString[j] = '\0';
if (!strcmp(tempString, token))
{
foundSet = YES;
//printf ("match at %s %s\n", token, tempString);
tempInt = (int)pow(2.0, (double)(i+1));
for (j=0; j<nChar; j++)
{
tempInt2 = tempInt & charSet[j];
if (tempInt == tempInt2)
{
typeDef[nTypeDefs*nChar + j] = charOrdering;
//sitePartitions[j] = whichPartition;
}
}
}
}
if (foundSet == NO)
{
printf (" ERROR: Could not find charset %s\n", token);
return (ERROR);
}
break;
case CMD_SET_TYPESET11:
//printf ("typset11 (%s)\n", token);
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
typeDef[nTypeDefs*nChar + i] = charOrdering;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
break;
case CMD_SET_STATESSET1:
//printf ("typset1 (%s)\n", token);
if (isMatrixAllocated == NO)
{
printf (" ERROR: Data not read in\n");
return (ERROR);
}
break;
case CMD_SET_STATESSET2:
//printf ("typset2 (%s)\n", token);
i = 0;
while (token[i] != '\0')
{
nStatesDefLabels[nNStatesDefs][i] = token[i];
i++;
}
nStatesDefLabels[nNStatesDefs][i] = '|';
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetPotWait = YES;
charSetFreq = 1;
printf (" Assigning nstatesset set \"");
i = 0;
while (nStatesDefLabels[nNStatesDefs][i] != '|')
{
printf ("%c", nStatesDefLabels[nNStatesDefs][i]);
i++;
}
printf ("\"\n");
if (nNStatesDefs > 0)
{
nStatesDef = (int *)realloc(nStatesDef, (size_t) ((nNStatesDefs+1) * nChar * sizeof(int)));
if (!nStatesDef)
{
printf (" ERROR: Could not reallocate nStatesDef\n");
return (ERROR);
}
for (i=nNStatesDefs*nChar; i<(nNStatesDefs+1)*nChar; i++)
nStatesDef[i] = nCharStates;
}
break;
case CMD_SET_STATESSET3:
//printf ("typset3 (%s)\n", token);
printf (" ERROR: You cannot use nstatesset names that are digits\n");
return (ERROR);
break;
case CMD_SET_STATESSET4:
//printf ("typset4 (%s)\n", token);
sscanf (token, "%d", &charOrdering);
break;
case CMD_SET_STATESSET5:
//printf ("typset5 (%s)\n", token);
break;
case CMD_SET_STATESSET6:
//printf ("typset6 (%s)\n", token);
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
nStatesDef[nNStatesDefs*nChar + i] = charOrdering;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
sscanf (token, "%d", &tempInt);
if (tempInt <= 0 || tempInt > nChar)
{
printf (" ERROR: Number (%d) out of range\n", tempInt);
return (ERROR);
}
if (charSetSlashWait == YES && charSetWait == YES)
{
printf (" ERROR: Problem assigning character set\n");
return (ERROR);
}
if (charSetSlashWait == YES)
{
charSetFreq = tempInt;
charSetSlashWait = NO;
charSetPotWait = NO;
}
else if (charSetWait == YES)
{
charSetTo = tempInt;
charSetWait = NO;
charSetPotWait = NO;
}
else
{
if (charSetWait == NO)
{
charSetFrom = tempInt;
charSetTo = tempInt;
charSetPotWait = NO;
}
else
{
charSetTo = tempInt;
charSetPotWait = NO;
}
}
break;
case CMD_SET_STATESSET7:
//printf ("typset7 (%s)\n", token);
charSetWait = YES;
charSetPotWait = YES;
break;
case CMD_SET_STATESSET8:
//printf ("typset8 (%s)\n", token);
charSetSlashWait = YES;
charSetPotWait = YES;
break;
case CMD_SET_STATESSET9:
//printf ("typset9 (%s)\n", token);
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
nStatesDef[nNStatesDefs*nChar + i] = charOrdering;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
/*for (i=0; i<(nNStatesDefs+1)*nChar; i++)
{
printf ("%d", nStatesDef[i]);
}
printf ("\n");*/
nNStatesDefs++;
break;
case CMD_SET_STATESSET10:
//printf ("typset10 (%s)\n", token);
foundSet = NO;
for (i=0; i<nCharSets; i++)
{
j = 0;
while (charSetLabels[i][j] != '|')
{
tempString[j] = charSetLabels[i][j];
j++;
}
tempString[j] = '\0';
if (!strcmp(tempString, token))
{
foundSet = YES;
//printf ("match at %s %s\n", token, tempString);
tempInt = (int)pow(2.0, (double)(i+1));
for (j=0; j<nChar; j++)
{
tempInt2 = tempInt & charSet[j];
if (tempInt == tempInt2)
{
nStatesDef[nNStatesDefs*nChar + j] = charOrdering;
//sitePartitions[j] = whichPartition;
}
}
}
}
if (foundSet == NO)
{
printf (" ERROR: Could not find charset %s\n", token);
return (ERROR);
}
break;
case CMD_SET_STATESSET11:
//printf ("typset11 (%s)\n", token);
if (charSetWait == NO && charSetSlashWait == NO && charSetPotWait == NO)
{
j = charSetFreq;
for (i=charSetFrom-1; i<=charSetTo-1; i++)
{
if (j % charSetFreq == 0)
nStatesDef[nNStatesDefs*nChar + i] = charOrdering;
j++;
}
charSetFrom = -1;
charSetTo = -1;
charSetWait = NO;
charSetSlashWait = NO;
charSetFreq = 1;
charSetPotWait = YES;
}
break;
case CMD_SET_ASSUME1:
foundSet = NO;
for (i=0; i<nTypeDefs; i++)
{
j = 0;
while (typeDefLabels[i][j] != '|')
{
tempString[j] = typeDefLabels[i][j];
j++;
}
tempString[j] = '\0';
if (!strcmp(tempString, token))
{
foundSet = YES;
//printf ("match at %s %s\n", token, tempString);
for (j=0; j<nChar; j++)
{
charType[j] = typeDef[i*nChar + j];
}
}
}
if (foundSet == NO)
{
printf (" ERROR: Could not find typeset %s\n", token);
return (ERROR);
}
printf (" Assume typeset = %s\n", token);
break;
case CMD_SET_ASSUME2:
foundSet = NO;
for (i=0; i<nNStatesDefs; i++)
{
j = 0;
while (nStatesDefLabels[i][j] != '|')
{
tempString[j] = nStatesDefLabels[i][j];
j++;
}
tempString[j] = '\0';
if (!strcmp(tempString, token))
{
foundSet = YES;
//printf ("match at %s %s\n", token, tempString);
for (j=0; j<nChar; j++)
{
charNStates[j] = nStatesDef[i*nChar + j];
}
}
}
if (foundSet == NO)
{
printf (" ERROR: Could not find nstatesset %s\n", token);
return (ERROR);
}
printf (" Assume nstatesset = %s\n", token);
break;
}
return (NO_ERROR);
}
double EnterNum (void)
{
double tempD;
char tempString[20];
for (;;)
{
fgets(tempString, 20, stdin);
sscanf (tempString, "%lf", &tempD);
return tempD;
}
}
void ErrorExit (void)
{
if (isMatrixAllocated == YES)
{
free (origDataMatrix);
free (taxonLabels);
free (excludedSites);
free (sitePartitions);
free (matrixCounter);
free (charSet);
free (calibrations);
free (constraints);
free (excludedTaxa);
free (userTree);
free (sumTree);
free (transOldNames);
free (transNewNames);
free (charType);
free (charNStates);
free (typeDef);
free (nStatesDef);
}
nTaxa = nChar = 0;
isMatrixAllocated = NO;
isNtaxaInitialized = NO;
isNcharInitialized = NO;
}
void FinishTree (TreeNode *p, int *i, int isThisTreeRooted)
{
if (p != NULL)
{
FinishTree (p->left, i, isThisTreeRooted);
FinishTree (p->right, i, isThisTreeRooted);
p->marked = NO;
if (p->left == NULL && p->right == NULL && p->anc != NULL)
{
}
else if (p->left != NULL && p->right == NULL && p->anc == NULL)
{
if (isThisTreeRooted == YES)
p->index = (*i)++;
}
else
{
p->index = (*i)++;
}
}
}
#if defined (CONTREE)
int FirstTaxonInPartition (unsigned int *partition, int length)
{
int i, j, nBits, taxon;
unsigned int x;
nBits = sizeof(unsigned int) * 8;
for (i=taxon=0; i<length; i++)
{
x = 1;
for (j=0; j<nBits; j++)
{
if (partition[i]&x)
return taxon;
taxon++;
x <<= 1;
}
}
return taxon;
}
void FlipBits (unsigned int *partition, int length, unsigned int lastMask)
{
int i;
for (i=0; i<length; i++)
partition[i] ^= -1;
partition[i - 1] &= lastMask;
}
void GetConDownPass (PolyNode **downPass, PolyNode *p, int *i)
{
PolyNode *q;
if (p->left != NULL)
{
for (q=p->left; q!=NULL; q=q->sib)
GetConDownPass(downPass, q, i);
}
downPass[(*i)++] = p;
}
#endif
void GetToken (int *tokenType)
{
int allNumbers;
register char *temp;
(*tokenType) = 0;
temp = token;
while (IsWhite(*tokenP) == 1 || IsWhite(*tokenP) == 2)
{
if (IsWhite(*tokenP) == 2)
*tokenType = RETURNSYMBOL;
++tokenP;
}
if (IsIn(*tokenP,"="))
{
*temp++ = *tokenP++;
*tokenType = EQUALSIGN;
}
else if (IsIn(*tokenP,";"))
{
*temp++ = *tokenP++;
*tokenType = SEMICOLON;
}
else if (IsIn(*tokenP,":"))
{
*temp++ = *tokenP++;
*tokenType = COLON;
}
else if (IsIn(*tokenP,","))
{
*temp++ = *tokenP++;
*tokenType = COMMA;
}
else if (IsIn(*tokenP,"#"))
{
*temp++ = *tokenP++;
*tokenType = POUNDSIGN;
}
else if (IsIn(*tokenP,"("))
{
*temp++ = *tokenP++;
*tokenType = LEFTPAR;
}
else if (IsIn(*tokenP,")"))
{
*temp++ = *tokenP++;
*tokenType = RIGHTPAR;
}
else if (IsIn(*tokenP,"["))
{
*temp++ = *tokenP++;
*tokenType = LEFTCOMMENT;
}
else if (IsIn(*tokenP,"]"))
{
*temp++ = *tokenP++;
*tokenType = RIGHTCOMMENT;
}
else if (IsIn(*tokenP,"-"))
{
*temp++ = *tokenP++;
*tokenType = DASH;
}
else if (IsIn(*tokenP,"?"))
{
*temp++ = *tokenP++;
*tokenType = QUESTIONMARK;
}
else if (IsIn(*tokenP,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789."))
{
allNumbers = TRUE;
if (!IsIn(*tokenP,"0123456789."))
allNumbers = FALSE;
*temp++ = *tokenP++;
while(IsIn(*tokenP,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789."))
{
if (!IsIn(*tokenP,"0123456789."))
allNumbers = FALSE;
*temp++ = *tokenP++;
}
if (allNumbers == TRUE)
*tokenType = NUMBER;
else
*tokenType = ALPHA;
}
else if (IsIn(*tokenP,"*"))
{
*temp++ = *tokenP++;
*tokenType = ASTERISK;
}
else if (IsIn(*tokenP,"/"))
{
*temp++ = *tokenP++;
*tokenType = BACKSLASH;
}
else if (IsIn(*tokenP,"'\\'"))
{
*temp++ = *tokenP++;
*tokenType = FORWARDSLASH;
}
else if (IsIn(*tokenP,"!"))
{
*temp++ = *tokenP++;
*tokenType = EXCLAMATIONMARK;
}
else if (IsIn(*tokenP,"%"))
{
*temp++ = *tokenP++;
*tokenType = PERCENT;
}
else if (IsIn(*tokenP,"&"))
{
*temp++ = *tokenP++;
*tokenType = AMPERSTAND;
}
else if (IsIn(*tokenP,"~"))
{
*temp++ = *tokenP++;
*tokenType = TILDE;
}
else if (IsIn(*tokenP,"+"))
{
*temp++ = *tokenP++;
*tokenType = PLUS;
}
else if (IsIn(*tokenP,"^"))
{
*temp++ = *tokenP++;
*tokenType = CARAT;
}
else if (IsIn(*tokenP,"$"))
{
*temp++ = *tokenP++;
*tokenType = DOLLARSIGN;
}
else if (IsIn(*tokenP,"@"))
{
*temp++ = *tokenP++;
*tokenType = ATSIGN;
}
else if (IsIn(*tokenP,"|"))
{
*temp++ = *tokenP++;
*tokenType = PIPESIGN;
}
else if (IsIn(*tokenP,"{"))
{
*temp++ = *tokenP++;
*tokenType = LEFTCURLY;
}
else if (IsIn(*tokenP,"}"))
{
*temp++ = *tokenP++;
*tokenType = RIGHTCURLY;
}
*temp = '\0';
}
void GetUserDownPass (TreeNode *p, TreeNode **x, int *y)
{
if (p != NULL)
{
GetUserDownPass (p->left, x, y);
GetUserDownPass (p->right, x, y);
x[(*y)] = p;
(*y)++;
}
}
void GetUserHelp (void)
{
if (generalHelp == YES)
{
printf ("\n Commands that are available include:\n\n");
printf (" execute -- Executes a file\n");
printf (" quit -- Quits the program\n");
printf (" lset -- Sets the parameters of the likelihood\n");
printf (" prset -- Sets the priors for the parameters\n");
printf (" props -- Sets MCMC chain parameters\n");
printf (" mcmc -- Starts Markov chain Monte Carlo\n");
printf (" mcmcp -- Sets the parameters of a chain (without starting analysis)\n");
printf (" exclude -- Excludes sites from the analysis\n");
printf (" include -- Includes sites\n");
printf (" delete -- Deletes taxa from the analysis\n");
printf (" restore -- Restores taxa\n");
printf (" charstat -- Shows status of characters\n");
printf (" charset -- Assigns a group of sites to a set\n");
printf (" partition -- Assigns a character partition\n");
printf (" constraint -- Assigns a constraint on a tree\n");
printf (" calibration -- Assigns a calibration on a tree\n");
printf (" outgroup -- Assigns a single species to be the outgroup\n");
printf (" root -- Roots tree at outgroup species\n");
printf (" deroot -- Deroots tree\n");
printf (" showtree -- Shows the current user tree\n");
printf (" shownodes -- Shows the current user tree as linked nodes\n");
printf (" sumt -- Summarize the trees in a tree file\n");
printf (" set -- Sets run conditions of program\n");
printf (" usertree -- Assigns a user tree\n");
printf ("\n");
}
else
{
if (!strcmp(helpRequest, "execute"))
{
printf ("\n execute\n\n");
printf (" This command executes a file called <file name>.\n");
printf (" The correct usage is: \"execute <file name>\"\n");
printf (" For example, \"execute replicase.nex\" would execute the\n");
printf (" file named \"replicase.nex\". This file must be in the\n");
printf (" same directory as the executable.\n\n");
}
else if (!strcmp(helpRequest, "quit"))
{
printf ("\n quit\n\n");
printf (" This command quits the program.\n");
printf (" The correct usage is: \"quit\"\n\n");
}
else if (!strcmp(helpRequest, "lset"))
{
printf ("\n lset\n\n");
printf (" This command sets the parameters of the likelihood model.\n");
printf (" The likelihood function is the probability of observing the\n");
printf (" data conditional on the phylogenetic model. In order to\n");
printf (" calculate the likelihood, you must assume a model of character\n");
printf (" change. This command lets you tailor these assumptions.\n");
printf (" The correct usage is: \"lset <parameter>=<option>\"\n");
printf (" For example, \"lset nst=6 rates=gamma\" would set the\n");
printf (" model to a general model of DNA substition (the GTR)\n");
printf (" with gamma-distributed rate variation across sites.\n\n");
printf (" Options: \n\n");
printf (" nst -- Sets the number of substitution types: \"1\" is JC69 or \n");
printf (" F81, \"2\" is K80 or HKY85, \"6\" is GTR, and \"12\" is \n");
printf (" the general nonreversible model. \n");
printf (" aamodel -- Sets the model of substitution for amino acid sequence \n");
printf (" data. The options are \"poisson\" (a glorified Jukes- \n");
printf (" Cantor), \"equalin\" (a glorified Felsenstein, 1981), \n");
printf (" \"jones\", \"dayhoff\", and \"gtr\". \n");
printf (" rates -- Sets the model for among-site rate variation: \n");
printf (" * equal -- No rate variation across sites. \n");
printf (" * gamma -- Gamma-distributed rate variation. \n");
printf (" * adgamma -- Autocorrelated rates across sites. The \n");
printf (" marginal rate at a site is gamma, but \n");
printf (" adjacent sites have correlated rates. \n");
printf (" * invariant -- A proportion of the sites are invariable. \n");
printf (" * invgamma -- A proportion of the sites are invariable \n");
printf (" while the rate for the remaining sites is \n");
printf (" drawn from a gamma distribution. \n");
printf (" * sitespec -- Site specific rates where sites are \n");
printf (" assigned to partitions and the rate for \n");
printf (" each partition estimated separately. \n");
printf (" * ssgamma -- Site specific rates but the rates within \n");
printf (" a class have rate variation as described \n");
printf (" by a gamma distribution. \n");
printf (" * ssadgamma -- Site specific rates but the rates within \n");
printf (" a class have rate variation as described \n");
printf (" by a autocorrelated gamma distribution. \n");
printf (" inferrates -- When inferrates=yes, the rate factor of the sites is \n");
printf (" estimated. \n");
printf (" basefreq -- Sets the base frequencies: \"equal\" sets the frequency \n");
printf (" to 1/4 for each nucleotide, \"empirical\" sets the freq- \n");
printf (" uencies to the observed frequency of each nucleotide in \n");
printf (" the alignment, and \"estimate\" allows the program to \n");
printf (" estimate the frequencies. Note that when \"nst=12\", that \n");
printf (" the base frequencies are completely determined by the Q \n");
printf (" matrix. \n");
printf (" clock -- Sets the model for branch length constraints: \"strict\" \n");
printf (" restrains the branch lengths such that the molecular clock\n");
printf (" is obeyed, \"relaxed\" relaxes the molecular clock \n");
printf (" assumption by assuming that rates change on the tree \n");
printf (" according to a compound Poisson process, and \"uncon- \n");
printf (" strained\" allows each branch to have its own rate \n");
printf (" parameter. \n");
printf (" tratio -- Sets the transition/transverion rate ratio. This option \n");
printf (" only works when \"nst=2\". \n");
printf (" revmat -- Sets the rates for the GTR model. This option only works \n");
printf (" when \"nst=6\". \n");
printf (" nonrevmat -- Sets the rates for the general nonreversible model. This \n");
printf (" option only works when \"nst=12\". \n");
printf (" shape -- Sets the shape parameter of the gamma distribution. This \n");
printf (" option only works when gamma-distributed rate variation \n");
printf (" has been selected (\"rates=gamma\"). \n");
printf (" ncat -- Sets the number of rate categories for the gamma distri- \n");
printf (" bution. The gamma distribution is a continuous one. \n");
printf (" However, it is virtually impossible to calculate likeli- \n");
printf (" hoods under the gamma distribution. Hence, an approx- \n");
printf (" imation to the continuous gamma is used; the gamma distri-\n");
printf (" bution is broken into ncat categories of equal weight \n");
printf (" (1/ncat). The mean rate for each category represents the \n");
printf (" rate for the entire category. This option allows you to \n");
printf (" specify how many rates to use when approximating the \n");
printf (" gamma. The approximation is better as ncat is increased. \n");
printf (" In practice, \"ncat=4\" does a reasonable job of approx- \n");
printf (" imating the continuous gamma. \n");
printf (" coding -- This specifies how characters were sampled. If all \n");
printf (" site patterns had the possiblity of being sampled, then \n");
printf (" \"all\" should be specified (the default). Otherwise, \n");
printf (" \"variable\" (only variable characters), \"informative\" \n");
printf (" only parsimony informative), \"noabsence\" (patterns \n");
printf (" with all characters absent), or \"nopresence\" (patterns \n");
printf (" with all characters present) should be specified. These \n");
printf (" options only work with morphological (all/variable/ \n");
printf (" informative) or restriction site (all/variable/noabsence/ \n");
printf (" nopresence) data. \n");
printf (" enforcecodon -- Enforces the use of a 61 X 61 codon model of DNA \n");
printf (" substitution. Use of this option allows you to estimate \n");
printf (" the nonsynonymous/synonymous rate of substitution (omega).\n");
printf (" Make certain that the data are protein coding DNA \n");
printf (" sequences that are in frame (i.e., the length of the \n");
printf (" sequences should be divisable by three. \n");
printf (" code -- Enforces the use of a particular genetic code. The default\n");
printf (" is the universal code. Other options include \"vertmt\" \n");
printf (" for vertebrate mitochondrial DNA, \"mycoplasma\", \n");
printf (" \"yeast\", \"ciliates\", and \"metmt\" (for metazoan \n");
printf (" mitochondrial DNA, except vertebrates). \n");
printf (" omegavar -- Allows the nonsynonymous/synonymous rate ratio (omega) to \n");
printf (" vary across codons according to the model of Nielsen and \n");
printf (" Yang (1998) when the \"ny98\" option is enforced. Other- \n");
printf (" wise, omega is assumed to be equal across sites. \n");
printf (" omegaratio -- Sets the nonsynonymous/synonymous rate ratio. \n");
printf (" seqerror -- Sets the probability of a sequencing error at a site in \n");
printf (" the aligned sequence. \n");
printf (" inferpossel -- Sets the option for inferring positively selected sites. \n");
printf (" You must specify the codon model of DNA substitution and \n");
printf (" the ny98 model for omega variation. \n");
printf (" sitepartition -- Sets the name of the site partition to use for site \n");
printf (" specific rate variation. A partition must be defined for \n");
printf (" this option to be implemented. \n");
printf (" siterates -- Sets the rates for site specific rate variation. A site \n");
printf (" partition must be defined. \n");
printf (" enforcecon -- Enforces constraints, if defined, when \"enforcecon=yes\".\n");
printf (" enforcecal -- Enforces calibrations. \n");
printf (" inferanc -- Causes the states at nodes specified by constraints to be \n");
printf (" inferred. Constraints must be defined for this option to \n");
printf (" work. \n");
printf (" ancfile -- Determines whether all of the ancestral state information \n");
printf (" is printed to files (yes) or only a summary file for each \n");
printf (" constrained node (no). \n\n");
printf (" Parameter Options Current Setting\n");
printf (" ----------------------------------------------------------------\n");
printf (" nst 1/2/6/12 %s\n", subModel);
if (aaModelType == POISSON)
printf (" aamodel poisson/equalin/jones/dayhoff/gtr poisson\n");
else if (aaModelType == EQUALIN)
printf (" aamodel poisson/equalin/jones/dayhoff/gtr equalin\n");
else if (aaModelType == JONES)
printf (" aamodel poisson/equalin/jones/dayhoff/gtr jones\n");
else if (aaModelType == DAYHOFF)
printf (" aamodel poisson/equalin/jones/dayhoff/gtr dayhoff\n");
else if (aaModelType == GTR)
printf (" aamodel poisson/equalin/jones/dayhoff/gtr gtr\n");
printf (" rates equal/gamma/adgamma/invariant/ \n");
printf (" invgamma/sitespec/ssgamma/ \n");
printf (" ssadgamma %s\n", ratesModel);
if (inferRates == YES)
printf (" inferrates yes/no yes\n");
else
printf (" inferrates yes/no no\n");
printf (" basefreq equal/empirical/estimate %s\n", baseFreqModel);
printf (" clock unconstrained/relaxed/strict %s\n", clockModel);
if (tRatioModel[0] == 'e')
printf (" tratio <number>/estimate %s\n", tRatioModel);
else
printf (" tratio <number>/estimate %lf\n", tRatio);
if (revRatesModel[0] == 'e')
printf (" revmat (<number>, ..., <number>)/estimate %s\n", revRatesModel);
else
printf (" revmat (<number>, ..., <number>)/estimate (%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n",
revRates[0], revRates[1], revRates[2], revRates[3], revRates[4], revRates[5]);
if (nonRevRatesModel[0] == 'e')
printf (" nonrevmat (<number>, ..., <number>)/estimate %s\n", nonRevRatesModel);
else
{
printf (" nonrevmat (<number>, ..., <number>)/estimate (%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,\n",
nonRevRates[0], nonRevRates[1], nonRevRates[2], nonRevRates[3], nonRevRates[4], nonRevRates[5]);
printf (" %1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n",
nonRevRates[6], nonRevRates[7], nonRevRates[8], nonRevRates[9], nonRevRates[10], nonRevRates[11]);
}
if (omegaRatioModel[0] == 'e')
printf (" omega <number>/estimate %s\n", omegaRatioModel);
else
printf (" omega <number>/estimate %lf\n", omegaRatio);
printf (" omegavar equal/ny98 %s\n", codonModelType);
if (shapeModel[0] == 'e')
printf (" shape <number>/estimate %s\n", shapeModel);
else
printf (" shape <number>/estimate %lf\n", shape);
printf (" ncat <number> %d\n", nRateCats);
printf (" coding all/variable/informative/ \n");
printf (" noabsence/nopresence %s\n", codingType);
printf (" seqerror <number> %1.3lf\n", seqErrorProb);
printf (" sitepartition <name> %s\n", partitionName);
printf (" siterates (<number>, ..., <number>)/estimate %s\n", siteRatesModel);
if (enforceConstraints == YES)
printf (" enforcecon yes/no yes\n");
else
printf (" enforcecon yes/no no\n");
if (enforceCalibrations == YES)
printf (" enforcecal yes/no yes\n");
else
printf (" enforcecal yes/no no\n");
if (inferAncStates == YES)
printf (" inferanc yes/no yes\n");
else
printf (" inferanc yes/no no\n");
if (saveAncFiles == YES)
printf (" ancfile yes/no yes\n");
else
printf (" ancfile yes/no no\n");
if (enforceCodonModel == YES)
printf (" enforcecodon yes/no yes\n");
else
printf (" enforcecodon yes/no no\n");
if (inferPoseSel == YES)
printf (" inferpossel yes/no yes\n");
else
printf (" inferpossel yes/no no\n");
printf (" code universal/vertmt/mycoplasma/ \n");
if (aaCode == UNIV)
printf (" yeast/ciliates/metmt universal\n\n");
else if (aaCode == VERTMT)
printf (" yeast/ciliates/metmt vertmt\n\n");
else if (aaCode == MYCO)
printf (" yeast/ciliates/metmt mycoplasma\n\n");
else if (aaCode == YEAST)
printf (" yeast/ciliates/metmt yeast\n\n");
else if (aaCode == CILIATES)
printf (" yeast/ciliates/metmt ciliates\n\n");
else
printf (" yeast/ciliates/metmt metmt\n\n");
}
else if (!strcmp(helpRequest, "exclude"))
{
printf ("\n exclude\n\n");
printf (" This command excludes characters from the analysis.\n");
printf (" The correct usage is: \"exclude <number> <number> <number> - <number>\"\n");
printf (" For example, \"exclude 2 3 10-14 22\" excludes sites 2, 3, 10, 11, 12,\n");
printf (" 13, 14, and 22 from the analysis. Similarly, \"exclude all\" excludes all of\n");
printf (" the characters.\n\n");
}
else if (!strcmp(helpRequest, "include"))
{
printf ("\n include\n\n");
printf (" This command includes characters that were previously deleted from \n");
printf (" the analysis. The correct usage is: \"include <number> <number> \n");
printf (" <number> - <number>\". For example, \"include 2 3 10-14 22\" includes \n");
printf (" sites 2, 3, 10, 11, 12, 13, 14, and 22 in the analysis. Similarly, \n");
printf (" \"include all\" includes all of the characters.\n\n");
}
else if (!strcmp(helpRequest, "delete"))
{
printf ("\n delete\n\n");
printf (" This command deletes taxa from the analysis.\n");
printf (" The correct usage is: \"delete <name> <number>\". A list of the\n");
printf (" taxon names and/or numbers can be used (the taxa are numbered \n");
printf (" from 1 to n in the order in the matrix). For example, \"delete 1 2\n");
printf (" Homo_sapiens\" deletes taxa 1, 2, and the taxon labelled \"Homo sapiens\"\n");
printf (" from the analysis.\n\n");
}
else if (!strcmp(helpRequest, "restore"))
{
printf ("\n restore\n\n");
printf (" This command restores taxa to the analysis.\n");
printf (" The correct usage is: \"restore <name> <number>\". A list of the\n");
printf (" taxon names and/or numbers can be used (the taxa are numbered \n");
printf (" from 1 to n in the order in the matrix). For example, \"restore 1 2\n");
printf (" Homo_sapiens\" restores taxa 1, 2, and the taxon labelled \"Homo sapiens\"\n");
printf (" to the analysis.\n\n");
}
else if (!strcmp(helpRequest, "charstat"))
{
printf ("\n charstat\n\n");
printf (" This command shows the status of all the characters.\n");
printf (" The correct usage is: \"charstat\"\n");
printf (" After typing \"charstat\", the character number, whether it is\n");
printf (" excluded or included, and the partition identity are shown.\n\n");
}
else if (!strcmp(helpRequest, "outgroup"))
{
printf ("\n outgroup\n\n");
printf (" This command assigns a taxon to the outgroup.\n");
printf (" The correct usage is: \"outgroup <number>/<taxon name>\"\n");
printf (" For example, \"outgroup 3\" assigns the third taxon in the\n");
printf (" matrix to be the outgroup. Similarly, \"outgroup Homo_sapiens\".\n");
printf (" assigns the taxon labelled \"Homo_sapiens\" to be the outgroup\n");
printf (" (assuming that there is a taxon named \"Homo_sapiens\" in the matrix).\n");
printf (" Only a single taxon can be assigned to be the outgroup.\n\n");
}
else if (!strcmp(helpRequest, "prset"))
{
printf ("\n prset\n\n");
printf (" This command sets the priors for the phylogenetic model.\n");
printf (" Remember that in a Bayesian analysis, you must specify a\n");
printf (" prior probability distribution for the parameters of the\n");
printf (" likelihood model. In this case, you must specify the priors\n");
printf (" for the model of DNA substitution. qmatpr sets the prior for the\n");
printf (" rate matrix; the options are \"fixed\", \"exp\", and \"uni\", which\n");
printf (" fixes the rate matrix, places an exponential or uniform distribution on\n");
printf (" the rate matrix, respectively. Other options include \"basefreqpr\",\n");
printf (" \"brlenpr\", \"shapepr\", and \"siteratepr\" which specify the prior\n");
printf (" for the base frequencies, branch lengths, gamma shape parameter, or\n");
printf (" site specific rates, respectively. The correct usage is: \"prset \n");
printf (" qmatpr=uni(0,100.0) basefreqpr=dir(1.0)\", which would set the\n");
printf (" prior on the rates of the instantaneous rate matrix to a uniform\n");
printf (" (0,100) and the prior on the base frequencies to a dirichlet.\n\n");
printf (" Options: \n\n");
printf (" Parameter Options Current Setting\n");
printf (" ------------------------------------------------\n");
printf (" qmatpr fixed/exp/uni %s\n", qmatprModel);
printf (" basefreqpr fixed/dir %s\n", basefreqprModel);
printf (" brlenpr uni/exp/bd %s\n", brlenprModel);
printf (" shapepr fixed/exp/uni %s\n", shapeprModel);
printf (" omegapr fixed/exp/uni %s\n", omegaprModel);
printf (" siteratepr fixed/exp/uni %s\n", siterateprModel);
printf (" statefreqpr fixed/dir %s\n\n", stateFreqPrModel);
}
else if (!strcmp(helpRequest, "mcmc"))
{
printf ("\n mcmc\n\n");
printf (" This command starts the Markov chain Monte Carlo (MCMC) analysis.\n");
printf (" The posterior probability of phylogenetic trees (and other parameters\n");
printf (" of the substitution model) cannot be determined analytically. Instead,\n");
printf (" MCMC is used to approximate the posterior probabilities of trees by\n");
printf (" drawing (dependent) samples from the posterior distribution. This\n");
printf (" program can implement a variant of MCMC called \"Metropolis-coupled\n");
printf (" Markov chain Monte Carlo\", or MCMCMC for short. Basically, \"nchains\"\n");
printf (" are run, with nchains - 1 of them heated. The chains are labelled\n");
printf (" 1, 2, ..., nchains. The heat that is applied to the i-th chain is\n");
printf (" B = 1 / (1 + temp X i). B is the power to which the posterior\n");
printf (" probability is raised. When B = 0, all trees have equal probability\n");
printf (" and the chain freely visits trees. B = 1 is the \"cold\" chain (or\n");
printf (" the distribution of interest). MCMCMC can mix better than ordinary\n");
printf (" MCMC; after all of the chains have gone through one cycle, two\n");
printf (" chains are chosen at random and an attempt is made to swap the\n");
printf (" states (with the probability of a swap being determined by\n");
printf (" the Metropolis et al. equation). This allows the chain to potentially\n");
printf (" jump a valley in a single bound. The correct usage is \"mcmc ngen=100000\n");
printf (" nchains=4 temp=0.5\", which performs a MCMCMC analysis with four chains\n");
printf (" with the temperature set to 0.5. The chains would be run for 100,000 cycles.\n\n");
printf (" Options: \n\n");
printf (" Parameter Options Current Setting\n");
printf (" ----------------------------------------------\n");
printf (" seed <number> %ld\n", randomSeed);
printf (" ngen <number> %d\n", nGen);
printf (" samplefreq <number> %d\n", sampleFreq);
printf (" printfreq <number> %d\n", printFreq);
printf (" nchains <number> %d\n", numChains);
printf (" temp <number> %lf\n", chainTemp);
printf (" filename <file name> %s\n", outFile);
printf (" burnin <number> %d\n", mcmcBurn);
/*if (calcPseudoBf == YES)
printf (" calcpseudobf yes/no yes\n");
else
printf (" calcpseudobf yes/no no\n");
printf (" cyclefreq <number> %d\n", cycleFreq);*/
printf (" startingtree random/user %s\n", startingTreeModel);
printf (" nperts <number> %d\n", nPerturbations);
if (saveBrlens == YES)
printf (" savebrlens yes/no yes\n\n");
else
printf (" savebrlens yes/no no\n\n");
}
else if (!strcmp(helpRequest, "mcmcp"))
{
printf ("\n mcmcp\n\n");
printf (" This command sets the parameters of the Markov chain Monte Carlo (MCMC) \n");
printf (" analysis without actually starting the chain. This command is identical\n");
printf (" in all respects to mcmc, except that the analysis will not start after\n");
printf (" this command is issued.\n\n");
printf (" Options: \n\n");
printf (" Parameter Options Current Setting\n");
printf (" ----------------------------------------------\n");
printf (" seed <number> %ld\n", randomSeed);
printf (" ngen <number> %d\n", nGen);
printf (" samplefreq <number> %d\n", sampleFreq);
printf (" printfreq <number> %d\n", printFreq);
printf (" nchains <number> %d\n", numChains);
printf (" temp <number> %lf\n", chainTemp);
printf (" filename <file name> %s\n", outFile);
printf (" burnin <number> %d\n", mcmcBurn);
/*if (calcPseudoBf == YES)
printf (" calcpseudobf yes/no yes\n");
else
printf (" calcpseudobf yes/no no\n");
printf (" cyclefreq <number> %d\n", cycleFreq);*/
printf (" startingtree random/user %s\n", startingTreeModel);
printf (" nperts <number> %d\n", nPerturbations);
if (saveBrlens == YES)
printf (" savebrlens yes/no yes\n\n");
else
printf (" savebrlens yes/no no\n\n");
}
else if (!strcmp(helpRequest, "root"))
{
printf ("\n root\n\n");
printf (" This command roots the tree. If the tree is already\n");
printf (" rooted, a warning is issued. The tree is rooted at\n");
printf (" the outgroup species. The correct usage is \"root\".\n\n");
}
else if (!strcmp(helpRequest, "set"))
{
printf ("\n set\n\n");
printf (" This command sets run conditions of the program. Currently, the only\n");
printf (" option is \"autoclose\". When autoclose=yes, the program will skip\n");
printf (" the querry usually issued at the end of a MCMC analysis.\n\n");
printf (" Options: \n\n");
printf (" Parameter Options Current Setting\n");
printf (" ----------------------------------------------\n");
if (autoclose == YES)
printf (" autoclose yes/no yes\n\n");
else
printf (" autoclose yes/no no\n\n");
}
else if (!strcmp(helpRequest, "charset"))
{
printf ("\n charset\n\n");
printf (" This command defines a character set. The format for the\n");
printf (" charset command is \"charset <name> = <character numbers>\". For \n");
printf (" example, \"charset first_pos = 1-720\\3\" defines a character set \n");
printf (" called \"first_pos\" that includes every third site from 1 to 720. \n");
printf (" The character set name cannot have any spaces in it. The slash (\\) \n");
printf (" is a nifty way of telling the program to assign every third (or \n");
printf (" second, or fifth, or whatever) character to the character set. \n");
printf (" You can assign up to 32 character sets. This option is best used \n");
printf (" not from the command line but rather as a line in the mrbayes block \n");
printf (" of a file. \n\n");
}
else if (!strcmp(helpRequest, "constraint"))
{
printf ("\n constraint\n\n");
printf (" This command defines a tree constraint. The format for the\n");
printf (" constraint command is \"constraint <name> = <list of taxa>\". For \n");
printf (" example, \"constraint apes = human chimp gorilla organg gibbon\" \n");
printf (" defines a constraint consisting of five species. The list of taxa\n");
printf (" defines a constraint on a tree by specifying a taxon bipartition \n");
printf (" that must be present in all trees considered by the MCMC algorithm. \n");
printf (" In effect, by using a constraint, you are specifying a very strong\n");
printf (" prior on the topology of the tree (the posterior probabilities of all\n");
printf (" trees that do not contain the taxon bipartition is zero). For the program\n");
printf (" to actually see a constraint, you must specify enforcecon=yes in the lset\n");
printf (" command. This option is best used as as a line in the mrbayes block.\n\n");
}
else if (!strcmp(helpRequest, "calibration"))
{
printf ("\n calibration\n\n");
printf (" This command defines a calibration on a tree. The format for the\n");
printf (" calibration command is \"calibration <name> = (<min age> <+error>)\n");
printf (" <list of taxa>\". For example, \"calibration apes = (4, 2) human chimp \n");
printf (" gorilla organg gibbon\" defines a calibration consisting of five species. \n");
printf (" The list of taxa defines a constraint on a tree (see description of \n");
printf (" constraint command). The numbers in the parantheses specify two things: \n");
printf (" the first number specifies the youngest age for the clade containing\n");
printf (" the listed taxa; the second number specifies how much older than this\n");
printf (" minimum age the clade can be. The program assumes that the divergence\n");
printf (" time is uniformly distributed on the interval (x, x+y), where x is the\n");
printf (" first number and y is the second number specified in the parantheses.\n");
printf (" In order for the program to see calibrations, you must specify \n");
printf (" enforcecal=yes in the lset command. If you are interested in inferring \n");
printf (" speciation times on a tree (as I suspect you must be if you go through \n");
printf (" the trouble of specifying a calibration), then you should also make certain \n");
printf (" that you assume the molecular clock (or a relaxed version thereof). \n");
printf (" Although you can specify a calibration from the command line, it makes\n");
printf (" more sense to use this option as a line in the mrbayes block. \n\n");
}
else if (!strcmp(helpRequest, "usertree"))
{
printf ("\n usertree\n\n");
printf (" This command allows you to specify a user tree. The user tree can then be\n");
printf (" used as a starting tree for a MCMC analysis. The format for the command is\n");
printf (" \"usertree = <tree in Newick format>\". For example, \"usertree = (A,B,(C,D))\"\n");
printf (" specifies an unrooted tree of four species. Note that the program requires\n");
printf (" that trees are binary (i.e., strictly bifurcating). Hence, there can be only\n");
printf (" one three-way split, as shown in the example. If the tree is not binary, the\n");
printf (" program should return an error.\n\n");
}
else if (!strcmp(helpRequest, "partition"))
{
printf ("\n partition\n\n");
printf (" This command allows you to specify a character partition. The format for \n");
printf (" this command is \"partition <name> = <number of partitions>:<sites in first>,\n");
printf (" <sites in second>,<sites in third>,<sites in fourth>, ...,<sites in last \n");
printf (" partition>\". For example, \"partition by_codon = 3:1st_pos,2nd_pos,3rd_pos\" \n");
printf (" specifies a partition called \"by_codon\" which consists of three parts \n");
printf (" (first, second, and third codon positions). Here, I am assuming that the \n");
printf (" sites in each partition were defined using the charset command. You can \n");
printf (" specify a partition without using charset as follows: \"partition by_codon \n");
printf (" = 3:1 4 6 9 12,2 5 7 10 13,3 6 8 11 14\". However, I recommend that you use \n");
printf (" the charsets to define a set of characters and then use these predefined sets \n");
printf (" when defining the partition. Also, it makes more sense to define a partition\n");
printf (" as a line in the mrbayes block than to issue the command from the command \n");
printf (" line (then again, you may be a masochist, and want to do extra work).\n\n");
}
else if (!strcmp(helpRequest, "cladists"))
{
printf ("\n cladists\n\n");
printf (" Unfortunately, cladists are beyond my ability to help. I suspect that\n");
printf (" you cannot help them either.\n\n");
}
else if (!strcmp(helpRequest, "ken"))
{
printf ("\n ken\n\n");
printf (" mcmc savebrlens=no is the default.\n\n");
}
else if (!strcmp(helpRequest, "props"))
{
printf ("\n props\n\n");
printf (" This command allows you to control aspects of the MCMC algorithm.\n");
printf (" The MCMC algorithm updates parameters in blocks. Each proposal\n");
printf (" mechanism changes the parameter in a specific manner. This command\n");
printf (" lets you change these proposal mechanisms so that the chain mixes\n");
printf (" better for your specific data set. You should only be using this\n");
printf (" command if you have a fairly good understanding of the MCMC algorithm.\n\n");
printf (" Options: \n\n");
printf (" Parameter Current Setting \n");
printf (" ----------------------------------------------\n");
printf (" qmatwin %1.3lf \n", qMatWinProp);
printf (" pialpha %1.3lf \n", piAlphaProp);
printf (" ratewin %1.3lf \n", rateWinProp);
printf (" tuning %1.3lf \n", tuningProp);
printf (" clocktune %1.3lf \n", clockTuneProp);
printf (" timetune %1.3lf \n", timeTuneProp);
printf (" mtune %1.3lf \n", mTuneProp);
printf (" extendp %1.3lf \n", extendPProp);
printf (" wormtune %1.3lf \n", wormTuneProp);
printf (" bdwin %1.3lf \n", bdWinProp);
printf (" omegawin %1.3lf \n", omegaWinProp);
printf (" rhowin %1.3lf \n", rhoWinProp);
printf (" omegaalpha %1.3lf \n", omegaAlphaProp);
printf (" invslide %1.3lf \n", invSlideProp);
printf (" switchwin %1.3lf \n", switchWinProp);
printf (" alphawin %1.3lf \n", alphaWinProp);
printf (" reconlim %1.0lf \n", reconLimProp);
printf (" tbrextendp %1.3lf \n", tbrExtendPProp);
printf (" tbrtune %1.3lf \n", tbrTuneProp);
printf (" blTune %1.3lf \n", blTuneProp);
/*printf (" node time window %lf \n", nodeTimeTuneProp);*/
}
else if (!strcmp(helpRequest, "deroot"))
{
printf ("\n deroot\n\n");
printf (" This command deroots the tree. If the tree is already\n");
printf (" unrooted, a warning is issued. The correct usage is \"deroot\".\n\n");
}
else if (!strcmp(helpRequest, "showtree"))
{
printf ("\n showtree\n\n");
printf (" This command shows the current user tree.\n");
printf (" The correct usage is \"showtree\".\n\n");
}
else if (!strcmp(helpRequest, "shownodes"))
{
printf ("\n shownodes\n\n");
printf (" This command shows the current user tree as a linked list\n");
printf (" of nodes. The nodes are formated as \"N w (l=x r=y a=z) <number>\", \n");
printf (" where \"w\" is the node number, \"x\" is the node to the left,\n");
printf (" \"y\" is the node to the right, and \"z\" is the ancestral node to node\n");
printf (" \"w\", respectively. The last decimal number is the length of the\n");
printf (" branch leading to node \"w\". A \"-1\" indicates that the node does\n");
printf (" not exist (is null). The correct usage is \"shownodes\".\n\n");
}
else if (!strcmp(helpRequest, "sumt"))
{
printf ("\n sumt\n\n");
printf (" This command summarizes the trees in a tree file named \"filename\".\n");
printf (" All of the trees are read from the file and the proportion of the\n");
printf (" time any single taxon bipartition is found is counted. The proportion\n");
printf (" of the time that the bipartition is found is an approximation of\n");
printf (" the posterior probability of the bipartition. (Remember that a\n");
printf (" taxon bipartition is defined by removing a branch on the tree, dividing\n");
printf (" the tree into those taxa to the left and right of the removed branch.\n");
printf (" This set is called a taxon bipartition). The branch length of the\n");
printf (" bipartition is also recorded. The result is a list of the taxon\n");
printf (" bipartitions found, the frequency with which they were found, the\n");
printf (" posterior probability of the bipartition and, if branch lengths were\n");
printf (" recorded, the mean and variance of the length of the branch. The\n");
printf (" partition information is output to a file called \"<filename>.parts\". A\n");
printf (" consensus tree is also printed to a file called \"<filename>.con\".\n");
printf (" The consensus tree is either a 50 percent majority rule tree or a\n");
printf (" majority rule tree with all compatible partitions displayed.\n");
printf (" Finally, the number of trees in the tree file that are skipped is\n");
printf (" controlled by the \"burnin\". The default is 0, but you may want\n");
printf (" to discard those trees that were sampled while the chain was not\n");
printf (" at stationarity. You can display the majority rule consensus tree\n");
printf (" using a program such as PAUP*. You will have to manually put the\n");
printf (" probabilities of clades on the tree.\n\n");
printf (" Options: \n\n");
printf (" Parameter Options Current Setting\n");
printf (" ----------------------------------------------------\n");
printf (" filename <name> %s\n", sumTreeFile);
printf (" burnin <number> %d\n", burnIn);
if (consensusType == HALF_COMPAT)
printf (" contype halfcompat/allcompat halfcompat\n\n");
else
printf (" contype halfcompat/allcompat allcompat\n\n");
}
else if (!strcmp(helpRequest, "sump"))
{
printf ("\n sump\n\n");
printf (" This command summarizes the information in a file named \"filename\".\n");
printf (" The program prints three files during a MCMC analysis: one tree file and\n");
printf (" two parameter files. The parameter files have extensions .p and .bp.\n");
printf (" This command, sump, summarizes the information in the file <filename.bp>.\n");
printf (" The output is to the screen, and provides the mean, variance, and\n");
printf (" 95 percent credible interval for the parameter. You may want to\n");
printf (" discard a specified number of observations from the chain as the\n");
printf (" burn-in.\n\n");
printf (" Options: \n\n");
printf (" Parameter Options Current Setting\n");
printf (" ----------------------------------------------------\n");
printf (" filename <name> %s\n", sumParmFile);
printf (" burnin <number> %d\n\n", burnIn);
}
else if (!strcmp(helpRequest, "andrea"))
{
printf ("\n andrea\n\n");
printf (" Unfortunately, helping Andrea is beyond my ability.\n\n");
}
else
{
printf ("\n Sorry, but I don't recognize the command \"%s\" that you\n", helpRequest);
printf (" requested help with.\n\n");
}
}
}
int IsCommandValid (int commandNumber)
{
int i, stopLoop;
command_list *p, *q;
p = q = cmdPtr;
//printf ("cmdPtr = %d\n", p->index);
if (cmdPtr->left != NULL)
{
p = cmdPtr->left;
q = cmdPtr->left;
}
else
{
if (cmdPtr->rNde != NULL)
cmdPtr = cmdPtr->rNde;
else
{
printf ("next is null \n");
return -1;
}
p = cmdPtr->left;
q = cmdPtr->left;
}
//printf (" p = %d\n", p->index);
/* get expected commands */
for (i=0; i<HIERARCHYSIZE; i++)
expectedCommands[i] = -1;
i = 0;
stopLoop = FALSE;
while (stopLoop == FALSE)
{
if (q->cmd != NUMCOMMANDS + SEMICOLON && !(q->cmdName[0] == 'e' && q->cmdName[1] == 'n' && q->cmdName[2] == 'd'))
expectedCommands[i++] = q->index;
if (q->sib != NULL)
q = q->sib;
else
stopLoop = TRUE;
}
stopLoop = FALSE;
while (stopLoop == FALSE)
{
if (commandNumber == p->cmd)
{
cmdPtr = p;
//printf (" now at %d (%s) (%d %d)\n", p->index, p->cmdName, commandNumber, p->cmd);
return (p->action);
}
else if (p->cmd == NUMCOMMANDS + ANYTOKEN && commandNumber != NUMCOMMANDS + SEMICOLON)
{
cmdPtr = p;
//printf (" *now at %d (%s) (%d %d)\n", p->index, p->cmdName, commandNumber, p->cmd);
return (p->action);
}
else
{
if (p->sib != NULL)
p = p->sib;
else
{
stopLoop = TRUE;
}
/*printf (" p = %d\n", p->index);*/
}
}
return (ERROR_ACTION);
}
#if defined (CONTREE)
int IsPartCompatible (unsigned int *smaller, unsigned int *larger, int length)
{
int i;
for (i=0; i<length; i++)
if ((smaller[i]&larger[i]) != 0)
break;
if (i != length) // potentially incompatible
{
for (i=0; i<length; i++)
if ((smaller[i]|larger[i]) != larger[i])
break;
}
if (i == length) // passed either one of the tests
return 1;
else
return 0;
}
int IsPartNested (unsigned int *smaller, unsigned int *larger, int length)
{
int i;
for (i=0; i<length; i++)
if ((smaller[i]|larger[i]) != larger[i])
break;
if (i == length)
return 1;
else
return 0;
}
#endif
int IsIn (char ch, char *s)
{
while (*s)
{
if (*s++ == ch)
return 1;
}
return 0;
}
int IsWhite (char c)
{
if (c == ' ' || c == '\t' || c == '\n')
{
if (c == '\n')
return 2;
return 1;
}
return 0;
}
int NucID (char nuc)
{
char n;
if (nuc == 'U' || nuc == 'u')
n = 'T';
else
n = nuc;
if (n == 'A' || n == 'a')
{
return 1;
}
else if (n == 'C' || n == 'c')
{
return 2;
}
else if (n == 'G' || n == 'g')
{
return 4;
}
else if (n == 'T' || n == 't')
{
return 8;
}
else if (n == 'R' || n == 'r')
{
return 5;
}
else if (n == 'Y' || n == 'y')
{
return 10;
}
else if (n == 'M' || n == 'm')
{
return 3;
}
else if (n == 'K' || n == 'k')
{
return 12;
}
else if (n == 'S' || n == 's')
{
return 6;
}
else if (n == 'W' || n == 'w')
{
return 9;
}
else if (n == 'H' || n == 'h')
{
return 11;
}
else if (n == 'B' || n == 'b')
{
return 14;
}
else if (n == 'V' || n == 'v')
{
return 7;
}
else if (n == 'D' || n == 'd')
{
return 13;
}
else if (n == 'N' || n == 'n')
{
return 15;
}
else if (n == gapChar)
{
return 15;
}
else if (n == missingChar)
{
return 15;
}
else
return -1;
}
void ParseCommand (char *s)
{
int i, rc, tokenType, commandNumber, actionType, inError, isCommented;
command_list *q;
tokenP = &s[0];
cmdPtr = &cmdList[41];
isCommented = NO;
inError = NO;
changeToLower = YES;
do
{
GetToken (&tokenType);
commandNumber = ParseToken (tokenType);
if (commandNumber == NUMCOMMANDS + LEFTCOMMENT)
isCommented = YES;
if (*token && isCommented == NO)
{
//printf (" token = %s (%d %d)\n", token, tokenType, commandNumber);
actionType = IsCommandValid (commandNumber);
//printf ("actionType = %d\n", actionType);
if (actionType == ERROR_ACTION)
{
//printf ("\n");
inError = YES;
if (tokenType != SEMICOLON)
printf (" ERROR: Invalid command \"%s\"\n", token);
if (expectedCommands[0] != -1)
{
printf (" EXPECTING: ");
i = 0;
while (expectedCommands[i] != -1)
{
q = &cmdList[expectedCommands[i]];
printf ("\"%s\"", q->cmdName);
i++;
if (expectedCommands[i+1] == -1 && expectedCommands[i] != -1)
printf (", or ");
else if (expectedCommands[i] != -1)
printf (", ");
if (i % 4 == 0)
printf ("\n ");
}
//printf ("\n");
}
printf ("\n");
}
else if (actionType >= 0)
{
rc = DoAction (actionType);
if (rc == ERROR)
goto errorExit;
}
}
if (commandNumber == NUMCOMMANDS + RIGHTCOMMENT)
isCommented = NO;
} while (*token && inError == NO);
errorExit:
;
}
int ParseToken (int tokenType)
{
int i;
char tempToken[NUMTOKENCHARS];
PrepareToken ();
for (i=0; i<NUMCOMMANDS; i++)
{
ReadInTempToken (tempToken, i);
if (!strcmp (token, tempToken))
return (i);
}
return (tokenType+NUMCOMMANDS);
}
void PrepareToken (void)
{
int j;
char temp1;
j = 0;
while (token[j] != '\0')
{
temp1 = token[j];
if (changeToLower == YES)
token[j] = ChangeCase (temp1);
else
token[j] = temp1;
j++;
}
}
int ProtID (char aa)
{
if (aa == 'A' || aa == 'a') /* Ala */
{
return 1;
}
else if (aa == 'R' || aa == 'r') /* Arg */
{
return 2;
}
else if (aa == 'N' || aa == 'n') /* Asn */
{
return 3;
}
else if (aa == 'D' || aa == 'd') /* Asp */
{
return 4;
}
else if (aa == 'C' || aa == 'c') /* Cys */
{
return 5;
}
else if (aa == 'Q' || aa == 'q') /* Gln */
{
return 6;
}
else if (aa == 'E' || aa == 'e') /* Glu */
{
return 7;
}
else if (aa == 'G' || aa == 'g') /* Gly */
{
return 8;
}
else if (aa == 'H' || aa == 'h') /* His */
{
return 9;
}
else if (aa == 'I' || aa == 'i') /* Ile */
{
return 10;
}
else if (aa == 'L' || aa == 'l') /* Leu */
{
return 11;
}
else if (aa == 'K' || aa == 'k') /* Lys */
{
return 12;
}
else if (aa == 'M' || aa == 'm') /* Met */
{
return 13;
}
else if (aa == 'F' || aa == 'f') /* Phe */
{
return 14;
}
else if (aa == 'P' || aa == 'p') /* Pro */
{
return 15;
}
else if (aa == 'S' || aa == 's') /* Ser */
{
return 16;
}
else if (aa == 'T' || aa == 't') /* Thr */
{
return 17;
}
else if (aa == 'W' || aa == 'w') /* Trp */
{
return 18;
}
else if (aa == 'Y' || aa == 'y') /* Tyr */
{
return 19;
}
else if (aa == 'V' || aa == 'v') /* Val */
{
return 20;
}
else if (aa == gapChar)
{
return 21;
}
else if (aa == missingChar)
{
return 21;
}
else
return -1;
}
void ReadInTempToken (char tempToken[NUMTOKENCHARS], int i)
{
int j;
for (j=0; j<NUMTOKENCHARS; j++)
tempToken[j] = validTokens[i][j];
tempToken[j] = '\0';
}
int ReadNexusFile (void)
{
int i, rc, tokenType, commandNumber, actionType, inError, isCommented;
char s[STRING_LENGTH];
command_list *q;
FILE *fp, *fopen();
rc = NO_ERROR;
if ((fp = fopen (inFile, "r")) == NULL)
{
printf ("\n ERROR: Could not open file \"%s\"\n\n", inFile);
return ERROR;
}
cmdPtr = &cmdList[0];
isCommented = NO;
inError = NO;
lineNumber = 0;
while (fgets (s, STRING_LENGTH, fp) != NULL)
{
lineNumber++;
//printf ("%s", s);
tokenP = &s[0];
do
{
GetToken (&tokenType);
if (tokenType == RETURNSYMBOL)
returnEncountered = YES;
commandNumber = ParseToken (tokenType);
if (commandNumber == NUMCOMMANDS + LEFTCOMMENT)
isCommented = YES;
if (*token && isCommented == NO)
{
//printf (" token = %s (%d %d)\n", token, tokenType, commandNumber);
actionType = IsCommandValid (commandNumber);
//printf (" actionType = %d\n", actionType);
if (actionType == ERROR_ACTION)
{
printf ("\n");
inError = YES;
if (tokenType != SEMICOLON)
printf (" ERROR: Invalid command \"%s\"\n", token);
if (expectedCommands[0] != -1)
{
printf (" EXPECTING: ");
i = 0;
while (expectedCommands[i] != -1)
{
q = &cmdList[expectedCommands[i]];
printf ("\"%s\"", q->cmdName);
i++;
if (expectedCommands[i+1] == -1 && expectedCommands[i] != -1)
printf (", or ");
else if (expectedCommands[i] != -1)
printf (", ");
if (i % 4 == 0)
printf ("\n ");
if (i % 4 == 0)
printf ("\n ");
}
printf ("\n");
}
//printf ("\n");
}
else if (actionType >= 0)
{
rc = DoAction (actionType);
if (rc == ERROR)
{
printf (" The problem is on line %d of the file named \"%s\"\n", lineNumber, inFile);
goto errorExit;
}
}
}
if (commandNumber == NUMCOMMANDS + RIGHTCOMMENT)
isCommented = NO;
} while (*token && inError == NO);
}
fclose (fp);
return (rc);
errorExit:
fclose (fp);
return (rc);
}
int RealloateTreeParts (void)
{
numPartsAllocated += 100;
treePartsFound = (unsigned *)realloc(treePartsFound, (size_t) (nUnsignedNeeded * numPartsAllocated * sizeof(unsigned)));
if (!treePartsFound)
{
printf (" ERROR: Could not reallocate treePartsFound\n");
free (treeBits);
return (ERROR);
}
numFoundOfThisPart = (int *)realloc(numFoundOfThisPart, (size_t) (numPartsAllocated * sizeof(int)));
if (!numFoundOfThisPart)
{
printf (" ERROR: Could not reallocate numFoundOfThisPart\n");
free (treePartsFound);
free (treeBits);
return (ERROR);
}
aBrlens = (double *)realloc(aBrlens, (size_t) (numPartsAllocated * sizeof(double)));
if (!aBrlens)
{
printf (" ERROR: Could not reallocate aBrlens\n");
free (treePartsFound);
free (treeBits);
free (numFoundOfThisPart);
return (ERROR);
}
aOldBrlens = (double *)realloc(aOldBrlens, (size_t) (numPartsAllocated * sizeof(double)));
if (!aOldBrlens)
{
printf (" ERROR: Could not reallocate aOldBrlens\n");
free (treePartsFound);
free (treeBits);
free (numFoundOfThisPart);
free (aBrlens);
return (ERROR);
}
sBrlens = (double *)realloc(sBrlens, (size_t) (numPartsAllocated * sizeof(double)));
if (!sBrlens)
{
printf (" ERROR: Could not reallocate sBrlens\n");
free (treePartsFound);
free (treeBits);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
return (ERROR);
}
return (NO_ERROR);
}
int ResID (char nuc)
{
char n;
n = nuc;
if (n == '0' || n == 'a' || n == 'A')
{
return 1;
}
else if (n == '1' || n == 'b' || n == 'B')
{
return 2;
}
else if (n == gapChar)
{
return 3;
}
else if (n == missingChar)
{
return 3;
}
else
return -1;
}
int RootTree (TreeNode *p)
{
int i, j, nNodes, *usedMemIndex, availableMemIndex[2], isMarked;
double tempBrLen;
TreeNode **downPass, *first, *second, *lft, *rht, *m1, *m2, *um1, *um2;
/* get down pass sequence */
if (isTreeRooted == YES)
{
printf (" ERROR: Tree is already rooted\n");
return (ERROR);
}
else
{
nNodes = 2 * nTaxa - 2;
}
downPass = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!downPass)
{
printf (" ERROR: Could not allocate downPass\n");
return (ERROR);
}
i = 0;
GetUserDownPass (userTreeRoot, downPass, &i);
/* find available nodes */
usedMemIndex = (int *)malloc((size_t) (2 * nTaxa * sizeof(int)));
if (!usedMemIndex)
{
printf (" ERROR: Could not allocate usedMemIndex\n");
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
usedMemIndex[i] = NO;
for (i=0; i<nNodes; i++)
{
p = downPass[i];
usedMemIndex[p->memoryIndex] = YES;
}
j = 0;
for (i=0; i<2*nTaxa; i++)
{
if (usedMemIndex[i] == NO)
{
if (j <= 1)
{
availableMemIndex[j] = i;
j++;
}
else
{
printf (" ERROR: Too many available nodes\n");
}
}
}
first = &userTree[availableMemIndex[0]];
second = &userTree[availableMemIndex[1]];
free (downPass);
free (usedMemIndex);
/* root tree with previously down taxon as first right */
lft = userTreeRoot->left;
rht = userTreeRoot;
tempBrLen = lft->length;
if (tempBrLen < 0.0)
tempBrLen = 0.0;
lft->anc = first;
rht->left = NULL;
rht->right = NULL;
rht->anc = first;
first->left = lft;
first->right = rht;
first->anc = second;
second->left = first;
second->right = NULL;
second->anc = NULL;
lft->length = tempBrLen * 0.5;
rht->length = tempBrLen * 0.5;
first->length = 0.0;
second->length = 0.0;
userTreeRoot = second;
isTreeRooted = YES;
/* now, bring the outgroup around to the first right position */
downPass = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!downPass)
{
printf (" ERROR: Could not allocate downPass\n");
return (ERROR);
}
i = 0;
GetUserDownPass (userTreeRoot, downPass, &i);
isMarked = NO;
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->index == outgroupNum)
{
p->marked = YES;
isMarked = YES;
}
else
p->marked = NO;
}
if (isMarked == NO)
{
printf (" ERROR: Could not find outgroup taxon\n");
return (ERROR);
}
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->left != NULL && p->right != NULL)
if (p->left->marked == YES || p->right->marked == YES)
p->marked = YES;
}
free (downPass);
lft = userTreeRoot->left;
while (lft->left->index != outgroupNum && lft->right->index != outgroupNum)
{
if (lft->left->marked == YES && lft->right->marked == NO)
{
m1 = lft->left;
um1 = lft->right;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m2;
lft->right = m1;
m2->anc = lft;
m1->left = um2;
m1->right = um1;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else if (lft->left->marked == NO && lft->right->marked == YES)
{
m1 = lft->right;
um1 = lft->left;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m1;
lft->right = m2;
m2->anc = lft;
m1->left = um1;
m1->right = um2;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
/* make certain outgroup is to the right of the root */
if (userTreeRoot->left->left->index == outgroupNum)
{
m1 = userTreeRoot->left->left;
m2 = userTreeRoot->left->right;
lft = userTreeRoot->left;
lft->left = m2;
lft->right = m1;
}
/* reindex internal nodes of tree */
i = nTaxa;
FinishTree (userTreeRoot, &i, YES);
return (NO_ERROR);
}
int RootSumTree (TreeNode *p)
{
int i, j, nNodes, *usedMemIndex, availableMemIndex[2], isMarked;
double tempBrLen;
TreeNode **downPass, *first, *second, *lft, *rht, *m1, *m2, *um1, *um2;
/* get down pass sequence */
if (isSumTreeRooted == YES)
{
printf (" ERROR: Tree is already rooted\n");
return (ERROR);
}
else
{
nNodes = 2 * nTaxa - 2;
}
downPass = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!downPass)
{
printf (" ERROR: Could not allocate downPass\n");
return (ERROR);
}
i = 0;
GetUserDownPass (sumTreeRoot, downPass, &i);
/* find available nodes */
usedMemIndex = (int *)malloc((size_t) (2 * nTaxa * sizeof(int)));
if (!usedMemIndex)
{
printf (" ERROR: Could not allocate usedMemIndex\n");
return (ERROR);
}
for (i=0; i<2*nTaxa; i++)
usedMemIndex[i] = NO;
for (i=0; i<nNodes; i++)
{
p = downPass[i];
usedMemIndex[p->memoryIndex] = YES;
}
j = 0;
for (i=0; i<2*nTaxa; i++)
{
if (usedMemIndex[i] == NO)
{
if (j <= 1)
{
availableMemIndex[j] = i;
j++;
}
else
{
printf (" ERROR: Too many available nodes\n");
}
}
}
first = &sumTree[availableMemIndex[0]];
second = &sumTree[availableMemIndex[1]];
free (downPass);
free (usedMemIndex);
/* root tree with previously down taxon as first right */
lft = sumTreeRoot->left;
rht = sumTreeRoot;
tempBrLen = lft->length;
if (tempBrLen < 0.0)
tempBrLen = 0.0;
lft->anc = first;
rht->left = NULL;
rht->right = NULL;
rht->anc = first;
first->left = lft;
first->right = rht;
first->anc = second;
second->left = first;
second->right = NULL;
second->anc = NULL;
lft->length = tempBrLen * 0.5;
rht->length = tempBrLen * 0.5;
first->length = 0.0;
second->length = 0.0;
sumTreeRoot = second;
isSumTreeRooted = YES;
/* now, bring the outgroup around to the first right position */
downPass = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!downPass)
{
printf (" ERROR: Could not allocate downPass\n");
return (ERROR);
}
i = 0;
GetUserDownPass (sumTreeRoot, downPass, &i);
isMarked = NO;
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->index == outgroupNum)
{
p->marked = YES;
isMarked = YES;
}
else
p->marked = NO;
}
if (isMarked == NO)
{
printf (" ERROR: Could not find outgroup taxon\n");
return (ERROR);
}
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->left != NULL && p->right != NULL)
if (p->left->marked == YES || p->right->marked == YES)
p->marked = YES;
}
free (downPass);
lft = sumTreeRoot->left;
while (lft->left->index != outgroupNum && lft->right->index != outgroupNum)
{
if (lft->left->marked == YES && lft->right->marked == NO)
{
m1 = lft->left;
um1 = lft->right;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m2;
lft->right = m1;
m2->anc = lft;
m1->left = um2;
m1->right = um1;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else if (lft->left->marked == NO && lft->right->marked == YES)
{
m1 = lft->right;
um1 = lft->left;
if (m1->left != NULL && m1->right != NULL)
{
if (m1->left->marked == YES)
{
m2 = m1->left;
um2 = m1->right;
}
else
{
m2 = m1->right;
um2 = m1->left;
}
lft->left = m1;
lft->right = m2;
m2->anc = lft;
m1->left = um1;
m1->right = um2;
m1->anc = lft;
um1->anc = m1;
um2->anc = m1;
m1->marked = NO;
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
else
{
printf (" ERROR: Rooting routine is lost\n");
return (ERROR);
}
}
/* make certain outgroup is to the right of the root */
if (sumTreeRoot->left->left->index == outgroupNum)
{
m1 = sumTreeRoot->left->left;
m2 = sumTreeRoot->left->right;
lft = sumTreeRoot->left;
lft->left = m2;
lft->right = m1;
}
/* reindex internal nodes of tree */
i = nTaxa;
FinishTree (sumTreeRoot, &i, YES);
return (NO_ERROR);
}
int SetBits (int n)
{
int i, integerSize, offSet;
unsigned x, y;
/* find out how big an unsigned integer is on this machine */
integerSize = sizeof (unsigned);
//printf ("integer is %d bytes \n", integerSize);
/* decide how many unsigned ints are going to be needed to
represent a taxon number */
nUnsignedNeeded = (n / (integerSize*8)) + 1;
//printf ("nUnsignedNeeded = %d\n", nUnsignedNeeded);
numPartsAllocated = MAX_PARTITIONS;
/* allocate memory */
treeBits = (unsigned *)malloc((size_t) (2 * nTaxa * nUnsignedNeeded * sizeof(unsigned)));
if (!treeBits)
{
printf (" ERROR: Could not allocate treeBits\n");
return (ERROR);
}
treePartsFound = (unsigned *)malloc((size_t) (nUnsignedNeeded * MAX_PARTITIONS * sizeof(unsigned)));
if (!treePartsFound)
{
printf (" ERROR: Could not allocate treePartsFound\n");
free (treeBits);
return (ERROR);
}
numFoundOfThisPart = (int *)malloc((size_t) (MAX_PARTITIONS * sizeof(int)));
if (!numFoundOfThisPart)
{
printf (" ERROR: Could not allocate numFoundOfThisPart\n");
free (treePartsFound);
free (treeBits);
return (ERROR);
}
aBrlens = (double *)malloc((size_t) (MAX_PARTITIONS * sizeof(double)));
if (!aBrlens)
{
printf (" ERROR: Could not allocate aBrlens\n");
free (treePartsFound);
free (treeBits);
free (numFoundOfThisPart);
return (ERROR);
}
aOldBrlens = (double *)malloc((size_t) (MAX_PARTITIONS * sizeof(double)));
if (!aOldBrlens)
{
printf (" ERROR: Could not allocate aOldBrlens\n");
free (treePartsFound);
free (treeBits);
free (numFoundOfThisPart);
free (aBrlens);
return (ERROR);
}
sBrlens = (double *)malloc((size_t) (MAX_PARTITIONS * sizeof(double)));
if (!sBrlens)
{
printf (" ERROR: Could not allocate sBrlens\n");
free (treePartsFound);
free (treeBits);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
return (ERROR);
}
taxonMask = (unsigned *)malloc((size_t) (nUnsignedNeeded * sizeof(unsigned)));
if (!taxonMask)
{
printf (" ERROR: Could not allocate taxonMask\n");
free (treePartsFound);
free (treeBits);
free (numFoundOfThisPart);
free (aBrlens);
free (aOldBrlens);
free (sBrlens);
return (ERROR);
}
for (i=0; i<2*nTaxa*nUnsignedNeeded; i++)
treeBits[i] = 0;
for (i=0; i<nUnsignedNeeded*MAX_PARTITIONS; i++)
treePartsFound[i] = 0;
for (i=0; i<MAX_PARTITIONS; i++)
numFoundOfThisPart[i] = 0;
for (i=0; i<MAX_PARTITIONS; i++)
aBrlens[i] = aOldBrlens[i] = sBrlens[i] = 0.0;
numTreePartsFound = 0;
for (i=0; i<nUnsignedNeeded; i++)
taxonMask[i] = 0;
for (i=0; i<nTaxa; i++)
{
offSet = 0;
while ((i+1) > integerSize*8*(offSet+1))
offSet++;
x = 1 << (i - offSet*integerSize*8);
y = taxonMask[offSet];
taxonMask[offSet] = x | y;
}
/*for (i=0; i<nUnsignedNeeded; i++)
DisplayBits (taxonMask[i]);*/
return (NO_ERROR);
}
void SetUpCommandHierarchy (void)
{
command_list *p;
/* 0: root of command hierarchy */
p = &cmdList[0];
p->index = 0;
p->parent = NULL;
p->left = &cmdList[1];
p->sib = NULL;
p->rNde = NULL;
p->cmd = -1;
p->action = -1;
strcpy(p->cmdName, "#");
/* 1: # */
p = &cmdList[1];
p->index = 1;
p->parent = &cmdList[0];
p->left = &cmdList[2];
p->sib = &cmdList[3];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + POUNDSIGN;
p->action = -1;
strcpy(p->cmdName, "#");
/* 2: NEXUS */
p = &cmdList[2];
p->index = 2;
p->parent = &cmdList[1];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[0];
p->cmd = 27;
p->action = -1;
strcpy(p->cmdName, "NEXUS");
/* 3: begin */
p = &cmdList[3];
p->index = 3;
p->parent = &cmdList[0];
p->left = &cmdList[4];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 1;
p->action = -1;
strcpy(p->cmdName, "begin");
/* 4: data */
p = &cmdList[4];
p->index = 4;
p->parent = &cmdList[3];
p->left = &cmdList[5];
p->sib = &cmdList[40];
p->rNde = NULL;
p->cmd = 4;
p->action = -1;
strcpy(p->cmdName, "data");
/* 5: ; */
p = &cmdList[5];
p->index = 5;
p->parent = &cmdList[4];
p->left = &cmdList[6];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_INIT_DATA_BLOCK;
strcpy(p->cmdName, ";");
/* 6: dimensions */
p = &cmdList[6];
p->index = 6;
p->parent = &cmdList[5];
p->left = &cmdList[7];
p->sib = &cmdList[14];
p->rNde = NULL;
p->cmd = 12;
p->action = -1;
strcpy(p->cmdName, "dimensions");
/* 7: ntax */
p = &cmdList[7];
p->index = 7;
p->parent = &cmdList[6];
p->left = &cmdList[8];
p->sib = &cmdList[10];
p->rNde = NULL;
p->cmd = 13;
p->action = -1;
strcpy(p->cmdName, "ntax");
/* 8: = */
p = &cmdList[8];
p->index = 8;
p->parent = &cmdList[7];
p->left = &cmdList[9];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 9: digit */
p = &cmdList[9];
p->index = 9;
p->parent = &cmdList[8];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[6];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_NTAX;
strcpy(p->cmdName, "<integer>");
/* 10: nchar */
p = &cmdList[10];
p->index = 10;
p->parent = &cmdList[6];
p->left = &cmdList[11];
p->sib = &cmdList[13];
p->rNde = NULL;
p->cmd = 14;
p->action = -1;
strcpy(p->cmdName, "nchar");
/* 11: = */
p = &cmdList[11];
p->index = 11;
p->parent = &cmdList[10];
p->left = &cmdList[12];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 12: digit */
p = &cmdList[12];
p->index = 12;
p->parent = &cmdList[11];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[6];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_NCHAR;
strcpy(p->cmdName, "<integer>");
/* 13: ; */
p = &cmdList[13];
p->index = 13;
p->parent = &cmdList[6];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[5];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_ALLOC_MATRIX;
strcpy(p->cmdName, ";");
/* 14: format */
p = &cmdList[14];
p->index = 14;
p->parent = &cmdList[5];
p->left = &cmdList[15];
p->sib = &cmdList[34];
p->rNde = NULL;
p->cmd = 15;
p->action = -1;
strcpy(p->cmdName, "format");
/* 15: datatype */
p = &cmdList[15];
p->index = 15;
p->parent = &cmdList[14];
p->left = &cmdList[16];
p->sib = &cmdList[20];
p->rNde = NULL;
p->cmd = 16;
p->action = -1;
strcpy(p->cmdName, "datatype");
/* 16: = */
p = &cmdList[16];
p->index = 16;
p->parent = &cmdList[15];
p->left = &cmdList[17];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 17: dna */
p = &cmdList[17];
p->index = 17;
p->parent = &cmdList[16];
p->left = NULL;
p->sib = &cmdList[18];
p->rNde = &cmdList[14];
p->cmd = 19;
p->action = CMD_INIT_DATATYPE;
strcpy(p->cmdName, "dna");
/* 18: rna */
p = &cmdList[18];
p->index = 18;
p->parent = &cmdList[16];
p->left = NULL;
p->sib = &cmdList[19];
p->rNde = &cmdList[14];
p->cmd = 20;
p->action = CMD_INIT_DATATYPE;
strcpy(p->cmdName, "rna");
/* 19: protein */
p = &cmdList[19];
p->index = 19;
p->parent = &cmdList[16];
p->left = NULL;
p->sib = &cmdList[498];
p->rNde = &cmdList[14];
p->cmd = 21;
p->action = CMD_INIT_DATATYPE;
strcpy(p->cmdName, "protein");
/* 20: interleave */
p = &cmdList[20];
p->index = 20;
p->parent = &cmdList[14];
p->left = &cmdList[21];
p->sib = &cmdList[24];
p->rNde = NULL;
p->cmd = 22;
p->action = -1;
strcpy(p->cmdName, "interleave");
/* 21: = */
p = &cmdList[21];
p->index = 21;
p->parent = &cmdList[20];
p->left = &cmdList[22];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 22: yes */
p = &cmdList[22];
p->index = 22;
p->parent = &cmdList[21];
p->left = NULL;
p->sib = &cmdList[23];
p->rNde = &cmdList[14];
p->cmd = 17;
p->action = CMD_INIT_INTERLEAVE;
strcpy(p->cmdName, "yes");
/* 23: no */
p = &cmdList[23];
p->index = 23;
p->parent = &cmdList[21];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[14];
p->cmd = 18;
p->action = CMD_INIT_INTERLEAVE;
strcpy(p->cmdName, "no");
/* 24: gap */
p = &cmdList[24];
p->index = 24;
p->parent = &cmdList[14];
p->left = &cmdList[25];
p->sib = &cmdList[27];
p->rNde = NULL;
p->cmd = 23;
p->action = -1;
strcpy(p->cmdName, "gap");
/* 25: = */
p = &cmdList[25];
p->index = 25;
p->parent = &cmdList[24];
p->left = &cmdList[26];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 26: gapcharacter */
p = &cmdList[26];
p->index = 26;
p->parent = &cmdList[25];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[14];
p->cmd = NUMCOMMANDS + ANYTOKEN;
p->action = CMD_INIT_GAPCHAR;
strcpy(p->cmdName, "<single character>");
/* 27: missing */
p = &cmdList[27];
p->index = 27;
p->parent = &cmdList[14];
p->left = &cmdList[28];
p->sib = &cmdList[30];
p->rNde = NULL;
p->cmd = 25;
p->action = -1;
strcpy(p->cmdName, "missing");
/* 28: = */
p = &cmdList[28];
p->index = 28;
p->parent = &cmdList[27];
p->left = &cmdList[29];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 29: missing character */
p = &cmdList[29];
p->index = 29;
p->parent = &cmdList[28];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[14];
p->cmd = NUMCOMMANDS + ANYTOKEN;
p->action = CMD_INIT_MISSINGCHAR;
strcpy(p->cmdName, "<missing character>");
/* 30: matchchar */
p = &cmdList[30];
p->index = 30;
p->parent = &cmdList[14];
p->left = &cmdList[31];
p->sib = &cmdList[33];
p->rNde = NULL;
p->cmd = 24;
p->action = -1;
strcpy(p->cmdName, "matchchar");
/* 31: = */
p = &cmdList[31];
p->index = 31;
p->parent = &cmdList[30];
p->left = &cmdList[32];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 32: single matching character */
p = &cmdList[32];
p->index = 32;
p->parent = &cmdList[31];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[14];
p->cmd = NUMCOMMANDS + ANYTOKEN;
p->action = CMD_INIT_MATCHCHAR;
strcpy(p->cmdName, "<matching character>");
/* 33: ; */
p = &cmdList[33];
p->index = 33;
p->parent = &cmdList[14];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[5];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 34: matrix */
p = &cmdList[34];
p->index = 34;
p->parent = &cmdList[5];
p->left = &cmdList[35];
p->sib = &cmdList[38];
p->rNde = NULL;
p->cmd = 26;
p->action = CMD_INIT_READ_MATRIX;
strcpy(p->cmdName, "matrix");
/* 35: alpha */
p = &cmdList[35];
p->index = 35;
p->parent = &cmdList[34];
p->left = NULL;
p->sib = &cmdList[36];
p->rNde = &cmdList[34];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_FILL_MATRIX;
strcpy(p->cmdName, "");
/* 36: miscellaneous character */
p = &cmdList[36];
p->index = 36;
p->parent = &cmdList[34];
p->left = NULL;
p->sib = &cmdList[37];
p->rNde = &cmdList[34];
p->cmd = NUMCOMMANDS + ANYTOKEN;
p->action = CMD_FILL_MATRIX;
strcpy(p->cmdName, "");
/* 37: ; */
p = &cmdList[37];
p->index = 37;
p->parent = &cmdList[34];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[5];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_FINISH_READ_MATRIX;
strcpy(p->cmdName, ";");
/* 38: end */
p = &cmdList[38];
p->index = 38;
p->parent = &cmdList[5];
p->left = &cmdList[39];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 2;
p->action = -1;
strcpy(p->cmdName, "end");
/* 39: ; */
p = &cmdList[39];
p->index = 39;
p->parent = &cmdList[38];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[0];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_EXIT_DATA_BLOCK;
strcpy(p->cmdName, ";");
/* 40: mrbayes */
p = &cmdList[40];
p->index = 40;
p->parent = &cmdList[3];
p->left = &cmdList[41];
p->sib = &cmdList[333];
p->rNde = NULL;
p->cmd = 3;
p->action = -1;
strcpy(p->cmdName, "mrbayes");
/* 41: ; */
p = &cmdList[41];
p->index = 41;
p->parent = &cmdList[40];
p->left = &cmdList[42];
p->sib = &cmdList[45];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_ENTER_MRBAYES_BLOCK;
strcpy(p->cmdName, ";");
/* 42: execute */
p = &cmdList[42];
p->index = 42;
p->parent = &cmdList[41];
p->left = &cmdList[43];
p->sib = &cmdList[45];
p->rNde = NULL;
p->cmd = 0;
p->action = CMD_ENTER_INPUT_FILE_NAME1;
strcpy(p->cmdName, "execute");
/* 43: filename */
p = &cmdList[43];
p->index = 43;
p->parent = &cmdList[42];
p->left = &cmdList[44];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_ENTER_INPUT_FILE_NAME2;
strcpy(p->cmdName, "<file name>");
/* 44: ; */
p = &cmdList[44];
p->index = 44;
p->parent = &cmdList[43];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_EXECUTE;
strcpy(p->cmdName, ";");
/* 45: quit */
p = &cmdList[45];
p->index = 45;
p->parent = &cmdList[41];
p->left = &cmdList[46];
p->sib = &cmdList[47];
p->rNde = NULL;
p->cmd = 7;
p->action = -1;
strcpy(p->cmdName, "quit");
/* 46: ; */
p = &cmdList[46];
p->index = 46;
p->parent = &cmdList[45];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_QUIT;
strcpy(p->cmdName, ";");
/* 47: end */
p = &cmdList[47];
p->index = 47;
p->parent = &cmdList[41];
p->left = &cmdList[48];
p->sib = &cmdList[49];
p->rNde = NULL;
p->cmd = 2;
p->action = -1;
strcpy(p->cmdName, "end");
/* 48: ; */
p = &cmdList[48];
p->index = 48;
p->parent = &cmdList[47];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_EXIT_MRBAYES_BLOCK;
strcpy(p->cmdName, ";");
/* 49: help */
p = &cmdList[49];
p->index = 49;
p->parent = &cmdList[41];
p->left = &cmdList[50];
p->sib = &cmdList[53];
p->rNde = NULL;
p->cmd = 6;
p->action = CMD_INIT_HELP;
strcpy(p->cmdName, "help");
/* 50: help command */
p = &cmdList[50];
p->index = 50;
p->parent = &cmdList[49];
p->left = &cmdList[51];
p->sib = &cmdList[52];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ANYTOKEN;
p->action = CMD_ENTER_HELP_Q;
strcpy(p->cmdName, "<command name>");
/* 51: ; */
p = &cmdList[51];
p->index = 51;
p->parent = &cmdList[50];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_GET_USER_SOME_HELP;
strcpy(p->cmdName, ";");
/* 52: ; */
p = &cmdList[52];
p->index = 52;
p->parent = &cmdList[49];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_GET_USER_SOME_HELP;
strcpy(p->cmdName, ";");
/* 53: lset */
p = &cmdList[53];
p->index = 53;
p->parent = &cmdList[41];
p->left = &cmdList[54];
p->sib = &cmdList[106];
p->rNde = NULL;
p->cmd = 8;
p->action = -1;
strcpy(p->cmdName, "lset");
/* 54: nst */
p = &cmdList[54];
p->index = 54;
p->parent = &cmdList[53];
p->left = &cmdList[55];
p->sib = &cmdList[57];
p->rNde = NULL;
p->cmd = 9;
p->action = -1;
strcpy(p->cmdName, "nst");
/* 55: = */
p = &cmdList[55];
p->index = 55;
p->parent = &cmdList[54];
p->left = &cmdList[56];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 56: digit */
p = &cmdList[56];
p->index = 56;
p->parent = &cmdList[55];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_NST;
strcpy(p->cmdName, "digit");
/* 57: rates */
p = &cmdList[57];
p->index = 57;
p->parent = &cmdList[53];
p->left = &cmdList[58];
p->sib = &cmdList[63];
p->rNde = NULL;
p->cmd = 11;
p->action = -1;
strcpy(p->cmdName, "rates");
/* 58: = */
p = &cmdList[58];
p->index = 58;
p->parent = &cmdList[57];
p->left = &cmdList[59];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 59: equal */
p = &cmdList[59];
p->index = 59;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = &cmdList[60];
p->rNde = &cmdList[53];
p->cmd = 28;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "equal");
/* 60: gamma */
p = &cmdList[60];
p->index = 60;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = &cmdList[61];
p->rNde = &cmdList[53];
p->cmd = 29;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "gamma");
/* 61: sitespec */
p = &cmdList[61];
p->index = 61;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = &cmdList[462];
p->rNde = &cmdList[53];
p->cmd = 30;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "sitespec");
/* 62: covarion */
p = &cmdList[62];
p->index = 62;
p->parent = &cmdList[53];
p->left = &cmdList[494];
p->sib = &cmdList[520];
p->rNde = NULL;
p->cmd = 31;
p->action = -1;
strcpy(p->cmdName, "covarion");
/* 63: basefreq */
p = &cmdList[63];
p->index = 63;
p->parent = &cmdList[53];
p->left = &cmdList[64];
p->sib = &cmdList[68];
p->rNde = NULL;
p->cmd = 10;
p->action = -1;
strcpy(p->cmdName, "basefreq");
/* 64: = */
p = &cmdList[64];
p->index = 64;
p->parent = &cmdList[63];
p->left = &cmdList[65];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 65: equal */
p = &cmdList[65];
p->index = 65;
p->parent = &cmdList[64];
p->left = NULL;
p->sib = &cmdList[66];
p->rNde = &cmdList[53];
p->cmd = 28;
p->action = CMD_SET_BASE_FREQ;
strcpy(p->cmdName, "equal");
/* 66: empirical */
p = &cmdList[66];
p->index = 66;
p->parent = &cmdList[64];
p->left = NULL;
p->sib = &cmdList[67];
p->rNde = &cmdList[53];
p->cmd = 36;
p->action = CMD_SET_BASE_FREQ;
strcpy(p->cmdName, "empirical");
/* 67: estimate */
p = &cmdList[67];
p->index = 67;
p->parent = &cmdList[64];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_SET_BASE_FREQ;
strcpy(p->cmdName, "estimate");
/* 68: clock */
p = &cmdList[68];
p->index = 68;
p->parent = &cmdList[53];
p->left = &cmdList[69];
p->sib = &cmdList[73];
p->rNde = NULL;
p->cmd = 32;
p->action = -1;
strcpy(p->cmdName, "clock");
/* 69: = */
p = &cmdList[69];
p->index = 69;
p->parent = &cmdList[68];
p->left = &cmdList[70];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 70: unconstrained */
p = &cmdList[70];
p->index = 70;
p->parent = &cmdList[69];
p->left = NULL;
p->sib = &cmdList[71];
p->rNde = &cmdList[53];
p->cmd = 33;
p->action = CMD_SET_CLOCK;
strcpy(p->cmdName, "unconstrained");
/* 71: relaxed */
p = &cmdList[71];
p->index = 71;
p->parent = &cmdList[69];
p->left = NULL;
p->sib = &cmdList[72];
p->rNde = &cmdList[53];
p->cmd = 34;
p->action = CMD_SET_CLOCK;
strcpy(p->cmdName, "relaxed");
/* 72: strict */
p = &cmdList[72];
p->index = 72;
p->parent = &cmdList[69];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 35;
p->action = CMD_SET_CLOCK;
strcpy(p->cmdName, "strict");
/* 73: ; */
p = &cmdList[73];
p->index = 73;
p->parent = &cmdList[53];
p->left = NULL;
p->sib = &cmdList[74];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_END_NST;
strcpy(p->cmdName, ";");
/* 74: tratio */
p = &cmdList[74];
p->index = 74;
p->parent = &cmdList[53];
p->left = &cmdList[75];
p->sib = &cmdList[78];
p->rNde = NULL;
p->cmd = 38;
p->action = -1;
strcpy(p->cmdName, "tratio");
/* 75: = */
p = &cmdList[75];
p->index = 75;
p->parent = &cmdList[74];
p->left = &cmdList[76];
p->sib = NULL;
p->rNde = NULL;
p->cmd =NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 76: digit */
p = &cmdList[76];
p->index = 76;
p->parent = &cmdList[75];
p->left = NULL;
p->sib = &cmdList[77];
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_TRATIO;
strcpy(p->cmdName, "<number>");
/* 77: estimate */
p = &cmdList[77];
p->index = 77;
p->parent = &cmdList[75];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_INIT_TRATIO;
strcpy(p->cmdName, "estimate");
/* 78: revmat */
p = &cmdList[78];
p->index = 78;
p->parent = &cmdList[53];
p->left = &cmdList[79];
p->sib = &cmdList[85];
p->rNde = NULL;
p->cmd = 39;
p->action = -1;
strcpy(p->cmdName, "revmat");
/* 79: = */
p = &cmdList[79];
p->index = 79;
p->parent = &cmdList[78];
p->left = &cmdList[80];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 80: ( */
p = &cmdList[80];
p->index = 80;
p->parent = &cmdList[79];
p->left = &cmdList[82];
p->sib = &cmdList[81];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = CMD_INIT_REVRATES;
strcpy(p->cmdName, "(");
/* 81: estimate */
p = &cmdList[81];
p->index = 81;
p->parent = &cmdList[79];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_INIT_REVRATES;
strcpy(p->cmdName, "estimate");
/* 82: digit */
p = &cmdList[82];
p->index = 82;
p->parent = &cmdList[80];
p->left = &cmdList[83];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_REVRATES2;
strcpy(p->cmdName, "<number>");
/* 83: , */
p = &cmdList[83];
p->index = 83;
p->parent = &cmdList[82];
p->left = NULL;
p->sib = &cmdList[84];
p->rNde = &cmdList[80];
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 84: ) */
p = &cmdList[84];
p->index = 84;
p->parent = &cmdList[82];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = CMD_INIT_REVRATES3;
strcpy(p->cmdName, ")");
/* 85: nonrevmat */
p = &cmdList[85];
p->index = 85;
p->parent = &cmdList[53];
p->left = &cmdList[86];
p->sib = &cmdList[92];
p->rNde = NULL;
p->cmd = 40;
p->action = -1;
strcpy(p->cmdName, "nonrevmat");
/* 86: = */
p = &cmdList[86];
p->index = 86;
p->parent = &cmdList[85];
p->left = &cmdList[87];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 87: ( */
p = &cmdList[87];
p->index = 87;
p->parent = &cmdList[86];
p->left = &cmdList[89];
p->sib = &cmdList[88];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = CMD_INIT_NONREVRATES;
strcpy(p->cmdName, "(");
/* 88: estimate */
p = &cmdList[88];
p->index = 88;
p->parent = &cmdList[86];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_INIT_NONREVRATES;
strcpy(p->cmdName, "estimate");
/* 89: digit */
p = &cmdList[89];
p->index = 89;
p->parent = &cmdList[87];
p->left = &cmdList[90];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_NONREVRATES2;
strcpy(p->cmdName, "<number>");
/* 90: , */
p = &cmdList[90];
p->index = 90;
p->parent = &cmdList[89];
p->left = NULL;
p->sib = &cmdList[91];
p->rNde = &cmdList[87];
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 91: ) */
p = &cmdList[91];
p->index = 91;
p->parent = &cmdList[89];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = CMD_INIT_NONREVRATES3;
strcpy(p->cmdName, ")");
/* 92: shape */
p = &cmdList[92];
p->index = 92;
p->parent = &cmdList[53];
p->left = &cmdList[93];
p->sib = &cmdList[96];
p->rNde = NULL;
p->cmd = 41;
p->action = -1;
strcpy(p->cmdName, "shape");
/* 93: = */
p = &cmdList[93];
p->index = 93;
p->parent = &cmdList[92];
p->left = &cmdList[94];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 94: digit */
p = &cmdList[94];
p->index = 94;
p->parent = &cmdList[93];
p->left = NULL;
p->sib = &cmdList[95];
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_SHAPE;
strcpy(p->cmdName, "<number>");
/* 95: estimate */
p = &cmdList[95];
p->index = 95;
p->parent = &cmdList[93];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_INIT_SHAPE;
strcpy(p->cmdName, "estimate");
/* 96: sitepartition */
p = &cmdList[96];
p->index = 96;
p->parent = &cmdList[53];
p->left = &cmdList[97];
p->sib = &cmdList[99];
p->rNde = NULL;
p->cmd = 42;
p->action = -1;
strcpy(p->cmdName, "sitepartition");
/* 97: = */
p = &cmdList[97];
p->index = 97;
p->parent = &cmdList[96];
p->left = &cmdList[98];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 98: alpha */
p = &cmdList[98];
p->index = 98;
p->parent = &cmdList[97];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_INIT_PARTITION;
strcpy(p->cmdName, "<partition name>");
/* 99: siterates */
p = &cmdList[99];
p->index = 99;
p->parent = &cmdList[53];
p->left = &cmdList[100];
p->sib = &cmdList[282];
p->rNde = NULL;
p->cmd = 43;
p->action = -1;
strcpy(p->cmdName, "siterates");
/* 100: = */
p = &cmdList[100];
p->index = 100;
p->parent = &cmdList[99];
p->left = &cmdList[101];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 101: ( */
p = &cmdList[101];
p->index = 101;
p->parent = &cmdList[100];
p->left = &cmdList[102];
p->sib = &cmdList[105];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = CMD_INIT_SITERATES;
strcpy(p->cmdName, "(");
/* 102: digit */
p = &cmdList[102];
p->index = 102;
p->parent = &cmdList[101];
p->left = &cmdList[103];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_SITERATES2;
strcpy(p->cmdName, "<number>");
/* 103: , */
p = &cmdList[103];
p->index = 103;
p->parent = &cmdList[102];
p->left = NULL;
p->sib = &cmdList[104];
p->rNde = &cmdList[101];
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 104: ) */
p = &cmdList[104];
p->index = 104;
p->parent = &cmdList[102];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 105: estimate */
p = &cmdList[105];
p->index = 105;
p->parent = &cmdList[100];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_INIT_SITERATES;
strcpy(p->cmdName, "estimate");
/* 106: exclude */
p = &cmdList[106];
p->index = 106;
p->parent = &cmdList[41];
p->left = &cmdList[107];
p->sib = &cmdList[111];
p->rNde = NULL;
p->cmd = 46;
p->action = CMD_INIT_EXCLUDE;
strcpy(p->cmdName, "exclude");
/* 107: digit */
p = &cmdList[107];
p->index = 107;
p->parent = &cmdList[106];
p->left = NULL;
p->sib = &cmdList[108];
p->rNde = &cmdList[106];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_EXCLUDE;
strcpy(p->cmdName, "<number>");
/* 108: - */
p = &cmdList[108];
p->index = 108;
p->parent = &cmdList[106];
p->left = NULL;
p->sib = &cmdList[109];
p->rNde = &cmdList[106];
p->cmd = NUMCOMMANDS + DASH;
p->action = CMD_EXCLUDE;
strcpy(p->cmdName, "-");
/* 109: name */
p = &cmdList[109];
p->index = 109;
p->parent = &cmdList[106];
p->left = NULL;
p->sib = &cmdList[110];
p->rNde = &cmdList[106];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_EXCLUDE2;
strcpy(p->cmdName, "<character set>");
/* 110: ; */
p = &cmdList[110];
p->index = 110;
p->parent = &cmdList[106];
p->left = NULL;
p->sib = &cmdList[261];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_EXCLUDE3;
strcpy(p->cmdName, ";");
/* 111: charset */
p = &cmdList[111];
p->index = 111;
p->parent = &cmdList[41];
p->left = &cmdList[112];
p->sib = &cmdList[118];
p->rNde = NULL;
p->cmd = 45;
p->action = -1;
strcpy(p->cmdName, "charset");
/* 112: name */
p = &cmdList[112];
p->index = 112;
p->parent = &cmdList[111];
p->left = &cmdList[113];
p->sib = &cmdList[129];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_INIT_CHARSET_NAME;
strcpy(p->cmdName, "<charset name>");
/* 113: = */
p = &cmdList[113];
p->index = 113;
p->parent = &cmdList[112];
p->left = &cmdList[114];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 114: digit */
p = &cmdList[114];
p->index = 114;
p->parent = &cmdList[113];
p->left = NULL;
p->sib = &cmdList[115];
p->rNde = &cmdList[113];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_CHARSET;
strcpy(p->cmdName, "<number>");
/* 115: - */
p = &cmdList[115];
p->index = 115;
p->parent = &cmdList[113];
p->left = NULL;
p->sib = &cmdList[116];
p->rNde = &cmdList[113];
p->cmd = NUMCOMMANDS + DASH;
p->action = CMD_INIT_CHARSET;
strcpy(p->cmdName, "-");
/* 116: \ */
p = &cmdList[116];
p->index = 116;
p->parent = &cmdList[113];
p->left = NULL;
p->sib = &cmdList[117];
p->rNde = &cmdList[113];
p->cmd = NUMCOMMANDS + FORWARDSLASH;
p->action = CMD_INIT_CHARSET;
strcpy(p->cmdName, "\\");
/* 117: ; */
p = &cmdList[117];
p->index = 117;
p->parent = &cmdList[113];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_INIT_CHARSET2;
strcpy(p->cmdName, ";");
/* 118: partition */
p = &cmdList[118];
p->index = 118;
p->parent = &cmdList[41];
p->left = &cmdList[119];
p->sib = &cmdList[130];
p->rNde = NULL;
p->cmd = 44;
p->action = -1;
strcpy(p->cmdName, "partition");
/* 119: name */
p = &cmdList[119];
p->index = 119;
p->parent = &cmdList[118];
p->left = &cmdList[120];
p->sib = &cmdList[128];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_DEF_PARTITION;
strcpy(p->cmdName, "<partition name>");
/* 120: = */
p = &cmdList[120];
p->index = 120;
p->parent = &cmdList[119];
p->left = &cmdList[121];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 121: digit */
p = &cmdList[121];
p->index = 121;
p->parent = &cmdList[120];
p->left = &cmdList[122];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PARTITION2;
strcpy(p->cmdName, "<number partitions>");
/* 122: : */
p = &cmdList[122];
p->index = 122;
p->parent = &cmdList[121];
p->left = &cmdList[123];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COLON;
p->action = CMD_PARTITION3;
strcpy(p->cmdName, ":");
/* 123: digit */
p = &cmdList[123];
p->index = 123;
p->parent = &cmdList[122];
p->left = NULL;
p->sib = &cmdList[124];
p->rNde = &cmdList[122];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PARTITION4;
strcpy(p->cmdName, "<number>");
/* 124: - */
p = &cmdList[124];
p->index = 124;
p->parent = &cmdList[122];
p->left = NULL;
p->sib = &cmdList[125];
p->rNde = &cmdList[122];
p->cmd = NUMCOMMANDS + DASH;
p->action = CMD_PARTITION4;
strcpy(p->cmdName, "-");
/* 125: name */
p = &cmdList[125];
p->index = 125;
p->parent = &cmdList[122];
p->left = NULL;
p->sib = &cmdList[126];
p->rNde = &cmdList[122];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_PARTITION6;
strcpy(p->cmdName, "<charset name>");
/* 126: \ */
p = &cmdList[126];
p->index = 126;
p->parent = &cmdList[122];
p->left = NULL;
p->sib = &cmdList[127];
p->rNde = &cmdList[122];
p->cmd = NUMCOMMANDS + FORWARDSLASH;
p->action = CMD_PARTITION4;
strcpy(p->cmdName, "\\");
/* 127: ; */
p = &cmdList[127];
p->index = 127;
p->parent = &cmdList[122];
p->left = NULL;
p->sib = &cmdList[134];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_PARTITION5;
strcpy(p->cmdName, ";");
/* 128: number */
p = &cmdList[128];
p->index = 128;
p->parent = &cmdList[118];
p->left = &cmdList[120];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PARTITION;
strcpy(p->cmdName, "<partition number>");
/* 129: number */
p = &cmdList[129];
p->index = 129;
p->parent = &cmdList[111];
p->left = &cmdList[113];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_CHARSET_NAME2;
strcpy(p->cmdName, "<charset number>");
/* 130: outgroup */
p = &cmdList[130];
p->index = 130;
p->parent = &cmdList[41];
p->left = &cmdList[131];
p->sib = &cmdList[135];
p->rNde = NULL;
p->cmd = 47;
p->action = -1;
strcpy(p->cmdName, "outgroup");
/* 131: name */
p = &cmdList[131];
p->index = 131;
p->parent = &cmdList[130];
p->left = &cmdList[133];
p->sib = &cmdList[132];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_DEF_OUTGROUP1;
strcpy(p->cmdName, "<taxon name>");
/* 132: number */
p = &cmdList[132];
p->index = 132;
p->parent = &cmdList[130];
p->left = &cmdList[133];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_DEF_OUTGROUP2;
strcpy(p->cmdName, "<taxon number>");
/* 133: ; */
p = &cmdList[133];
p->index = 133;
p->parent = &cmdList[131];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 134: , */
p = &cmdList[134];
p->index = 134;
p->parent = &cmdList[122];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[122];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_PARTITION5;
strcpy(p->cmdName, ",");
/* 135: charstat */
p = &cmdList[135];
p->index = 135;
p->parent = &cmdList[41];
p->left = &cmdList[136];
p->sib = &cmdList[137];
p->rNde = NULL;
p->cmd = 48;
p->action = -1;
strcpy(p->cmdName, "charstat");
/* 136: ; */
p = &cmdList[136];
p->index = 136;
p->parent = &cmdList[135];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SHOW_CHAR_STAT;
strcpy(p->cmdName, ";");
/* 137: calibration */
p = &cmdList[137];
p->index = 137;
p->parent = &cmdList[41];
p->left = &cmdList[138];
p->sib = &cmdList[147];
p->rNde = NULL;
p->cmd = 49;
p->action = -1;
strcpy(p->cmdName, "calibration");
/* 138: name */
p = &cmdList[138];
p->index = 138;
p->parent = &cmdList[137];
p->left = &cmdList[139];
p->sib = &cmdList[162];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_CALIBRATION1;
strcpy(p->cmdName, "<calibration name>");
/* 139: = */
p = &cmdList[139];
p->index = 139;
p->parent = &cmdList[138];
p->left = &cmdList[140];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 140: ( */
p = &cmdList[140];
p->index = 140;
p->parent = &cmdList[139];
p->left = &cmdList[141];
p->sib = &cmdList[145];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 141: digit */
p = &cmdList[141];
p->index = 141;
p->parent = &cmdList[140];
p->left = &cmdList[142];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_CALIBRATION3;
strcpy(p->cmdName, "<time>");
/* 142: , */
p = &cmdList[142];
p->index = 142;
p->parent = &cmdList[141];
p->left = &cmdList[143];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 143: digit */
p = &cmdList[143];
p->index = 143;
p->parent = &cmdList[142];
p->left = &cmdList[144];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_CALIBRATION4;
strcpy(p->cmdName, "<error>");
/* 144: ) */
p = &cmdList[144];
p->index = 144;
p->parent = &cmdList[143];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[139];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 145: name */
p = &cmdList[145];
p->index = 145;
p->parent = &cmdList[139];
p->left = NULL;
p->sib = &cmdList[146];
p->rNde = &cmdList[139];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_CALIBRATION5;
strcpy(p->cmdName, "<taxon name>");
/* 146: ; */
p = &cmdList[146];
p->index = 146;
p->parent = &cmdList[139];
p->left = NULL;
p->sib = &cmdList[161];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_CALIBRATION7;
strcpy(p->cmdName, ";");
/* 147: constraint */
p = &cmdList[147];
p->index = 147;
p->parent = &cmdList[41];
p->left = &cmdList[148];
p->sib = &cmdList[152];
p->rNde = NULL;
p->cmd = 50;
p->action = -1;
strcpy(p->cmdName, "constraint");
/* 148: name */
p = &cmdList[148];
p->index = 148;
p->parent = &cmdList[147];
p->left = &cmdList[149];
p->sib = &cmdList[163];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_CONSTRAINT1;
strcpy(p->cmdName, "<constraint name>");
/* 149: = */
p = &cmdList[149];
p->index = 149;
p->parent = &cmdList[148];
p->left = &cmdList[150];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 150: name */
p = &cmdList[150];
p->index = 150;
p->parent = &cmdList[149];
p->left = NULL;
p->sib = &cmdList[151];
p->rNde = &cmdList[149];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_CONSTRAINT3;
strcpy(p->cmdName, "<taxon name>");
/* 151: ; */
p = &cmdList[151];
p->index = 151;
p->parent = &cmdList[149];
p->left = NULL;
p->sib = &cmdList[164];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_CONSTRAINT5;
strcpy(p->cmdName, ";");
/* 152: compchar */
p = &cmdList[152];
p->index = 152;
p->parent = &cmdList[41];
p->left = &cmdList[153];
p->sib = &cmdList[165];
p->rNde = NULL;
p->cmd = 51;
p->action = -1;
strcpy(p->cmdName, "compchar");
/* 153: number */
p = &cmdList[153];
p->index = 153;
p->parent = &cmdList[152];
p->left = &cmdList[154];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = -1;
strcpy(p->cmdName, "<dimension>");
/* 154: : */
p = &cmdList[154];
p->index = 154;
p->parent = &cmdList[153];
p->left = &cmdList[155];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COLON;
p->action = -1;
strcpy(p->cmdName, ":");
/* 155: { */
p = &cmdList[155];
p->index = 155;
p->parent = &cmdList[154];
p->left = &cmdList[156];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTCURLY;
p->action = -1;
strcpy(p->cmdName, "{");
/* 156: digit */
p = &cmdList[156];
p->index = 156;
p->parent = &cmdList[155];
p->left = &cmdList[157];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = -1;
strcpy(p->cmdName, "<character x>");
/* 157: , */
p = &cmdList[157];
p->index = 157;
p->parent = &cmdList[156];
p->left = NULL;
p->sib = &cmdList[158];
p->rNde = &cmdList[155];
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 158: } */
p = &cmdList[158];
p->index = 158;
p->parent = &cmdList[156];
p->left = &cmdList[159];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + RIGHTCURLY;
p->action = -1;
strcpy(p->cmdName, "}");
/* 159: , */
p = &cmdList[159];
p->index = 159;
p->parent = &cmdList[158];
p->left = NULL;
p->sib = &cmdList[160];
p->rNde = &cmdList[154];
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 160: ; */
p = &cmdList[160];
p->index = 160;
p->parent = &cmdList[158];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 161: number */
p = &cmdList[161];
p->index = 161;
p->parent = &cmdList[139];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[139];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_CALIBRATION6;
strcpy(p->cmdName, "<taxon number>");
/* 162: number */
p = &cmdList[162];
p->index = 162;
p->parent = &cmdList[137];
p->left = &cmdList[139];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_CALIBRATION2;
strcpy(p->cmdName, "<calibration number>");
/* 163: number */
p = &cmdList[163];
p->index = 163;
p->parent = &cmdList[137];
p->left = &cmdList[149];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_CONSTRAINT2;
strcpy(p->cmdName, "<constraint number>");
/* 164: digit */
p = &cmdList[164];
p->index = 164;
p->parent = &cmdList[149];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[149];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_CONSTRAINT4;
strcpy(p->cmdName, "<taxon number>");
/* 165: include */
p = &cmdList[165];
p->index = 165;
p->parent = &cmdList[41];
p->left = &cmdList[166];
p->sib = &cmdList[170];
p->rNde = NULL;
p->cmd = 53;
p->action = CMD_INIT_INCLUDE;
strcpy(p->cmdName, "include");
/* 166: digit */
p = &cmdList[166];
p->index = 166;
p->parent = &cmdList[165];
p->left = NULL;
p->sib = &cmdList[167];
p->rNde = &cmdList[165];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INCLUDE;
strcpy(p->cmdName, "<character number>");
/* 167: - */
p = &cmdList[167];
p->index = 167;
p->parent = &cmdList[165];
p->left = NULL;
p->sib = &cmdList[168];
p->rNde = &cmdList[165];
p->cmd = NUMCOMMANDS + DASH;
p->action = CMD_INCLUDE;
strcpy(p->cmdName, "-");
/* 168: name */
p = &cmdList[168];
p->index = 168;
p->parent = &cmdList[165];
p->left = NULL;
p->sib = &cmdList[169];
p->rNde = &cmdList[165];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_INCLUDE2;
strcpy(p->cmdName, "<charset name>");
/* 169: ; */
p = &cmdList[169];
p->index = 169;
p->parent = &cmdList[165];
p->left = NULL;
p->sib = &cmdList[262];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_INCLUDE3;
strcpy(p->cmdName, ";");
/* 170: delete */
p = &cmdList[170];
p->index = 170;
p->parent = &cmdList[41];
p->left = &cmdList[171];
p->sib = &cmdList[174];
p->rNde = NULL;
p->cmd = 54;
p->action = -1;
strcpy(p->cmdName, "delete");
/* 171: name */
p = &cmdList[171];
p->index = 171;
p->parent = &cmdList[170];
p->left = NULL;
p->sib = &cmdList[172];
p->rNde = &cmdList[170];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_DELETE1;
strcpy(p->cmdName, "<taxon name>");
/* 172: ; */
p = &cmdList[172];
p->index = 172;
p->parent = &cmdList[170];
p->left = NULL;
p->sib = &cmdList[173];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 173: digit */
p = &cmdList[173];
p->index = 173;
p->parent = &cmdList[170];
p->left = NULL;
p->sib = &cmdList[263];
p->rNde = &cmdList[170];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_DELETE2;
strcpy(p->cmdName, "<taxon number>");
/* 174: restore */
p = &cmdList[174];
p->index = 174;
p->parent = &cmdList[41];
p->left = &cmdList[175];
p->sib = &cmdList[178];
p->rNde = NULL;
p->cmd = 55;
p->action = -1;
strcpy(p->cmdName, "restore");
/* 175: name */
p = &cmdList[175];
p->index = 175;
p->parent = &cmdList[174];
p->left = NULL;
p->sib = &cmdList[176];
p->rNde = &cmdList[174];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_RESTORE1;
strcpy(p->cmdName, "<taxon name>");
/* 176: digit */
p = &cmdList[176];
p->index = 176;
p->parent = &cmdList[174];
p->left = NULL;
p->sib = &cmdList[177];
p->rNde = &cmdList[174];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_RESTORE2;
strcpy(p->cmdName, "<taxon number>");
/* 177: ; */
p = &cmdList[177];
p->index = 177;
p->parent = &cmdList[174];
p->left = NULL;
p->sib = &cmdList[264];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 178: mcmc */
p = &cmdList[178];
p->index = 178;
p->parent = &cmdList[41];
p->left = &cmdList[179];
p->sib = &cmdList[201];
p->rNde = NULL;
p->cmd = 56;
p->action = CMD_MCMC;
strcpy(p->cmdName, "mcmc");
/* 179: seed */
p = &cmdList[179];
p->index = 179;
p->parent = &cmdList[178];
p->left = &cmdList[180];
p->sib = &cmdList[182];
p->rNde = NULL;
p->cmd = 57;
p->action = -1;
strcpy(p->cmdName, "seed");
/* 180: = */
p = &cmdList[180];
p->index = 180;
p->parent = &cmdList[179];
p->left = &cmdList[181];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 181: digit */
p = &cmdList[181];
p->index = 181;
p->parent = &cmdList[180];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC1;
strcpy(p->cmdName, "<integer>");
/* 182: ngen */
p = &cmdList[182];
p->index = 182;
p->parent = &cmdList[178];
p->left = &cmdList[183];
p->sib = &cmdList[185];
p->rNde = NULL;
p->cmd = 58;
p->action = -1;
strcpy(p->cmdName, "ngen");
/* 183: = */
p = &cmdList[183];
p->index = 183;
p->parent = &cmdList[182];
p->left = &cmdList[184];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 184: digit */
p = &cmdList[184];
p->index = 184;
p->parent = &cmdList[183];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC2;
strcpy(p->cmdName, "<number generations>");
/* 185: samplefreq */
p = &cmdList[185];
p->index = 185;
p->parent = &cmdList[178];
p->left = &cmdList[186];
p->sib = &cmdList[188];
p->rNde = NULL;
p->cmd = 59;
p->action = -1;
strcpy(p->cmdName, "samplefreq");
/* 186: = */
p = &cmdList[186];
p->index = 186;
p->parent = &cmdList[185];
p->left = &cmdList[187];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 187: digit */
p = &cmdList[187];
p->index = 187;
p->parent = &cmdList[186];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC3;
strcpy(p->cmdName, "<sample frequency");
/* 188: printfreq */
p = &cmdList[188];
p->index = 188;
p->parent = &cmdList[178];
p->left = &cmdList[189];
p->sib = &cmdList[191];
p->rNde = NULL;
p->cmd = 60;
p->action = -1;
strcpy(p->cmdName, "printfreq");
/* 189: = */
p = &cmdList[189];
p->index = 189;
p->parent = &cmdList[188];
p->left = &cmdList[190];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 190: digit */
p = &cmdList[190];
p->index = 190;
p->parent = &cmdList[189];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC4;
strcpy(p->cmdName, "<print frequency>");
/* 191: nchains */
p = &cmdList[191];
p->index = 191;
p->parent = &cmdList[178];
p->left = &cmdList[192];
p->sib = &cmdList[194];
p->rNde = NULL;
p->cmd = 61;
p->action = -1;
strcpy(p->cmdName, "nchains");
/* 192: = */
p = &cmdList[192];
p->index = 192;
p->parent = &cmdList[191];
p->left = &cmdList[193];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 193: digit */
p = &cmdList[193];
p->index = 193;
p->parent = &cmdList[192];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC5;
strcpy(p->cmdName, "<number of chains>");
/* 194: temp */
p = &cmdList[194];
p->index = 194;
p->parent = &cmdList[178];
p->left = &cmdList[195];
p->sib = &cmdList[197];
p->rNde = NULL;
p->cmd = 62;
p->action = -1;
strcpy(p->cmdName, "temp");
/* 195: = */
p = &cmdList[195];
p->index = 195;
p->parent = &cmdList[194];
p->left = &cmdList[196];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 196: digit */
p = &cmdList[196];
p->index = 196;
p->parent = &cmdList[195];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC6;
strcpy(p->cmdName, "<temperature>");
/* 197: filename */
p = &cmdList[197];
p->index = 197;
p->parent = &cmdList[178];
p->left = &cmdList[198];
p->sib = &cmdList[200];
p->rNde = NULL;
p->cmd = 63;
p->action = -1;
strcpy(p->cmdName, "filename");
/* 198: = */
p = &cmdList[198];
p->index = 198;
p->parent = &cmdList[197];
p->left = &cmdList[199];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 199: name */
p = &cmdList[199];
p->index = 199;
p->parent = &cmdList[198];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_MCMC7;
strcpy(p->cmdName, "<file name>");
/* 200: ; */
p = &cmdList[200];
p->index = 200;
p->parent = &cmdList[178];
p->left = NULL;
p->sib = &cmdList[266];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_MCMC8;
strcpy(p->cmdName, ";");
/* 201: prset */
p = &cmdList[201];
p->index = 201;
p->parent = &cmdList[41];
p->left = &cmdList[202];
p->sib = &cmdList[270];
p->rNde = NULL;
p->cmd = 64;
p->action = -1;
strcpy(p->cmdName, "prset");
/* 202: qmatpr */
p = &cmdList[202];
p->index = 202;
p->parent = &cmdList[201];
p->left = &cmdList[203];
p->sib = &cmdList[215];
p->rNde = NULL;
p->cmd = 65;
p->action = -1;
strcpy(p->cmdName, "qmatpr");
/* 203: = */
p = &cmdList[203];
p->index = 203;
p->parent = &cmdList[202];
p->left = &cmdList[204];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 204: fixed */
p = &cmdList[204];
p->index = 204;
p->parent = &cmdList[203];
p->left = NULL;
p->sib = &cmdList[205];
p->rNde = &cmdList[201];
p->cmd = 66;
p->action = CMD_PRIOR1;
strcpy(p->cmdName, "fixed");
/* 205: exp */
p = &cmdList[205];
p->index = 205;
p->parent = &cmdList[203];
p->left = &cmdList[206];
p->sib = &cmdList[209];
p->rNde = NULL;
p->cmd = 67;
p->action = CMD_PRIOR2;
strcpy(p->cmdName, "exp");
/* 206: ( */
p = &cmdList[206];
p->index = 206;
p->parent = &cmdList[205];
p->left = &cmdList[207];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 207: digit */
p = &cmdList[207];
p->index = 207;
p->parent = &cmdList[206];
p->left = &cmdList[208];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR4;
strcpy(p->cmdName, "<number>");
/* 208: ) */
p = &cmdList[208];
p->index = 208;
p->parent = &cmdList[207];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 209: uni */
p = &cmdList[209];
p->index = 209;
p->parent = &cmdList[203];
p->left = &cmdList[210];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 68;
p->action = CMD_PRIOR3;
strcpy(p->cmdName, "uni");
/* 210: ( */
p = &cmdList[210];
p->index = 210;
p->parent = &cmdList[209];
p->left = &cmdList[211];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 211: digit */
p = &cmdList[211];
p->index = 211;
p->parent = &cmdList[210];
p->left = &cmdList[212];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR5;
strcpy(p->cmdName, "<number>");
/* 212: , */
p = &cmdList[212];
p->index = 212;
p->parent = &cmdList[211];
p->left = &cmdList[213];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 213: digit */
p = &cmdList[213];
p->index = 213;
p->parent = &cmdList[212];
p->left = &cmdList[214];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR6;
strcpy(p->cmdName, "digit");
/* 214: ) */
p = &cmdList[214];
p->index = 214;
p->parent = &cmdList[213];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 215: basefreqpr */
p = &cmdList[215];
p->index = 215;
p->parent = &cmdList[201];
p->left = &cmdList[216];
p->sib = &cmdList[222];
p->rNde = NULL;
p->cmd = 69;
p->action = -1;
strcpy(p->cmdName, "basefreqpr");
/* 216: = */
p = &cmdList[216];
p->index = 216;
p->parent = &cmdList[215];
p->left = &cmdList[217];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 217: fixed */
p = &cmdList[217];
p->index = 217;
p->parent = &cmdList[216];
p->left = NULL;
p->sib = &cmdList[218];
p->rNde = &cmdList[201];
p->cmd = 66;
p->action = CMD_PRIOR7;
strcpy(p->cmdName, "fixed");
/* 218: dir */
p = &cmdList[218];
p->index = 218;
p->parent = &cmdList[216];
p->left = &cmdList[219];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 70;
p->action = CMD_PRIOR8;
strcpy(p->cmdName, "dir");
/* 219: ( */
p = &cmdList[219];
p->index = 219;
p->parent = &cmdList[218];
p->left = &cmdList[220];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 220: digit */
p = &cmdList[220];
p->index = 220;
p->parent = &cmdList[219];
p->left = &cmdList[221];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR9;
strcpy(p->cmdName, "<number>");
/* 221: ) */
p = &cmdList[221];
p->index = 221;
p->parent = &cmdList[220];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 222: brlenpr */
p = &cmdList[222];
p->index = 222;
p->parent = &cmdList[201];
p->left = &cmdList[223];
p->sib = &cmdList[234];
p->rNde = NULL;
p->cmd = 71;
p->action = -1;
strcpy(p->cmdName, "brlenpr");
/* 223: = */
p = &cmdList[223];
p->index = 223;
p->parent = &cmdList[222];
p->left = &cmdList[224];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 224: uni */
p = &cmdList[224];
p->index = 224;
p->parent = &cmdList[223];
p->left = &cmdList[225];
p->sib = &cmdList[230];
p->rNde = NULL;
p->cmd = 68;
p->action = CMD_PRIOR10;
strcpy(p->cmdName, "uni");
/* 225: ( */
p = &cmdList[225];
p->index = 225;
p->parent = &cmdList[224];
p->left = &cmdList[226];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 226: digit */
p = &cmdList[226];
p->index = 226;
p->parent = &cmdList[225];
p->left = &cmdList[227];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR13;
strcpy(p->cmdName, "<number>");
/* 227: , */
p = &cmdList[227];
p->index = 227;
p->parent = &cmdList[226];
p->left = &cmdList[228];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 228: digit */
p = &cmdList[228];
p->index = 228;
p->parent = &cmdList[227];
p->left = &cmdList[229];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR14;
strcpy(p->cmdName, "<number>");
/* 229: ) */
p = &cmdList[229];
p->index = 229;
p->parent = &cmdList[228];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 230: exp */
p = &cmdList[230];
p->index = 230;
p->parent = &cmdList[223];
p->left = &cmdList[231];
p->sib = &cmdList[260];
p->rNde = NULL;
p->cmd = 67;
p->action = CMD_PRIOR11;
strcpy(p->cmdName, "exp");
/* 231: ( */
p = &cmdList[231];
p->index = 231;
p->parent = &cmdList[230];
p->left = &cmdList[232];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 232: digit */
p = &cmdList[232];
p->index = 232;
p->parent = &cmdList[231];
p->left = &cmdList[233];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR15;
strcpy(p->cmdName, "<number>");
/* 233: ) */
p = &cmdList[233];
p->index = 233;
p->parent = &cmdList[232];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 234: shapepr */
p = &cmdList[234];
p->index = 234;
p->parent = &cmdList[201];
p->left = &cmdList[235];
p->sib = &cmdList[247];
p->rNde = NULL;
p->cmd = 73;
p->action = -1;
strcpy(p->cmdName, "shapepr");
/* 235: = */
p = &cmdList[235];
p->index = 235;
p->parent = &cmdList[234];
p->left = &cmdList[236];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 236: fixed */
p = &cmdList[236];
p->index = 236;
p->parent = &cmdList[235];
p->left = NULL;
p->sib = &cmdList[237];
p->rNde = &cmdList[201];
p->cmd = 66;
p->action = CMD_PRIOR16;
strcpy(p->cmdName, "fixed");
/* 237: uni */
p = &cmdList[237];
p->index = 237;
p->parent = &cmdList[235];
p->left = &cmdList[238];
p->sib = &cmdList[243];
p->rNde = NULL;
p->cmd = 68;
p->action = CMD_PRIOR17;
strcpy(p->cmdName, "uni");
/* 238: ( */
p = &cmdList[238];
p->index = 238;
p->parent = &cmdList[237];
p->left = &cmdList[239];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 239: digit */
p = &cmdList[239];
p->index = 239;
p->parent = &cmdList[238];
p->left = &cmdList[240];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR19;
strcpy(p->cmdName, "<number>");
/* 240: , */
p = &cmdList[240];
p->index = 240;
p->parent = &cmdList[239];
p->left = &cmdList[241];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 241: digit */
p = &cmdList[241];
p->index = 241;
p->parent = &cmdList[240];
p->left = &cmdList[242];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR20;
strcpy(p->cmdName, "<number>");
/* 242: ) */
p = &cmdList[242];
p->index = 242;
p->parent = &cmdList[241];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 243: exp */
p = &cmdList[243];
p->index = 243;
p->parent = &cmdList[235];
p->left = &cmdList[244];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 67;
p->action = CMD_PRIOR18;
strcpy(p->cmdName, "exp");
/* 244: ( */
p = &cmdList[244];
p->index = 244;
p->parent = &cmdList[243];
p->left = &cmdList[245];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 245: digit */
p = &cmdList[245];
p->index = 245;
p->parent = &cmdList[244];
p->left = &cmdList[246];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR21;
strcpy(p->cmdName, "<number>");
/* 246: ) */
p = &cmdList[246];
p->index = 246;
p->parent = &cmdList[245];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 247: siteratepr */
p = &cmdList[247];
p->index = 247;
p->parent = &cmdList[201];
p->left = &cmdList[248];
p->sib = &cmdList[265];
p->rNde = NULL;
p->cmd = 74;
p->action = -1;
strcpy(p->cmdName, "siteratepr");
/* 248: = */
p = &cmdList[248];
p->index = 248;
p->parent = &cmdList[247];
p->left = &cmdList[249];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 249: fixed */
p = &cmdList[249];
p->index = 249;
p->parent = &cmdList[248];
p->left = NULL;
p->sib = &cmdList[250];
p->rNde = &cmdList[201];
p->cmd = 66;
p->action = CMD_PRIOR22;
strcpy(p->cmdName, "fixed");
/* 250: uni */
p = &cmdList[250];
p->index = 250;
p->parent = &cmdList[248];
p->left = &cmdList[251];
p->sib = &cmdList[256];
p->rNde = NULL;
p->cmd = 68;
p->action = CMD_PRIOR23;
strcpy(p->cmdName, "uni");
/* 251: ( */
p = &cmdList[251];
p->index = 251;
p->parent = &cmdList[250];
p->left = &cmdList[252];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 252: digit */
p = &cmdList[252];
p->index = 252;
p->parent = &cmdList[251];
p->left = &cmdList[253];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR25;
strcpy(p->cmdName, "<number>");
/* 253: , */
p = &cmdList[253];
p->index = 253;
p->parent = &cmdList[252];
p->left = &cmdList[254];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 254: digit */
p = &cmdList[254];
p->index = 254;
p->parent = &cmdList[253];
p->left = &cmdList[255];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR26;
strcpy(p->cmdName, "<number>");
/* 255: ) */
p = &cmdList[255];
p->index = 255;
p->parent = &cmdList[254];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 256: exp */
p = &cmdList[256];
p->index = 256;
p->parent = &cmdList[248];
p->left = &cmdList[257];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 67;
p->action = CMD_PRIOR24;
strcpy(p->cmdName, "exp");
/* 257: ( */
p = &cmdList[257];
p->index = 257;
p->parent = &cmdList[256];
p->left = &cmdList[258];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 258: digit */
p = &cmdList[258];
p->index = 258;
p->parent = &cmdList[257];
p->left = &cmdList[259];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_PRIOR27;
strcpy(p->cmdName, "<number>");
/* 259: ) */
p = &cmdList[259];
p->index = 259;
p->parent = &cmdList[258];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 260: bd */
p = &cmdList[260];
p->index = 260;
p->parent = &cmdList[223];
p->left = &cmdList[310];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 72;
p->action = CMD_PRIOR12;
strcpy(p->cmdName, "bd");
/* 261: all */
p = &cmdList[261];
p->index = 261;
p->parent = &cmdList[106];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[106];
p->cmd = 52;
p->action = CMD_EXCLUDE4;
strcpy(p->cmdName, "all");
/* 262: all */
p = &cmdList[262];
p->index = 262;
p->parent = &cmdList[165];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[165];
p->cmd = 52;
p->action = CMD_INCLUDE4;
strcpy(p->cmdName, "all");
/* 263: all */
p = &cmdList[263];
p->index = 263;
p->parent = &cmdList[170];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[170];
p->cmd = 52;
p->action = CMD_DELETE3;
strcpy(p->cmdName, "all");
/* 264: all */
p = &cmdList[264];
p->index = 264;
p->parent = &cmdList[174];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[174];
p->cmd = 52;
p->action = CMD_RESTORE3;
strcpy(p->cmdName, "all");
/* 265: ; */
p = &cmdList[265];
p->index = 265;
p->parent = &cmdList[201];
p->left = NULL;
p->sib = &cmdList[437];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 266: startingtree */
p = &cmdList[266];
p->index = 266;
p->parent = &cmdList[178];
p->left = &cmdList[267];
p->sib = &cmdList[303];
p->rNde = NULL;
p->cmd = 75;
p->action = -1;
strcpy(p->cmdName, "startingtree");
/* 267: = */
p = &cmdList[267];
p->index = 267;
p->parent = &cmdList[266];
p->left = &cmdList[268];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 268: random */
p = &cmdList[268];
p->index = 268;
p->parent = &cmdList[267];
p->left = NULL;
p->sib = &cmdList[269];
p->rNde = &cmdList[178];
p->cmd = 76;
p->action = CMD_MCMC9;
strcpy(p->cmdName, "random");
/* 269: user */
p = &cmdList[269];
p->index = 269;
p->parent = &cmdList[267];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = 77;
p->action = CMD_MCMC9;
strcpy(p->cmdName, "user");
/* 270: usertree */
p = &cmdList[270];
p->index = 270;
p->parent = &cmdList[41];
p->left = &cmdList[271];
p->sib = &cmdList[280];
p->rNde = NULL;
p->cmd = 78;
p->action = -1;
strcpy(p->cmdName, "usertree");
/* 271: = */
p = &cmdList[271];
p->index = 271;
p->parent = &cmdList[270];
p->left = &cmdList[272];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = CMD_TREE;
strcpy(p->cmdName, "=");
/* 272: ( */
p = &cmdList[272];
p->index = 272;
p->parent = &cmdList[271];
p->left = NULL;
p->sib = &cmdList[273];
p->rNde = &cmdList[271];
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = CMD_TREE1;
strcpy(p->cmdName, "(");
/* 273: name */
p = &cmdList[273];
p->index = 273;
p->parent = &cmdList[271];
p->left = NULL;
p->sib = &cmdList[274];
p->rNde = &cmdList[271];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_TREE2;
strcpy(p->cmdName, "<taxon name>");
/* 274: number */
p = &cmdList[274];
p->index = 274;
p->parent = &cmdList[271];
p->left = NULL;
p->sib = &cmdList[275];
p->rNde = &cmdList[271];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_TREE3;
strcpy(p->cmdName, "<taxon number>");
/* 275: ) */
p = &cmdList[275];
p->index = 275;
p->parent = &cmdList[271];
p->left = NULL;
p->sib = &cmdList[276];
p->rNde = &cmdList[271];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = CMD_TREE4;
strcpy(p->cmdName, ")");
/* 276: , */
p = &cmdList[276];
p->index = 276;
p->parent = &cmdList[271];
p->left = NULL;
p->sib = &cmdList[277];
p->rNde = &cmdList[271];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_TREE5;
strcpy(p->cmdName, ",");
/* 277: : */
p = &cmdList[277];
p->index = 277;
p->parent = &cmdList[271];
p->left = &cmdList[279];
p->sib = &cmdList[278];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COLON;
p->action = CMD_TREE6;
strcpy(p->cmdName, ":");
/* 278: ; */
p = &cmdList[278];
p->index = 278;
p->parent = &cmdList[271];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_TREE7;
strcpy(p->cmdName, ";");
/* 279: number */
p = &cmdList[279];
p->index = 279;
p->parent = &cmdList[277];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[271];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_TREE8;
strcpy(p->cmdName, "<branch length>");
/* 280: showtree */
p = &cmdList[280];
p->index = 280;
p->parent = &cmdList[41];
p->left = &cmdList[281];
p->sib = &cmdList[297];
p->rNde = NULL;
p->cmd = 79;
p->action = -1;
strcpy(p->cmdName, "showtree");
/* 281: ; */
p = &cmdList[281];
p->index = 281;
p->parent = &cmdList[280];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SHOWUSERTREE;
strcpy(p->cmdName, ";");
/* 282: enforcecal */
p = &cmdList[282];
p->index = 282;
p->parent = &cmdList[53];
p->left = &cmdList[283];
p->sib = &cmdList[286];
p->rNde = NULL;
p->cmd = 80;
p->action = -1;
strcpy(p->cmdName, "enforcecal");
/* 283: = */
p = &cmdList[283];
p->index = 283;
p->parent = &cmdList[282];
p->left = &cmdList[284];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 284: yes */
p = &cmdList[284];
p->index = 284;
p->parent = &cmdList[283];
p->left = NULL;
p->sib = &cmdList[285];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_INIT_ENFORCECAL;
strcpy(p->cmdName, "yes");
/* 285: no */
p = &cmdList[285];
p->index = 285;
p->parent = &cmdList[283];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_INIT_ENFORCECAL;
strcpy(p->cmdName, "no");
/* 286: enforcecon */
p = &cmdList[286];
p->index = 286;
p->parent = &cmdList[53];
p->left = &cmdList[287];
p->sib = &cmdList[290];
p->rNde = NULL;
p->cmd = 81;
p->action = -1;
strcpy(p->cmdName, "enforcecon");
/* 287: = */
p = &cmdList[287];
p->index = 287;
p->parent = &cmdList[286];
p->left = &cmdList[288];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 288: yes */
p = &cmdList[288];
p->index = 288;
p->parent = &cmdList[287];
p->left = NULL;
p->sib = &cmdList[289];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_INIT_ENFORCECON;
strcpy(p->cmdName, "yes");
/* 289: no */
p = &cmdList[289];
p->index = 289;
p->parent = &cmdList[287];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_INIT_ENFORCECON;
strcpy(p->cmdName, "no");
/* 290: inferanc */
p = &cmdList[290];
p->index = 290;
p->parent = &cmdList[53];
p->left = &cmdList[291];
p->sib = &cmdList[294];
p->rNde = NULL;
p->cmd = 82;
p->action = -1;
strcpy(p->cmdName, "inferanc");
/* 291: = */
p = &cmdList[291];
p->index = 291;
p->parent = &cmdList[290];
p->left = &cmdList[292];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 292: yes */
p = &cmdList[292];
p->index = 292;
p->parent = &cmdList[291];
p->left = NULL;
p->sib = &cmdList[293];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_INIT_INFERANC;
strcpy(p->cmdName, "yes");
/* 293: no */
p = &cmdList[293];
p->index = 293;
p->parent = &cmdList[291];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_INIT_INFERANC;
strcpy(p->cmdName, "no");
/* 294: ncat */
p = &cmdList[294];
p->index = 294;
p->parent = &cmdList[53];
p->left = &cmdList[295];
p->sib = &cmdList[307];
p->rNde = NULL;
p->cmd = 85;
p->action = -1;
strcpy(p->cmdName, "ncat");
/* 295: = */
p = &cmdList[295];
p->index = 295;
p->parent = &cmdList[294];
p->left = &cmdList[296];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 296: digit */
p = &cmdList[296];
p->index = 296;
p->parent = &cmdList[296];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_NCAT;
strcpy(p->cmdName, "<num rate cats");
/* 297: root */
p = &cmdList[297];
p->index = 297;
p->parent = &cmdList[41];
p->left = &cmdList[298];
p->sib = &cmdList[299];
p->rNde = NULL;
p->cmd = 83;
p->action = -1;
strcpy(p->cmdName, "root");
/* 298: ; */
p = &cmdList[298];
p->index = 298;
p->parent = &cmdList[297];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_ROOT_TREE;
strcpy(p->cmdName, ";");
/* 299: deroot */
p = &cmdList[299];
p->index = 299;
p->parent = &cmdList[41];
p->left = &cmdList[300];
p->sib = &cmdList[301];
p->rNde = NULL;
p->cmd = 84;
p->action = -1;
strcpy(p->cmdName, "deroot");
/* 300: ; */
p = &cmdList[300];
p->index = 300;
p->parent = &cmdList[299];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_DEROOT_TREE;
strcpy(p->cmdName, ";");
/* 301: shownodes */
p = &cmdList[301];
p->index = 301;
p->parent = &cmdList[41];
p->left = &cmdList[302];
p->sib = &cmdList[317];
p->rNde = NULL;
p->cmd = 86;
p->action = -1;
strcpy(p->cmdName, "shownodes");
/* 302: ; */
p = &cmdList[302];
p->index = 302;
p->parent = &cmdList[301];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SHOWNODES;
strcpy(p->cmdName, ";");
/* 303: savebrlens */
p = &cmdList[303];
p->index = 303;
p->parent = &cmdList[178];
p->left = &cmdList[304];
p->sib = &cmdList[411];
p->rNde = NULL;
p->cmd = 87;
p->action = -1;
strcpy(p->cmdName, "savebrlens");
/* 304: = */
p = &cmdList[304];
p->index = 304;
p->parent = &cmdList[303];
p->left = &cmdList[305];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 305: yes */
p = &cmdList[305];
p->index = 305;
p->parent = &cmdList[304];
p->left = NULL;
p->sib = &cmdList[306];
p->rNde = &cmdList[178];
p->cmd = 17;
p->action = CMD_SAVEBRLENS;
strcpy(p->cmdName, "yes");
/* 306: no */
p = &cmdList[306];
p->index = 306;
p->parent = &cmdList[304];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = 18;
p->action = CMD_SAVEBRLENS;
strcpy(p->cmdName, "no");
/* 307: seqerror */
p = &cmdList[307];
p->index = 307;
p->parent = &cmdList[53];
p->left = &cmdList[308];
p->sib = &cmdList[414];
p->rNde = NULL;
p->cmd = 88;
p->action = -1;
strcpy(p->cmdName, "seqerror");
/* 308: = */
p = &cmdList[308];
p->index = 308;
p->parent = &cmdList[307];
p->left = &cmdList[309];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 309: digit */
p = &cmdList[309];
p->index = 309;
p->parent = &cmdList[308];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_SEQ_ERROR;
strcpy(p->cmdName, "<number>");
/* 310: ( */
p = &cmdList[310];
p->index = 310;
p->parent = &cmdList[260];
p->left = &cmdList[311];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 311: digit */
p = &cmdList[311];
p->index = 311;
p->parent = &cmdList[310];
p->left = &cmdList[312];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_SP_RATE;
strcpy(p->cmdName, "<speciation rate>");
/* 312: , */
p = &cmdList[312];
p->index = 312;
p->parent = &cmdList[311];
p->left = &cmdList[313];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 313: digit */
p = &cmdList[313];
p->index = 313;
p->parent = &cmdList[312];
p->left = &cmdList[314];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_EX_RATE;
strcpy(p->cmdName, "<extinction rate>");
/* 314: , */
p = &cmdList[314];
p->index = 314;
p->parent = &cmdList[313];
p->left = &cmdList[315];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 315: digit */
p = &cmdList[315];
p->index = 315;
p->parent = &cmdList[314];
p->left = &cmdList[316];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_SAMP_FRAC;
strcpy(p->cmdName, "<sample fraction>");
/* 316: ) */
p = &cmdList[316];
p->index = 316;
p->parent = &cmdList[315];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 317: sumt */
p = &cmdList[317];
p->index = 317;
p->parent = &cmdList[41];
p->left = &cmdList[318];
p->sib = &cmdList[325];
p->rNde = NULL;
p->cmd = 89;
p->action = -1;
strcpy(p->cmdName, "sumt");
/* 318: filename */
p = &cmdList[318];
p->index = 318;
p->parent = &cmdList[317];
p->left = &cmdList[319];
p->sib = &cmdList[321];
p->rNde = NULL;
p->cmd = 63;
p->action = -1;
strcpy(p->cmdName, "filename");
/* 319: = */
p = &cmdList[319];
p->index = 319;
p->parent = &cmdList[318];
p->left = &cmdList[320];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 320: name */
p = &cmdList[320];
p->index = 320;
p->parent = &cmdList[319];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[317];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SUMT_FILENAME;
strcpy(p->cmdName, "<file name>");
/* 321: burnin */
p = &cmdList[321];
p->index = 321;
p->parent = &cmdList[317];
p->left = &cmdList[322];
p->sib = &cmdList[324];
p->rNde = NULL;
p->cmd = 91;
p->action = -1;
strcpy(p->cmdName, "burnin");
/* 322: = */
p = &cmdList[322];
p->index = 322;
p->parent = &cmdList[321];
p->left = &cmdList[323];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 323: digit */
p = &cmdList[323];
p->index = 323;
p->parent = &cmdList[322];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[317];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SUMT_BURN;
strcpy(p->cmdName, "<burn in>");
/* 324: ; */
p = &cmdList[324];
p->index = 324;
p->parent = &cmdList[317];
p->left = NULL;
p->sib = &cmdList[355];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUMT_READFILE;
strcpy(p->cmdName, ";");
/* 325: sump */
p = &cmdList[325];
p->index = 325;
p->parent = &cmdList[41];
p->left = &cmdList[326];
p->sib = &cmdList[371];
p->rNde = NULL;
p->cmd = 90;
p->action = -1;
strcpy(p->cmdName, "sump");
/* 326: filename */
p = &cmdList[326];
p->index = 326;
p->parent = &cmdList[325];
p->left = &cmdList[327];
p->sib = &cmdList[329];
p->rNde = NULL;
p->cmd = 63;
p->action = -1;
strcpy(p->cmdName, "filename");
/* 327: = */
p = &cmdList[327];
p->index = 327;
p->parent = &cmdList[326];
p->left = &cmdList[328];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 328: name */
p = &cmdList[328];
p->index = 328;
p->parent = &cmdList[327];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[325];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SUMP_FILENAME;
strcpy(p->cmdName, "<file name>");
/* 329: burnin */
p = &cmdList[329];
p->index = 329;
p->parent = &cmdList[325];
p->left = &cmdList[330];
p->sib = &cmdList[332];
p->rNde = NULL;
p->cmd = 91;
p->action = -1;
strcpy(p->cmdName, "burnin");
/* 330: = */
p = &cmdList[330];
p->index = 330;
p->parent = &cmdList[329];
p->left = &cmdList[331];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 331: digit */
p = &cmdList[331];
p->index = 331;
p->parent = &cmdList[330];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[325];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SUMP_BURN;
strcpy(p->cmdName, "<burn in>");
/* 332: ; */
p = &cmdList[332];
p->index = 332;
p->parent = &cmdList[325];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUMP_READFILE;
strcpy(p->cmdName, ";");
/* 333: trees */
p = &cmdList[333];
p->index = 333;
p->parent = &cmdList[3];
p->left = &cmdList[334];
p->sib = &cmdList[359];
p->rNde = NULL;
p->cmd = 5;
p->action = -1;
strcpy(p->cmdName, "trees");
/* 334: ; */
p = &cmdList[334];
p->index = 334;
p->parent = &cmdList[333];
p->left = &cmdList[335];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_INIT_TREE_BLK;
strcpy(p->cmdName, ";");
/* 335: end */
p = &cmdList[335];
p->index = 335;
p->parent = &cmdList[334];
p->left = &cmdList[336];
p->sib = &cmdList[337];
p->rNde = NULL;
p->cmd = 2;
p->action = -1;
strcpy(p->cmdName, "end");
/* 336: ; */
p = &cmdList[336];
p->index = 336;
p->parent = &cmdList[335];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[0];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUM_TREE_END;
strcpy(p->cmdName, ";");
/* 337: translate */
p = &cmdList[337];
p->index = 337;
p->parent = &cmdList[334];
p->left = &cmdList[338];
p->sib = &cmdList[343];
p->rNde = NULL;
p->cmd = 93;
p->action = CMD_TRANS_INIT;
strcpy(p->cmdName, "translate");
/* 338: number */
p = &cmdList[338];
p->index = 338;
p->parent = &cmdList[337];
p->left = &cmdList[340];
p->sib = &cmdList[339];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_TRANS_NEW_NM;
strcpy(p->cmdName, "<number>");
/* 339: name */
p = &cmdList[339];
p->index = 339;
p->parent = &cmdList[337];
p->left = &cmdList[340];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_TRANS_NEW_NM;
strcpy(p->cmdName, "<name>");
/* 340: name */
p = &cmdList[340];
p->index = 340;
p->parent = &cmdList[338];
p->left = &cmdList[341];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_TRANS_OLD_NM;
strcpy(p->cmdName, "<taxon name>");
/* 341: , */
p = &cmdList[341];
p->index = 341;
p->parent = &cmdList[340];
p->left = NULL;
p->sib = &cmdList[342];
p->rNde = &cmdList[337];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_TRANS_COMMA;
strcpy(p->cmdName, ",");
/* 342: ; */
p = &cmdList[342];
p->index = 342;
p->parent = &cmdList[340];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[334];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_TRANS_END;
strcpy(p->cmdName, ";");
/* 343: tree */
p = &cmdList[343];
p->index = 343;
p->parent = &cmdList[334];
p->left = &cmdList[344];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 92;
p->action = -1;
strcpy(p->cmdName, "tree");
/* 344: name */
p = &cmdList[344];
p->index = 344;
p->parent = &cmdList[343];
p->left = &cmdList[346];
p->sib = &cmdList[345];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = -1;
strcpy(p->cmdName, "<tree name>");
/* 345: number */
p = &cmdList[345];
p->index = 345;
p->parent = &cmdList[343];
p->left = &cmdList[346];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = -1;
strcpy(p->cmdName, "<tree number>");
/* 346: = */
p = &cmdList[346];
p->index = 346;
p->parent = &cmdList[344];
p->left = &cmdList[347];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = CMD_SUM_TREE;
strcpy(p->cmdName, "=");
/* 347: ( */
p = &cmdList[347];
p->index = 347;
p->parent = &cmdList[346];
p->left = NULL;
p->sib = &cmdList[348];
p->rNde = &cmdList[346];
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = CMD_SUM_TREE1;
strcpy(p->cmdName, "(");
/* 348: name */
p = &cmdList[348];
p->index = 348;
p->parent = &cmdList[346];
p->left = NULL;
p->sib = &cmdList[349];
p->rNde = &cmdList[346];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SUM_TREE2;
strcpy(p->cmdName, "<taxon name>");
/* 349: number */
p = &cmdList[349];
p->index = 349;
p->parent = &cmdList[346];
p->left = NULL;
p->sib = &cmdList[350];
p->rNde = &cmdList[346];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SUM_TREE3;
strcpy(p->cmdName, "<taxon number>");
/* 350: ) */
p = &cmdList[350];
p->index = 350;
p->parent = &cmdList[346];
p->left = NULL;
p->sib = &cmdList[351];
p->rNde = &cmdList[346];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = CMD_SUM_TREE4;
strcpy(p->cmdName, ")");
/* 351: , */
p = &cmdList[351];
p->index = 351;
p->parent = &cmdList[346];
p->left = NULL;
p->sib = &cmdList[352];
p->rNde = &cmdList[346];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_SUM_TREE5;
strcpy(p->cmdName, ",");
/* 352: : */
p = &cmdList[352];
p->index = 352;
p->parent = &cmdList[346];
p->left = &cmdList[354];
p->sib = &cmdList[353];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COLON;
p->action = CMD_SUM_TREE6;
strcpy(p->cmdName, ":");
/* 353: ; */
p = &cmdList[353];
p->index = 353;
p->parent = &cmdList[346];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[334];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUM_TREE7;
strcpy(p->cmdName, ";");
/* 354: digit */
p = &cmdList[354];
p->index = 354;
p->parent = &cmdList[352];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[346];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SUM_TREE8;
strcpy(p->cmdName, "<branch length>");
/* 355: contype */
p = &cmdList[355];
p->index = 355;
p->parent = &cmdList[317];
p->left = &cmdList[356];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 94;
p->action = -1;
strcpy(p->cmdName, "contype");
/* 356: = */
p = &cmdList[356];
p->index = 356;
p->parent = &cmdList[355];
p->left = &cmdList[357];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 357: halfcompat */
p = &cmdList[357];
p->index = 357;
p->parent = &cmdList[356];
p->left = NULL;
p->sib = &cmdList[358];
p->rNde = &cmdList[317];
p->cmd = 95;
p->action = CMD_SUMT_HALFCOMP;
strcpy(p->cmdName, "halfcompat");
/* 358: allcompat */
p = &cmdList[358];
p->index = 358;
p->parent = &cmdList[356];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[317];
p->cmd = 96;
p->action = CMD_SUMT_ALLCOMP;
strcpy(p->cmdName, "allcompat");
/* 359: bayesparams */
p = &cmdList[359];
p->index = 359;
p->parent = &cmdList[3];
p->left = &cmdList[360];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 97;
p->action = -1;
strcpy(p->cmdName, "bayesparams");
/* 360: ; */
p = &cmdList[360];
p->index = 360;
p->parent = &cmdList[359];
p->left = &cmdList[361];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUM_PARM1;
strcpy(p->cmdName, ";");
/* 361: end */
p = &cmdList[361];
p->index = 361;
p->parent = &cmdList[360];
p->left = &cmdList[362];
p->sib = &cmdList[363];
p->rNde = NULL;
p->cmd = 2;
p->action = -1;
strcpy(p->cmdName, "end");
/* 362: ; */
p = &cmdList[362];
p->index = 362;
p->parent = &cmdList[361];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[0];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUM_PARM2;
strcpy(p->cmdName, ";");
/* 363: header */
p = &cmdList[363];
p->index = 363;
p->parent = &cmdList[360];
p->left = &cmdList[364];
p->sib = &cmdList[367];
p->rNde = NULL;
p->cmd = 98;
p->action = -1;
strcpy(p->cmdName, "header");
/* 364: <name> */
p = &cmdList[364];
p->index = 364;
p->parent = &cmdList[363];
p->left = &cmdList[365];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SUM_PARM3;
strcpy(p->cmdName, "<name>");
/* 365: , */
p = &cmdList[365];
p->index = 365;
p->parent = &cmdList[364];
p->left = NULL;
p->sib = &cmdList[366];
p->rNde = &cmdList[363];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_SUM_PARM4;
strcpy(p->cmdName, ",");
/* 366: ; */
p = &cmdList[366];
p->index = 366;
p->parent = &cmdList[364];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[360];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUM_PARM5;
strcpy(p->cmdName, ";");
/* 367: data */
p = &cmdList[367];
p->index = 367;
p->parent = &cmdList[360];
p->left = &cmdList[368];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 4;
p->action = CMD_SUM_PARM6;
strcpy(p->cmdName, "data");
/* 368: number */
p = &cmdList[368];
p->index = 368;
p->parent = &cmdList[367];
p->left = &cmdList[369];
p->sib = &cmdList[465];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SUM_PARM7;
strcpy(p->cmdName, "<number>");
/* 369: , */
p = &cmdList[369];
p->index = 369;
p->parent = &cmdList[368];
p->left = NULL;
p->sib = &cmdList[370];
p->rNde = &cmdList[367];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_SUM_PARM8;
strcpy(p->cmdName, ",");
/* 370: ; */
p = &cmdList[370];
p->index = 370;
p->parent = &cmdList[368];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[360];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUM_PARM9;
strcpy(p->cmdName, ";");
/* 371: set */
p = &cmdList[371];
p->index = 371;
p->parent = &cmdList[41];
p->left = &cmdList[372];
p->sib = &cmdList[377];
p->rNde = NULL;
p->cmd = 99;
p->action = -1;
strcpy(p->cmdName, "set");
/* 372: ; */
p = &cmdList[372];
p->index = 372;
p->parent = &cmdList[371];
p->left = NULL;
p->sib = &cmdList[373];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 373: autoclose */
p = &cmdList[373];
p->index = 373;
p->parent = &cmdList[371];
p->left = &cmdList[374];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 100;
p->action = -1;
strcpy(p->cmdName, "autoclose");
/* 374: = */
p = &cmdList[374];
p->index = 374;
p->parent = &cmdList[373];
p->left = &cmdList[375];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 375: yes */
p = &cmdList[375];
p->index = 375;
p->parent = &cmdList[374];
p->left = NULL;
p->sib = &cmdList[376];
p->rNde = &cmdList[371];
p->cmd = 17;
p->action = CMD_AUTOCLOSE1;
strcpy(p->cmdName, "yes");
/* 376: no */
p = &cmdList[376];
p->index = 376;
p->parent = &cmdList[374];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[371];
p->cmd = 18;
p->action = CMD_AUTOCLOSE2;
strcpy(p->cmdName, "no");
/* 377: mcmcp */
p = &cmdList[377];
p->index = 377;
p->parent = &cmdList[41];
p->left = &cmdList[378];
p->sib = &cmdList[499];
p->rNde = NULL;
p->cmd = 101;
p->action = CMD_MCMCP;
strcpy(p->cmdName, "mcmcp");
/* 378: seed */
p = &cmdList[378];
p->index = 378;
p->parent = &cmdList[377];
p->left = &cmdList[379];
p->sib = &cmdList[381];
p->rNde = NULL;
p->cmd = 57;
p->action = -1;
strcpy(p->cmdName, "seed");
/* 379: = */
p = &cmdList[379];
p->index = 379;
p->parent = &cmdList[378];
p->left = &cmdList[380];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 380: digit */
p = &cmdList[380];
p->index = 380;
p->parent = &cmdList[379];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC1;
strcpy(p->cmdName, "<number>");
/* 381: ngen */
p = &cmdList[381];
p->index = 381;
p->parent = &cmdList[377];
p->left = &cmdList[382];
p->sib = &cmdList[384];
p->rNde = NULL;
p->cmd = 58;
p->action = -1;
strcpy(p->cmdName, "ngen");
/* 382: = */
p = &cmdList[382];
p->index = 382;
p->parent = &cmdList[381];
p->left = &cmdList[383];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 383: digit */
p = &cmdList[383];
p->index = 383;
p->parent = &cmdList[382];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC2;
strcpy(p->cmdName, "<number>");
/* 384: samplefreq */
p = &cmdList[384];
p->index = 384;
p->parent = &cmdList[377];
p->left = &cmdList[385];
p->sib = &cmdList[387];
p->rNde = NULL;
p->cmd = 59;
p->action = -1;
strcpy(p->cmdName, "samplefreq");
/* 385: = */
p = &cmdList[385];
p->index = 385;
p->parent = &cmdList[384];
p->left = &cmdList[386];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 386: digit */
p = &cmdList[386];
p->index = 386;
p->parent = &cmdList[385];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC3;
strcpy(p->cmdName, "<number>");
/* 387: printfreq */
p = &cmdList[387];
p->index = 387;
p->parent = &cmdList[377];
p->left = &cmdList[388];
p->sib = &cmdList[390];
p->rNde = NULL;
p->cmd = 60;
p->action = -1;
strcpy(p->cmdName, "printfreq");
/* 388: = */
p = &cmdList[388];
p->index = 388;
p->parent = &cmdList[387];
p->left = &cmdList[389];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 389: digit */
p = &cmdList[389];
p->index = 389;
p->parent = &cmdList[388];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC4;
strcpy(p->cmdName, "<number>");
/* 390: nchains */
p = &cmdList[390];
p->index = 390;
p->parent = &cmdList[377];
p->left = &cmdList[391];
p->sib = &cmdList[393];
p->rNde = NULL;
p->cmd = 61;
p->action = -1;
strcpy(p->cmdName, "nchains");
/* 391: = */
p = &cmdList[391];
p->index = 391;
p->parent = &cmdList[390];
p->left = &cmdList[392];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 392: digit */
p = &cmdList[392];
p->index = 392;
p->parent = &cmdList[391];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC5;
strcpy(p->cmdName, "<number>");
/* 393: temp */
p = &cmdList[393];
p->index = 393;
p->parent = &cmdList[377];
p->left = &cmdList[394];
p->sib = &cmdList[396];
p->rNde = NULL;
p->cmd = 62;
p->action = -1;
strcpy(p->cmdName, "temp");
/* 394: = */
p = &cmdList[394];
p->index = 394;
p->parent = &cmdList[393];
p->left = &cmdList[395];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 395: digit */
p = &cmdList[395];
p->index = 395;
p->parent = &cmdList[394];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_MCMC6;
strcpy(p->cmdName, "<number>");
/* 396: filename */
p = &cmdList[396];
p->index = 396;
p->parent = &cmdList[377];
p->left = &cmdList[397];
p->sib = &cmdList[399];
p->rNde = NULL;
p->cmd = 63;
p->action = -1;
strcpy(p->cmdName, "filename");
/* 397: = */
p = &cmdList[397];
p->index = 397;
p->parent = &cmdList[396];
p->left = &cmdList[398];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 398: alpha */
p = &cmdList[398];
p->index = 398;
p->parent = &cmdList[397];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_MCMC7;
strcpy(p->cmdName, "<file name>");
/* 399: ; */
p = &cmdList[399];
p->index = 399;
p->parent = &cmdList[377];
p->left = NULL;
p->sib = &cmdList[400];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 400: startingtree */
p = &cmdList[400];
p->index = 400;
p->parent = &cmdList[377];
p->left = &cmdList[401];
p->sib = &cmdList[404];
p->rNde = NULL;
p->cmd = 75;
p->action = -1;
strcpy(p->cmdName, "startingtree");
/* 401: = */
p = &cmdList[401];
p->index = 401;
p->parent = &cmdList[400];
p->left = &cmdList[402];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 402: random */
p = &cmdList[402];
p->index = 402;
p->parent = &cmdList[401];
p->left = NULL;
p->sib = &cmdList[403];
p->rNde = &cmdList[377];
p->cmd = 76;
p->action = CMD_MCMC9;
strcpy(p->cmdName, "random");
/* 403: user */
p = &cmdList[403];
p->index = 403;
p->parent = &cmdList[401];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = 77;
p->action = CMD_MCMC9;
strcpy(p->cmdName, "user");
/* 404: savebrlens */
p = &cmdList[404];
p->index = 404;
p->parent = &cmdList[377];
p->left = &cmdList[405];
p->sib = &cmdList[408];
p->rNde = NULL;
p->cmd = 87;
p->action = -1;
strcpy(p->cmdName, "savebrlens");
/* 405: = */
p = &cmdList[405];
p->index = 405;
p->parent = &cmdList[404];
p->left = &cmdList[406];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 406: yes */
p = &cmdList[406];
p->index = 406;
p->parent = &cmdList[405];
p->left = NULL;
p->sib = &cmdList[407];
p->rNde = &cmdList[377];
p->cmd = 17;
p->action = CMD_SAVEBRLENS;
strcpy(p->cmdName, "yes");
/* 407: no */
p = &cmdList[407];
p->index = 407;
p->parent = &cmdList[405];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = 18;
p->action = CMD_SAVEBRLENS;
strcpy(p->cmdName, "no");
/* 408: nperts */
p = &cmdList[408];
p->index = 408;
p->parent = &cmdList[377];
p->left = &cmdList[409];
p->sib = &cmdList[555];
p->rNde = NULL;
p->cmd = 102;
p->action = -1;
strcpy(p->cmdName, "nperts");
/* 409: = */
p = &cmdList[409];
p->index = 409;
p->parent = &cmdList[408];
p->left = &cmdList[410];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 410: digit */
p = &cmdList[410];
p->index = 410;
p->parent = &cmdList[409];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_NPERB;
strcpy(p->cmdName, "<number>");
/* 411: nperts */
p = &cmdList[411];
p->index = 411;
p->parent = &cmdList[178];
p->left = &cmdList[412];
p->sib = &cmdList[545];
p->rNde = NULL;
p->cmd = 102;
p->action = -1;
strcpy(p->cmdName, "nperts");
/* 412: = */
p = &cmdList[412];
p->index = 412;
p->parent = &cmdList[411];
p->left = &cmdList[413];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 413: digit */
p = &cmdList[413];
p->index = 413;
p->parent = &cmdList[412];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_NPERB;
strcpy(p->cmdName, "<number>");
/* 414: aamodel */
p = &cmdList[414];
p->index = 414;
p->parent = &cmdList[53];
p->left = &cmdList[415];
p->sib = &cmdList[421];
p->rNde = NULL;
p->cmd = 103;
p->action = -1;
strcpy(p->cmdName, "aamodel");
/* 415: = */
p = &cmdList[415];
p->index = 415;
p->parent = &cmdList[414];
p->left = &cmdList[416];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 416: poisson */
p = &cmdList[416];
p->index = 416;
p->parent = &cmdList[415];
p->left = NULL;
p->sib = &cmdList[417];
p->rNde = &cmdList[53];
p->cmd = 104;
p->action = CMD_SET_AAMODEL1;
strcpy(p->cmdName, "poisson");
/* 417: equalin */
p = &cmdList[417];
p->index = 417;
p->parent = &cmdList[415];
p->left = NULL;
p->sib = &cmdList[418];
p->rNde = &cmdList[53];
p->cmd = 105;
p->action = CMD_SET_AAMODEL2;
strcpy(p->cmdName, "equalin");
/* 418: jones */
p = &cmdList[418];
p->index = 418;
p->parent = &cmdList[415];
p->left = NULL;
p->sib = &cmdList[419];
p->rNde = &cmdList[53];
p->cmd = 106;
p->action = CMD_SET_AAMODEL3;
strcpy(p->cmdName, "jones");
/* 419: dayhoff */
p = &cmdList[419];
p->index = 419;
p->parent = &cmdList[415];
p->left = NULL;
p->sib = &cmdList[420];
p->rNde = &cmdList[53];
p->cmd = 107;
p->action = CMD_SET_AAMODEL4;
strcpy(p->cmdName, "dayhoff");
/* 420: gtr */
p = &cmdList[420];
p->index = 420;
p->parent = &cmdList[415];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 108;
p->action = CMD_SET_AAMODEL5;
strcpy(p->cmdName, "gtr");
/* 421: ancfile */
p = &cmdList[421];
p->index = 421;
p->parent = &cmdList[53];
p->left = &cmdList[422];
p->sib = &cmdList[425];
p->rNde = NULL;
p->cmd = 110;
p->action = -1;
strcpy(p->cmdName, "ancfile");
/* 422: = */
p = &cmdList[422];
p->index = 422;
p->parent = &cmdList[421];
p->left = &cmdList[423];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 423: yes */
p = &cmdList[423];
p->index = 423;
p->parent = &cmdList[422];
p->left = NULL;
p->sib = &cmdList[424];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_SET_ANCFILE1;
strcpy(p->cmdName, "yes");
/* 424: no */
p = &cmdList[424];
p->index = 424;
p->parent = &cmdList[422];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_SET_ANCFILE2;
strcpy(p->cmdName, "no");
/* 425: enforcecodon */
p = &cmdList[425];
p->index = 425;
p->parent = &cmdList[53];
p->left = &cmdList[426];
p->sib = &cmdList[429];
p->rNde = NULL;
p->cmd = 111;
p->action = -1;
strcpy(p->cmdName, "enforcecodon");
/* 426: = */
p = &cmdList[426];
p->index = 426;
p->parent = &cmdList[425];
p->left = &cmdList[427];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 427: yes */
p = &cmdList[427];
p->index = 427;
p->parent = &cmdList[426];
p->left = NULL;
p->sib = &cmdList[428];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_SET_CODON1;
strcpy(p->cmdName, "yes");
/* 428: no */
p = &cmdList[428];
p->index = 428;
p->parent = &cmdList[426];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_SET_CODON2;
strcpy(p->cmdName, "no");
/* 429: omegavar */
p = &cmdList[429];
p->index = 429;
p->parent = &cmdList[53];
p->left = &cmdList[430];
p->sib = &cmdList[433];
p->rNde = NULL;
p->cmd = 112;
p->action = -1;
strcpy(p->cmdName, "omegavar");
/* 430: = */
p = &cmdList[430];
p->index = 430;
p->parent = &cmdList[429];
p->left = &cmdList[431];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 431: equal */
p = &cmdList[431];
p->index = 431;
p->parent = &cmdList[430];
p->left = NULL;
p->sib = &cmdList[432];
p->rNde = &cmdList[53];
p->cmd = 28;
p->action = CMD_SET_OMEGAVAR1;
strcpy(p->cmdName, "equal");
/* 432: ny98 */
p = &cmdList[432];
p->index = 432;
p->parent = &cmdList[430];
p->left = NULL;
p->sib = &cmdList[463];
p->rNde = &cmdList[53];
p->cmd = 113;
p->action = CMD_SET_OMEGAVAR2;
strcpy(p->cmdName, "ny98");
/* 433: omega */
p = &cmdList[433];
p->index = 433;
p->parent = &cmdList[53];
p->left = &cmdList[434];
p->sib = &cmdList[450];
p->rNde = NULL;
p->cmd = 114;
p->action = -1;
strcpy(p->cmdName, "omega");
/* 434: = */
p = &cmdList[434];
p->index = 434;
p->parent = &cmdList[433];
p->left = &cmdList[435];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 435: number */
p = &cmdList[435];
p->index = 435;
p->parent = &cmdList[434];
p->left = NULL;
p->sib = &cmdList[436];
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_OMEGA;
strcpy(p->cmdName, "<number>");
/* 436: estimate */
p = &cmdList[436];
p->index = 436;
p->parent = &cmdList[434];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_SET_OMEGA;
strcpy(p->cmdName, "estimate");
/* 437: omegapr */
p = &cmdList[437];
p->index = 437;
p->parent = &cmdList[201];
p->left = &cmdList[438];
p->sib = &cmdList[473];
p->rNde = NULL;
p->cmd = 109;
p->action = -1;
strcpy(p->cmdName, "omegapr");
/* 438: = */
p = &cmdList[438];
p->index = 438;
p->parent = &cmdList[437];
p->left = &cmdList[439];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 439: fixed */
p = &cmdList[439];
p->index = 439;
p->parent = &cmdList[438];
p->left = NULL;
p->sib = &cmdList[440];
p->rNde = &cmdList[201];
p->cmd = 66;
p->action = CMD_OMEGAPR1;
strcpy(p->cmdName, "fixed");
/* 440: uni */
p = &cmdList[440];
p->index = 440;
p->parent = &cmdList[438];
p->left = &cmdList[441];
p->sib = &cmdList[446];
p->rNde = NULL;
p->cmd = 68;
p->action = CMD_OMEGAPR2;
strcpy(p->cmdName, "uni");
/* 441: ( */
p = &cmdList[441];
p->index = 441;
p->parent = &cmdList[440];
p->left = &cmdList[442];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 442: digit */
p = &cmdList[442];
p->index = 442;
p->parent = &cmdList[441];
p->left = &cmdList[443];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = -1;
strcpy(p->cmdName, "<number>");
/* 443: , */
p = &cmdList[443];
p->index = 443;
p->parent = &cmdList[442];
p->left = &cmdList[444];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 444: digit */
p = &cmdList[444];
p->index = 444;
p->parent = &cmdList[443];
p->left = &cmdList[445];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = -1;
strcpy(p->cmdName, "<number>");
/* 445: ) */
p = &cmdList[445];
p->index = 445;
p->parent = &cmdList[444];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 446: exp */
p = &cmdList[446];
p->index = 446;
p->parent = &cmdList[438];
p->left = &cmdList[447];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 67;
p->action = CMD_OMEGAPR5;
strcpy(p->cmdName, "exp");
/* 447: ( */
p = &cmdList[447];
p->index = 447;
p->parent = &cmdList[446];
p->left = &cmdList[448];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 448: digit */
p = &cmdList[448];
p->index = 448;
p->parent = &cmdList[447];
p->left = &cmdList[449];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = -1;
strcpy(p->cmdName, "<number>");
/* 449: ) */
p = &cmdList[449];
p->index = 449;
p->parent = &cmdList[448];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 450: code */
p = &cmdList[450];
p->index = 450;
p->parent = &cmdList[53];
p->left = &cmdList[451];
p->sib = &cmdList[458];
p->rNde = NULL;
p->cmd = 115;
p->action = -1;
strcpy(p->cmdName, "code");
/* 451: = */
p = &cmdList[451];
p->index = 451;
p->parent = &cmdList[450];
p->left = &cmdList[452];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 452: universal */
p = &cmdList[452];
p->index = 452;
p->parent = &cmdList[451];
p->left = NULL;
p->sib = &cmdList[453];
p->rNde = &cmdList[53];
p->cmd = 116;
p->action = CMD_SET_CODE;
strcpy(p->cmdName, "universal");
/* 453: vertmt */
p = &cmdList[453];
p->index = 453;
p->parent = &cmdList[451];
p->left = NULL;
p->sib = &cmdList[454];
p->rNde = &cmdList[53];
p->cmd = 117;
p->action = CMD_SET_CODE;
strcpy(p->cmdName, "vertmt");
/* 454: mycoplasma */
p = &cmdList[454];
p->index = 454;
p->parent = &cmdList[451];
p->left = NULL;
p->sib = &cmdList[455];
p->rNde = &cmdList[53];
p->cmd = 118;
p->action = CMD_SET_CODE;
strcpy(p->cmdName, "mycoplasma");
/* 455: yeast */
p = &cmdList[455];
p->index = 455;
p->parent = &cmdList[451];
p->left = NULL;
p->sib = &cmdList[456];
p->rNde = &cmdList[53];
p->cmd = 119;
p->action = CMD_SET_CODE;
strcpy(p->cmdName, "yeast");
/* 456: ciliates */
p = &cmdList[456];
p->index = 456;
p->parent = &cmdList[451];
p->left = NULL;
p->sib = &cmdList[457];
p->rNde = &cmdList[53];
p->cmd = 120;
p->action = CMD_SET_CODE;
strcpy(p->cmdName, "ciliates");
/* 457: metmt */
p = &cmdList[457];
p->index = 457;
p->parent = &cmdList[451];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 121;
p->action = CMD_SET_CODE;
strcpy(p->cmdName, "metmt");
/* 458: inferpossel */
p = &cmdList[458];
p->index = 458;
p->parent = &cmdList[53];
p->left = &cmdList[459];
p->sib = &cmdList[469];
p->rNde = NULL;
p->cmd = 122;
p->action = -1;
strcpy(p->cmdName, "inferpossel");
/* 459: = */
p = &cmdList[459];
p->index = 459;
p->parent = &cmdList[458];
p->left = &cmdList[460];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 460: yes */
p = &cmdList[460];
p->index = 460;
p->parent = &cmdList[459];
p->left = NULL;
p->sib = &cmdList[461];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_INFERSEL_YES;
strcpy(p->cmdName, "yes");
/* 461: no */
p = &cmdList[461];
p->index = 461;
p->parent = &cmdList[459];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_INFERSEL_NO;
strcpy(p->cmdName, "no");
/* 462: adgamma */
p = &cmdList[462];
p->index = 462;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = &cmdList[486];
p->rNde = &cmdList[53];
p->cmd = 123;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "adgamma");
/* 463: ac1ny98 */
p = &cmdList[463];
p->index = 463;
p->parent = &cmdList[430];
p->left = NULL;
p->sib = &cmdList[464];
p->rNde = &cmdList[53];
p->cmd = 124;
p->action = CMD_SET_OMEGAVAR3;
strcpy(p->cmdName, "ac1ny98");
/* 464: ac2ny98 */
p = &cmdList[464];
p->index = 464;
p->parent = &cmdList[430];
p->left = NULL;
p->sib = &cmdList[497];
p->rNde = &cmdList[53];
p->cmd = 125;
p->action = CMD_SET_OMEGAVAR4;
strcpy(p->cmdName, "ac2ny98");
/* 465: - */
p = &cmdList[465];
p->index = 465;
p->parent = &cmdList[367];
p->left = &cmdList[466];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + DASH;
p->action = -1;
strcpy(p->cmdName, "-");
/* 466: number */
p = &cmdList[466];
p->index = 466;
p->parent = &cmdList[465];
p->left = &cmdList[467];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SUM_PARM10;
strcpy(p->cmdName, "<number>");
/* 467: , */
p = &cmdList[467];
p->index = 467;
p->parent = &cmdList[466];
p->left = NULL;
p->sib = &cmdList[468];
p->rNde = &cmdList[367];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_SUM_PARM8;
strcpy(p->cmdName, ",");
/* 468: ; */
p = &cmdList[468];
p->index = 468;
p->parent = &cmdList[466];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[360];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SUM_PARM9;
strcpy(p->cmdName, ";");
/* 469: lag */
p = &cmdList[469];
p->index = 469;
p->parent = &cmdList[53];
p->left = &cmdList[470];
p->sib = &cmdList[490];
p->rNde = NULL;
p->cmd = 126;
p->action = -1;
strcpy(p->cmdName, "lag");
/* 470: = */
p = &cmdList[470];
p->index = 470;
p->parent = &cmdList[469];
p->left = &cmdList[471];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 471: digit */
p = &cmdList[471];
p->index = 471;
p->parent = &cmdList[470];
p->left = NULL;
p->sib = &cmdList[472];
p->rNde = &cmdList[53];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_INIT_LAG1;
strcpy(p->cmdName, "<number>");
/* 472: estimate */
p = &cmdList[472];
p->index = 472;
p->parent = &cmdList[470];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 37;
p->action = CMD_INIT_LAG2;
strcpy(p->cmdName, "estimate");
/* 473: lagpr */
p = &cmdList[473];
p->index = 473;
p->parent = &cmdList[201];
p->left = &cmdList[474];
p->sib = &cmdList[536];
p->rNde = NULL;
p->cmd = 127;
p->action = -1;
strcpy(p->cmdName, "lagpr");
/* 474: = */
p = &cmdList[474];
p->index = 474;
p->parent = &cmdList[473];
p->left = &cmdList[475];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 475: fixed */
p = &cmdList[475];
p->index = 475;
p->parent = &cmdList[474];
p->left = NULL;
p->sib = &cmdList[476];
p->rNde = &cmdList[201];
p->cmd = 66;
p->action = CMD_SET_LAG_PR1;
strcpy(p->cmdName, "fixed");
/* 476: uni */
p = &cmdList[476];
p->index = 476;
p->parent = &cmdList[474];
p->left = &cmdList[477];
p->sib = &cmdList[482];
p->rNde = NULL;
p->cmd = 68;
p->action = -1;
strcpy(p->cmdName, "uni");
/* 477: ( */
p = &cmdList[477];
p->index = 477;
p->parent = &cmdList[476];
p->left = &cmdList[478];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 478: digit */
p = &cmdList[478];
p->index = 478;
p->parent = &cmdList[477];
p->left = &cmdList[479];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_LAG_PR2;
strcpy(p->cmdName, "<number>");
/* 479: , */
p = &cmdList[479];
p->index = 479;
p->parent = &cmdList[478];
p->left = &cmdList[480];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COMMA;
p->action = -1;
strcpy(p->cmdName, ",");
/* 480: digit */
p = &cmdList[480];
p->index = 480;
p->parent = &cmdList[479];
p->left = &cmdList[481];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_LAG_PR3;
strcpy(p->cmdName, "digit");
/* 481: ) */
p = &cmdList[481];
p->index = 481;
p->parent = &cmdList[480];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 482: exp */
p = &cmdList[482];
p->index = 482;
p->parent = &cmdList[474];
p->left = &cmdList[483];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 67;
p->action = -1;
strcpy(p->cmdName, "exp");
/* 483: ( */
p = &cmdList[483];
p->index = 483;
p->parent = &cmdList[482];
p->left = &cmdList[484];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 484: digit */
p = &cmdList[484];
p->index = 484;
p->parent = &cmdList[483];
p->left = &cmdList[485];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_LAG_PR4;
strcpy(p->cmdName, "<number>");
/* 485: ) */
p = &cmdList[485];
p->index = 485;
p->parent = &cmdList[484];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 486: invariant */
p = &cmdList[486];
p->index = 486;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = &cmdList[487];
p->rNde = &cmdList[53];
p->cmd = 128;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "invariant");
/* 487: invgamma */
p = &cmdList[487];
p->index = 487;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = &cmdList[488];
p->rNde = &cmdList[53];
p->cmd = 129;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "invgamma");
/* 488: ssgamma */
p = &cmdList[488];
p->index = 488;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = &cmdList[489];
p->rNde = &cmdList[53];
p->cmd = 130;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "ssgamma");
/* 489: ssadgamma */
p = &cmdList[489];
p->index = 489;
p->parent = &cmdList[58];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 131;
p->action = CMD_SET_RATES;
strcpy(p->cmdName, "ssadgamma");
/* 490: inferrates */
p = &cmdList[490];
p->index = 490;
p->parent = &cmdList[53];
p->left = &cmdList[491];
p->sib = &cmdList[62];
p->rNde = NULL;
p->cmd = 132;
p->action = -1;
strcpy(p->cmdName, "inferrates");
/* 491: = */
p = &cmdList[491];
p->index = 491;
p->parent = &cmdList[490];
p->left = &cmdList[492];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 492: yes */
p = &cmdList[492];
p->index = 492;
p->parent = &cmdList[491];
p->left = NULL;
p->sib = &cmdList[493];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_SET_INFERRATES1;
strcpy(p->cmdName, "yes");
/* 493: no */
p = &cmdList[493];
p->index = 493;
p->parent = &cmdList[491];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_SET_INFERRATES2;
strcpy(p->cmdName, "no");
/* 494: = */
p = &cmdList[494];
p->index = 494;
p->parent = &cmdList[62];
p->left = &cmdList[495];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 495: yes */
p = &cmdList[495];
p->index = 495;
p->parent = &cmdList[494];
p->left = NULL;
p->sib = &cmdList[496];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_SET_COVARION1;
strcpy(p->cmdName, "yes");
/* 496: no */
p = &cmdList[496];
p->index = 496;
p->parent = &cmdList[494];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_SET_COVARION2;
strcpy(p->cmdName, "no");
/* 497: covny98 */
p = &cmdList[497];
p->index = 497;
p->parent = &cmdList[430];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 133;
p->action = CMD_SET_OMEGAVAR5;
strcpy(p->cmdName, "covny98");
/* 498: restriction */
p = &cmdList[498];
p->index = 498;
p->parent = &cmdList[16];
p->left = NULL;
p->sib = &cmdList[527];
p->rNde = &cmdList[14];
p->cmd = 134;
p->action = CMD_INIT_DATATYPE;
strcpy(p->cmdName, "restriction");
/* 499: props */
p = &cmdList[499];
p->index = 499;
p->parent = &cmdList[41];
p->left = &cmdList[500];
p->sib = &cmdList[543];
p->rNde = NULL;
p->cmd = 151;
p->action = -1;
strcpy(p->cmdName, "props");
/* 500: qmatwin */
p = &cmdList[500];
p->index = 500;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[501];
p->rNde = NULL;
p->cmd = 135;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "qmatwin");
/* 501: pialpha */
p = &cmdList[501];
p->index = 501;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[502];
p->rNde = NULL;
p->cmd = 136;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "pialpha");
/* 502: alphawin */
p = &cmdList[502];
p->index = 502;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[503];
p->rNde = NULL;
p->cmd = 150;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "alphawin");
/* 503: ratewin */
p = &cmdList[503];
p->index = 503;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[504];
p->rNde = NULL;
p->cmd = 137;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "ratewin");
/* 504: tuning */
p = &cmdList[504];
p->index = 504;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[505];
p->rNde = NULL;
p->cmd = 138;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "tuning");
/* 505: clocktune */
p = &cmdList[505];
p->index = 505;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[506];
p->rNde = NULL;
p->cmd = 139;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "clocktune");
/* 506: timetune */
p = &cmdList[506];
p->index = 506;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[507];
p->rNde = NULL;
p->cmd = 140;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "timetune");
/* 507: mtune */
p = &cmdList[507];
p->index = 507;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[508];
p->rNde = NULL;
p->cmd = 141;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "mtune");
/* 508: extendp */
p = &cmdList[508];
p->index = 508;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[509];
p->rNde = NULL;
p->cmd = 142;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "extendp");
/* 509: wormtune */
p = &cmdList[509];
p->index = 509;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[510];
p->rNde = NULL;
p->cmd = 143;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "wormtune");
/* 510: bdwin */
p = &cmdList[510];
p->index = 510;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[511];
p->rNde = NULL;
p->cmd = 144;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "bdwin");
/* 511: omegawin */
p = &cmdList[511];
p->index = 511;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[512];
p->rNde = NULL;
p->cmd = 145;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "omegawin");
/* 512: omegaalpha */
p = &cmdList[512];
p->index = 512;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[513];
p->rNde = NULL;
p->cmd = 146;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "omegaalpha");
/* 513: rhowin */
p = &cmdList[513];
p->index = 513;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[514];
p->rNde = NULL;
p->cmd = 147;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "rhowin");
/* 514: invslide */
p = &cmdList[514];
p->index = 514;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[515];
p->rNde = NULL;
p->cmd = 148;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "invslide");
/* 515: switchwin */
p = &cmdList[515];
p->index = 515;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[516];
p->rNde = NULL;
p->cmd = 149;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "switchwin");
/* 516: ; */
p = &cmdList[516];
p->index = 516;
p->parent = &cmdList[499];
p->left = NULL;
p->sib = &cmdList[519];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 517: = */
p = &cmdList[517];
p->index = 517;
p->parent = &cmdList[500];
p->left = &cmdList[518];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 518: digit */
p = &cmdList[518];
p->index = 518;
p->parent = &cmdList[517];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[499];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_PROPS2;
strcpy(p->cmdName, "<number>");
/* 519: reconlim */
p = &cmdList[519];
p->index = 519;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[524];
p->rNde = NULL;
p->cmd = 152;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "reconlim");
/* 520: covtype */
p = &cmdList[520];
p->index = 520;
p->parent = &cmdList[53];
p->left = &cmdList[521];
p->sib = &cmdList[529];
p->rNde = NULL;
p->cmd = 153;
p->action = -1;
strcpy(p->cmdName, "covtype");
/* 521: = */
p = &cmdList[521];
p->index = 521;
p->parent = &cmdList[520];
p->left = &cmdList[522];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 522: ts98 */
p = &cmdList[522];
p->index = 522;
p->parent = &cmdList[521];
p->left = NULL;
p->sib = &cmdList[523];
p->rNde = &cmdList[53];
p->cmd = 154;
p->action = CMD_SET_COVTYPE;
strcpy(p->cmdName, "ts98");
/* 523: gcswitch */
p = &cmdList[523];
p->index = 523;
p->parent = &cmdList[521];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 155;
p->action = CMD_SET_COVTYPE;
strcpy(p->cmdName, "gcswitch");
/* 524: tbrextendp */
p = &cmdList[524];
p->index = 524;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[525];
p->rNde = NULL;
p->cmd = 156;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "tbrextendp");
/* 525: tbrtune */
p = &cmdList[525];
p->index = 525;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = &cmdList[526];
p->rNde = NULL;
p->cmd = 157;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "tbrtune");
/* 526: bltune */
p = &cmdList[526];
p->index = 526;
p->parent = &cmdList[499];
p->left = &cmdList[517];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 158;
p->action = CMD_SET_PROPS1;
strcpy(p->cmdName, "bltune");
/* 527: standard */
p = &cmdList[527];
p->index = 527;
p->parent = &cmdList[16];
p->left = NULL;
p->sib = &cmdList[528];
p->rNde = &cmdList[14];
p->cmd = 159;
p->action = CMD_INIT_DATATYPE;
strcpy(p->cmdName, "standard");
/* 528: mixed */
p = &cmdList[528];
p->index = 528;
p->parent = &cmdList[16];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[14];
p->cmd = 160;
p->action = CMD_INIT_DATATYPE;
strcpy(p->cmdName, "mixed");
/* 529: coding */
p = &cmdList[529];
p->index = 529;
p->parent = &cmdList[53];
p->left = &cmdList[530];
p->sib = &cmdList[565];
p->rNde = NULL;
p->cmd = 161;
p->action = -1;
strcpy(p->cmdName, "coding");
/* 530: = */
p = &cmdList[530];
p->index = 530;
p->parent = &cmdList[529];
p->left = &cmdList[531];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 531: all */
p = &cmdList[531];
p->index = 531;
p->parent = &cmdList[530];
p->left = NULL;
p->sib = &cmdList[532];
p->rNde = &cmdList[53];
p->cmd = 52;
p->action = CMD_SET_CODING;
strcpy(p->cmdName, "all");
/* 532: variable */
p = &cmdList[532];
p->index = 532;
p->parent = &cmdList[530];
p->left = NULL;
p->sib = &cmdList[533];
p->rNde = &cmdList[53];
p->cmd = 162;
p->action = CMD_SET_CODING;
strcpy(p->cmdName, "variable");
/* 533: informative */
p = &cmdList[533];
p->index = 533;
p->parent = &cmdList[530];
p->left = NULL;
p->sib = &cmdList[534];
p->rNde = &cmdList[53];
p->cmd = 163;
p->action = CMD_SET_CODING;
strcpy(p->cmdName, "informative");
/* 534: noabsence */
p = &cmdList[534];
p->index = 534;
p->parent = &cmdList[530];
p->left = NULL;
p->sib = &cmdList[535];
p->rNde = &cmdList[53];
p->cmd = 164;
p->action = CMD_SET_CODING;
strcpy(p->cmdName, "noabsence");
/* 535: nopresence */
p = &cmdList[535];
p->index = 535;
p->parent = &cmdList[530];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 165;
p->action = CMD_SET_CODING;
strcpy(p->cmdName, "nopresence");
/* 536: statefreqpr */
p = &cmdList[536];
p->index = 536;
p->parent = &cmdList[201];
p->left = &cmdList[537];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 166;
p->action = -1;
strcpy(p->cmdName, "statefreqpr");
/* 537: = */
p = &cmdList[537];
p->index = 537;
p->parent = &cmdList[536];
p->left = &cmdList[538];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 538: fixed */
p = &cmdList[538];
p->index = 538;
p->parent = &cmdList[537];
p->left = NULL;
p->sib = &cmdList[539];
p->rNde = &cmdList[201];
p->cmd = 66;
p->action = CMD_SET_STATE_PR1;
strcpy(p->cmdName, "fixed");
/* 539: dir */
p = &cmdList[539];
p->index = 539;
p->parent = &cmdList[537];
p->left = &cmdList[540];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 70;
p->action = -1;
strcpy(p->cmdName, "dir");
/* 540: ( */
p = &cmdList[540];
p->index = 540;
p->parent = &cmdList[539];
p->left = &cmdList[541];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + LEFTPAR;
p->action = -1;
strcpy(p->cmdName, "(");
/* 541: digit */
p = &cmdList[541];
p->index = 541;
p->parent = &cmdList[540];
p->left = &cmdList[542];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_STATE_PR2;
strcpy(p->cmdName, "<number>");
/* 542: ) */
p = &cmdList[542];
p->index = 542;
p->parent = &cmdList[541];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[201];
p->cmd = NUMCOMMANDS + RIGHTPAR;
p->action = -1;
strcpy(p->cmdName, ")");
/* 543: setmoveprops */
p = &cmdList[543];
p->index = 543;
p->parent = &cmdList[41];
p->left = &cmdList[544];
p->sib = &cmdList[569];
p->rNde = NULL;
p->cmd = 167;
p->action = -1;
strcpy(p->cmdName, "setmoveprops");
/* 544: ; */
p = &cmdList[544];
p->index = 544;
p->parent = &cmdList[543];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SET_MOVE_PROPS;
strcpy(p->cmdName, ";");
/* 545: burnin */
p = &cmdList[545];
p->index = 545;
p->parent = &cmdList[178];
p->left = &cmdList[546];
p->sib = &cmdList[548];
p->rNde = NULL;
p->cmd = 91;
p->action = -1;
strcpy(p->cmdName, "burnin");
/* 546: = */
p = &cmdList[546];
p->index = 546;
p->parent = &cmdList[545];
p->left = &cmdList[547];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 547: digit */
p = &cmdList[547];
p->index = 547;
p->parent = &cmdList[546];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_MCMC_BURN;
strcpy(p->cmdName, "<number>");
/* 548: cyclefreq */
p = &cmdList[548];
p->index = 548;
p->parent = &cmdList[178];
p->left = &cmdList[549];
p->sib = &cmdList[551];
p->rNde = NULL;
p->cmd = 168;
p->action = -1;
strcpy(p->cmdName, "cyclefreq");
/* 549: = */
p = &cmdList[549];
p->index = 549;
p->parent = &cmdList[548];
p->left = &cmdList[550];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 550: digit */
p = &cmdList[550];
p->index = 550;
p->parent = &cmdList[549];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_CYCLEFREQ;
strcpy(p->cmdName, "<number>");
/* 551: calcpseudobf */
p = &cmdList[551];
p->index = 551;
p->parent = &cmdList[178];
p->left = &cmdList[552];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 169;
p->action = -1;
strcpy(p->cmdName, "calcpseudobf");
/* 552: = */
p = &cmdList[552];
p->index = 552;
p->parent = &cmdList[551];
p->left = &cmdList[553];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 553: yes */
p = &cmdList[553];
p->index = 553;
p->parent = &cmdList[552];
p->left = NULL;
p->sib = &cmdList[554];
p->rNde = &cmdList[178];
p->cmd = 17;
p->action = CMD_SET_CALCPSEUDOBF;
strcpy(p->cmdName, "yes");
/* 554: no */
p = &cmdList[554];
p->index = 554;
p->parent = &cmdList[552];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[178];
p->cmd = 18;
p->action = CMD_SET_CALCPSEUDOBF;
strcpy(p->cmdName, "no");
/* 555: burnin */
p = &cmdList[555];
p->index = 555;
p->parent = &cmdList[377];
p->left = &cmdList[556];
p->sib = &cmdList[558];
p->rNde = NULL;
p->cmd = 91;
p->action = -1;
strcpy(p->cmdName, "burnin");
/* 556: = */
p = &cmdList[556];
p->index = 556;
p->parent = &cmdList[555];
p->left = &cmdList[557];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 557: digit */
p = &cmdList[557];
p->index = 557;
p->parent = &cmdList[556];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_MCMC_BURN;
strcpy(p->cmdName, "<number>");
/* 558: cyclefreq */
p = &cmdList[558];
p->index = 558;
p->parent = &cmdList[377];
p->left = &cmdList[559];
p->sib = &cmdList[561];
p->rNde = NULL;
p->cmd = 168;
p->action = -1;
strcpy(p->cmdName, "cyclefreq");
/* 559: = */
p = &cmdList[559];
p->index = 559;
p->parent = &cmdList[558];
p->left = &cmdList[560];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 560: digit */
p = &cmdList[560];
p->index = 560;
p->parent = &cmdList[559];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_CYCLEFREQ;
strcpy(p->cmdName, "<number>");
/* 561: calcpseudobf */
p = &cmdList[561];
p->index = 561;
p->parent = &cmdList[377];
p->left = &cmdList[562];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 169;
p->action = -1;
strcpy(p->cmdName, "calcpseudobf");
/* 562: = */
p = &cmdList[562];
p->index = 562;
p->parent = &cmdList[561];
p->left = &cmdList[563];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 563: yes */
p = &cmdList[563];
p->index = 563;
p->parent = &cmdList[562];
p->left = NULL;
p->sib = &cmdList[564];
p->rNde = &cmdList[377];
p->cmd = 17;
p->action = CMD_SET_CALCPSEUDOBF;
strcpy(p->cmdName, "yes");
/* 564: no */
p = &cmdList[564];
p->index = 564;
p->parent = &cmdList[562];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[377];
p->cmd = 18;
p->action = CMD_SET_CALCPSEUDOBF;
strcpy(p->cmdName, "no");
/* 565: parsmodel */
p = &cmdList[565];
p->index = 565;
p->parent = &cmdList[53];
p->left = &cmdList[566];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 170;
p->action = -1;
strcpy(p->cmdName, "parsmodel");
/* 566: = */
p = &cmdList[566];
p->index = 566;
p->parent = &cmdList[565];
p->left = &cmdList[567];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 567: yes */
p = &cmdList[567];
p->index = 567;
p->parent = &cmdList[566];
p->left = NULL;
p->sib = &cmdList[568];
p->rNde = &cmdList[53];
p->cmd = 17;
p->action = CMD_SET_PARS_CRIT;
strcpy(p->cmdName, "yes");
/* 568: no */
p = &cmdList[568];
p->index = 568;
p->parent = &cmdList[566];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[53];
p->cmd = 18;
p->action = CMD_SET_PARS_CRIT;
strcpy(p->cmdName, "no");
/* 569: typeset */
p = &cmdList[569];
p->index = 569;
p->parent = &cmdList[41];
p->left = &cmdList[570];
p->sib = &cmdList[582];
p->rNde = NULL;
p->cmd = 171;
p->action = CMD_SET_TYPESET1;
strcpy(p->cmdName, "typeset");
/* 570: name */
p = &cmdList[570];
p->index = 570;
p->parent = &cmdList[569];
p->left = &cmdList[572];
p->sib = &cmdList[571];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SET_TYPESET2;
strcpy(p->cmdName, "<typeset name>");
/* 571: number */
p = &cmdList[571];
p->index = 571;
p->parent = &cmdList[569];
p->left = &cmdList[572];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_TYPESET3;
strcpy(p->cmdName, "<typeset digit");
/* 572: = */
p = &cmdList[572];
p->index = 572;
p->parent = &cmdList[570];
p->left = &cmdList[573];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 573: ord */
p = &cmdList[573];
p->index = 573;
p->parent = &cmdList[572];
p->left = &cmdList[575];
p->sib = &cmdList[574];
p->rNde = NULL;
p->cmd = 173;
p->action = CMD_SET_TYPESET4;
strcpy(p->cmdName, "ord");
/* 574: unord */
p = &cmdList[574];
p->index = 574;
p->parent = &cmdList[572];
p->left = &cmdList[575];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 174;
p->action = CMD_SET_TYPESET4;
strcpy(p->cmdName, "unord");
/* 575: : */
p = &cmdList[575];
p->index = 575;
p->parent = &cmdList[573];
p->left = &cmdList[576];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COLON;
p->action = CMD_SET_TYPESET5;
strcpy(p->cmdName, ":");
/* 576: digit */
p = &cmdList[576];
p->index = 576;
p->parent = &cmdList[575];
p->left = NULL;
p->sib = &cmdList[577];
p->rNde = &cmdList[575];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_TYPESET6;
strcpy(p->cmdName, "digit");
/* 577: - */
p = &cmdList[577];
p->index = 577;
p->parent = &cmdList[575];
p->left = NULL;
p->sib = &cmdList[578];
p->rNde = &cmdList[575];
p->cmd = NUMCOMMANDS + DASH;
p->action = CMD_SET_TYPESET7;
strcpy(p->cmdName, "-");
/* 578: \ */
p = &cmdList[578];
p->index = 578;
p->parent = &cmdList[575];
p->left = NULL;
p->sib = &cmdList[579];
p->rNde = &cmdList[575];
p->cmd = NUMCOMMANDS + FORWARDSLASH;
p->action = CMD_SET_TYPESET8;
strcpy(p->cmdName, "\\");
/* 579: ; */
p = &cmdList[579];
p->index = 579;
p->parent = &cmdList[575];
p->left = NULL;
p->sib = &cmdList[580];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SET_TYPESET9;
strcpy(p->cmdName, ";");
/* 580: name */
p = &cmdList[580];
p->index = 580;
p->parent = &cmdList[575];
p->left = NULL;
p->sib = &cmdList[581];
p->rNde = &cmdList[575];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SET_TYPESET10;
strcpy(p->cmdName, "<charset name>");
/* 581: , */
p = &cmdList[581];
p->index = 581;
p->parent = &cmdList[575];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[572];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_SET_TYPESET11;
strcpy(p->cmdName, ",");
/* 582: nstatesset */
p = &cmdList[582];
p->index = 582;
p->parent = &cmdList[41];
p->left = &cmdList[583];
p->sib = &cmdList[594];
p->rNde = NULL;
p->cmd = 172;
p->action = CMD_SET_STATESSET1;
strcpy(p->cmdName, "nstatesset");
/* 583: name */
p = &cmdList[583];
p->index = 583;
p->parent = &cmdList[582];
p->left = &cmdList[585];
p->sib = &cmdList[584];
p->rNde = NULL;
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SET_STATESSET2;
strcpy(p->cmdName, "<nstatesset name>");
/* 584: number */
p = &cmdList[584];
p->index = 584;
p->parent = &cmdList[582];
p->left = &cmdList[585];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_STATESSET3;
strcpy(p->cmdName, "<nstatesset number>");
/* 585: = */
p = &cmdList[585];
p->index = 585;
p->parent = &cmdList[583];
p->left = &cmdList[586];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 586: digit */
p = &cmdList[586];
p->index = 586;
p->parent = &cmdList[585];
p->left = &cmdList[587];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_STATESSET4;
strcpy(p->cmdName, "<number>");
/* 587: : */
p = &cmdList[587];
p->index = 587;
p->parent = &cmdList[586];
p->left = &cmdList[588];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + COLON;
p->action = CMD_SET_STATESSET5;
strcpy(p->cmdName, ":");
/* 588: digit */
p = &cmdList[588];
p->index = 588;
p->parent = &cmdList[587];
p->left = NULL;
p->sib = &cmdList[589];
p->rNde = &cmdList[587];
p->cmd = NUMCOMMANDS + NUMBER;
p->action = CMD_SET_STATESSET6;
strcpy(p->cmdName, "<number>");
/* 589: - */
p = &cmdList[589];
p->index = 589;
p->parent = &cmdList[587];
p->left = NULL;
p->sib = &cmdList[590];
p->rNde = &cmdList[587];
p->cmd = NUMCOMMANDS + DASH;
p->action = CMD_SET_STATESSET7;
strcpy(p->cmdName, "-");
/* 590: \ */
p = &cmdList[590];
p->index = 590;
p->parent = &cmdList[587];
p->left = NULL;
p->sib = &cmdList[591];
p->rNde = &cmdList[587];
p->cmd = NUMCOMMANDS + FORWARDSLASH;
p->action = CMD_SET_STATESSET8;
strcpy(p->cmdName, "\\");
/* 591: ; */
p = &cmdList[591];
p->index = 591;
p->parent = &cmdList[587];
p->left = NULL;
p->sib = &cmdList[592];
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = CMD_SET_STATESSET9;
strcpy(p->cmdName, ";");
/* 592: name */
p = &cmdList[592];
p->index = 592;
p->parent = &cmdList[587];
p->left = NULL;
p->sib = &cmdList[593];
p->rNde = &cmdList[587];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SET_STATESSET10;
strcpy(p->cmdName, "<charset name>");
/* 593: , */
p = &cmdList[593];
p->index = 593;
p->parent = &cmdList[587];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[585];
p->cmd = NUMCOMMANDS + COMMA;
p->action = CMD_SET_STATESSET11;
strcpy(p->cmdName, ",");
/* 594: assume */
p = &cmdList[594];
p->index = 594;
p->parent = &cmdList[41];
p->left = &cmdList[595];
p->sib = NULL;
p->rNde = NULL;
p->cmd = 175;
p->action = -1;
strcpy(p->cmdName, "assume");
/* 595: typeset */
p = &cmdList[595];
p->index = 595;
p->parent = &cmdList[594];
p->left = &cmdList[596];
p->sib = &cmdList[598];
p->rNde = NULL;
p->cmd = 171;
p->action = -1;
strcpy(p->cmdName, "typeset");
/* 596: = */
p = &cmdList[596];
p->index = 596;
p->parent = &cmdList[595];
p->left = &cmdList[597];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 597: name */
p = &cmdList[597];
p->index = 597;
p->parent = &cmdList[596];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[594];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SET_ASSUME1;
strcpy(p->cmdName, "<typeset name>");
/* 598: nstatesset */
p = &cmdList[598];
p->index = 598;
p->parent = &cmdList[594];
p->left = &cmdList[599];
p->sib = &cmdList[601];
p->rNde = NULL;
p->cmd = 172;
p->action = -1;
strcpy(p->cmdName, "nstatesset");
/* 599: = */
p = &cmdList[599];
p->index = 599;
p->parent = &cmdList[598];
p->left = &cmdList[600];
p->sib = NULL;
p->rNde = NULL;
p->cmd = NUMCOMMANDS + EQUALSIGN;
p->action = -1;
strcpy(p->cmdName, "=");
/* 600: name */
p = &cmdList[600];
p->index = 600;
p->parent = &cmdList[599];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[594];
p->cmd = NUMCOMMANDS + ALPHA;
p->action = CMD_SET_ASSUME2;
strcpy(p->cmdName, "name");
/* 601: ; */
p = &cmdList[601];
p->index = 601;
p->parent = &cmdList[594];
p->left = NULL;
p->sib = NULL;
p->rNde = &cmdList[41];
p->cmd = NUMCOMMANDS + SEMICOLON;
p->action = -1;
strcpy(p->cmdName, ";");
/* 602: yyy */
p = &cmdList[602];
p->index = 602;
p->parent = NULL;
p->left = NULL;
p->sib = NULL;
p->rNde = NULL;
p->cmd = -1;
p->action = -1;
strcpy(p->cmdName, "yyy");
/* 603: yyy */
p = &cmdList[603];
p->index = 603;
p->parent = NULL;
p->left = NULL;
p->sib = NULL;
p->rNde = NULL;
p->cmd = -1;
p->action = -1;
strcpy(p->cmdName, "yyy");
/* 604: yyy */
p = &cmdList[604];
p->index = 604;
p->parent = NULL;
p->left = NULL;
p->sib = NULL;
p->rNde = NULL;
p->cmd = -1;
p->action = -1;
strcpy(p->cmdName, "yyy");
/* 605: yyy */
p = &cmdList[605];
p->index = 605;
p->parent = NULL;
p->left = NULL;
p->sib = NULL;
p->rNde = NULL;
p->cmd = -1;
p->action = -1;
strcpy(p->cmdName, "yyy");
# if 0
{
int i;
for (i=0; i<371; i++)
{
p = &cmdList[i];
printf ("%3d (%3d %3d %3d %3d) %3d %s | ",
Dex(p), Dex(p->parent), Dex(p->left), Dex(p->sib), Dex(p->rNde), p->cmd, p->cmdName);
if (p->parent != NULL)
printf ("%s -> ", p->parent->cmdName);
else
printf ("NULL -> ");
printf ("%s -> ", p->cmdName);
if (p->left != NULL)
printf ("%s ", p->left->cmdName);
else
printf ("NULL ");
printf ("\n");
}
}
# endif
}
void ShowNodes (TreeNode *p, int indent, int isThisTreeRooted)
{
if (p != NULL)
{
printf (" ");
if (p->left == NULL && p->right == NULL && p->anc != NULL)
{
printf("%*cN %d (l=%d r=%d a=%d) %lf (%s) ",
indent, ' ', Dex2(p), Dex2(p->left), Dex2(p->right), Dex2(p->anc), p->length, p->label);
}
else if (p->left != NULL && p->right == NULL && p->anc == NULL)
{
if (isThisTreeRooted == NO)
{
if (p->label[0] == '\0' || p->label[0] == '\n' || p->label[0] == ' ')
printf("%*cN %d (l=%d r=%d a=%d) (---) ",
indent, ' ', Dex2(p), Dex2(p->left), Dex2(p->right), Dex2(p->anc));
else
printf("%*cN %d (l=%d r=%d a=%d) (%s) ",
indent, ' ', Dex2(p), Dex2(p->left), Dex2(p->right), Dex2(p->anc), p->label);
}
else
{
printf("%*cN %d (l=%d r=%d a=%d) X.XXXXXX ",
indent, ' ', Dex2(p), Dex2(p->left), Dex2(p->right), Dex2(p->anc));
}
}
else
{
if (p->anc != NULL)
{
if (p->anc->anc == NULL && isThisTreeRooted == YES)
printf("%*cN %d (l=%d r=%d a=%d) X.XXXXXX ",
indent, ' ', Dex2(p), Dex2(p->left), Dex2(p->right), Dex2(p->anc));
else
printf("%*cN %d (l=%d r=%d a=%d) %lf ",
indent, ' ', Dex2(p), Dex2(p->left), Dex2(p->right), Dex2(p->anc), p->length);
}
}
if (enforceCalibrations == YES)
{
if (p->anc != NULL)
{
printf ("%1.3lf ", p->nodeTime);
if (p->isCalibrated == YES)
printf (" <== %s (%1.3lf %1.3lf)", p->calibrationName, p->calTime[0], p->calTime[1]);
}
}
if (enforceConstraints == YES)
{
if (p->isConstrained == YES)
printf (" <== %s ", p->constraintName);
}
printf ("\n");
ShowNodes (p->left, indent + 2, isThisTreeRooted);
ShowNodes (p->right, indent + 2, isThisTreeRooted);
}
}
#if defined (CONTREE)
int ShowConPhylogram (FILE *fp, int nNodes, PolyNode *root, int screenWidth)
{
int i, j, k, nLines, from, to, treeWidth;
char *printLine, *markLine;
double scale, f;
PolyNode *p, *q, **allDownPass;
// allocate space for printLine and markLine
printLine = (char *) calloc ((2*screenWidth+1),sizeof(char));
if (!printLine)
return ERROR;
markLine = printLine + screenWidth + 1;
// allocate allDownPass
allDownPass = (PolyNode **) malloc (nNodes * sizeof(PolyNode *));
if (!allDownPass)
return ERROR;
// get fresh downpass sequence
i = 0;
GetConDownPass(allDownPass, root, &i);
// calculate scale
scale = 0.0;
root->f = 0.0;
for (i=nNodes-2; i>=0; i--)
{
p = allDownPass[i];
p->f = p->anc->f + p->length;
if (p->left == NULL)
{
f = p->f / (screenWidth - strlen(p->label) - 2);
if (f > scale)
{
scale = f;
treeWidth = screenWidth - strlen(p->label) - 2;
}
}
}
// calculate x coordinates
for (i=0; i<nNodes; i++)
{
p = allDownPass[i];
p->x = (int) (0.5 + (p->f / scale));
}
// calculate y coordinates and lines to print
for (i=nLines=0; i<nNodes; i++)
{
p = allDownPass[i];
if (p->left != NULL)
{
// internal node
for (q=p->left->sib; q->sib!=NULL; q=q->sib)
;
p->y = (int) (0.5 + ((p->left->y + q->y) / 2.0));
}
else
{
// terminal node
p->y = nLines;
nLines += 2;
}
}
// print tree line by line
for (i=0; i<nLines; i++)
{
// empty printLine
for (j=0; j<screenWidth; j++)
{
printLine[j] = ' ';
}
printLine[j]='\0';
for (j=0; j<nNodes; j++)
{
p = allDownPass[j];
if (p->y != i)
continue;
// this branch should be printed
// add branch
if (p->anc == NULL)
{
// this is the root of the whole tree
printLine[p->x] = '+';
}
else
{
// this is an ordinary branch
to = p->x;
from = p->anc->x;
for (k=from+1; k<=to; k++)
printLine[k] = '-';
if (p == p->anc->left)
{
if (markLine[from] == 0)
printLine[from] = '/';
else
printLine[from] = '|';
markLine[from] ++;
}
else if (p->sib == NULL)
{
if (markLine[from] == 1)
printLine[from] = '\\';
else
printLine[from] = '|';
markLine[from] --;
}
if (p->left!=NULL)
{
if (from != to)
printLine[to] = '+';
else
printLine[to] = '|';
}
else
{
// add label if the branch is terminal
sprintf(printLine+to+2,"%s",p->label);
}
}
}
// check for cross branches
for (j=0; j<screenWidth; j++)
{
if (markLine[j] >= 1 && printLine[j] == ' ')
printLine[j] = '|';
}
fprintf(fp, "%s\n",printLine);
}
// print scale
for (i=0; i<treeWidth; i++)
if (i % 10 == 0)
printLine[i] = '+';
else
printLine[i] = '-';
printLine[i++] = '>';
printLine[i] = '\0';
fprintf(fp, "%s\n",printLine);
printLine[0] = '0';
printLine[1] = '.';
printLine[2] = '0';
f = scale * 10.0;
for (i=3; i<treeWidth - 5; i++)
{
if ( (i + 3) % 10 == 0)
{
j = (int) log10(f);
j = j > 1 ? j : 1;
sprintf (printLine + i, "%7.*f", 6 - j, f);
f += (scale * 10.0);
i += 6;
}
else
printLine[i] = ' ';
}
printLine[i] = '\0';
fprintf(fp, "%s\n",printLine);
free (allDownPass);
free (printLine);
return NO_ERROR;
}
int ShowConTree (FILE *fp, int nNodes, PolyNode *root, int screenWidth)
{
int i, j, k, treeWidth, minBranchLength, maxWidth, isTreeDivided,
printWidth, nLines, nodesToBePrinted, from, to;
unsigned int maxLabelLength;
char *printLine, *markLine, temp[20];
PolyNode *p, *q, **allDownPass;
minBranchLength = 5;
isTreeDivided = NO;
// allocate space for printLine and markLine
printLine = (char *) calloc ((2*screenWidth+1),sizeof(char));
if (!printLine)
return ERROR;
markLine = printLine + screenWidth + 1;
// allocate allDownPass
allDownPass = (PolyNode **) malloc (nNodes * sizeof(PolyNode *));
if (!allDownPass)
return ERROR;
// get fresh downpass sequence and internal node indices
i = 0;
GetConDownPass(allDownPass, root, &i);
for (i=k=0; i<nNodes; i++)
if (allDownPass[i]->left == NULL)
k++;
for (i=0; i<nNodes; i++)
{
p = allDownPass[i];
if (p->left != NULL)
p->index = k++;
}
// calculate max length of labels
// initially set to hold largest node index number plus parentheses
maxLabelLength = (unsigned int) (3.0 + log10((double)nNodes));
for (i=0; i<nNodes; i++)
{
p = allDownPass[i];
if (p->left == NULL && strlen(p->label)>maxLabelLength)
maxLabelLength = strlen(p->label);
}
// calculate remaining screen width for tree
// and maxWidth in terms of branches
treeWidth = screenWidth - maxLabelLength - 1;
maxWidth = treeWidth / minBranchLength;
// unmark whole tree
for (i=0; i<nNodes; i++)
allDownPass[i]->mark = 0;
nodesToBePrinted = nNodes;
while (nodesToBePrinted > 0)
{
// count depth of nodes in unprinted tree
for (i=0; i<nNodes; i++)
{
p = allDownPass[i];
if (p->mark == 0)
{
p->x = 0;
if (p->left != NULL && p->left->mark == 0)
{
for (q = p->left; q!=NULL; q=q->sib)
{
if (q->x > p->x)
p->x = q->x;
}
p->x++;
// break when root of print subtree has been found
if (p->x >= maxWidth)
break;
}
}
}
// if internal node then find largest nonprinted subtree among descendant nodes
if (p->anc != NULL)
{
for (q=p->left; q!=NULL; q=q->sib)
{
if (q->x == p->x - 1 && q->mark == 0)
p = q;
}
fprintf (fp, "Subclade rooted at node %d:\n\n",p->index);
isTreeDivided = YES;
}
else if (isTreeDivided == YES)
fprintf (fp, "Root part of tree:\n\n");
// mark subtree for printing and
// translate x coordinates from depth to position
if (p->anc == NULL)
printWidth = p->x;
else
printWidth = p->x + 1;
p->mark = 1;
p->x = (int) (treeWidth - 0.5 - ((treeWidth - 1) * (p->x / (double) printWidth)));
for (i--; i>=0; i--)
{
p = allDownPass[i];
if (p->mark == 0 && p->anc->mark == 1)
{
p->mark = 1;
p->x = (int) (treeWidth - 0.5 - ((treeWidth - 1) * (p->x / (double) printWidth)));
}
}
// calculate y coordinates of nodes to be printed and lines to print
for (i=nLines=0; i<nNodes; i++)
{
p = allDownPass[i];
if (p->mark == 1)
{
if (p->left != NULL && p->left->mark == 1)
{
// internal node
for (q=p->left->sib; q->sib!=NULL; q=q->sib)
;
p->y = (int) (0.5 + ((p->left->y + q->y) / 2.0));
}
else
{
// terminal node
p->y = nLines;
nLines += 2;
}
}
}
// print subtree line by line
for (i=0; i<nLines; i++)
{
// empty printLine
for (j=0; j<screenWidth; j++)
{
printLine[j] = ' ';
}
printLine[j]='\0';
for (j=0; j<nNodes; j++)
{
p = allDownPass[j];
if (p->mark != 1 || p->y != i)
continue;
// this branch should be printed
// add label if the branch is terminal in tree to be printed
if (p->left == NULL)
sprintf(printLine+treeWidth+1,"%s",p->label);
else if (p->left->mark == 2)
sprintf(printLine+treeWidth+1,"(%d)",p->index);
// add branch
if (p->anc == NULL)
{
// this is the root of the whole tree
printLine[p->x] = '+';
nodesToBePrinted--;
}
else if (p->anc->mark == 0)
{
// this is a root of a subtree
// this branch will have to be printed again so do
// not decrease nodesToBePrinted
to = p->x;
from = 0;
for (k=from; k<to; k++)
printLine[k] = '-';
printLine[to] = '+';
sprintf(temp,"%d\0", (int) (p->support + 0.5));
from = (int)(from + 1.5 + ((to - from - 1 - strlen(temp)) / 2.0));
for (k=0; temp[k]!='\0'; k++)
printLine[from++] = temp[k];
}
else
{
// this is an ordinary branch
to = p->x;
from = p->anc->x;
for (k=from+1; k<=to; k++)
printLine[k] = '-';
if (p == p->anc->left)
{
printLine[from] = '/';
markLine[from] = 1;
}
else if (p->sib == NULL)
{
printLine[from] = '\\';
markLine[from] = 0;
}
if (p->left!=NULL && p->left->mark!=2)
{
printLine[to] = '+';
sprintf(temp,"%d\0", (int) (p->support + 0.5));
from = (int)(from + 1.5 + ((to - from - 1 - strlen(temp)) / 2.0));
for (k=0; temp[k]!='\0'; k++)
printLine[from++] = temp[k];
}
nodesToBePrinted--;
}
}
// check for cross branches
for (j=0; j<treeWidth; j++)
{
if (markLine[j] == 1 && printLine[j] == ' ')
printLine[j] = '|';
}
fprintf(fp, "%s\n",printLine);
}
// mark printed branches
for (i=0; i<nNodes; i++)
{
p = allDownPass[i];
if (p->mark == 1)
{
if (p->anc == NULL)
p->mark = 2;
else if (p->anc->mark == 0)
p->mark = 0; // this branch will have to be printed again
else
p->mark = 2;
}
}
} // next subtree
free (allDownPass);
free (printLine);
return NO_ERROR;
}
#endif
#define EDDIE_NODES
int ShowTree (TreeNode *r, int isThisTreeRooted)
{
int i, j, k, nNodes, x, nLines, nLevels, levelDepth, from, to;
char treeLine[SCREENWIDTH2], labelLine[100];
TreeNode **downPass, *p;
/* get down pass sequence */
if (isThisTreeRooted == YES)
nNodes = 2 * nTaxa;
else
nNodes = 2 * nTaxa - 2;
downPass = (TreeNode **)malloc((size_t) (2 * nTaxa * sizeof(TreeNode *)));
if (!downPass)
{
printf (" ERROR: Could not allocate downPass\n");
return (ERROR);
}
i = 0;
GetUserDownPass (r, downPass, &i);
/* get coordinates */
x = 0;
nLines = 0;
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->left == NULL && p->right == NULL)
{
p->x = x;
x += 2;
p->y = 0;
nLines += 2;
}
else if (p->left != NULL && p->right != NULL && p->anc != NULL)
{
p->x = p->left->x + (p->right->x - p->left->x) / 2;
if (p->left->y > p->right->y)
p->y = p->left->y + 1;
else
p->y = p->right->y + 1;
}
else
{
p->x = x;
x += 2;
p->y = 0;
}
}
/* print tree out, line-by-line */
levelDepth = SCREENWIDTH / r->left->y;
nLevels = r->left->y;
for (j=0; j<=nLines-2; j++)
{
if (j % 2 == 0)
{
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->left == NULL && p->x == j)
{
strcpy (labelLine, p->label);
}
}
}
for (i=0; i<SCREENWIDTH-1; i++)
treeLine[i] = ' ';
treeLine[SCREENWIDTH-1] = '\0';
for (i=0; i<nNodes; i++)
{
p = downPass[i];
if (p->anc != NULL)
{
if (p->anc->anc != NULL)
{
if (p->x == j)
{
from = (nLevels - p->anc->y) * levelDepth;
to = (nLevels - p->y) * levelDepth;
if (p->y == 0)
to = SCREENWIDTH-1;
if (to >= SCREENWIDTH)
to = SCREENWIDTH-1;
for (k=from; k<to; k++)
treeLine[k] = '-';
if (p->anc->left == p)
treeLine[from] = '/';
else
treeLine[from] = '\\';
if (p->left != NULL)
{
# if defined (EDDIE_NODES)
treeLine[to] = '|';
# else
treeLine[to] = '+';
# endif
}
if (p->anc->anc == r && p->anc->right == p)
{
if (isThisTreeRooted == NO)
# if defined (EDDIE_NODES)
treeLine[to] = '|';
# else
treeLine[to] = '+';
# endif
else
treeLine[from] = '\\';
}
}
else
{
if (p->left != NULL && p->right != NULL)
{
if (j < p->x && j > p->left->x)
{
from = (nLevels - p->y) * levelDepth;
treeLine[from] = '|';
}
else if (j > p->x && j < p->right->x && p->left != NULL)
{
from = (nLevels - p->y) * levelDepth;
treeLine[from] = '|';
}
}
}
}
else
{
if (p->x == j)
{
treeLine[0] = '|'; /* temp */
}
else if (j < p->x && j > p->left->x)
{
treeLine[0] = '|';
}
else if (j > p->x && j < p->right->x)
{
treeLine[0] = '|';
}
if (isThisTreeRooted == NO)
{
if (j > p->x && j <= nLines-2)
treeLine[0] = '|';
if (j == p->right->x)
# if defined (EDDIE_NODES)
treeLine[0] = '|';
# else
treeLine[0] = '+';
# endif
}
else
{
if (j == p->x)
# if defined (EDDIE_NODES)
treeLine[0] = '|';
# else
treeLine[0] = '+';
# endif
}
}
}
}
treeLine[SCREENWIDTH-1] = '\0';
if (j % 2 == 0)
printf (" %s %s\n", treeLine, labelLine);
else
printf (" %s \n", treeLine);
}
if (isThisTreeRooted == NO)
{
for (i=0; i<SCREENWIDTH; i++)
treeLine[i] = ' ';
treeLine[SCREENWIDTH-1] = '\0';
printf (" |\n");
for (k=0; k<SCREENWIDTH; k++)
treeLine[k] = '-';
treeLine[SCREENWIDTH-1] = '\0';
treeLine[0] = '\\';
strcpy (labelLine, r->label);
labelLine[19] = '\0';
printf (" %s %s\n", treeLine, labelLine);
}
free (downPass);
return (NO_ERROR);
}
#if !defined (CONTREE)
void SortCompatParts (int *item, unsigned *item2, double *item3, int count)
{
SortCompatParts2 (item, item2, item3, 0, count-1);
}
void SortCompatParts2 (int *item, unsigned *item2, double *item3, int left, int right)
{
register int i, j, k, x, y;
unsigned yU;
double yD;
i = left;
j = right;
x = item[((left+right)/2)];
do
{
while (item[i] > x && i < right)
i++;
while (x > item[j] && j > left)
j--;
if (i <= j)
{
y = item[i];
item[i] = item[j];
item[j] = y;
for (k = 0; k<nUnsignedNeeded; k++)
{
yU = item2[i*nUnsignedNeeded+k];
item2[i*nUnsignedNeeded+k] = item2[j*nUnsignedNeeded+k];
item2[j*nUnsignedNeeded+k] = yU;
}
yD = item3[i];
item3[i] = item3[j];
item3[j] = yD;
i++;
j--;
}
} while (i <= j);
if (left < j)
SortCompatParts2 (item, item2, item3, left, j);
if (i < right)
SortCompatParts2 (item, item2, item3, i, right);
}
#endif
void SortParts (int *item, int count)
{
SortParts2 (item, 0, count-1);
}
void SortParts2 (int *item, int left, int right)
{
register int i, j, k;
unsigned yU;
double x, y;
i = left;
j = right;
x = item[(left+right)/2];
do
{
while (item[i] > x && i < right)
i++;
while (x > item[j] && j > left)
j--;
if (i <= j)
{
y = item[i];
item[i] = item[j];
item[j] = y;
y = aBrlens[i];
aBrlens[i] = aBrlens[j];
aBrlens[j] = y;
y = aOldBrlens[i];
aOldBrlens[i] = aOldBrlens[j];
aOldBrlens[j] = y;
y = sBrlens[i];
sBrlens[i] = sBrlens[j];
sBrlens[j] = y;
for (k = 0; k<nUnsignedNeeded; k++)
{
yU = treePartsFound[i*nUnsignedNeeded + k];
treePartsFound[i*nUnsignedNeeded + k] = treePartsFound[j*nUnsignedNeeded + k];
treePartsFound[j*nUnsignedNeeded + k] = yU;
}
i++;
j--;
}
} while (i <= j);
if (left < j)
SortParts2 (item, left, j);
if (i < right)
SortParts2 (item, i, right);
}
void SortVector (double *item, int count)
{
SortVector2 (item, 0, count-1);
}
void SortVector2 (double *item, int left, int right)
{
register int i, j;
double yD, x;
i = left;
j = right;
x = item[((left+right)/2)];
do
{
while (item[i] < x && i < right)
i++;
while (x < item[j] && j > left)
j--;
if (i <= j)
{
yD = item[i];
item[i] = item[j];
item[j] = yD;
i++;
j--;
}
} while (i <= j);
if (left < j)
SortVector2 (item, left, j);
if (i < right)
SortVector2 (item, i, right);
}
int StandID (char nuc)
{
char n;
n = nuc;
if (n == '0')
{
return 1;
}
else if (n == '1')
{
return 2;
}
else if (n == 'N' || n == 'n')
{
return 3;
}
else if (n == gapChar)
{
return 3;
}
else if (n == missingChar)
{
return 3;
}
/*else if (n == '2')
{
return 4;
}
else if (n == '3')
{
return 8;
}
else if (n == '4')
{
return 16;
}
else if (n == '5')
{
return 32;
}
else if (n == '6')
{
return 64;
}
else if (n == '7')
{
return 128;
}
else if (n == '8')
{
return 256;
}
else if (n == '9')
{
return 512;
}
else if (n == 'N' || n == 'n')
{
return 1023;
}
else if (n == gapChar)
{
return 1023;
}
else if (n == missingChar)
{
return 1023;
}*/
else
return -1;
}
int SummarizeParams (void)
{
int i, rc, tokenType, commandNumber, actionType, inError, isCommented;
char s[STRING_LENGTH];
command_list *q;
FILE *fp, *fopen();
if ((fp = fopen (sumParmFile, "r")) == NULL)
{
printf ("\n ERROR: Could not open file \"%s\"\n\n", sumParmFile);
rc = ERROR;
goto errorExit;
}
cmdPtr = &cmdList[0];
isCommented = NO;
inError = NO;
lineNumber = 0;
while (fgets (s, STRING_LENGTH, fp) != NULL)
{
lineNumber++;
//printf ("%s", s);
tokenP = &s[0];
do
{
GetToken (&tokenType);
if (tokenType == RETURNSYMBOL)
returnEncountered = YES;
commandNumber = ParseToken (tokenType);
if (commandNumber == NUMCOMMANDS + LEFTCOMMENT)
isCommented = YES;
if (*token && isCommented == NO)
{
//printf (" token = %s (%d %d)\n", token, tokenType, commandNumber);
actionType = IsCommandValid (commandNumber);
//printf (" actionType = %d\n", actionType);
if (actionType == ERROR_ACTION)
{
printf ("\n");
inError = YES;
if (tokenType != SEMICOLON)
printf (" ERROR: Invalid command \"%s\"\n", token);
if (expectedCommands[0] != -1)
{
printf (" EXPECTING: ");
i = 0;
while (expectedCommands[i] != -1)
{
q = &cmdList[expectedCommands[i]];
printf ("\"%s\"", q->cmdName);
i++;
if (expectedCommands[i+1] == -1 && expectedCommands[i] != -1)
printf (", or ");
else if (expectedCommands[i] != -1)
printf (", ");
if (i % 4 == 0)
printf ("\n ");
if (i % 4 == 0)
printf ("\n ");
}
printf ("\n");
}
//printf ("\n");
}
else if (actionType >= 0)
{
rc = DoAction (actionType);
if (rc == ERROR)
{
printf (" The problem is on line %d of the file named \"%s\"\n", lineNumber, sumTreeFile);
goto errorExit;
}
}
}
if (commandNumber == NUMCOMMANDS + RIGHTCOMMENT)
isCommented = NO;
} while (*token && inError == NO);
}
fclose (fp);
return (NO_ERROR);
errorExit:
#if defined (MORPH)
if (fp!=NULL)
fclose (fp);
#else
fclose (fp);
#endif
return (ERROR);
}
int SummarizeTrees (void)
{
int i, rc, tokenType, commandNumber, actionType, inError, isCommented;
char s[STRING_LENGTH];
command_list *q;
FILE *fp, *fopen();
if ((fp = fopen (sumTreeFile, "r")) == NULL)
{
printf ("\n ERROR: Could not open file \"%s\"\n\n", sumTreeFile);
rc = ERROR;
goto errorExit;
}
cmdPtr = &cmdList[0];
isCommented = NO;
inError = NO;
lineNumber = 0;
while (fgets (s, STRING_LENGTH, fp) != NULL)
{
lineNumber++;
//printf ("%s", s);
tokenP = &s[0];
do
{
GetToken (&tokenType);
if (tokenType == RETURNSYMBOL)
returnEncountered = YES;
commandNumber = ParseToken (tokenType);
if (commandNumber == NUMCOMMANDS + LEFTCOMMENT)
isCommented = YES;
if (*token && isCommented == NO)
{
//printf (" token = %s (%d %d)\n", token, tokenType, commandNumber);
actionType = IsCommandValid (commandNumber);
//printf (" actionType = %d\n", actionType);
if (actionType == ERROR_ACTION)
{
printf ("\n");
inError = YES;
if (tokenType != SEMICOLON)
printf (" ERROR: Invalid command \"%s\"\n", token);
if (expectedCommands[0] != -1)
{
printf (" EXPECTING: ");
i = 0;
while (expectedCommands[i] != -1)
{
q = &cmdList[expectedCommands[i]];
printf ("\"%s\"", q->cmdName);
i++;
if (expectedCommands[i+1] == -1 && expectedCommands[i] != -1)
printf (", or ");
else if (expectedCommands[i] != -1)
printf (", ");
if (i % 4 == 0)
printf ("\n ");
if (i % 4 == 0)
printf ("\n ");
}
printf ("\n");
}
//printf ("\n");
}
else if (actionType >= 0)
{
rc = DoAction (actionType);
if (rc == ERROR)
{
printf (" The problem is on line %d of the file named \"%s\"\n", lineNumber, sumTreeFile);
goto errorExit;
}
}
}
if (commandNumber == NUMCOMMANDS + RIGHTCOMMENT)
isCommented = NO;
} while (*token && inError == NO);
}
fclose (fp);
return (NO_ERROR);
errorExit:
#if defined (MORPH)
if (fp != NULL)
#endif
fclose (fp);
return (ERROR);
}
#if defined (CONTREE)
void WriteConTree (PolyNode *p, FILE *fp)
{
PolyNode *q;
if (p->anc != NULL)
if (p->anc->left == p)
fprintf (fp, "(");
for (q = p->left; q != NULL; q = q->sib)
{
if (q->anc != NULL) // added by JPH
if (q->anc->left != q)
fprintf (fp, ",");
WriteConTree (q, fp);
}
if (p->left == NULL)
{
if (foundBrlens == YES)
fprintf (fp, "%d:%lf", p->index+1, p->length);
else
fprintf (fp, "%d", p->index+1);
}
if (p->sib == NULL && p->anc != NULL)
{
if (foundBrlens == YES)
fprintf (fp, "):%lf", p->anc->length); // added "anc->" by JPH
else
fprintf (fp, ")");
}
}
#else
void WriteConTreeToScreen (ConTreeNode *p, FILE *fp)
{
ConTreeNode *q;
if (p->anc != NULL)
if (p->anc->left == p)
fprintf (fp, "(");
for (q = p->left; q != NULL; q = q->rightSib)
{
if (q->anc != NULL)
if (q->anc->left != q)
fprintf (fp, ",");
WriteConTreeToScreen (q, fp);
}
if (p->left == NULL)
{
if (foundBrlens == YES)
fprintf (fp, "%d:%lf", p->index+1, p->length);
else
fprintf (fp, "%d", p->index+1);
}
if (p->rightSib == NULL && p->anc != NULL)
{
if (foundBrlens == YES)
fprintf (fp, "):%lf", p->anc->length);
else
fprintf (fp, ")");
}
}
#endif
#if defined(__MWERKS__)
# pragma optimization_level reset
#endif
|