1 | /* |
---|
2 | * MrBayes 3 |
---|
3 | * |
---|
4 | * (c) 2002-2010 |
---|
5 | * |
---|
6 | * John P. Huelsenbeck |
---|
7 | * Dept. Integrative Biology |
---|
8 | * University of California, Berkeley |
---|
9 | * Berkeley, CA 94720-3140 |
---|
10 | * johnh@berkeley.edu |
---|
11 | * |
---|
12 | * Fredrik Ronquist |
---|
13 | * Swedish Museum of Natural History |
---|
14 | * Box 50007 |
---|
15 | * SE-10405 Stockholm, SWEDEN |
---|
16 | * fredrik.ronquist@nrm.se |
---|
17 | * |
---|
18 | * With important contributions by |
---|
19 | * |
---|
20 | * Paul van der Mark (paulvdm@sc.fsu.edu) |
---|
21 | * Maxim Teslenko (maxim.teslenko@nrm.se) |
---|
22 | * |
---|
23 | * and by many users (run 'acknowledgements' to see more info) |
---|
24 | * |
---|
25 | * This program is free software; you can redistribute it and/or |
---|
26 | * modify it under the terms of the GNU General Public License |
---|
27 | * as published by the Free Software Foundation; either version 2 |
---|
28 | * of the License, or (at your option) any later version. |
---|
29 | * |
---|
30 | * This program is distributed in the hope that it will be useful, |
---|
31 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
33 | * GNU General Public License for more details (www.gnu.org). |
---|
34 | * |
---|
35 | */ |
---|
36 | |
---|
37 | #include <assert.h> |
---|
38 | #include <stdio.h> |
---|
39 | #include <stdlib.h> |
---|
40 | #include <time.h> |
---|
41 | #include <math.h> |
---|
42 | #include <string.h> |
---|
43 | #include <ctype.h> |
---|
44 | #include "mb.h" |
---|
45 | #include "mbbeagle.h" |
---|
46 | #include "globals.h" |
---|
47 | #include "command.h" |
---|
48 | #include "bayes.h" |
---|
49 | #include "model.h" |
---|
50 | #include "mcmc.h" |
---|
51 | #include "plot.h" |
---|
52 | #include "sump.h" |
---|
53 | #include "sumt.h" |
---|
54 | #include "tree.h" |
---|
55 | #include "utils.h" |
---|
56 | #if defined (BEAGLE_ENABLED) |
---|
57 | #include "libhmsbeagle/beagle.h" |
---|
58 | #endif |
---|
59 | #if defined(__MWERKS__) |
---|
60 | #include "SIOUX.h" |
---|
61 | #endif |
---|
62 | |
---|
63 | const char* const svnRevisionCommandC="$Rev: 513 $"; /* Revision keyword which is expended/updated by svn on each commit/update*/ |
---|
64 | |
---|
65 | #define NUMCOMMANDS 61 /* Note: NUMCOMMANDS gives the total number */ |
---|
66 | /* of commands in the program */ |
---|
67 | #define NUMPARAMS 269 |
---|
68 | #define PARAM(i, s, f, l) p->string = s; \ |
---|
69 | p->fp = f; \ |
---|
70 | p->valueList = l; \ |
---|
71 | p++; |
---|
72 | #define HIDE 0 |
---|
73 | #define SHOW 1 |
---|
74 | |
---|
75 | /* Debugging options */ |
---|
76 | #undef SHOW_TOKENS |
---|
77 | #undef ECHO_PROCESSED_COMMANDS |
---|
78 | |
---|
79 | |
---|
80 | /* Local function prototypes */ |
---|
81 | int AddNameSet(NameSet **nameSetList, int numNameSets, char **nameSet, int numNames); |
---|
82 | int AddToSet (int i, int j, int k, int id); |
---|
83 | int AllocCharacters (void); |
---|
84 | int AllocMatrix (void); |
---|
85 | int AllocTaxa (void); |
---|
86 | char ChangeCase (char c); |
---|
87 | int CharacterCode (char ch, int *charCode, int chType); |
---|
88 | int CharacterNumber (int charCode, int chType); |
---|
89 | int CheckInitialPartitions (void); |
---|
90 | int Dex (TreeNode *p); |
---|
91 | int DoAbout (void); |
---|
92 | int DoAcknowledgments (void); |
---|
93 | int DoBeginParm (char *parmName, char *tkn); |
---|
94 | int DoBreaks (void); |
---|
95 | int DoBreaksParm (char *parmName, char *tkn); |
---|
96 | int DoCalibrate (void); |
---|
97 | int DoCalibrateParm (char *parmName, char *tkn); |
---|
98 | int DoCharset (void); |
---|
99 | int DoCharsetParm (char *parmName, char *tkn); |
---|
100 | int DoCharStat (void); |
---|
101 | int DoCitations (void); |
---|
102 | int DoConstraint (void); |
---|
103 | int DoConstraintParm (char *parmName, char *tkn); |
---|
104 | int DoCtype (void); |
---|
105 | int DoCtypeParm (char *parmName, char *tkn); |
---|
106 | int DoDelete (void); |
---|
107 | int DoDeleteParm (char *parmName, char *tkn); |
---|
108 | int DoDimensions (void); |
---|
109 | int DoDimensionsParm (char *parmName, char *tkn); |
---|
110 | int DoDisclaimer (void); |
---|
111 | int DoEndBlock (void); |
---|
112 | int DoExecuteParm (char *parmName, char *tkn); |
---|
113 | int DoExclude (void); |
---|
114 | int DoExcludeParm (char *parmName, char *tkn); |
---|
115 | int DoFormat (void); |
---|
116 | int DoFormatParm (char *parmName, char *tkn); |
---|
117 | int DoHelp (void); |
---|
118 | int DoHelpParm (char *parmName, char *tkn); |
---|
119 | int DoInclude (void); |
---|
120 | int DoIncludeParm (char *parmName, char *tkn); |
---|
121 | int DoLog (void); |
---|
122 | int DoLogParm (char *parmName, char *tkn); |
---|
123 | int DoManual (void); |
---|
124 | int DoManualParm (char *parmName, char *tkn); |
---|
125 | int DoMatrix (void); |
---|
126 | int DoMatrixParm (char *parmName, char *tkn); |
---|
127 | int DoNexusParm (char *parmName, char *tkn); |
---|
128 | int DoOutgroup (void); |
---|
129 | int DoOutgroupParm (char *parmName, char *tkn); |
---|
130 | int DoPairs (void); |
---|
131 | int DoPairsParm (char *parmName, char *tkn); |
---|
132 | int DoPartition (void); |
---|
133 | int DoPartitionParm (char *parmName, char *tkn); |
---|
134 | int DoRestore (void); |
---|
135 | int DoRestoreParm (char *parmName, char *tkn); |
---|
136 | int DoSet (void); |
---|
137 | int DoSetParm (char *parmName, char *tkn); |
---|
138 | int DoShowMatrix (void); |
---|
139 | int DoShowUserTrees (void); |
---|
140 | int DoShowBeagle (void); |
---|
141 | int DoSpeciespartition (void); |
---|
142 | int DoSpeciespartitionParm (char *parmName, char *tkn); |
---|
143 | int DoTaxaset (void); |
---|
144 | int DoTaxasetParm (char *parmName, char *tkn); |
---|
145 | int DoTaxaStat (void); |
---|
146 | int DoTaxlabels (void); |
---|
147 | int DoTaxlabelsParm (char *parmName, char *tkn); |
---|
148 | int DoTranslate (void); |
---|
149 | int DoTranslateParm (char *parmName, char *tkn); |
---|
150 | int DoTree (void); |
---|
151 | int DoTreeParm (char *parmName, char *tkn); |
---|
152 | int DoUserTree (void); |
---|
153 | int DoUserTreeParm (char *parmName, char *tkn); |
---|
154 | int DoVersion (void); |
---|
155 | int FindValidParam (char *tk, int *numMatches); |
---|
156 | int FreeCharacters (void); |
---|
157 | int FreeMatrix (void); |
---|
158 | int FreeTaxa (void); |
---|
159 | int GetNumPartDivisions (int n); |
---|
160 | int GetUserHelp (char *helpTkn); |
---|
161 | int IsAmbig (int charCode, int dType); |
---|
162 | int IsMissing (int charCode, int dType); |
---|
163 | int MBResID (char nuc); |
---|
164 | int NBits (int x); |
---|
165 | int NucID (char nuc); |
---|
166 | void PrintSettings (char *command, ModelInfo *mp); |
---|
167 | void PrintYesNo (int yn, char s[4]); |
---|
168 | int ProtID (char aa); |
---|
169 | int SetPartition (int part); |
---|
170 | int SetSpeciespartition (int part); |
---|
171 | int SetTaxaFromTranslateTable (void); |
---|
172 | int StandID (char nuc); |
---|
173 | void WhatVariableExp (SafeLong exp, char *st); |
---|
174 | char WhichAA (int x); |
---|
175 | MrBFlt WhichCont (int x); |
---|
176 | char WhichRes (int x); |
---|
177 | char WhichStand (int x); |
---|
178 | |
---|
179 | |
---|
180 | |
---|
181 | /* globals */ |
---|
182 | int autoClose; /* autoclose */ |
---|
183 | int autoOverwrite; /* Overwrite or append outputfiles when nowarnings=yes */ |
---|
184 | Calibration *calibrationPtr; /* ptr to calibration being set */ |
---|
185 | CharInformation *charInfo; /* holds critical information about characters */ |
---|
186 | SafeLong **charSet; /* holds information about defined charsets */ |
---|
187 | char **charSetNames; /* holds names of character sets */ |
---|
188 | Comptree comptreeParams; /* holds parameters for comparetree command */ |
---|
189 | char **constraintNames; /* holds names of constraints */ |
---|
190 | int dataType; /* type of data */ |
---|
191 | Calibration defaultCalibration; /* default calibration */ |
---|
192 | SafeLong **definedConstraint; /* bitfields representing taxa sets of defined constraints */ |
---|
193 | SafeLong **definedConstraintTwo;/* bitfields representing second taxa sets of defined constraints (used for PARTIAL constraints) */ |
---|
194 | SafeLong **definedConstraintPruned; /* bitfields representing taxa sets of defined constraints after delited taxa are removed */ |
---|
195 | SafeLong **definedConstraintTwoPruned;/* bitfields representing second taxa sets of defined constraints for PARTIAL constraints after delited*/ |
---|
196 | /* taxa are removed and for NEGATIVE constraint it contains complements of definedConstraintPruned */ |
---|
197 | int echoMB; /* flag used by Manual to prevent echoing */ |
---|
198 | SafeLong expecting; /* variable denoting expected token type */ |
---|
199 | int foundNewLine; /* whether a new line has been found */ |
---|
200 | int inComment; /* flag for whether input stream is commented */ |
---|
201 | int inComparetreeCommand; /* flag set whenever you enter comparetree cmd */ |
---|
202 | int inferAncStates; /* should ancestral states be inferred (y/n) */ |
---|
203 | int inferSiteOmegas; /* should site omegas be inferred (y/n) */ |
---|
204 | int inferSiteRates; /* should site rates be inferred (y/n) */ |
---|
205 | int inMrbayesBlock; /* flag for whether we are in a mrbayes block */ |
---|
206 | int inSumtCommand; /* flag set whenever you enter sumt cmd */ |
---|
207 | int inTreesBlock; /* flag for whether we are in a trees block */ |
---|
208 | int inValidCommand; /* a useful flag set whenever you enter a cmd */ |
---|
209 | int isInAmbig, isInPoly; /* flags whether we are within () or {} */ |
---|
210 | int isTaxsetDef; /* is a taxon set defined */ |
---|
211 | int isTranslateDef; /* is a translation block defined */ |
---|
212 | int isTranslateDiff; /* is translate different from current taxaset? */ |
---|
213 | char logFileName[100]; /* name of the log file */ |
---|
214 | int logToFile; /* should screen output be logged to a file */ |
---|
215 | FILE *logFileFp; /* file pointer to log file */ |
---|
216 | int longIntegerSize; /* size of an unsigned integer */ |
---|
217 | char manFileName[100]; /* name of the file for the command help info */ |
---|
218 | int *matrix; /* matrix containing original data */ |
---|
219 | int matrixHasPoly; /* flag for whether matrix has polymorphisms */ |
---|
220 | int memAllocs[NUM_ALLOCS]; /* allocated memory flags */ |
---|
221 | int mode; /* mode of program (interactive/noninteractive) */ |
---|
222 | Calibration *nodeCalibration; /* holds information about node calibrations */ |
---|
223 | int noWarn; /* no warnings on overwriting files */ |
---|
224 | int numChar; /* number of characters in character matrix */ |
---|
225 | int numCharSets; /* number of character sets */ |
---|
226 | int numComments; /* counts how deeply nested a comment is */ |
---|
227 | int numDefinedConstraints; /* number of constraints defined */ |
---|
228 | int numDefinedPartitions; /* number of partitions defined */ |
---|
229 | int numDefinedSpeciespartitions; /* number of speciespartitions defined */ |
---|
230 | int numNamedTaxa; /* number of named taxa during parsing of cmd */ |
---|
231 | int numOpenExeFiles; /* number of execute files open */ |
---|
232 | int numSpecies; /* number of species in current speciespartition */ |
---|
233 | int numTaxa; /* number of taxa in character matrix */ |
---|
234 | int numTaxaSets; /* number of taxa sets */ |
---|
235 | int numTranslates; /* number of taxa in active translate block */ |
---|
236 | int outGroupNum; /* number of outgroup taxon */ |
---|
237 | ParmInfo paramTable[NUMPARAMS]; /* information on parameters */ |
---|
238 | char **partitionNames; /* hold names of partitions (first is "default") */ |
---|
239 | int **partitionId; /* holds information about defined partitions */ |
---|
240 | int partitionNum; /* index of current partition */ |
---|
241 | Plot plotParams; /* holds parameters for plot command */ |
---|
242 | int precision; /* precision of samples and summary stats */ |
---|
243 | int quitOnError; /* quit on error? */ |
---|
244 | int replaceLogFile; /* should logfile be replace/appended to */ |
---|
245 | int scientific; /* use scientific format for samples ? */ |
---|
246 | char spacer[10]; /* holds blanks for printing indentations */ |
---|
247 | NameSet *speciesNameSets; /* hold species name sets, one for each speciespartition */ |
---|
248 | int **speciespartitionId; /* holds info about defined speciespartitions */ |
---|
249 | char **speciespartitionNames; /* hold names of speciespartitions (first is "default") */ |
---|
250 | int speciespartitionNum; /* index of current speciespartition */ |
---|
251 | Sump sumpParams; /* holds parameters for sump command */ |
---|
252 | Sumt sumtParams; /* holds parameters for sumt command */ |
---|
253 | Sumss sumssParams; /* holds parameters for sumss command */ |
---|
254 | TaxaInformation *taxaInfo; /* holds critical information about taxa */ |
---|
255 | char **taxaNames; /* holds name of taxa */ |
---|
256 | SafeLong **taxaSet; /* holds information about defined taxasets */ |
---|
257 | char **taxaSetNames; /* holds names of taxa sets */ |
---|
258 | int *tempActiveConstraints;/* temporarily holds active constraints size allcated */ |
---|
259 | enum ConstraintType *definedConstraintsType;/* Store type of constraint */ |
---|
260 | int *tempSet; /* temporarily holds defined set */ |
---|
261 | int *tempSetNeg; /* holds bitset of negative set of taxa for partial constraint*/ |
---|
262 | int theAmbigChar; /* int containing ambiguous character */ |
---|
263 | Calibration *tipCalibration; /* holds information about node calibrations */ |
---|
264 | char **transFrom; /* translation block information */ |
---|
265 | char **transTo; /* translation block information */ |
---|
266 | int userBrlensDef; /* are the branch lengths on user tree defined */ |
---|
267 | |
---|
268 | #if defined (BEAGLE_ENABLED) |
---|
269 | int tryToUseBEAGLE; /* try to use the BEAGLE library */ |
---|
270 | int beagleScalingScheme; /* BEAGLE dynamic scaling */ |
---|
271 | int beagleScalingFrequency;/* BEAGLE dynamic scaling frequency */ |
---|
272 | long beagleFlags; /* BEAGLE required resource flags */ |
---|
273 | int *beagleResource; /* BEAGLE resource choice list */ |
---|
274 | int beagleResourceCount; /* BEAGLE resource choice list length */ |
---|
275 | int beagleInstanceCount; /* total number of BEAGLE instances */ |
---|
276 | #endif |
---|
277 | |
---|
278 | #if defined (THREADS_ENABLED) |
---|
279 | int tryToUseThreads; /* try to use pthreads with BEAGLE library */ |
---|
280 | #endif |
---|
281 | |
---|
282 | |
---|
283 | /* local (to this file) */ |
---|
284 | char *tokenP, token[CMD_STRING_LENGTH], *cmdStr=NULL; |
---|
285 | Calibration defaultCalibration = { |
---|
286 | /* name = */ "Unconstrained", |
---|
287 | /* prior = */ 0, /* = unconstrained */ |
---|
288 | /* max = */ -1.0, |
---|
289 | /* min = */ -1.0, |
---|
290 | /* offset = */ -1.0, |
---|
291 | /* lambda = */ -1.0, |
---|
292 | /* age = */ -1.0}; |
---|
293 | |
---|
294 | CmdType commands[] = |
---|
295 | { |
---|
296 | /* Information on commands initialization: |
---|
297 | |
---|
298 | 1 = Command number (cmdNumber) |
---|
299 | 2 = Command name (string) |
---|
300 | 3 = Special command (YES/NO) (specialCmd) |
---|
301 | 4 = Pointer to finishing function (fp) |
---|
302 | 5 = Number of valid parameters (numParms) |
---|
303 | 6 = List of valid parameters (parmList) |
---|
304 | 7 = Expecting (2^TokenType) (expect) (PARAMETER = 4; SEMICOLON = 32; ALPHA = 16384; |
---|
305 | ALPHA | QUESTIONMARK | DASH | NUMBER | ASTERISK | EXCLAMATIONMARK | PERCENT | WEIRD | SEMICOLON = 11715360; |
---|
306 | ALPHA | QUESTIONMARK | DASH | NUMBER | ASTERISK | EXCLAMATIONMARK | PERCENT | WEIRD | SEMICOLON | LEFTPAR | RIGHTPAR | LEFTCURL | RIGHTCURL = 112381728; |
---|
307 | PARAMETER | SEMICOLON = 36; NUMBER | ALPHA = 49152; ALPHA | SEMICOLON = 16416; EQUALSIGN = 8; NUMBER = 32768) |
---|
308 | 8 = Description of the command (cmdDescription) |
---|
309 | 9 = Where should the command be used (cmdUse) (IN_CMD = used from command line or mrbayes block; IN_FILE = used in data block or in tree block) |
---|
310 | 10 = Should the command be shown when "help" is typed (hiding). |
---|
311 | |
---|
312 | #1 #2 #3 #4 #5 #6 #7 #8 #9 #10 |
---|
313 | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ |
---|
314 | { 0, "#", NO, NULL, 1, {0}, 4, "", IN_FILE, HIDE }, |
---|
315 | { 1, "About", NO, DoAbout, 0, {-1}, 32, "Describes the program", IN_CMD, SHOW }, |
---|
316 | { 2, "Acknowledgments", NO, DoAcknowledgments, 0, {-1}, 32, "Shows program acknowledgments", IN_CMD, SHOW }, |
---|
317 | { 3, "Begin", NO, NULL, 6, {1,2,3,201,226,227}, 4, "Denotes beginning of block in file", IN_FILE, SHOW }, |
---|
318 | { 4, "Calibrate", NO, DoCalibrate, 1, {119}, 4, "Assigns dates to terminals or interior nodes", IN_CMD, SHOW }, |
---|
319 | { 5, "Charset", NO, DoCharset, 1, {15}, 4, "Assigns a group of sites to a set", IN_CMD, SHOW }, |
---|
320 | { 6, "Charstat", NO, DoCharStat, 0, {-1}, 32, "Shows status of characters", IN_CMD, SHOW }, |
---|
321 | { 7, "Citations", NO, DoCitations, 0, {-1}, 32, "Citation of program, models, and methods", IN_CMD, SHOW }, |
---|
322 | { 8, "Comparetree", NO, DoCompareTree, 7, {127,128,129,130,221,222,223}, 36, "Compares the trees from two tree files", IN_CMD, SHOW }, |
---|
323 | { 9, "Constraint", NO, DoConstraint, 1, {66}, 4, "Defines a constraint on tree topology", IN_CMD, SHOW }, |
---|
324 | { 10, "Ctype", NO, DoCtype, 1, {65}, 4, "Assigns ordering for the characters", IN_CMD, SHOW }, |
---|
325 | { 11, "Databreaks", YES, DoBreaks, 1, {93}, 32768, "Defines data breaks for autodiscrete gamma model", IN_CMD, SHOW }, |
---|
326 | { 12, "Delete", YES, DoDelete, 1, {47}, 49152, "Deletes taxa from the analysis", IN_CMD, SHOW }, |
---|
327 | { 13, "Dimensions", NO, DoDimensions, 2, {4,5}, 4, "Defines size of character matrix", IN_FILE, SHOW }, |
---|
328 | { 14, "Disclaimer", NO, DoDisclaimer, 0, {-1}, 32, "Describes program disclaimer", IN_CMD, SHOW }, |
---|
329 | { 15, "End", NO, DoEndBlock, 0, {-1}, 32, "Denotes end of a block in file", IN_FILE, SHOW }, |
---|
330 | { 16, "Endblock", NO, DoEndBlock, 0, {-1}, 32, "Alternative way of denoting end of a block", IN_FILE, SHOW }, |
---|
331 | { 17, "Exclude", YES, DoExclude, 1, {45}, 49152, "Excludes sites from the analysis", IN_CMD, SHOW }, |
---|
332 | { 18, "Execute", YES, DoExecute, 1, {12}, 16384, "Executes a file", IN_CMD, SHOW }, |
---|
333 | { 19, "Format", NO, DoFormat, 7, {6,7,8,9,10,219,220}, 4, "Defines character format in data block", IN_FILE, SHOW }, |
---|
334 | { 20, "Help", YES, DoHelp, 1, {50}, 16416, "Provides detailed description of commands", IN_CMD, SHOW }, |
---|
335 | { 21, "Include", YES, DoInclude, 1, {46}, 49152, "Includes sites", IN_CMD, SHOW }, |
---|
336 | { 22, "Link", NO, DoLink, 27, {55,56,57,58,59,60,61,62,63,72,73,74,75,76,105,118,193,194,195,196,197,242,243,252,253,255,256}, 4, "Links parameters across character partitions", IN_CMD, SHOW }, |
---|
337 | { 23, "Log", NO, DoLog, 5, {85,86,87,88,89}, 4, "Logs screen output to a file", IN_CMD, SHOW }, |
---|
338 | { 24, "Lset", NO, DoLset, 16, {28,29,30,31,32,33,34,40,51,52,53,90,91,131,188,189}, 4, "Sets the parameters of the likelihood model", IN_CMD, SHOW }, |
---|
339 | { 25, "Manual", NO, DoManual, 1, {126}, 36, "Prints a command reference to a text file", IN_CMD, SHOW }, |
---|
340 | { 26, "Matrix", YES, DoMatrix, 1, {11},112381728, "Defines matrix of characters in data block", IN_FILE, SHOW }, |
---|
341 | { 27, "Mcmc", NO, DoMcmc, 46, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152, |
---|
342 | 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215}, 36, "Starts Markov chain Monte Carlo analysis", IN_CMD, SHOW }, |
---|
343 | { 28, "Mcmcp", NO, DoMcmcp, 46, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152, |
---|
344 | 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215}, 4, "Sets the parameters of a chain (without starting analysis)", IN_CMD, SHOW }, |
---|
345 | { 29, "Outgroup", YES, DoOutgroup, 1, {78}, 49152, "Changes outgroup taxon", IN_CMD, SHOW }, |
---|
346 | { 30, "Pairs", YES, DoPairs, 1, {92}, 32768, "Defines nucleotide pairs (doublets) for stem models", IN_CMD, SHOW }, |
---|
347 | { 31, "Partition", NO, DoPartition, 1, {16}, 4, "Assigns a character partition", IN_CMD, SHOW }, |
---|
348 | { 32, "Plot", NO, DoPlot, 6, {106,107,108,109,224,225}, 36, "Plots parameters from MCMC analysis", IN_CMD, SHOW }, |
---|
349 | { 33, "Prset", NO, DoPrset, 41, {35,36,37,38,39,41,42,43,44,54,64,67,68,69,70,71,77,100,101,102,103,104,110,111,117,120,121,133, |
---|
350 | 168,172,173,174,183,184,185,218,241,246,247,251,254}, 4, "Sets the priors for the parameters", IN_CMD, SHOW }, |
---|
351 | { 34, "Propset", NO, DoPropset, 1, {186}, 4, "Sets proposal probabilities and tuning parameters", IN_CMD, SHOW }, |
---|
352 | { 35, "Quit", NO, DoQuit, 0, {-1}, 32, "Quits the program", IN_CMD, SHOW }, |
---|
353 | { 36, "Report", NO, DoReport, 9, {122,123,124,125,134,135,136,192,217}, 4, "Controls how model parameters are reported", IN_CMD, SHOW }, |
---|
354 | { 37, "Restore", YES, DoRestore, 1, {48}, 49152, "Restores taxa", IN_CMD, SHOW }, |
---|
355 | { 38, "Set", NO, DoSet, 22, {13,14,94,145,170,171,179,181,182,216,229,233,234,235,236,237,238,239,240,245,268}, 4, "Sets run conditions and defines active data partition", IN_CMD, SHOW }, |
---|
356 | { 39, "Showbeagle", NO, DoShowBeagle, 0, {-1}, 32, "Show available BEAGLE resources", IN_CMD, SHOW }, |
---|
357 | { 40, "Showmatrix", NO, DoShowMatrix, 0, {-1}, 32, "Shows current character matrix", IN_CMD, SHOW }, |
---|
358 | { 41, "Showmcmctrees", NO, DoShowMcmcTrees, 0, {-1}, 32, "Shows trees used in mcmc analysis", IN_CMD, SHOW }, |
---|
359 | { 42, "Showmodel", NO, DoShowModel, 0, {-1}, 32, "Shows model settings", IN_CMD, SHOW }, |
---|
360 | { 43, "Showmoves", NO, DoShowMoves, 1, {180}, 36, "Shows moves for current model", IN_CMD, SHOW }, |
---|
361 | { 44, "Showparams", NO, DoShowParams, 0, {-1}, 32, "Shows parameters in current model", IN_CMD, SHOW }, |
---|
362 | { 45, "Showusertrees", NO, DoShowUserTrees, 0, {-1}, 32, "Shows user-defined trees", IN_CMD, SHOW }, |
---|
363 | { 46,"Speciespartition", NO,DoSpeciespartition, 1, {244}, 4, "Defines a partition of tips into species", IN_CMD, SHOW }, |
---|
364 | { 47, "Ss", NO, DoSs, 50, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152, |
---|
365 | 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215,248,249,250,257}, 36, "Starts stepping-stone sampling", IN_CMD, SHOW }, |
---|
366 | { 48, "Ssp", NO, DoSsp, 50, {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152, |
---|
367 | 153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215,248,249,250,257}, 36, "Sets the parameters of a stepping-stone (without starting)", IN_CMD, SHOW }, |
---|
368 | { 49, "Startvals", NO, DoStartvals, 1, {187}, 4, "Sets starting values of parameters", IN_CMD, SHOW }, |
---|
369 | { 50, "Sump", NO, DoSump, 13, {96,97,137,138,139,140,141,161,162,178,211,212,231}, 36, "Summarizes parameters from MCMC analysis", IN_CMD, SHOW }, |
---|
370 | { 51, "Sumss", NO, DoSumSs, 10, {258,259,260,261,262,263,264,265,266,267}, 36, "Summarizes parameters from stepping-stone analysis", IN_CMD, SHOW }, |
---|
371 | { 52, "Sumt", NO, DoSumt, 21, {80,81,82,95,146,147,163,164,165,167,175,177,204,205,206,207,208,209,210,230,232}, 36, "Summarizes trees from MCMC analysis", IN_CMD, SHOW }, |
---|
372 | { 53, "Taxastat", NO, DoTaxaStat, 0, {-1}, 32, "Shows status of taxa", IN_CMD, SHOW }, |
---|
373 | { 54, "Taxset", NO, DoTaxaset, 1, {49}, 4, "Assigns a group of taxa to a set", IN_CMD, SHOW }, |
---|
374 | { 55, "Taxlabels", YES, DoTaxlabels, 1, {228}, 49152, "Defines taxon labels", IN_FILE, SHOW }, |
---|
375 | { 56, "Translate", YES, DoTranslate, 1, {83}, 49152, "Defines alternative names for taxa", IN_FILE, SHOW }, |
---|
376 | { 57, "Tree", NO, DoTree, 1, {79}, 4, "Defines a tree", IN_FILE, SHOW }, |
---|
377 | { 58, "Unlink", NO, DoUnlink, 23, {55,56,57,58,59,60,61,62,63,72,73,74,75,76,105,118,193,194,195,196,197,242,243}, 4, "Unlinks parameters across character partitions", IN_CMD, SHOW }, |
---|
378 | { 59, "Usertree", YES, DoUserTree, 1, {203}, 8, "Defines a single user tree", IN_CMD, HIDE }, |
---|
379 | { 60, "Version", NO, DoVersion, 0, {-1}, 32, "Shows program version", IN_CMD, SHOW }, |
---|
380 | /* NOTE: If you add a command here, make certain to change NUMCOMMANDS (above, in this file) appropriately! */ |
---|
381 | { 999, NULL, NO, NULL, 0, {-1}, 32, "", IN_CMD, HIDE } |
---|
382 | }; |
---|
383 | static int fromI, toJ, isNegative, foundDash, foundExp, foundEqual; |
---|
384 | int inDataBlock, inForeignBlock, isInterleaved, isFirstMatrixRead, isFirstInterleavedBlock, |
---|
385 | taxonCount, everyK, foundSlash, foundFirst, isMixed, whichPartition, |
---|
386 | numDivisions, charOrdering, foundColon, isFirstNode, nextAvailableNode, |
---|
387 | pairId, firstPair, inTaxaBlock, inCharactersBlock; |
---|
388 | char gapId, missingId, matchId, tempSetName[100], **tempNames; |
---|
389 | CmdType *commandPtr; /*Points to the commands array entery which corresponds to currently processed command*/ |
---|
390 | ParmInfoPtr paramPtr; /*Points to paramTable table array entery which corresponds to currently processed parameter of current command*/ |
---|
391 | TreeNode *pPtr, *qPtr; |
---|
392 | |
---|
393 | enum ConstraintType consrtainType; /* Used only in processing of constraine command to indicate what is the type of constrain */ |
---|
394 | |
---|
395 | |
---|
396 | |
---|
397 | int AddToGivenSet (int i, int j, int k, int id, int *Set) |
---|
398 | |
---|
399 | { |
---|
400 | |
---|
401 | int m, n; |
---|
402 | |
---|
403 | if (id <= 0) |
---|
404 | { |
---|
405 | MrBayesPrint ("%s The id for a temporary set should be greater than 0\n", spacer); |
---|
406 | return (ERROR); |
---|
407 | } |
---|
408 | |
---|
409 | if (i < 0 && j < 0) |
---|
410 | return (ERROR); |
---|
411 | else if (i < 0 && j >= 0) |
---|
412 | return (ERROR); |
---|
413 | else if (i >= 0 && j < 0) |
---|
414 | { |
---|
415 | if (k >= 0) |
---|
416 | return (ERROR); |
---|
417 | else |
---|
418 | { |
---|
419 | if (Set[i] != 0) |
---|
420 | { |
---|
421 | MrBayesPrint ("%s Character %d defined more than once\n", spacer, i+1); |
---|
422 | return (ERROR); |
---|
423 | } |
---|
424 | Set[i] = id; |
---|
425 | } |
---|
426 | } |
---|
427 | else if (i >= 0 && j >= 0) |
---|
428 | { |
---|
429 | if (k < 0) |
---|
430 | { |
---|
431 | for (m=i; m<=j; m++) |
---|
432 | { |
---|
433 | if (Set[m] != 0) |
---|
434 | { |
---|
435 | MrBayesPrint ("%s Character %d defined more than once\n", spacer, m+1); |
---|
436 | return (ERROR); |
---|
437 | } |
---|
438 | Set[m] = id; |
---|
439 | } |
---|
440 | } |
---|
441 | else |
---|
442 | { |
---|
443 | n = k; |
---|
444 | for (m=i; m<=j; m++) |
---|
445 | { |
---|
446 | if (n % k == 0) |
---|
447 | { |
---|
448 | if (Set[m] != 0) |
---|
449 | { |
---|
450 | MrBayesPrint ("%s Character %d defined more than once\n", spacer, m+1); |
---|
451 | return (ERROR); |
---|
452 | } |
---|
453 | Set[m] = id; |
---|
454 | } |
---|
455 | n++; |
---|
456 | } |
---|
457 | } |
---|
458 | } |
---|
459 | |
---|
460 | |
---|
461 | return (NO_ERROR); |
---|
462 | |
---|
463 | } |
---|
464 | |
---|
465 | |
---|
466 | |
---|
467 | |
---|
468 | |
---|
469 | int AddToSet (int i, int j, int k, int id) |
---|
470 | { |
---|
471 | return AddToGivenSet (i, j, k,id, tempSet); |
---|
472 | } |
---|
473 | |
---|
474 | |
---|
475 | |
---|
476 | |
---|
477 | /* AddNameSet: Push a name set onto the end of a list of name sets, with reallocation |
---|
478 | of list to hold the extra element. The calling function needs to keep track of |
---|
479 | the counter holding the length of the list. */ |
---|
480 | int AddNameSet (NameSet **nameSetList, int numNameSets, char **nameSet, int numNames) |
---|
481 | { |
---|
482 | int i; |
---|
483 | |
---|
484 | (*nameSetList) = (NameSet*) SafeRealloc ((void*)(*nameSetList), (size_t)(((numNameSets+1)*sizeof(NameSet)))); |
---|
485 | |
---|
486 | (*nameSetList)[numNameSets].names = NULL; |
---|
487 | (*nameSetList)[numNameSets].numNames = numNames; |
---|
488 | |
---|
489 | for (i=0; i<numNames; i++) |
---|
490 | AddString(&((*nameSetList)[numNameSets].names), i, nameSet[i]); |
---|
491 | |
---|
492 | return NO_ERROR; |
---|
493 | } |
---|
494 | |
---|
495 | |
---|
496 | |
---|
497 | |
---|
498 | |
---|
499 | /* AddString: Push a string onto the end of a list, with reallocation of list |
---|
500 | to hold the extra element. The calling function needs to keep track of |
---|
501 | the counter holding the length of the list. */ |
---|
502 | int AddString (char ***list, int len, char *token) |
---|
503 | { |
---|
504 | (*list) = (char **) SafeRealloc ((void *)(*list), (size_t)((len+1)*sizeof(char*))); |
---|
505 | if (!(*list)) |
---|
506 | return ERROR; |
---|
507 | |
---|
508 | (*list)[len] = (char *) SafeCalloc ((size_t)(strlen(token)+1), sizeof(char)); |
---|
509 | if (!(*list)[len]) |
---|
510 | return ERROR; |
---|
511 | |
---|
512 | strcpy ((*list)[len], token); |
---|
513 | |
---|
514 | return NO_ERROR; |
---|
515 | } |
---|
516 | |
---|
517 | |
---|
518 | |
---|
519 | |
---|
520 | |
---|
521 | int AllocCharacters (void) |
---|
522 | |
---|
523 | { |
---|
524 | |
---|
525 | int i, tempSetSize; |
---|
526 | |
---|
527 | if (memAllocs[ALLOC_MATRIX] == YES) |
---|
528 | goto errorExit; |
---|
529 | matrix = (int *)SafeMalloc((size_t) (numTaxa * numChar * sizeof(int))); |
---|
530 | if (!matrix) |
---|
531 | { |
---|
532 | MrBayesPrint ("%s Problem allocating matrix (%d)\n", spacer, numTaxa * numChar * sizeof(int)); |
---|
533 | goto errorExit; |
---|
534 | } |
---|
535 | for (i=0; i<numTaxa * numChar; i++) |
---|
536 | matrix[i] = 0; |
---|
537 | memAllocs[ALLOC_MATRIX] = YES; |
---|
538 | |
---|
539 | if (memAllocs[ALLOC_CHARINFO] == YES) |
---|
540 | goto errorExit; |
---|
541 | charInfo = (CharInformation *)SafeMalloc((size_t) (numChar * sizeof(CharInformation))); |
---|
542 | if (!charInfo) |
---|
543 | { |
---|
544 | MrBayesPrint ("%s Problem allocating charInfo (%d)\n", spacer, numChar * sizeof(CharInformation)); |
---|
545 | goto errorExit; |
---|
546 | } |
---|
547 | for (i=0; i<numChar; i++) |
---|
548 | { |
---|
549 | charInfo[i].isExcluded = NO; |
---|
550 | charInfo[i].numStates = 0; |
---|
551 | charInfo[i].charType = 0; |
---|
552 | charInfo[i].isMissAmbig = NO; |
---|
553 | charInfo[i].ctype = UNORD; |
---|
554 | charInfo[i].charId = 0; |
---|
555 | charInfo[i].pairsId = 0; |
---|
556 | charInfo[i].bigBreakAfter = NO; |
---|
557 | } |
---|
558 | memAllocs[ALLOC_CHARINFO] = YES; |
---|
559 | |
---|
560 | if (memAllocs[ALLOC_CHARSETS] == YES) |
---|
561 | goto errorExit; |
---|
562 | charSetNames = NULL; |
---|
563 | charSet = NULL; |
---|
564 | numCharSets = 0; |
---|
565 | memAllocs[ALLOC_CHARSETS] = YES; /* safe to do free */ |
---|
566 | |
---|
567 | if (memAllocs[ALLOC_PARTITIONS] == YES) |
---|
568 | goto errorExit; |
---|
569 | partitionNames = NULL; |
---|
570 | partitionId = (int**) SafeMalloc ((size_t)(numChar*sizeof(int*))); |
---|
571 | for (i=0; i<numChar; i++) |
---|
572 | partitionId[i] = (int *) SafeMalloc ((size_t)(1 * sizeof(int))); |
---|
573 | numDefinedPartitions = 0; /* number of defined partitions */ |
---|
574 | memAllocs[ALLOC_PARTITIONS] = YES; /* safe to do free */ |
---|
575 | |
---|
576 | if (memAllocs[ALLOC_PARTITIONVARS] == YES) |
---|
577 | goto errorExit; |
---|
578 | numVars = NULL; |
---|
579 | tempLinkUnlinkVec = NULL; |
---|
580 | activeParts = NULL; |
---|
581 | tempLinkUnlinkVec = NULL; |
---|
582 | tempNum = NULL; |
---|
583 | linkTable[0] = NULL; |
---|
584 | tempLinkUnlink[0] = NULL; |
---|
585 | for (i=0; i<NUM_LINKED; i++) |
---|
586 | { |
---|
587 | linkTable[i] = NULL; |
---|
588 | tempLinkUnlink[i] = NULL; |
---|
589 | activeParams[i] = NULL; |
---|
590 | } |
---|
591 | memAllocs[ALLOC_PARTITIONVARS] = YES; |
---|
592 | |
---|
593 | if (memAllocs[ALLOC_TMPSET] == NO) |
---|
594 | goto errorExit; |
---|
595 | if (numChar > numTaxa) |
---|
596 | tempSetSize = numChar; |
---|
597 | else |
---|
598 | tempSetSize = numTaxa; |
---|
599 | tempSet = (int *)SafeRealloc((void *)tempSet, (size_t) (tempSetSize * sizeof(int))); |
---|
600 | tempSetNeg = (int *)SafeRealloc((void *)tempSetNeg, (size_t) (tempSetSize * sizeof(int))); |
---|
601 | if (!tempSet || !tempSetNeg) |
---|
602 | { |
---|
603 | MrBayesPrint ("%s Problem reallocating tempSet (%d)\n", spacer, tempSetSize * sizeof(int)); |
---|
604 | goto errorExit; |
---|
605 | } |
---|
606 | |
---|
607 | MrBayesPrint ("%s Allocated matrix\n", spacer); |
---|
608 | return (NO_ERROR); |
---|
609 | |
---|
610 | errorExit: |
---|
611 | MrBayesPrint ("%s Problem allocating matrix\n", spacer); |
---|
612 | FreeMatrix(); |
---|
613 | return (ERROR); |
---|
614 | } |
---|
615 | |
---|
616 | |
---|
617 | |
---|
618 | |
---|
619 | |
---|
620 | int AllocMatrix (void) |
---|
621 | |
---|
622 | { |
---|
623 | if (memAllocs[ALLOC_TAXA] == NO && AllocTaxa() == ERROR) |
---|
624 | return ERROR; |
---|
625 | else |
---|
626 | return (AllocCharacters()); |
---|
627 | } |
---|
628 | |
---|
629 | |
---|
630 | |
---|
631 | |
---|
632 | |
---|
633 | int AllocTaxa (void) |
---|
634 | |
---|
635 | { |
---|
636 | |
---|
637 | int i; |
---|
638 | |
---|
639 | if (defTaxa==NO) |
---|
640 | { |
---|
641 | MrBayesPrint ("%s Number of taxa not defined\n", spacer); |
---|
642 | return (ERROR); |
---|
643 | } |
---|
644 | if (numTaxa == 0) |
---|
645 | { |
---|
646 | MrBayesPrint ("%s Number of taxa is 0\n", spacer); |
---|
647 | return (ERROR); |
---|
648 | } |
---|
649 | |
---|
650 | /* allocate space for taxa */ |
---|
651 | if (memAllocs[ALLOC_TAXA] == YES) |
---|
652 | goto errorExit; |
---|
653 | taxaNames = NULL; /* This variable is allocated in AddString */ |
---|
654 | taxaInfo = (TaxaInformation *)SafeMalloc((size_t) (numTaxa * sizeof(TaxaInformation))); |
---|
655 | if (!taxaInfo) |
---|
656 | { |
---|
657 | goto errorExit; |
---|
658 | } |
---|
659 | tipCalibration = (Calibration *)SafeMalloc((size_t) (numTaxa * sizeof(Calibration))); |
---|
660 | if (!tipCalibration) |
---|
661 | { |
---|
662 | free (taxaInfo); |
---|
663 | taxaInfo = NULL; |
---|
664 | goto errorExit; |
---|
665 | } |
---|
666 | for (i=0; i<numTaxa; i++) |
---|
667 | { |
---|
668 | taxaInfo[i].isDeleted = NO; |
---|
669 | taxaInfo[i].charCount = 0; |
---|
670 | } |
---|
671 | memAllocs[ALLOC_TAXA] = YES; |
---|
672 | |
---|
673 | /* taxa sets */ |
---|
674 | if (memAllocs[ALLOC_TAXASETS] == YES) |
---|
675 | goto errorExit; |
---|
676 | taxaSetNames = NULL; |
---|
677 | taxaSet = NULL; |
---|
678 | numTaxaSets = 0; |
---|
679 | memAllocs[ALLOC_TAXASETS] = YES; /* safe to free */ |
---|
680 | |
---|
681 | /* species partitions; allocate space and set default species partition */ |
---|
682 | if (memAllocs[ALLOC_SPECIESPARTITIONS] == YES) |
---|
683 | goto errorExit; |
---|
684 | speciespartitionNames = NULL; |
---|
685 | speciesNameSets = NULL; |
---|
686 | speciespartitionId = (int**) SafeMalloc ((size_t)(numTaxa*sizeof(int*))); |
---|
687 | for (i=0; i<numTaxa; i++) |
---|
688 | { |
---|
689 | speciespartitionId[i] = (int *) SafeMalloc ((size_t)(1 * sizeof(int))); |
---|
690 | speciespartitionId[i][0] = i + 1; /* 1-based taxon index, do not ask me why */ |
---|
691 | } |
---|
692 | numDefinedSpeciespartitions = 0; /* number of defined species partitions */ |
---|
693 | memAllocs[ALLOC_SPECIESPARTITIONS] = YES; /* safe to do free */ |
---|
694 | |
---|
695 | /* constraints */ |
---|
696 | if (memAllocs[ALLOC_CONSTRAINTS] == YES) |
---|
697 | goto errorExit; |
---|
698 | constraintNames = NULL; |
---|
699 | definedConstraintsType = NULL; |
---|
700 | definedConstraint = NULL; |
---|
701 | definedConstraintTwo = NULL; |
---|
702 | definedConstraintPruned = NULL; |
---|
703 | definedConstraintTwoPruned = NULL; |
---|
704 | numDefinedConstraints = 0; |
---|
705 | tempActiveConstraints = NULL; |
---|
706 | memAllocs[ALLOC_CONSTRAINTS] = YES; /* safe to free */ |
---|
707 | |
---|
708 | /* translate table */ |
---|
709 | transFrom = NULL; |
---|
710 | transTo = NULL; |
---|
711 | numTranslates = 0; |
---|
712 | |
---|
713 | /* tempSet */ |
---|
714 | if (memAllocs[ALLOC_TMPSET] == YES) |
---|
715 | goto errorExit; |
---|
716 | tempSet = (int *) SafeMalloc ((size_t)(numTaxa*sizeof(int))); |
---|
717 | tempSetNeg = (int *) SafeMalloc ((size_t)(numTaxa*sizeof(int))); |
---|
718 | if (!tempSet || !tempSetNeg) |
---|
719 | goto errorExit; |
---|
720 | memAllocs[ALLOC_TMPSET] = YES; |
---|
721 | |
---|
722 | /* make sure previous user trees are freed */ |
---|
723 | if (numUserTrees > 0) |
---|
724 | { |
---|
725 | MrBayesPrint ("%s Previous user trees not freed\n", spacer); |
---|
726 | goto errorExit; |
---|
727 | } |
---|
728 | |
---|
729 | MrBayesPrint ("%s Allocated taxon set\n", spacer); |
---|
730 | return NO_ERROR; |
---|
731 | |
---|
732 | errorExit: |
---|
733 | MrBayesPrint ("%s Problem allocating taxon set\n", spacer); |
---|
734 | FreeTaxa(); |
---|
735 | return ERROR; |
---|
736 | } |
---|
737 | |
---|
738 | |
---|
739 | |
---|
740 | |
---|
741 | |
---|
742 | char ChangeCase (char c) |
---|
743 | |
---|
744 | { |
---|
745 | |
---|
746 | int x; |
---|
747 | |
---|
748 | x = tolower(c); |
---|
749 | return (x); |
---|
750 | |
---|
751 | } |
---|
752 | |
---|
753 | |
---|
754 | |
---|
755 | |
---|
756 | |
---|
757 | int CharacterCode (char ch, int *charCode, int chType) |
---|
758 | |
---|
759 | { |
---|
760 | |
---|
761 | |
---|
762 | if (chType == DNA || chType == RNA) |
---|
763 | { |
---|
764 | if ((*charCode = NucID (ch)) == -1) |
---|
765 | { |
---|
766 | MrBayesPrint ("%s Unrecognized DNA/RNA character '%c'\n", spacer, ch); |
---|
767 | return (ERROR); |
---|
768 | } |
---|
769 | } |
---|
770 | else if (chType == PROTEIN) |
---|
771 | { |
---|
772 | if ((*charCode = ProtID (ch)) == -1) |
---|
773 | { |
---|
774 | MrBayesPrint ("%s Unrecognized Protein character '%c'\n", spacer, ch); |
---|
775 | return (ERROR); |
---|
776 | } |
---|
777 | } |
---|
778 | else if (chType == RESTRICTION) |
---|
779 | { |
---|
780 | if ((*charCode = MBResID (ch)) == -1) |
---|
781 | { |
---|
782 | MrBayesPrint ("%s Unrecognized Restriction character '%c'\n", spacer, ch); |
---|
783 | return (ERROR); |
---|
784 | } |
---|
785 | } |
---|
786 | else if (chType == STANDARD) |
---|
787 | { |
---|
788 | if ((*charCode = StandID (ch)) == -1) |
---|
789 | { |
---|
790 | MrBayesPrint ("%s Unrecognized Standard character '%c'\n", spacer, ch); |
---|
791 | return (ERROR); |
---|
792 | } |
---|
793 | } |
---|
794 | else if (chType == CONTINUOUS) |
---|
795 | { |
---|
796 | MrBayesPrint ("%s CharacterCode function cannot check continuous characters\n", spacer); |
---|
797 | } |
---|
798 | else |
---|
799 | { |
---|
800 | MrBayesPrint ("%s Unrecognized character type (%d)\n", spacer, chType); |
---|
801 | return (ERROR); |
---|
802 | } |
---|
803 | |
---|
804 | return (NO_ERROR); |
---|
805 | |
---|
806 | } |
---|
807 | |
---|
808 | |
---|
809 | |
---|
810 | |
---|
811 | |
---|
812 | int CharacterNumber (int charCode, int chType) |
---|
813 | |
---|
814 | { |
---|
815 | |
---|
816 | int i, x = charCode; |
---|
817 | |
---|
818 | if (chType == CONTINUOUS) |
---|
819 | return 0; |
---|
820 | |
---|
821 | for (i=0; x!=0; i++) |
---|
822 | x >>= 1; |
---|
823 | |
---|
824 | return (i); |
---|
825 | |
---|
826 | } |
---|
827 | |
---|
828 | |
---|
829 | |
---|
830 | |
---|
831 | |
---|
832 | int CheckInitialPartitions (void) |
---|
833 | |
---|
834 | { |
---|
835 | |
---|
836 | int i; |
---|
837 | |
---|
838 | for (i=0; i<numChar; i++) |
---|
839 | { |
---|
840 | if (partitionId[i][0] <= 0 || partitionId[i][0] > numDivisions) |
---|
841 | { |
---|
842 | MrBayesPrint ("%s The partition for site %d is incorrect\n", spacer, i+1); |
---|
843 | return (ERROR); |
---|
844 | } |
---|
845 | } |
---|
846 | |
---|
847 | return (NO_ERROR); |
---|
848 | |
---|
849 | } |
---|
850 | |
---|
851 | |
---|
852 | |
---|
853 | |
---|
854 | |
---|
855 | int CheckStringValidity (char *s) |
---|
856 | |
---|
857 | { |
---|
858 | |
---|
859 | int i, numUnknownChars, tempNumComments, tempInComment; |
---|
860 | char temp[100]; |
---|
861 | |
---|
862 | i = 0; |
---|
863 | numUnknownChars = 0; |
---|
864 | tempNumComments = numComments; |
---|
865 | tempInComment = inComment; |
---|
866 | |
---|
867 | while(s[i] != '\0') |
---|
868 | { |
---|
869 | if (tempInComment == NO) |
---|
870 | { |
---|
871 | if ( !IsIn(s[i],"=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.;:,#()[]?-*/'\\'!%\"&~+^$@|{}`>< ") ) |
---|
872 | { |
---|
873 | if (IsWhite(s[i]) == 1 || IsWhite(s[i]) == 2) |
---|
874 | { |
---|
875 | |
---|
876 | } |
---|
877 | else |
---|
878 | { |
---|
879 | if ( commandPtr == NULL) |
---|
880 | return (ERROR); |
---|
881 | MrBayesPrint ("%s Unknown character \"%c\" (ASCII code %d)\n", spacer, s[i], s[i]); |
---|
882 | if (!strcmp(commandPtr->string,"Matrix")) |
---|
883 | { |
---|
884 | if (foundNewLine == NO) |
---|
885 | { |
---|
886 | MrBayesPrint ("%s The error is in character %d for taxon %s\n", spacer, taxaInfo[taxonCount-1].charCount+i+1, "???"); /* bug? */ |
---|
887 | } |
---|
888 | else |
---|
889 | { |
---|
890 | if (taxonCount == 0) |
---|
891 | MrBayesPrint ("%s The error is in the first taxon name\n", spacer); |
---|
892 | else |
---|
893 | { |
---|
894 | strcpy(temp, taxaNames[taxonCount]); |
---|
895 | if (isInterleaved == NO) |
---|
896 | MrBayesPrint ("%s The error is in the name of the taxon following taxon %s\n", spacer, temp); |
---|
897 | else |
---|
898 | { |
---|
899 | MrBayesPrint ("%s The error is in the name of the taxon following taxon %s\n", spacer, temp); |
---|
900 | MrBayesPrint ("%s in one of the interleaved data blocks\n", spacer); |
---|
901 | } |
---|
902 | } |
---|
903 | } |
---|
904 | } |
---|
905 | else if (!strcmp(commandPtr->string,"Execute")) |
---|
906 | { |
---|
907 | MrBayesPrint ("%s Assuming irrelevant characters at beginning of file; processing continues\n", spacer); |
---|
908 | return (NO_ERROR); |
---|
909 | } |
---|
910 | return (ERROR); |
---|
911 | } |
---|
912 | } |
---|
913 | if (s[i]=='[') |
---|
914 | { |
---|
915 | tempInComment = YES; |
---|
916 | tempNumComments++; |
---|
917 | } |
---|
918 | } |
---|
919 | else if (tempInComment == YES) |
---|
920 | { |
---|
921 | if (s[i]==']') |
---|
922 | { |
---|
923 | tempNumComments--; |
---|
924 | if (tempNumComments == 0) |
---|
925 | tempInComment = NO; |
---|
926 | } |
---|
927 | } |
---|
928 | i++; |
---|
929 | } |
---|
930 | |
---|
931 | if (numUnknownChars > 0) |
---|
932 | return (ERROR); |
---|
933 | else |
---|
934 | return (NO_ERROR); |
---|
935 | |
---|
936 | } |
---|
937 | |
---|
938 | |
---|
939 | |
---|
940 | |
---|
941 | |
---|
942 | /* CheckString: This function simply checks a vector of strings for a match against token. |
---|
943 | Upon return, matchIndex contains the index of the matched string. An |
---|
944 | ERROR is returned if there are no matches. */ |
---|
945 | int CheckString (char **list, int len, char *token, int *matchIndex) |
---|
946 | { |
---|
947 | int i; |
---|
948 | |
---|
949 | *matchIndex = -1; |
---|
950 | for (i=0; i<len; i++) |
---|
951 | { |
---|
952 | if (StrCmpCaseInsensitive(token,list[i]) == 0) |
---|
953 | { |
---|
954 | *matchIndex = i; |
---|
955 | return (NO_ERROR); |
---|
956 | } |
---|
957 | } |
---|
958 | |
---|
959 | return (ERROR); |
---|
960 | } |
---|
961 | |
---|
962 | |
---|
963 | |
---|
964 | |
---|
965 | |
---|
966 | int Dex (TreeNode *p) |
---|
967 | |
---|
968 | { |
---|
969 | |
---|
970 | return (p == NULL) ? -1 : p->index; |
---|
971 | |
---|
972 | } |
---|
973 | |
---|
974 | |
---|
975 | |
---|
976 | |
---|
977 | |
---|
978 | int DoAbout (void) |
---|
979 | |
---|
980 | { |
---|
981 | |
---|
982 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
983 | MrBayesPrint (" About the program \n"); |
---|
984 | MrBayesPrint (" \n"); |
---|
985 | MrBayesPrint (" MrBayes is a program for the Bayesian estimation of phylogeny. Bayesian \n"); |
---|
986 | MrBayesPrint (" inference of phylogeny is based upon the posterior probability distribution \n"); |
---|
987 | MrBayesPrint (" of trees. Trees are labelled T1, T2, ..., Tn, where n is the number of \n"); |
---|
988 | MrBayesPrint (" possible trees. The posterior probability of the i-th tree is calculated \n"); |
---|
989 | MrBayesPrint (" using Bayes\'s formula as \n"); |
---|
990 | MrBayesPrint (" \n"); |
---|
991 | MrBayesPrint (" Pr[Ti | X] = Pr[X | Ti] X Pr[Ti] / Pr[X] \n"); |
---|
992 | MrBayesPrint (" \n"); |
---|
993 | MrBayesPrint (" where X is a character matrix. Here, \"Pr[Ti | X]\" is the posterior \n"); |
---|
994 | MrBayesPrint (" probability of the i-th tree, \"Pr[X | Ti]\" is the likelihood of the \n"); |
---|
995 | MrBayesPrint (" i-th tree, and \"Pr[Ti]\" is the prior probability of the i-th tree. The \n"); |
---|
996 | MrBayesPrint (" denominator of Bayes\'s formula (\"Pr[X]\") is a normalizing constant that \n"); |
---|
997 | MrBayesPrint (" involves a summation over all possible trees. The likelihood, as described \n"); |
---|
998 | MrBayesPrint (" above, cannot be calculated with knowledge of only the tree\'s topology. You \n"); |
---|
999 | MrBayesPrint (" also need to have information on the lenths of the branches and on the \n"); |
---|
1000 | MrBayesPrint (" mechanism of character change. Hence, the likelihood (\"Pr[X | Ti]\") \n"); |
---|
1001 | MrBayesPrint (" involves a multidimensional integral over all possible combinations of \n"); |
---|
1002 | MrBayesPrint (" branch lengths and substitution model parameters. \n"); |
---|
1003 | MrBayesPrint (" \n"); |
---|
1004 | MrBayesPrint (" In practice, it is impossible to calculate the posterior probability dist- \n"); |
---|
1005 | MrBayesPrint (" ribution of trees analytically. Instead, the posterior probability \n"); |
---|
1006 | MrBayesPrint (" of trees must be approximated. MrBayes uses a method called Markov chain \n"); |
---|
1007 | MrBayesPrint (" Monte Carlo (MCMC) to approximate the posterior probability of trees. \n"); |
---|
1008 | MrBayesPrint (" The object of MCMC is to construct a Markov chain that has as its state \n"); |
---|
1009 | MrBayesPrint (" space the parameters of the phylogenetic model and a stationary distribution \n"); |
---|
1010 | MrBayesPrint (" that is the posterior probability distribution of trees. MCMC takes valid, \n"); |
---|
1011 | MrBayesPrint (" albeit dependent, samples from the posterior probability distribution of \n"); |
---|
1012 | MrBayesPrint (" trees. The fraction of the time any tree appears in this sample is a \n"); |
---|
1013 | MrBayesPrint (" valid approximation of the posterior probability of the tree. MrBayes keeps \n"); |
---|
1014 | MrBayesPrint (" track of all the parameters of the phylogenetic model. The trees (with branch \n"); |
---|
1015 | MrBayesPrint (" lengths) that were sampled by the MCMC procedure are saved in one file \n"); |
---|
1016 | MrBayesPrint (" (a file with a \".t\" extension) whereas the parameters of the model of \n"); |
---|
1017 | MrBayesPrint (" character change are saved in another file (a file with a \".p\" ext- \n"); |
---|
1018 | MrBayesPrint (" ension). You can summarize the results in the \".t\" and \".p\" files \n"); |
---|
1019 | MrBayesPrint (" using the \"sumt\" and \"sump\" commands, respectively. \n"); |
---|
1020 | MrBayesPrint (" \n"); |
---|
1021 | MrBayesPrint (" MrBayes was originally written by John Huelsenbeck in August of 2000 and was \n"); |
---|
1022 | MrBayesPrint (" intended to be distributed to a small number of people. In March of 2001, \n"); |
---|
1023 | MrBayesPrint (" Fredrik Ronquist started making contributions to the program. The contribu- \n"); |
---|
1024 | MrBayesPrint (" tions were of such a significant nature that he was made a coauthor of the \n"); |
---|
1025 | MrBayesPrint (" program. Version 3 of MrBayes was a fully joint effort, started in the summer \n"); |
---|
1026 | MrBayesPrint (" of 2002 when JPH visited Sweden on a grant from the Wenner-Gren Foundations. \n"); |
---|
1027 | MrBayesPrint (" Several others have contributed to the MrBayes code since then, most notably \n"); |
---|
1028 | MrBayesPrint (" Paul van der Mark and Maxim Teslenko, both postdocs/programmers in Fredrik's \n"); |
---|
1029 | MrBayesPrint (" lab. A large number of users and students, too many to list here, have also \n"); |
---|
1030 | MrBayesPrint (" contributed importantly to the project (type 'Acknowledgments' for a list of \n"); |
---|
1031 | MrBayesPrint (" some of them). \n"); |
---|
1032 | MrBayesPrint (" \n"); |
---|
1033 | MrBayesPrint (" Since 2003, MrBayes has been distributed from SourceForge. Bugs can be repor- \n"); |
---|
1034 | MrBayesPrint (" ted to the MrBayes site on SourceForge or by contacting Maxim Teslenko \n"); |
---|
1035 | MrBayesPrint (" (maxim.teslenko@nrm.se) directly. \n"); |
---|
1036 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
1037 | |
---|
1038 | return (NO_ERROR); |
---|
1039 | |
---|
1040 | } |
---|
1041 | |
---|
1042 | |
---|
1043 | |
---|
1044 | |
---|
1045 | |
---|
1046 | int DoAcknowledgments (void) |
---|
1047 | |
---|
1048 | { |
---|
1049 | |
---|
1050 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
1051 | MrBayesPrint (" Acknowledgments \n"); |
---|
1052 | MrBayesPrint (" \n"); |
---|
1053 | MrBayesPrint (" JPH and FR would like to thank Gautam Altekar, Andrea Betancourt, Jon \n"); |
---|
1054 | MrBayesPrint (" Bollback, Barry Hall, Jimmy McGuire, Rasmus Nielsen, David Swofford, \n"); |
---|
1055 | MrBayesPrint (" Johan Nylander, Mikael Thollesson, and Derrick Zwickl for help during the \n"); |
---|
1056 | MrBayesPrint (" initial development of this program. Gautam Altekar, especially, was instru- \n"); |
---|
1057 | MrBayesPrint (" mental in getting the parallel version of the program working. Important bug- \n"); |
---|
1058 | MrBayesPrint (" fixes and additional functionality was contributed by Clemens Lakner, Sebas- \n"); |
---|
1059 | MrBayesPrint (" tian Hoehna, Paul Lewis, Mark Holder, Julian Catchen and Bret Larget. Marc \n"); |
---|
1060 | MrBayesPrint (" Suchard, Daniel Ayres and Aaron Darling got mrbayes working with beagle and \n"); |
---|
1061 | MrBayesPrint (" contributed a lot of related functionality and bug fixes. Aaron Darling was \n"); |
---|
1062 | MrBayesPrint (" instrumental in getting the Windows installer set up. Liu Liang and Dennis \n"); |
---|
1063 | MrBayesPrint (" Pearl helped integrate MrBayes with BEST. \n"); |
---|
1064 | MrBayesPrint (" \n"); |
---|
1065 | MrBayesPrint (" Bug fixes and user support was provided by Paul van der Mark (2005-2007) and \n"); |
---|
1066 | MrBayesPrint (" from 2010 by Maxim Teslenko (maxim.teslenko@nrm.se). \n"); |
---|
1067 | MrBayesPrint (" \n"); |
---|
1068 | MrBayesPrint (" Our wives -- Edna Huelsenbeck and Eva Ronquist -- showed extraordinary \n"); |
---|
1069 | MrBayesPrint (" patience with us while we spent many late nights programming. \n"); |
---|
1070 | MrBayesPrint (" \n"); |
---|
1071 | MrBayesPrint (" JPH was supported by NSF grants DEB-007540 and MCB-0075404 and a Wenner- \n"); |
---|
1072 | MrBayesPrint (" Gren scholarship while writing this program. FR was supported by grants \n"); |
---|
1073 | MrBayesPrint (" from the Swedish Natural Science Research Council and the Swedish Research \n"); |
---|
1074 | MrBayesPrint (" Council. \n"); |
---|
1075 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
1076 | |
---|
1077 | return (NO_ERROR); |
---|
1078 | |
---|
1079 | } |
---|
1080 | |
---|
1081 | |
---|
1082 | |
---|
1083 | |
---|
1084 | |
---|
1085 | int DoBeginParm (char *parmName, char *tkn) |
---|
1086 | |
---|
1087 | { |
---|
1088 | |
---|
1089 | if (expecting == Expecting(PARAMETER)) |
---|
1090 | { |
---|
1091 | /* set Data (inDataBlock) *************************************************************/ |
---|
1092 | if (!strcmp(parmName, "Data")) |
---|
1093 | { |
---|
1094 | if (FreeModel () == ERROR) |
---|
1095 | return (ERROR); |
---|
1096 | if (FreeMatrix () == ERROR) |
---|
1097 | return (ERROR); |
---|
1098 | MrBayesPrint (" Reading data block\n"); |
---|
1099 | inDataBlock = YES; |
---|
1100 | expecting = Expecting(SEMICOLON); |
---|
1101 | strcpy (spacer, " "); |
---|
1102 | } |
---|
1103 | /* set Characters (inCharactersBlock) *************************************************************/ |
---|
1104 | else if (!strcmp(parmName, "Characters")) |
---|
1105 | { |
---|
1106 | if (FreeModel () == ERROR) |
---|
1107 | return (ERROR); |
---|
1108 | if (FreeCharacters () == ERROR) |
---|
1109 | return (ERROR); |
---|
1110 | MrBayesPrint (" Reading characters block\n"); |
---|
1111 | inCharactersBlock = YES; |
---|
1112 | expecting = Expecting(SEMICOLON); |
---|
1113 | strcpy (spacer, " "); |
---|
1114 | } |
---|
1115 | /* set Taxa (inTaxaBlock) *************************************************************/ |
---|
1116 | else if (!strcmp(parmName, "Taxa")) |
---|
1117 | { |
---|
1118 | if (FreeModel () == ERROR) |
---|
1119 | return (ERROR); |
---|
1120 | if (FreeMatrix () == ERROR) |
---|
1121 | return (ERROR); |
---|
1122 | MrBayesPrint (" Reading taxa block\n"); |
---|
1123 | inTaxaBlock = YES; |
---|
1124 | expecting = Expecting(SEMICOLON); |
---|
1125 | strcpy (spacer, " "); |
---|
1126 | } |
---|
1127 | /* set Mrbayes (inMrbayesBlock) *******************************************************/ |
---|
1128 | else if (!strcmp(parmName, "Mrbayes")) |
---|
1129 | { |
---|
1130 | MrBayesPrint (" Reading mrbayes block\n"); |
---|
1131 | inMrbayesBlock = YES; |
---|
1132 | expecting = Expecting(SEMICOLON); |
---|
1133 | strcpy (spacer, " "); |
---|
1134 | } |
---|
1135 | /* set Trees (inTreesBlock) *******************************************************/ |
---|
1136 | else if (!strcmp(parmName, "Trees")) |
---|
1137 | { |
---|
1138 | MrBayesPrint (" Reading trees block\n"); |
---|
1139 | inTreesBlock = YES; |
---|
1140 | expecting = Expecting(SEMICOLON); |
---|
1141 | strcpy (spacer, " "); |
---|
1142 | } |
---|
1143 | /* set Foreign (inForeignBlock) *******************************************************/ |
---|
1144 | else |
---|
1145 | { |
---|
1146 | MrBayesPrint (" Skipping \"%s\" block\n", tkn); |
---|
1147 | inForeignBlock = YES; |
---|
1148 | expecting = Expecting(SEMICOLON); |
---|
1149 | strcpy (spacer, ""); |
---|
1150 | } |
---|
1151 | } |
---|
1152 | else |
---|
1153 | return (ERROR); |
---|
1154 | |
---|
1155 | return (NO_ERROR); |
---|
1156 | |
---|
1157 | } |
---|
1158 | |
---|
1159 | |
---|
1160 | |
---|
1161 | |
---|
1162 | |
---|
1163 | int DoBreaks (void) |
---|
1164 | |
---|
1165 | { |
---|
1166 | |
---|
1167 | int i, numBreaks; |
---|
1168 | |
---|
1169 | numBreaks = 0; |
---|
1170 | for (i=0; i<numChar; i++) |
---|
1171 | { |
---|
1172 | if (charInfo[i].bigBreakAfter == YES) |
---|
1173 | { |
---|
1174 | numBreaks++; |
---|
1175 | } |
---|
1176 | } |
---|
1177 | |
---|
1178 | if (numBreaks > 0) |
---|
1179 | { |
---|
1180 | if (numBreaks == 1) |
---|
1181 | MrBayesPrint ("%s One data break found after character ", spacer, numBreaks); |
---|
1182 | else |
---|
1183 | MrBayesPrint ("%s %d data breaks found after characters: ", spacer, numBreaks); |
---|
1184 | for (i=0; i<numChar; i++) |
---|
1185 | { |
---|
1186 | if (charInfo[i].bigBreakAfter == YES) |
---|
1187 | { |
---|
1188 | MrBayesPrint ("%d ", i+1); |
---|
1189 | } |
---|
1190 | } |
---|
1191 | MrBayesPrint ("\n"); |
---|
1192 | |
---|
1193 | if (numBreaks == 1) |
---|
1194 | MrBayesPrint ("%s Successfully defined one break in data\n", spacer); |
---|
1195 | else |
---|
1196 | MrBayesPrint ("%s Successfully defined %d breaks in data\n", spacer, numBreaks); |
---|
1197 | } |
---|
1198 | else |
---|
1199 | { |
---|
1200 | MrBayesPrint ("%s No breaks in data found\n", spacer); |
---|
1201 | } |
---|
1202 | |
---|
1203 | return (NO_ERROR); |
---|
1204 | |
---|
1205 | } |
---|
1206 | |
---|
1207 | |
---|
1208 | |
---|
1209 | |
---|
1210 | |
---|
1211 | int DoBreaksParm (char *parmName, char *tkn) |
---|
1212 | |
---|
1213 | { |
---|
1214 | |
---|
1215 | int i, tempInt; |
---|
1216 | |
---|
1217 | if (defMatrix == NO) |
---|
1218 | { |
---|
1219 | MrBayesPrint ("%s A matrix must be specified before you can define breaks in the data\n", spacer); |
---|
1220 | return (ERROR); |
---|
1221 | } |
---|
1222 | |
---|
1223 | if (expecting == Expecting(NUMBER)) |
---|
1224 | { |
---|
1225 | sscanf (tkn, "%d", &tempInt); |
---|
1226 | if (tempInt <= 0 || tempInt > numChar) |
---|
1227 | { |
---|
1228 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
1229 | for (i=0; i<numChar; i++) |
---|
1230 | charInfo[i].bigBreakAfter = NO; |
---|
1231 | return (ERROR); |
---|
1232 | } |
---|
1233 | if (tempInt == numChar) |
---|
1234 | { |
---|
1235 | MrBayesPrint ("%s Character number %d is the last character. MrBayes will define the\n", spacer, tempInt); |
---|
1236 | MrBayesPrint ("%s break, even though it doesn't make too much sense.\n", spacer); |
---|
1237 | } |
---|
1238 | tempInt--; |
---|
1239 | |
---|
1240 | charInfo[tempInt].bigBreakAfter = YES; |
---|
1241 | |
---|
1242 | expecting = (Expecting(NUMBER) | Expecting(SEMICOLON)); |
---|
1243 | } |
---|
1244 | else |
---|
1245 | { |
---|
1246 | for (i=0; i<numChar; i++) |
---|
1247 | charInfo[i].bigBreakAfter = NO; |
---|
1248 | return (ERROR); |
---|
1249 | } |
---|
1250 | |
---|
1251 | return (NO_ERROR); |
---|
1252 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
1253 | |
---|
1254 | } |
---|
1255 | |
---|
1256 | |
---|
1257 | |
---|
1258 | |
---|
1259 | |
---|
1260 | int DoCalibrate (void) |
---|
1261 | |
---|
1262 | { |
---|
1263 | |
---|
1264 | int i; |
---|
1265 | |
---|
1266 | /* show calibration times (for debugging) */ |
---|
1267 | #if 0 |
---|
1268 | MrBayesPrint ("Taxon ages\n"); |
---|
1269 | for (i=0; i<numTaxa; i++) |
---|
1270 | MrBayesPrint ("%4d -- %s\n", i+1, tipCalibration[i].name); |
---|
1271 | MrBayesPrint ("Constraint ages\n"); |
---|
1272 | for (i=0; i<numDefinedConstraints; i++) |
---|
1273 | { |
---|
1274 | if( definedConstraintsType[i] != HARD ) |
---|
1275 | continue; |
---|
1276 | MrBayesPrint ("%4d -- %s\n", i+1, nodeCalibration[i].name); |
---|
1277 | } |
---|
1278 | #endif |
---|
1279 | |
---|
1280 | /* Update model if calibrations enforced */ |
---|
1281 | for (i=0; i<numCurrentDivisions; i++) |
---|
1282 | { |
---|
1283 | if (!strcmp(modelParams[i].nodeAgePr,"Calibrated")) |
---|
1284 | { |
---|
1285 | if (SetUpAnalysis (&globalSeed) == ERROR) |
---|
1286 | return (ERROR); |
---|
1287 | break; |
---|
1288 | } |
---|
1289 | } |
---|
1290 | |
---|
1291 | return (NO_ERROR); |
---|
1292 | } |
---|
1293 | |
---|
1294 | |
---|
1295 | |
---|
1296 | |
---|
1297 | |
---|
1298 | int DoCalibrateParm (char *parmName, char *tkn) |
---|
1299 | |
---|
1300 | { |
---|
1301 | |
---|
1302 | static int isTaxon; |
---|
1303 | static char nodeName[100]; |
---|
1304 | int howMany, index; |
---|
1305 | char s[20], tempStr[100]; |
---|
1306 | MrBFlt tempD; |
---|
1307 | |
---|
1308 | if (defMatrix == NO) |
---|
1309 | { |
---|
1310 | MrBayesPrint ("%s A matrix must be specified before you can calibrate nodes\n", spacer); |
---|
1311 | return (ERROR); |
---|
1312 | } |
---|
1313 | |
---|
1314 | if (expecting == Expecting(PARAMETER)) |
---|
1315 | { |
---|
1316 | if (strcmp(parmName, "Xxxxxxxxxx") != 0) |
---|
1317 | { |
---|
1318 | MrBayesPrint ("%s Unexpected error - Wrong parmName in DoCalibrateParm\n", spacer); |
---|
1319 | return (ERROR); |
---|
1320 | } |
---|
1321 | |
---|
1322 | /* find taxon with this name */ |
---|
1323 | calibrationPtr = NULL; |
---|
1324 | howMany = 0; |
---|
1325 | |
---|
1326 | /* first look in constraint names */ |
---|
1327 | if (CheckString (constraintNames, numDefinedConstraints, tkn, &index) != ERROR && definedConstraintsType[index] == HARD ) |
---|
1328 | { |
---|
1329 | calibrationPtr = &nodeCalibration[index]; |
---|
1330 | howMany++; |
---|
1331 | isTaxon = NO; |
---|
1332 | strcpy (nodeName, tkn); |
---|
1333 | } |
---|
1334 | |
---|
1335 | /* then look in terminal taxon names */ |
---|
1336 | if (CheckString (taxaNames, numTaxa, tkn, &index) != ERROR) |
---|
1337 | { |
---|
1338 | calibrationPtr = &tipCalibration[index]; |
---|
1339 | howMany++; |
---|
1340 | isTaxon = YES; |
---|
1341 | strcpy (nodeName, tkn); |
---|
1342 | } |
---|
1343 | |
---|
1344 | /* return error if not found or ambiguous */ |
---|
1345 | if (howMany == 0) |
---|
1346 | { |
---|
1347 | MrBayesPrint ("%s No taxon or hard constraint named ""%s"" found. Note that only hard constraint can be calibrated.\n", spacer, tkn); |
---|
1348 | return (ERROR); |
---|
1349 | } |
---|
1350 | else if (howMany > 1) |
---|
1351 | { |
---|
1352 | MrBayesPrint ("%s Both a taxon and a constraint named ""%s"" encountered -- please rename one\n", spacer, tkn); |
---|
1353 | return (ERROR); |
---|
1354 | } |
---|
1355 | |
---|
1356 | if (calibrationPtr->prior != unconstrained) |
---|
1357 | { |
---|
1358 | MrBayesPrint ("%s Resetting previous calibration for ""%s""\n", spacer, tkn); |
---|
1359 | } |
---|
1360 | |
---|
1361 | /* reset the values of the calibration */ |
---|
1362 | calibrationPtr->prior = defaultCalibration.prior; |
---|
1363 | calibrationPtr->age = defaultCalibration.age; |
---|
1364 | calibrationPtr->lambda = defaultCalibration.lambda; |
---|
1365 | calibrationPtr->offset = defaultCalibration.offset; |
---|
1366 | calibrationPtr->min = defaultCalibration.min; |
---|
1367 | calibrationPtr->max = defaultCalibration.max; |
---|
1368 | strcpy(calibrationPtr->name, defaultCalibration.name); |
---|
1369 | |
---|
1370 | /* get ready to find the equal sign */ |
---|
1371 | expecting = Expecting(EQUALSIGN); |
---|
1372 | } |
---|
1373 | |
---|
1374 | else if (expecting == Expecting(EQUALSIGN)) |
---|
1375 | { |
---|
1376 | /* get ready to find the calibration prior */ |
---|
1377 | expecting = Expecting(ALPHA); |
---|
1378 | } |
---|
1379 | |
---|
1380 | else if (expecting == Expecting(ALPHA)) |
---|
1381 | { |
---|
1382 | /* set the calibration prior type */ |
---|
1383 | if (IsArgValid(tkn,tempStr) == NO_ERROR) |
---|
1384 | { |
---|
1385 | if (!strcmp (tempStr, "Uniform")) |
---|
1386 | calibrationPtr->prior = uniform; |
---|
1387 | else if (!strcmp (tempStr, "Offsetexponential")) |
---|
1388 | calibrationPtr->prior = offsetExponential; |
---|
1389 | else if (!strcmp (tempStr, "Fixed")) |
---|
1390 | calibrationPtr->prior = fixed; |
---|
1391 | else /* if (!strcmp (tempStr, "Unconstrained")) */ |
---|
1392 | calibrationPtr->prior = unconstrained; |
---|
1393 | strcpy (calibrationPtr->name, tempStr); |
---|
1394 | if (calibrationPtr->prior == unconstrained) |
---|
1395 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
1396 | else |
---|
1397 | expecting = Expecting(LEFTPAR); |
---|
1398 | } |
---|
1399 | else |
---|
1400 | { |
---|
1401 | MrBayesPrint ("%s Invalid calibration prior argument \n", spacer); |
---|
1402 | return (ERROR); |
---|
1403 | } |
---|
1404 | } |
---|
1405 | else if (expecting == Expecting(LEFTPAR)) |
---|
1406 | { |
---|
1407 | strcat (calibrationPtr->name, "("); |
---|
1408 | expecting = Expecting(NUMBER); |
---|
1409 | } |
---|
1410 | else if (expecting == Expecting(NUMBER)) |
---|
1411 | { |
---|
1412 | if (calibrationPtr->prior == fixed) |
---|
1413 | { |
---|
1414 | sscanf (tkn, "%lf", &tempD); |
---|
1415 | if (tempD < 0.0) |
---|
1416 | { |
---|
1417 | MrBayesPrint ("%s Age must be nonnegative\n", spacer); |
---|
1418 | calibrationPtr->prior = unconstrained; |
---|
1419 | return (ERROR); |
---|
1420 | } |
---|
1421 | calibrationPtr->age = tempD; |
---|
1422 | expecting = Expecting(RIGHTPAR); |
---|
1423 | } |
---|
1424 | else if (calibrationPtr->prior == uniform) |
---|
1425 | { |
---|
1426 | sscanf (tkn, "%lf", &tempD); |
---|
1427 | if (tempD < 0.0) |
---|
1428 | { |
---|
1429 | MrBayesPrint ("%s Age must be nonnegative\n", spacer); |
---|
1430 | calibrationPtr->prior = unconstrained; |
---|
1431 | return (ERROR); |
---|
1432 | } |
---|
1433 | if (calibrationPtr->min < 0.0) |
---|
1434 | { |
---|
1435 | calibrationPtr->min = tempD; |
---|
1436 | expecting = Expecting(COMMA); |
---|
1437 | } |
---|
1438 | else |
---|
1439 | { |
---|
1440 | if (tempD <= calibrationPtr->min) |
---|
1441 | { |
---|
1442 | MrBayesPrint ("%s Maximum age must be larger than minimum age\n", spacer); |
---|
1443 | calibrationPtr->prior = unconstrained; |
---|
1444 | return (ERROR); |
---|
1445 | } |
---|
1446 | calibrationPtr->max = tempD; |
---|
1447 | expecting = Expecting(RIGHTPAR); |
---|
1448 | } |
---|
1449 | } |
---|
1450 | else if (calibrationPtr->prior == offsetExponential) |
---|
1451 | { |
---|
1452 | sscanf (tkn, "%lf", &tempD); |
---|
1453 | if (calibrationPtr->offset < 0.0) |
---|
1454 | { |
---|
1455 | if (tempD < 0.0) |
---|
1456 | { |
---|
1457 | MrBayesPrint ("%s Offset age must be nonnegative\n", spacer); |
---|
1458 | calibrationPtr->prior = unconstrained; |
---|
1459 | return (ERROR); |
---|
1460 | } |
---|
1461 | calibrationPtr->offset = tempD; |
---|
1462 | expecting = Expecting(COMMA); |
---|
1463 | } |
---|
1464 | else |
---|
1465 | { |
---|
1466 | if (tempD <= OFFSETEXPLAMBDA_MIN) |
---|
1467 | { |
---|
1468 | MrBayesPrint ("%s Offset exponential lambda parameter must be larger than %lf\n", spacer, OFFSETEXPLAMBDA_MIN); |
---|
1469 | calibrationPtr->prior = unconstrained; |
---|
1470 | return (ERROR); |
---|
1471 | } |
---|
1472 | else if (tempD >= OFFSETEXPLAMBDA_MAX) |
---|
1473 | { |
---|
1474 | MrBayesPrint ("%s Offset exponential lambda parameter must be smaller than %lf\n", spacer, OFFSETEXPLAMBDA_MAX); |
---|
1475 | calibrationPtr->prior = unconstrained; |
---|
1476 | return (ERROR); |
---|
1477 | } |
---|
1478 | calibrationPtr->lambda = tempD; |
---|
1479 | expecting = Expecting(RIGHTPAR); |
---|
1480 | } |
---|
1481 | } |
---|
1482 | sprintf (s, "%1.2lf", tempD); |
---|
1483 | strcat (calibrationPtr->name, s); |
---|
1484 | } |
---|
1485 | else if (expecting == Expecting(COMMA)) |
---|
1486 | { |
---|
1487 | strcat (calibrationPtr->name, ","); |
---|
1488 | expecting = Expecting(NUMBER); |
---|
1489 | } |
---|
1490 | else if (expecting == Expecting(RIGHTPAR)) |
---|
1491 | { |
---|
1492 | strcat (calibrationPtr->name, ")"); |
---|
1493 | if (isTaxon == YES) |
---|
1494 | MrBayesPrint ("%s Setting age of taxon '%s' to %s\n", spacer, nodeName, calibrationPtr->name); |
---|
1495 | else |
---|
1496 | MrBayesPrint ("%s Setting age of constraint node '%s' to %s\n", spacer, nodeName, calibrationPtr->name); |
---|
1497 | /* get ready to find more calibrated nodes or taxa, if present */ |
---|
1498 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
1499 | } |
---|
1500 | else |
---|
1501 | return (ERROR); |
---|
1502 | |
---|
1503 | return (NO_ERROR); |
---|
1504 | |
---|
1505 | } |
---|
1506 | |
---|
1507 | |
---|
1508 | |
---|
1509 | |
---|
1510 | int DoCharset (void) |
---|
1511 | |
---|
1512 | { |
---|
1513 | |
---|
1514 | /* first add set to tempSet */ |
---|
1515 | if (fromI >= 0 && toJ < 0) |
---|
1516 | { |
---|
1517 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
1518 | return (ERROR); |
---|
1519 | } |
---|
1520 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
1521 | { |
---|
1522 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
1523 | return (ERROR); |
---|
1524 | } |
---|
1525 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
1526 | { |
---|
1527 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
1528 | return (ERROR); |
---|
1529 | } |
---|
1530 | |
---|
1531 | /* add name to charSetNames */ |
---|
1532 | if (AddString (&charSetNames, numCharSets, tempSetName) == ERROR) |
---|
1533 | { |
---|
1534 | MrBayesPrint ("%s Problem adding charset %s to list\n", spacer, tempSetName); |
---|
1535 | return (ERROR); |
---|
1536 | } |
---|
1537 | |
---|
1538 | /* store charset */ |
---|
1539 | AddBitfield (&charSet, numCharSets, tempSet, numChar); |
---|
1540 | |
---|
1541 | /* increment number of char sets */ |
---|
1542 | numCharSets++; |
---|
1543 | |
---|
1544 | return (NO_ERROR); |
---|
1545 | |
---|
1546 | } |
---|
1547 | |
---|
1548 | |
---|
1549 | |
---|
1550 | |
---|
1551 | |
---|
1552 | int DoCharsetParm (char *parmName, char *tkn) |
---|
1553 | |
---|
1554 | { |
---|
1555 | |
---|
1556 | int i, index, tempInt, allDigit; |
---|
1557 | |
---|
1558 | if (defMatrix == NO) |
---|
1559 | { |
---|
1560 | MrBayesPrint ("%s A matrix must be specified before charsets can be defined\n", spacer); |
---|
1561 | return (ERROR); |
---|
1562 | } |
---|
1563 | |
---|
1564 | if (expecting == Expecting(PARAMETER)) |
---|
1565 | { |
---|
1566 | if (!strcmp(parmName, "Xxxxxxxxxx")) |
---|
1567 | { |
---|
1568 | /* check that the name of the charset is not a number */ |
---|
1569 | allDigit = YES; |
---|
1570 | for (i=0; i<(int)strlen(tkn); i++) |
---|
1571 | { |
---|
1572 | if (tkn[i] == '0' || tkn[i] == '1' || tkn[i] == '2' || tkn[i] == '3' || tkn[i] == '4' || |
---|
1573 | tkn[i] == '5' || tkn[i] == '6' || tkn[i] == '7' || tkn[i] == '8' || tkn[i] == '9' || tkn[i] == '.') |
---|
1574 | {} |
---|
1575 | else |
---|
1576 | allDigit = NO; |
---|
1577 | } |
---|
1578 | if (allDigit == YES) |
---|
1579 | { |
---|
1580 | MrBayesPrint ("%s Charset name may not be a number\n", spacer); |
---|
1581 | return (ERROR); |
---|
1582 | } |
---|
1583 | |
---|
1584 | /* check size of charset name */ |
---|
1585 | if (strlen(tkn) > 99) |
---|
1586 | { |
---|
1587 | MrBayesPrint ("%s Charset name is too long\n", spacer); |
---|
1588 | return (ERROR); |
---|
1589 | } |
---|
1590 | |
---|
1591 | /* check to see if the name has already been used as a charset */ |
---|
1592 | if (numCharSets > 1) |
---|
1593 | { |
---|
1594 | if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR) |
---|
1595 | { |
---|
1596 | /* if the charset name has not been used, then we should have an ERROR returned */ |
---|
1597 | /* we _want_ to be here */ |
---|
1598 | |
---|
1599 | } |
---|
1600 | else |
---|
1601 | { |
---|
1602 | MrBayesPrint ("%s Charset name has been used previously\n", spacer); |
---|
1603 | return (ERROR); |
---|
1604 | } |
---|
1605 | } |
---|
1606 | |
---|
1607 | /* add the name to the character set */ |
---|
1608 | strcpy (tempSetName, tkn); |
---|
1609 | |
---|
1610 | /* clear tempSet */ |
---|
1611 | for (i=0; i<numChar; i++) |
---|
1612 | tempSet[i] = 0; |
---|
1613 | |
---|
1614 | fromI = toJ = everyK = -1; |
---|
1615 | foundDash = foundSlash = NO; |
---|
1616 | MrBayesPrint ("%s Defining charset called %s\n", spacer, tkn); |
---|
1617 | expecting = Expecting(EQUALSIGN); |
---|
1618 | } |
---|
1619 | else |
---|
1620 | return (ERROR); |
---|
1621 | } |
---|
1622 | else if (expecting == Expecting(EQUALSIGN)) |
---|
1623 | { |
---|
1624 | expecting = Expecting(ALPHA); |
---|
1625 | expecting |= Expecting(NUMBER); |
---|
1626 | } |
---|
1627 | else if (expecting == Expecting(ALPHA)) |
---|
1628 | { |
---|
1629 | /* We are defining a character set in terms of another (called tkn, here). We should be able |
---|
1630 | to find tkn in the list of character set names. If we cannot, then we have a problem and |
---|
1631 | return an error. */ |
---|
1632 | if (numCharSets < 1) |
---|
1633 | { |
---|
1634 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
1635 | return (ERROR); |
---|
1636 | } |
---|
1637 | if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR) |
---|
1638 | { |
---|
1639 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
1640 | return (ERROR); |
---|
1641 | } |
---|
1642 | /* add characters from charset "tkn" to new tempset */ |
---|
1643 | for (i=0; i<numChar; i++) |
---|
1644 | { |
---|
1645 | if (IsBitSet(i,charSet[index]) == YES) |
---|
1646 | tempSet[i] = 1; |
---|
1647 | } |
---|
1648 | fromI = toJ = everyK = -1; |
---|
1649 | |
---|
1650 | expecting = Expecting(ALPHA); |
---|
1651 | expecting |= Expecting(NUMBER); |
---|
1652 | expecting |= Expecting(SEMICOLON); |
---|
1653 | } |
---|
1654 | else if (expecting == Expecting(NUMBER)) |
---|
1655 | { |
---|
1656 | if (strlen(tkn) == 1 && tkn[0] == '.') |
---|
1657 | tempInt = numChar; |
---|
1658 | else |
---|
1659 | sscanf (tkn, "%d", &tempInt); |
---|
1660 | if (tempInt <= 0 || tempInt > numChar) |
---|
1661 | { |
---|
1662 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
1663 | return (ERROR); |
---|
1664 | } |
---|
1665 | tempInt--; |
---|
1666 | if (foundDash == YES) |
---|
1667 | { |
---|
1668 | if (fromI >= 0) |
---|
1669 | toJ = tempInt; |
---|
1670 | else |
---|
1671 | { |
---|
1672 | MrBayesPrint ("%s Improperly formatted charset\n", spacer); |
---|
1673 | return (ERROR); |
---|
1674 | } |
---|
1675 | foundDash = NO; |
---|
1676 | } |
---|
1677 | else if (foundSlash == YES) |
---|
1678 | { |
---|
1679 | tempInt++; |
---|
1680 | if (tempInt <= 1) |
---|
1681 | { |
---|
1682 | MrBayesPrint ("%s Improperly formatted charset\n", spacer); |
---|
1683 | return (ERROR); |
---|
1684 | } |
---|
1685 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
1686 | everyK = tempInt; |
---|
1687 | else |
---|
1688 | { |
---|
1689 | MrBayesPrint ("%s Improperly formatted charset\n", spacer); |
---|
1690 | return (ERROR); |
---|
1691 | } |
---|
1692 | foundSlash = NO; |
---|
1693 | } |
---|
1694 | else |
---|
1695 | { |
---|
1696 | if (fromI >= 0 && toJ < 0) |
---|
1697 | { |
---|
1698 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
1699 | return (ERROR); |
---|
1700 | fromI = tempInt; |
---|
1701 | } |
---|
1702 | else if (fromI < 0 && toJ < 0) |
---|
1703 | { |
---|
1704 | fromI = tempInt; |
---|
1705 | } |
---|
1706 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
1707 | { |
---|
1708 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
1709 | return (ERROR); |
---|
1710 | fromI = tempInt; |
---|
1711 | toJ = everyK = -1; |
---|
1712 | } |
---|
1713 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
1714 | { |
---|
1715 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
1716 | return (ERROR); |
---|
1717 | fromI = tempInt; |
---|
1718 | toJ = everyK = -1; |
---|
1719 | } |
---|
1720 | else |
---|
1721 | { |
---|
1722 | MrBayesPrint ("%s Improperly formatted charset\n", spacer); |
---|
1723 | { |
---|
1724 | return (ERROR); |
---|
1725 | } |
---|
1726 | } |
---|
1727 | |
---|
1728 | } |
---|
1729 | |
---|
1730 | |
---|
1731 | expecting = Expecting(ALPHA); |
---|
1732 | expecting |= Expecting(NUMBER); |
---|
1733 | expecting |= Expecting(SEMICOLON); |
---|
1734 | expecting |= Expecting(DASH); |
---|
1735 | expecting |= Expecting(BACKSLASH); |
---|
1736 | } |
---|
1737 | else if (expecting == Expecting(DASH)) |
---|
1738 | { |
---|
1739 | foundDash = YES; |
---|
1740 | expecting = Expecting(NUMBER); |
---|
1741 | } |
---|
1742 | else if (expecting == Expecting(BACKSLASH)) |
---|
1743 | { |
---|
1744 | foundSlash = YES; |
---|
1745 | expecting = Expecting(NUMBER); |
---|
1746 | } |
---|
1747 | else |
---|
1748 | return (ERROR); |
---|
1749 | |
---|
1750 | return (NO_ERROR); |
---|
1751 | |
---|
1752 | } |
---|
1753 | |
---|
1754 | |
---|
1755 | |
---|
1756 | |
---|
1757 | |
---|
1758 | int DoCharStat (void) |
---|
1759 | |
---|
1760 | { |
---|
1761 | |
---|
1762 | int i, j, numDivs; |
---|
1763 | char tempName[100]; |
---|
1764 | |
---|
1765 | if (defMatrix == NO) |
---|
1766 | { |
---|
1767 | MrBayesPrint ("%s A character matrix must be defined first\n", spacer); |
---|
1768 | return (ERROR); |
---|
1769 | } |
---|
1770 | |
---|
1771 | if (numDefinedPartitions == 1) |
---|
1772 | MrBayesPrint ("%s 1 character partition defined:\n", spacer, numDefinedPartitions); |
---|
1773 | else |
---|
1774 | MrBayesPrint ("%s %d character partitions defined:\n", spacer, numDefinedPartitions); |
---|
1775 | for (i=0; i<numDefinedPartitions; i++) |
---|
1776 | { |
---|
1777 | numDivs = GetNumPartDivisions (i+1); |
---|
1778 | if (numDivs == 1) |
---|
1779 | MrBayesPrint ("%s Partition %d (\"%s\") does not divide the characters\n", spacer, i+1, partitionNames[i]); |
---|
1780 | else |
---|
1781 | MrBayesPrint ("%s Partition %d (\"%s\") divides the characters into %d parts\n", spacer, i+1, partitionNames[i], numDivs); |
---|
1782 | } |
---|
1783 | MrBayesPrint ("%s Current partition is \"%s\"\n", spacer, partitionNames[partitionNum]); |
---|
1784 | MrBayesPrint ("\n"); |
---|
1785 | |
---|
1786 | /* print out list of characters with information about each */ |
---|
1787 | MrBayesPrint ("%s Showing character status:\n\n", spacer); |
---|
1788 | MrBayesPrint ("%s Partition(s)\n", spacer); |
---|
1789 | MrBayesPrint ("%s # Type In/Out Ambiguity Order ", spacer); |
---|
1790 | for (i=0; i<numDefinedPartitions; i++) |
---|
1791 | MrBayesPrint (" %2d", i+1); |
---|
1792 | MrBayesPrint ("\n"); |
---|
1793 | MrBayesPrint ("%s -----------------------------------------------", spacer); |
---|
1794 | for (i=0; i<numDefinedPartitions; i++) |
---|
1795 | MrBayesPrint ("---"); |
---|
1796 | MrBayesPrint ("\n"); |
---|
1797 | for (i=0; i<numChar; i++) |
---|
1798 | { |
---|
1799 | MrBayesPrint ("%s %4d -- ", spacer, i+1); |
---|
1800 | |
---|
1801 | if (charInfo[i].charType == DNA) |
---|
1802 | MrBayesPrint (" DNA"); |
---|
1803 | else if (charInfo[i].charType == RNA) |
---|
1804 | MrBayesPrint (" RNA"); |
---|
1805 | else if (charInfo[i].charType == PROTEIN) |
---|
1806 | MrBayesPrint (" Prot"); |
---|
1807 | else if (charInfo[i].charType == RESTRICTION) |
---|
1808 | MrBayesPrint (" Rest"); |
---|
1809 | else if (charInfo[i].charType == STANDARD) |
---|
1810 | MrBayesPrint (" Stand"); |
---|
1811 | else if (charInfo[i].charType == CONTINUOUS) |
---|
1812 | MrBayesPrint (" Cont"); |
---|
1813 | |
---|
1814 | if (charInfo[i].charType == DNA) |
---|
1815 | MrBayesPrint (" 4"); |
---|
1816 | else if (charInfo[i].charType == RNA) |
---|
1817 | MrBayesPrint (" 4"); |
---|
1818 | else if (charInfo[i].charType == PROTEIN) |
---|
1819 | MrBayesPrint (" 20"); |
---|
1820 | else if (charInfo[i].charType == RESTRICTION) |
---|
1821 | MrBayesPrint (" 2"); |
---|
1822 | else if (charInfo[i].charType == STANDARD) |
---|
1823 | MrBayesPrint (" %2d", charInfo[i].numStates); |
---|
1824 | else if (charInfo[i].charType == CONTINUOUS) |
---|
1825 | MrBayesPrint (" Inf"); |
---|
1826 | |
---|
1827 | if (charInfo[i].isExcluded == NO) |
---|
1828 | MrBayesPrint (" Included"); |
---|
1829 | else |
---|
1830 | MrBayesPrint (" Excluded"); |
---|
1831 | |
---|
1832 | if (charInfo[i].isMissAmbig == YES) |
---|
1833 | MrBayesPrint (" MissAmbig"); |
---|
1834 | else |
---|
1835 | MrBayesPrint (" None"); |
---|
1836 | |
---|
1837 | if (charInfo[i].ctype == UNORD) |
---|
1838 | MrBayesPrint (" Unord"); |
---|
1839 | else if (charInfo[i].ctype == ORD) |
---|
1840 | MrBayesPrint (" Ord"); |
---|
1841 | else if (charInfo[i].ctype == DOLLO) |
---|
1842 | MrBayesPrint (" Dollo"); |
---|
1843 | else if (charInfo[i].ctype == IRREV) |
---|
1844 | MrBayesPrint (" Irrev"); |
---|
1845 | |
---|
1846 | MrBayesPrint (" "); |
---|
1847 | |
---|
1848 | for (j=0; j<numDefinedPartitions; j++) |
---|
1849 | MrBayesPrint (" %2d", partitionId[i][j]); |
---|
1850 | |
---|
1851 | /* MrBayesPrint ("%4d ", charSet[i]);*/ |
---|
1852 | |
---|
1853 | if (charInfo[i].pairsId > 0) |
---|
1854 | { |
---|
1855 | /* find paired character */ |
---|
1856 | for (j=0; j<numChar; j++) |
---|
1857 | { |
---|
1858 | if (i != j && charInfo[j].pairsId == charInfo[i].pairsId) |
---|
1859 | { |
---|
1860 | MrBayesPrint (" (coupled with %d)", j+1); |
---|
1861 | break; |
---|
1862 | } |
---|
1863 | } |
---|
1864 | } |
---|
1865 | |
---|
1866 | MrBayesPrint ("\n"); |
---|
1867 | |
---|
1868 | if (charInfo[i].bigBreakAfter == YES) |
---|
1869 | { |
---|
1870 | MrBayesPrint ("%s ", spacer); |
---|
1871 | MrBayesPrint (" - - - - - - - - - - - - - - - - - - - - \n"); |
---|
1872 | } |
---|
1873 | |
---|
1874 | /* we may want to pause */ |
---|
1875 | if (autoClose == NO) |
---|
1876 | { |
---|
1877 | if ((i+1) % 100 == 0) |
---|
1878 | { |
---|
1879 | MrBayesPrint ("%s Hit return key to continue ", spacer); |
---|
1880 | fflush (stdin); |
---|
1881 | if( fgets (tempName, 100, stdin) == NULL ) |
---|
1882 | { |
---|
1883 | printf("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__); |
---|
1884 | } |
---|
1885 | } |
---|
1886 | } |
---|
1887 | } |
---|
1888 | |
---|
1889 | return (NO_ERROR); |
---|
1890 | |
---|
1891 | } |
---|
1892 | |
---|
1893 | |
---|
1894 | |
---|
1895 | |
---|
1896 | |
---|
1897 | int DoCitations (void) |
---|
1898 | |
---|
1899 | { |
---|
1900 | |
---|
1901 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
1902 | MrBayesPrint (" Citations \n"); |
---|
1903 | MrBayesPrint (" \n"); |
---|
1904 | MrBayesPrint (" If you publish results obtained using MrBayes you may want to cite the \n"); |
---|
1905 | MrBayesPrint (" program using one of these papers: \n"); |
---|
1906 | MrBayesPrint (" \n"); |
---|
1907 | MrBayesPrint (" Huelsenbeck, J. P. and F. Ronquist. 2001. MRBAYES: Bayesian \n"); |
---|
1908 | MrBayesPrint (" inference of phylogeny. Bioinformatics 17:754-755. \n"); |
---|
1909 | MrBayesPrint (" Ronquist, F. and J. P. Huelsenbeck. 2003. MRBAYES 3: Bayesian phylogenetic \n"); |
---|
1910 | MrBayesPrint (" inference under mixed models. Bioinformatics 19:1572-1574. \n"); |
---|
1911 | MrBayesPrint (" Ronquist, F. et al. 2012. MRBAYES 3.2: Efficient Bayesian phylogenetic \n"); |
---|
1912 | MrBayesPrint (" inference and model selection across a large model space. Systematic \n"); |
---|
1913 | MrBayesPrint (" Biology 61 (in press). \n"); |
---|
1914 | MrBayesPrint (" \n"); |
---|
1915 | MrBayesPrint (" If you use the parallel abilities of the program, you may also want to cite \n"); |
---|
1916 | MrBayesPrint (" \n"); |
---|
1917 | MrBayesPrint (" Altekar, G., S. Dwarkadas, J. P. Huelsenbeck, and F. Ronquist. 2004. \n"); |
---|
1918 | MrBayesPrint (" Parallel Metropolis-coupled Markov chain Monte Carlo for Bayesian \n"); |
---|
1919 | MrBayesPrint (" phylogenetic inference. Bioinformatics 20:407-415. \n"); |
---|
1920 | MrBayesPrint (" \n"); |
---|
1921 | MrBayesPrint (" If you use the BEAGLE library, the appropriate citation is \n"); |
---|
1922 | MrBayesPrint (" \n"); |
---|
1923 | MrBayesPrint (" Ayres, D. L., A. Darling, D. J. Zwickl, P. Beerli, M. T. Holder, P. O. \n"); |
---|
1924 | MrBayesPrint (" J. P. Huelsenbeck, F. Ronquist, D. L. Swofford, M. P. Cummings, A. \n"); |
---|
1925 | MrBayesPrint (" Rambaut, and M. A. Suchard. 2012. BEAGLE: an application programming \n"); |
---|
1926 | MrBayesPrint (" interface for statistical phylogenetics. Syst. Biol. 61:170-173. \n"); |
---|
1927 | MrBayesPrint (" \n"); |
---|
1928 | MrBayesPrint (" \n"); |
---|
1929 | MrBayesPrint (" You should also cite other papers for different ideas that are implemented \n"); |
---|
1930 | MrBayesPrint (" in the program. For example, the program performs Bayesian inference of \n"); |
---|
1931 | MrBayesPrint (" phylogeny, an idea that was first proposed in the following papers: \n"); |
---|
1932 | MrBayesPrint (" \n"); |
---|
1933 | MrBayesPrint (" Larget, B., and D. Simon. 1999. Markov chain Monte Carlo \n"); |
---|
1934 | MrBayesPrint (" algorithms for the Bayesian analysis of phylogenetic trees. \n"); |
---|
1935 | MrBayesPrint (" Mol. Biol. Evol. 16:750-759. \n"); |
---|
1936 | MrBayesPrint (" \n"); |
---|
1937 | MrBayesPrint (" Li, S. 1996. Phylogenetic tree construction using Markov chain \n"); |
---|
1938 | MrBayesPrint (" Monte carlo. Ph. D. dissertation, Ohio State University, Columbus. \n"); |
---|
1939 | MrBayesPrint (" \n"); |
---|
1940 | MrBayesPrint (" Mau, B. 1996. Bayesian phylogenetic inference via Markov chain \n"); |
---|
1941 | MrBayesPrint (" Monte carlo methods. Ph. D. dissertation, University of \n"); |
---|
1942 | MrBayesPrint (" Wisconsin, Madison. \n"); |
---|
1943 | MrBayesPrint (" \n"); |
---|
1944 | MrBayesPrint (" Mau, B., and M. Newton. 1997. Phylogenetic inference for binary \n"); |
---|
1945 | MrBayesPrint (" data on dendrograms using Markov chain Monte Carlo. Journal of \n"); |
---|
1946 | MrBayesPrint (" Computational and Graphical Statistics 6:122-131. \n"); |
---|
1947 | MrBayesPrint (" \n"); |
---|
1948 | MrBayesPrint (" Mau, B., M. Newton, and B. Larget. 1999. Bayesian phylogenetic \n"); |
---|
1949 | MrBayesPrint (" inference via Markov chain Monte carlo methods. Biometrics. 55:1-12. \n"); |
---|
1950 | MrBayesPrint (" \n"); |
---|
1951 | MrBayesPrint (" Newton, M., B. Mau, and B. Larget. 1999. Markov chain Monte Carlo \n"); |
---|
1952 | MrBayesPrint (" for the Bayesian analysis of evolutionary trees from aligned \n"); |
---|
1953 | MrBayesPrint (" molecular sequences. In Statistics in molecular biology (F. Seillier- \n"); |
---|
1954 | MrBayesPrint (" Moseiwitch, T. P. Speed, and M. Waterman, eds.). Monograph Series \n"); |
---|
1955 | MrBayesPrint (" of the Institute of Mathematical Statistics. \n"); |
---|
1956 | MrBayesPrint (" \n"); |
---|
1957 | MrBayesPrint (" Rannala, B., and Z. Yang. 1996. Probability distribution of \n"); |
---|
1958 | MrBayesPrint (" molecular evolutionary trees: a new method of phylogenetic \n"); |
---|
1959 | MrBayesPrint (" inference. J. Mol. Evol. 43:304-311. \n"); |
---|
1960 | MrBayesPrint (" \n"); |
---|
1961 | MrBayesPrint (" Yang, Z., and B. Rannala. 1997. Bayesian phylogenetic inference \n"); |
---|
1962 | MrBayesPrint (" using DNA sequences: a Markov chain Monte carlo method. Molecular \n"); |
---|
1963 | MrBayesPrint (" Biology and Evolution. 14:717-724. \n"); |
---|
1964 | MrBayesPrint (" \n"); |
---|
1965 | MrBayesPrint (" \n"); |
---|
1966 | MrBayesPrint (" MrBayes uses Markov chain Monte Carlo (MCMC) to approximate the posterior \n"); |
---|
1967 | MrBayesPrint (" probability of trees. MCMC was developed in the following papers: \n"); |
---|
1968 | MrBayesPrint (" \n"); |
---|
1969 | MrBayesPrint (" Metropolis, N., A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, \n"); |
---|
1970 | MrBayesPrint (" and E. Teller. 1953. Equations of state calculations by fast \n"); |
---|
1971 | MrBayesPrint (" computing machines. J. Chem. Phys. 21:1087-1091. \n"); |
---|
1972 | MrBayesPrint (" \n"); |
---|
1973 | MrBayesPrint (" Hastings, W. K. 1970. Monte Carlo sampling methods using Markov \n"); |
---|
1974 | MrBayesPrint (" chains and their applications. Biometrika 57:97-109. \n"); |
---|
1975 | MrBayesPrint (" \n"); |
---|
1976 | MrBayesPrint (" In particular, MrBayes implements a variant of MCMC that was described by \n"); |
---|
1977 | MrBayesPrint (" Charles Geyer: \n"); |
---|
1978 | MrBayesPrint (" \n"); |
---|
1979 | MrBayesPrint (" Geyer, C. J. 1991. Markov chain Monte Carlo maximum likelihood. \n"); |
---|
1980 | MrBayesPrint (" Pages 156-163 in Computing Science and Statistics: Proceed- \n"); |
---|
1981 | MrBayesPrint (" ings of the 23rd Symposium on the Interface. (E. M. Keramidas, \n"); |
---|
1982 | MrBayesPrint (" ed.). Fairfax Station: Interface Foundation. \n"); |
---|
1983 | MrBayesPrint (" \n"); |
---|
1984 | MrBayesPrint (" \n"); |
---|
1985 | MrBayesPrint (" MrBayes implements a large number of DNA substitution models. These models \n"); |
---|
1986 | MrBayesPrint (" are of three different structures. The \"4by4\" models are the usual \n"); |
---|
1987 | MrBayesPrint (" flavor of phylogenetic models. The \"Doublet\" model was first proposed \n"); |
---|
1988 | MrBayesPrint (" by \n"); |
---|
1989 | MrBayesPrint (" \n"); |
---|
1990 | MrBayesPrint (" Schoniger, M., and A. von Haeseler. 1994. A stochastic model and the \n"); |
---|
1991 | MrBayesPrint (" evolution of autocorrelated DNA sequences. Molecular Phylogenetics \n"); |
---|
1992 | MrBayesPrint (" and Evolution 3:240-247. \n"); |
---|
1993 | MrBayesPrint (" \n"); |
---|
1994 | MrBayesPrint (" The program also implements codon models. Two papers, published back-to-back \n"); |
---|
1995 | MrBayesPrint (" were the first to implement a codon model of DNA substitution in which the \n"); |
---|
1996 | MrBayesPrint (" substitution process is modelled on the codon, not on a site-by-site basis: \n"); |
---|
1997 | MrBayesPrint (" \n"); |
---|
1998 | MrBayesPrint (" Goldman, N., and Z. Yang. 1994. A codon-based model of nucleotide \n"); |
---|
1999 | MrBayesPrint (" substitution for protein coding DNA sequences. Molecular Biology \n"); |
---|
2000 | MrBayesPrint (" and Evolution. 11:725-736. \n"); |
---|
2001 | MrBayesPrint (" \n"); |
---|
2002 | MrBayesPrint (" Muse, S., and B. Gaut. 1994. A likelihood approach for comparing \n"); |
---|
2003 | MrBayesPrint (" synonymous and non-synonymous substitution rates, with application \n"); |
---|
2004 | MrBayesPrint (" to the chloroplast genome. Molecular Biology and Evolution. \n"); |
---|
2005 | MrBayesPrint (" 11:715-724. \n"); |
---|
2006 | MrBayesPrint (" \n"); |
---|
2007 | MrBayesPrint (" The program can be used to detect positively slected amino-acid sites using \n"); |
---|
2008 | MrBayesPrint (" a full hierarchical Bayes analysis. The method is based on the excellent paper\n"); |
---|
2009 | MrBayesPrint (" by Nielsen and Yang: \n"); |
---|
2010 | MrBayesPrint (" \n"); |
---|
2011 | MrBayesPrint (" Nielsen, R., and Z. Yang. 1998. Likelihood models for detecting \n"); |
---|
2012 | MrBayesPrint (" positively selected amino acid sites and applications to the HIV-1 \n"); |
---|
2013 | MrBayesPrint (" envelope gene. Genetics. 148:929-936. \n"); |
---|
2014 | MrBayesPrint (" \n"); |
---|
2015 | MrBayesPrint (" The previous four papers describe three different stuctures for the nuc- \n"); |
---|
2016 | MrBayesPrint (" leotide models implemented in MrBayes--the four-by-four models, the \n"); |
---|
2017 | MrBayesPrint (" 16-by-16 (doublet) models and the 64-by-64 (codon) models. The program \n"); |
---|
2018 | MrBayesPrint (" implements three different substitution models within each model structure. \n"); |
---|
2019 | MrBayesPrint (" These include the nst=1 models: \n"); |
---|
2020 | MrBayesPrint (" \n"); |
---|
2021 | MrBayesPrint (" Jukes, T., and C. Cantor. 1969. Evolution of protein molecules. \n"); |
---|
2022 | MrBayesPrint (" Pages 21-132 in Mammalian Protein Metabolism. (H. Munro, ed.). \n"); |
---|
2023 | MrBayesPrint (" Academic Press, New York. \n"); |
---|
2024 | MrBayesPrint (" \n"); |
---|
2025 | MrBayesPrint (" Felsenstein, J. 1981. Evolutionary trees from DNA sequences: A \n"); |
---|
2026 | MrBayesPrint (" maximum likelihood approach. Journal of Molecular Evolution \n"); |
---|
2027 | MrBayesPrint (" 17:368-376. \n"); |
---|
2028 | MrBayesPrint (" \n"); |
---|
2029 | MrBayesPrint (" the nst=2 models: \n"); |
---|
2030 | MrBayesPrint (" \n"); |
---|
2031 | MrBayesPrint (" Kimura, M. 1980. A simple method for estimating evolutionary rates \n"); |
---|
2032 | MrBayesPrint (" of base substitutions through comparative studies of nucleotide \n"); |
---|
2033 | MrBayesPrint (" sequences. Journal of Molecular Evolution. 16:111-120. \n"); |
---|
2034 | MrBayesPrint (" \n"); |
---|
2035 | MrBayesPrint (" Hasegawa, M., T. Yano, and H. Kishino. 1984. A new molecular clock \n"); |
---|
2036 | MrBayesPrint (" of mitochondrial DNA and the evolution of Hominoids. Proc. \n"); |
---|
2037 | MrBayesPrint (" Japan Acad. Ser. B 60:95-98. \n"); |
---|
2038 | MrBayesPrint (" \n"); |
---|
2039 | MrBayesPrint (" Hasegawa, M., H. Kishino, and T. Yano. 1985. Dating the human-ape \n"); |
---|
2040 | MrBayesPrint (" split by a molecular clock of mitochondrial DNA. Journal of \n"); |
---|
2041 | MrBayesPrint (" Molecular Evolution 22:160-174. \n"); |
---|
2042 | MrBayesPrint (" \n"); |
---|
2043 | MrBayesPrint (" and the the nst=6 models: \n"); |
---|
2044 | MrBayesPrint (" \n"); |
---|
2045 | MrBayesPrint (" Tavare, S. 1986. Some probabilistic and statisical problems on the \n"); |
---|
2046 | MrBayesPrint (" analysis of DNA sequences. Lect. Math. Life Sci. 17:57-86. \n"); |
---|
2047 | MrBayesPrint (" 17:368-376. \n"); |
---|
2048 | MrBayesPrint (" \n"); |
---|
2049 | MrBayesPrint (" \n"); |
---|
2050 | MrBayesPrint (" MrBayes implements a large number of amino-acid models. These include: \n"); |
---|
2051 | MrBayesPrint (" \n"); |
---|
2052 | MrBayesPrint (" Poisson -- \n"); |
---|
2053 | MrBayesPrint (" \n"); |
---|
2054 | MrBayesPrint (" Bishop, M.J., and A.E. Friday. 1987. Tetropad relationships: the \n"); |
---|
2055 | MrBayesPrint (" molecular evidence. Pp. 123ᅵ139 in Molecules and morphology in \n"); |
---|
2056 | MrBayesPrint (" evolution: conflict or compromise? (C. Patterson, ed.). Cambridge \n"); |
---|
2057 | MrBayesPrint (" University Press, Cambridge, England. \n"); |
---|
2058 | MrBayesPrint (" \n"); |
---|
2059 | MrBayesPrint (" Jones -- \n"); |
---|
2060 | MrBayesPrint (" \n"); |
---|
2061 | MrBayesPrint (" Jones, D.T., W. R. Taylor, and J. M. Thornton. 1992. The rapid generation \n"); |
---|
2062 | MrBayesPrint (" of mutation data matrices from protein sequences. Comput. Appl. \n"); |
---|
2063 | MrBayesPrint (" Biosci. 8:275ᅵ282. \n"); |
---|
2064 | MrBayesPrint (" \n"); |
---|
2065 | MrBayesPrint (" Dayhoff -- \n"); |
---|
2066 | MrBayesPrint (" \n"); |
---|
2067 | MrBayesPrint (" Dayhoff, M.O., R.M. Schwartz, and B.C. Orcutt. 1978. A model of evol- \n"); |
---|
2068 | MrBayesPrint (" utionary change in proteins. Pp. 345ᅵ352 in Atlas of protein sequence \n"); |
---|
2069 | MrBayesPrint (" and structure. Vol. 5, Suppl. 3. National Biomedical Research \n"); |
---|
2070 | MrBayesPrint (" Foundation, Washington, D.C. \n"); |
---|
2071 | MrBayesPrint (" \n"); |
---|
2072 | MrBayesPrint (" Mtrev -- \n"); |
---|
2073 | MrBayesPrint (" \n"); |
---|
2074 | MrBayesPrint (" Adachi, J. and M. Hasegawa. 1996. MOLPHY version 2.3: programs for \n"); |
---|
2075 | MrBayesPrint (" molecular phylogenetics based on maximum likelihood. Computer Science \n"); |
---|
2076 | MrBayesPrint (" Monographs of Institute of Statistical Mathematics 28:1-150. \n"); |
---|
2077 | MrBayesPrint (" \n"); |
---|
2078 | MrBayesPrint (" Mtmam -- \n"); |
---|
2079 | MrBayesPrint (" \n"); |
---|
2080 | MrBayesPrint (" Cao, Y., A. Janke, P.J. Waddell, M. Westerman, O. Takenaka, S. Murata, \n"); |
---|
2081 | MrBayesPrint (" N. Okada, S. Paabo, and M. Hasegawa. 1998. Conflict amongst individual \n"); |
---|
2082 | MrBayesPrint (" mitochondrial proteins in resolving the phylogeny of eutherian orders. \n"); |
---|
2083 | MrBayesPrint (" Journal of Molecular Evolution \n"); |
---|
2084 | MrBayesPrint (" \n"); |
---|
2085 | MrBayesPrint (" Yang, Z., R. Nielsen, and M. Hasegawa. 1998. Models of amino acid \n"); |
---|
2086 | MrBayesPrint (" substitution and applications to mitochondrial protein evolution \n"); |
---|
2087 | MrBayesPrint (" Molecular Biology and Evolution 15:1600ᅵ1611. \n"); |
---|
2088 | MrBayesPrint (" \n"); |
---|
2089 | MrBayesPrint (" WAG -- \n"); |
---|
2090 | MrBayesPrint (" \n"); |
---|
2091 | MrBayesPrint (" Whelan, S. and Goldman, N. 2001. A general empirical model of protein \n"); |
---|
2092 | MrBayesPrint (" evolution derived from multiple protein families using a maximum- \n"); |
---|
2093 | MrBayesPrint (" likelihood approach. Molecular Biology and Evolution 18:691-699. \n"); |
---|
2094 | MrBayesPrint (" \n"); |
---|
2095 | MrBayesPrint (" Rtrev -- \n"); |
---|
2096 | MrBayesPrint (" \n"); |
---|
2097 | MrBayesPrint (" Dimmic M.W., J.S. Rest, D.P. Mindell, and D. Goldstein. 2002. RArtREV: \n"); |
---|
2098 | MrBayesPrint (" An amino acid substitution matrix for inference of retrovirus and \n"); |
---|
2099 | MrBayesPrint (" reverse transcriptase phylogeny. Journal of Molecular Evolution \n"); |
---|
2100 | MrBayesPrint (" 55: 65-73. \n"); |
---|
2101 | MrBayesPrint (" \n"); |
---|
2102 | MrBayesPrint (" Cprev -- \n"); |
---|
2103 | MrBayesPrint (" \n"); |
---|
2104 | MrBayesPrint (" Adachi, J., P. Waddell, W. Martin, and M. Hasegawa. 2000. Plastid \n"); |
---|
2105 | MrBayesPrint (" genome phylogeny and a model of amino acid substitution for proteins \n"); |
---|
2106 | MrBayesPrint (" encoded by chloroplast DNA. Journal of Molecular Evolution \n"); |
---|
2107 | MrBayesPrint (" 50:348-358. \n"); |
---|
2108 | MrBayesPrint (" \n"); |
---|
2109 | MrBayesPrint (" Blosum -- \n"); |
---|
2110 | MrBayesPrint (" \n"); |
---|
2111 | MrBayesPrint (" Henikoff, S., and J. G. Henikoff. 1992. Amino acid substitution \n"); |
---|
2112 | MrBayesPrint (" matrices from protein blocks. Proc. Natl. Acad. Sci., U.S.A. \n"); |
---|
2113 | MrBayesPrint (" 89:10915-10919. The matrix implemented in MrBayes is Blosum62. \n"); |
---|
2114 | MrBayesPrint (" \n"); |
---|
2115 | MrBayesPrint (" Vt -- \n"); |
---|
2116 | MrBayesPrint (" \n"); |
---|
2117 | MrBayesPrint (" Muller, T., and M. Vingron. 2000. Modeling amino acid replacement. \n"); |
---|
2118 | MrBayesPrint (" Journal of Computational Biology 7:761-776. \n"); |
---|
2119 | MrBayesPrint (" \n"); |
---|
2120 | MrBayesPrint (" \n"); |
---|
2121 | MrBayesPrint (" MrBayes implements a simple Jukes-Cantor-like model for restriction sites \n"); |
---|
2122 | MrBayesPrint (" and other binary data. A problem with some of these data is that there is a \n"); |
---|
2123 | MrBayesPrint (" coding bias, such that certain characters are missing from any observable \n"); |
---|
2124 | MrBayesPrint (" data matrix. It is impossible, for instance, to observe restriction sites that\n"); |
---|
2125 | MrBayesPrint (" are absent in all the studied taxa. However, MrBayes corrects for this coding \n"); |
---|
2126 | MrBayesPrint (" bias according to an idea described in \n"); |
---|
2127 | MrBayesPrint (" \n"); |
---|
2128 | MrBayesPrint (" Felsenstein, J. 1992. Phylogenies from restriction sites: A maximum- \n"); |
---|
2129 | MrBayesPrint (" likelihood approach. Evolution 46:159-173. \n"); |
---|
2130 | MrBayesPrint (" \n"); |
---|
2131 | MrBayesPrint (" \n"); |
---|
2132 | MrBayesPrint (" The model used by MrBayes for 'standard' or morphological data is based on \n"); |
---|
2133 | MrBayesPrint (" the ideas originally presented by \n"); |
---|
2134 | MrBayesPrint (" \n"); |
---|
2135 | MrBayesPrint (" Lewis, P. O. 2001. A likelihood approach to estimating phylogeny from \n"); |
---|
2136 | MrBayesPrint (" discrete morphological character data. Systematic Biology 50:913-925. \n"); |
---|
2137 | MrBayesPrint (" \n"); |
---|
2138 | MrBayesPrint (" \n"); |
---|
2139 | MrBayesPrint (" For both DNA sequence and amino-acid data, the program allows rates to \n"); |
---|
2140 | MrBayesPrint (" change under a covarion-like model, first described by Tuffley and Steel \n"); |
---|
2141 | MrBayesPrint (" \n"); |
---|
2142 | MrBayesPrint (" Tuffley, C., and M. Steel. 1998. Modeling the covarion hypothesis \n"); |
---|
2143 | MrBayesPrint (" of nucleotide substitution. Mathematical Biosciences 147:63-91. \n"); |
---|
2144 | MrBayesPrint (" \n"); |
---|
2145 | MrBayesPrint (" and implemented by Huelsenbeck (2002) \n"); |
---|
2146 | MrBayesPrint (" \n"); |
---|
2147 | MrBayesPrint (" Huelsenbeck, J. P. 2002. Testing a covariotide model of DNA sub- \n"); |
---|
2148 | MrBayesPrint (" stitution. Molecular Biology and Evolution 19(5):698-707. \n"); |
---|
2149 | MrBayesPrint (" \n"); |
---|
2150 | MrBayesPrint (" Galtier (2001) implements a different variant of the covarion model in \n"); |
---|
2151 | MrBayesPrint (" a paper that is worth reading: \n"); |
---|
2152 | MrBayesPrint (" \n"); |
---|
2153 | MrBayesPrint (" Galtier, N. 2001. Maximum-likelihood phylogenetic analysis under a \n"); |
---|
2154 | MrBayesPrint (" covarion-like model. Mol. Biol. Evol. 18:866-873. \n"); |
---|
2155 | MrBayesPrint (" \n"); |
---|
2156 | MrBayesPrint (" \n"); |
---|
2157 | MrBayesPrint (" A number of models are available that allow rates to vary \n"); |
---|
2158 | MrBayesPrint (" across the characters. The program implements the proportion \n"); |
---|
2159 | MrBayesPrint (" of invariable sites model and two variants of gamma distributed \n"); |
---|
2160 | MrBayesPrint (" rate variation. Yang\'s (1993) paper is a good one to cite for \n"); |
---|
2161 | MrBayesPrint (" implementing a gamma-distributed rates model. In the 1994 paper he \n"); |
---|
2162 | MrBayesPrint (" provides a way to approximate the continuous gamma distribution: \n"); |
---|
2163 | MrBayesPrint (" \n"); |
---|
2164 | MrBayesPrint (" Yang, Z. 1993. Maximum likelihood estimation of phylogeny from DNA \n"); |
---|
2165 | MrBayesPrint (" sequences when substitution rates differ over sites. Molecular \n"); |
---|
2166 | MrBayesPrint (" Biology and Evolution 10:1396-1401. \n"); |
---|
2167 | MrBayesPrint (" \n"); |
---|
2168 | MrBayesPrint (" Yang, Z. 1994. Maximum likelihood phylogenetic estimation from DNA \n"); |
---|
2169 | MrBayesPrint (" sequences with variable rates over sites: Approximate methods. \n"); |
---|
2170 | MrBayesPrint (" Journal of Molecular Evolution 39:306-314. \n"); |
---|
2171 | MrBayesPrint (" \n"); |
---|
2172 | MrBayesPrint (" The program also implements Yang\'s autocorrelated gamma model. In \n"); |
---|
2173 | MrBayesPrint (" this model, the rate at one site depends to some extent on the rate at \n"); |
---|
2174 | MrBayesPrint (" an adjacent site. The appropriate citation for this model is: \n"); |
---|
2175 | MrBayesPrint (" \n"); |
---|
2176 | MrBayesPrint (" Yang, Z. 1995. A space-time process model for the evolution of \n"); |
---|
2177 | MrBayesPrint (" DNA sequences. Genetics 139:993-1005. \n"); |
---|
2178 | MrBayesPrint (" \n"); |
---|
2179 | MrBayesPrint (" \n"); |
---|
2180 | MrBayesPrint (" The following two papers show how ancestral states on a tree can be recon- \n"); |
---|
2181 | MrBayesPrint (" structed. The Yang et al. paper implements an empirical Bayes approach while \n"); |
---|
2182 | MrBayesPrint (" Huelsenbeck and Bollback use a pure, hierarchical Bayes approach. The method \n"); |
---|
2183 | MrBayesPrint (" used in MrBayes is the latter, since it integrates over uncertainty in model \n"); |
---|
2184 | MrBayesPrint (" parameters. \n"); |
---|
2185 | MrBayesPrint (" \n"); |
---|
2186 | MrBayesPrint (" Yang, Z., S. Kumar, and M. Nei. 1995. A new method of inference of \n"); |
---|
2187 | MrBayesPrint (" ancestral nucleotide and amino acid sequences. Genetics 141:1641 \n"); |
---|
2188 | MrBayesPrint (" 1650. \n"); |
---|
2189 | MrBayesPrint (" \n"); |
---|
2190 | MrBayesPrint (" Huelsenbeck, J. P., and J. P. Bollback. 2001. Empirical and hier- \n"); |
---|
2191 | MrBayesPrint (" archical Bayesian estimation of ancestral states. Systematic \n"); |
---|
2192 | MrBayesPrint (" Biology 50:351-366. \n"); |
---|
2193 | MrBayesPrint (" \n"); |
---|
2194 | MrBayesPrint (" You may also want to consult a more recent review of Bayesian reconstruction \n"); |
---|
2195 | MrBayesPrint (" of ancestral states and character evolution: \n"); |
---|
2196 | MrBayesPrint (" \n"); |
---|
2197 | MrBayesPrint (" Ronquist, F. 2004. Bayesian inference of character evolution. Trends in \n"); |
---|
2198 | MrBayesPrint (" Ecology and Evolution 19: 475-481. \n"); |
---|
2199 | MrBayesPrint (" \n"); |
---|
2200 | MrBayesPrint (" \n"); |
---|
2201 | MrBayesPrint (" MrBayes allows you to analyze gene tree - species tree problems using the \n"); |
---|
2202 | MrBayesPrint (" multi-species coalescent approach originally proposed by Edwards et al: \n"); |
---|
2203 | MrBayesPrint (" \n"); |
---|
2204 | MrBayesPrint (" Edwards, S., L. Liu, and D. Pearl. 2007. High-resolution species trees \n"); |
---|
2205 | MrBayesPrint (" without concatenation. Proc. Natl. Acad. Sci. USA 104: 5936-5941. \n"); |
---|
2206 | MrBayesPrint (" \n"); |
---|
2207 | MrBayesPrint (" \n"); |
---|
2208 | MrBayesPrint (" The program implements an incredibly parameter rich model, first described \n"); |
---|
2209 | MrBayesPrint (" by Tuffley and Steel (1997), that orders trees in the same way as the \n"); |
---|
2210 | MrBayesPrint (" so-called parsimony method of phylogenetic inference. The appropriate \n"); |
---|
2211 | MrBayesPrint (" citation is: \n"); |
---|
2212 | MrBayesPrint (" \n"); |
---|
2213 | MrBayesPrint (" Tuffley, C., and M. Steel. 1997. Links between maximum likelihood \n"); |
---|
2214 | MrBayesPrint (" and maximum parsimony under a simple model of site substitution. \n"); |
---|
2215 | MrBayesPrint (" Bull. Math. Bio. 59:581-607. \n"); |
---|
2216 | MrBayesPrint (" \n"); |
---|
2217 | MrBayesPrint (" \n"); |
---|
2218 | MrBayesPrint (" MrBayes implements three relaxed clock models: the Compound Poisson Process \n"); |
---|
2219 | MrBayesPrint (" (CPP), the Thorne-Kishino 2002 (TK02), and the Independent Gamma Rates (IGR) \n"); |
---|
2220 | MrBayesPrint (" models. The CPP model was first described by Huelsenbeck et al. (2000). It \n"); |
---|
2221 | MrBayesPrint (" is an autocorrelated discrete model of rate variation over time. Instead of \n"); |
---|
2222 | MrBayesPrint (" the modified gamma distribution originally proposed for the rate multipliers, \n"); |
---|
2223 | MrBayesPrint (" MrBayes uses a lognormal distribution. The extensions necessary to sample over\n"); |
---|
2224 | MrBayesPrint (" tree space under this model are original to MrBayes; the original paper only \n"); |
---|
2225 | MrBayesPrint (" considered fixed trees. \n"); |
---|
2226 | MrBayesPrint (" \n"); |
---|
2227 | MrBayesPrint (" The TK02 model was first described by Thorne and Kishino (2002), and is a \n"); |
---|
2228 | MrBayesPrint (" variant of a model presented by them earlier (Thorne et al., 1998). It is an \n"); |
---|
2229 | MrBayesPrint (" autocorrelated continuous model, in which rates vary according to a lognormal \n"); |
---|
2230 | MrBayesPrint (" distribution. Specifically, the rate of a descendant node is assumed to be \n"); |
---|
2231 | MrBayesPrint (" drawn from a lognormal distribution with the mean being the rate of the an- \n"); |
---|
2232 | MrBayesPrint (" cestral node, and the variance being proportional to the length of the branch \n"); |
---|
2233 | MrBayesPrint (" separating the nodes (measured in terms of expected substitutions per site at \n"); |
---|
2234 | MrBayesPrint (" the base rate of the clock). \n"); |
---|
2235 | MrBayesPrint (" \n"); |
---|
2236 | MrBayesPrint (" The final relaxed clock model is the IGR model, in which branch rates are \n"); |
---|
2237 | MrBayesPrint (" modeled as being drawn independently from a scaled gamma distribution. The \n"); |
---|
2238 | MrBayesPrint (" model was originally described in the literature as the 'White Noise' model \n"); |
---|
2239 | MrBayesPrint (" by Lepage et al. (2007), but the original MrBayes implementation predates that\n"); |
---|
2240 | MrBayesPrint (" paper. The IGR model is closely related to the uncorrelated gamma model pre- \n"); |
---|
2241 | MrBayesPrint (" sented originally by Drummond et al. (2006), but it is more elegant in that \n"); |
---|
2242 | MrBayesPrint (" it truly lacks time structure. See Lepage et al. (2007) for details. \n"); |
---|
2243 | MrBayesPrint (" \n"); |
---|
2244 | MrBayesPrint (" Huelsenbeck, J. P., B. Larget, and D. Swofford. 2000. A compound Poisson \n"); |
---|
2245 | MrBayesPrint (" process for relaxing the molecular clock. Genetics 154: 1879-1892. \n"); |
---|
2246 | MrBayesPrint (" \n"); |
---|
2247 | MrBayesPrint (" Thorne, J. L., H. Kishino, and I. S. Painter. 1998. Estimating the rate \n"); |
---|
2248 | MrBayesPrint (" of evolution of the rate of molecular evolution. Mol. Biol. Evol. \n"); |
---|
2249 | MrBayesPrint (" 15: 1647-1657. \n"); |
---|
2250 | MrBayesPrint (" \n"); |
---|
2251 | MrBayesPrint (" Thorne, J. L., and H. Kishino. 2002. Divergence time and evolutionary \n"); |
---|
2252 | MrBayesPrint (" rate estimation with multilocus data. Syst. Biol. 51: 689-702. \n"); |
---|
2253 | MrBayesPrint (" \n"); |
---|
2254 | MrBayesPrint (" Drummond, A. J., S. Y. W. Ho, M. J. Phillips, and A. Rambaut. 2006. \n"); |
---|
2255 | MrBayesPrint (" Relaxed phylogenetics and dating with confidence. PLoS Biology \n"); |
---|
2256 | MrBayesPrint (" 4: 699-710. \n"); |
---|
2257 | MrBayesPrint (" \n"); |
---|
2258 | MrBayesPrint (" Lepage, T., D. Bryant, H. Philippe, and N. Lartillot. 2007. A general \n"); |
---|
2259 | MrBayesPrint (" comparison of relaxed molecular clock models. Mol. Biol. Evol. \n"); |
---|
2260 | MrBayesPrint (" 24: 2669-2680. \n"); |
---|
2261 | MrBayesPrint (" \n"); |
---|
2262 | MrBayesPrint (" \n"); |
---|
2263 | MrBayesPrint (" The standard tree proposals used by MrBayes are described by Lakner et al. \n"); |
---|
2264 | MrBayesPrint (" (2008). The parsimony-biased tree proposals are still undescribed, although \n"); |
---|
2265 | MrBayesPrint (" a rough outline of the idea is presented in the same paper. \n"); |
---|
2266 | MrBayesPrint (" \n"); |
---|
2267 | MrBayesPrint (" Lakner, C., P. van der Mark, J. P. Huelsenbeck, B. Larget, and F. Ronquist.\n"); |
---|
2268 | MrBayesPrint (" 2008. Efficiency of Markov chain Monte Carlo tree proposals in Bayesian \n"); |
---|
2269 | MrBayesPrint (" phylogenetics. Syst. Biol. 57: 86-103. \n"); |
---|
2270 | MrBayesPrint (" \n"); |
---|
2271 | MrBayesPrint (" \n"); |
---|
2272 | MrBayesPrint (" The topology convergence diagnostic used by MrBayes, the average standard \n"); |
---|
2273 | MrBayesPrint (" deviation of split frequencies, is described by Lakner et al. (2008). The \n"); |
---|
2274 | MrBayesPrint (" potential scale reduction factor, the diagnostic used by MrBayes for contin- \n"); |
---|
2275 | MrBayesPrint (" uous parameters, was first proposed by Gelman and Rubin (1992). The auto- \n"); |
---|
2276 | MrBayesPrint (" tuning mechanism used in MrBayes is based on a paper by Roberts and Rosenthal \n"); |
---|
2277 | MrBayesPrint (" (2009). \n"); |
---|
2278 | MrBayesPrint (" \n"); |
---|
2279 | MrBayesPrint (" Gelman, A., and D. B. Rubin. 1992. Inference from iterative simulation \n"); |
---|
2280 | MrBayesPrint (" using multiple sequences. Statistical Science 7: 457-472. \n"); |
---|
2281 | MrBayesPrint (" Bull. Math. Bio. 59:581-607. \n"); |
---|
2282 | MrBayesPrint (" \n"); |
---|
2283 | MrBayesPrint (" Lakner, C., P. van der Mark, J. P. Huelsenbeck, B. Larget, and F. Ronquist.\n"); |
---|
2284 | MrBayesPrint (" 2008. Efficiency of Markov chain Monte Carlo tree proposals in Bayesian \n"); |
---|
2285 | MrBayesPrint (" phylogenetics. Syst. Biol. 57: 86-103. \n"); |
---|
2286 | MrBayesPrint (" \n"); |
---|
2287 | MrBayesPrint (" Roberts, G. O., and J. S. Rosenthal. 2009. Examples of adaptive MCMC. Jour-\n"); |
---|
2288 | MrBayesPrint (" nal of Compuational and Graphical Statistics 18: 349-367. \n"); |
---|
2289 | MrBayesPrint (" \n"); |
---|
2290 | MrBayesPrint (" \n"); |
---|
2291 | MrBayesPrint (" The harmonic mean estimator of model likelihoods, used for Bayes factor tes- \n"); |
---|
2292 | MrBayesPrint (" ting, was discussed by Newton and Raftery (1996). The more accurate stepping- \n"); |
---|
2293 | MrBayesPrint (" stone algorithm was first proposed by Xie et al. (2011). The paper by \n"); |
---|
2294 | MrBayesPrint (" Lartillot and Philippe (2006) presents an interesting discussion of the \n"); |
---|
2295 | MrBayesPrint (" shortcomings of the harmonic mean estimator and describes thermodynamic \n"); |
---|
2296 | MrBayesPrint (" integration, a technique that is similar to the stepping-stone algorithm. \n"); |
---|
2297 | MrBayesPrint (" \n"); |
---|
2298 | MrBayesPrint (" Newton, M. A., and A. E. Raftery. 1994. Approcimate Bayesian inference \n"); |
---|
2299 | MrBayesPrint (" with the weighted likelihood bootstrap. J. R. Stat. Soc. B. 56. 3-48. \n"); |
---|
2300 | MrBayesPrint (" \n"); |
---|
2301 | MrBayesPrint (" Lartillot, N., and H. Philippe. 2006. Computing Bayes factors using \n"); |
---|
2302 | MrBayesPrint (" thermodynamic integration. Syst. Biol. 55: 195-207. \n"); |
---|
2303 | MrBayesPrint (" \n"); |
---|
2304 | MrBayesPrint (" Xie, W., P. O. Lewis, Y. Fan, L. Kuo, and M.-H. Chen. 2011. Improving \n"); |
---|
2305 | MrBayesPrint (" marginal likelihood estimation for Bayesian phylogenetic model \n"); |
---|
2306 | MrBayesPrint (" selection. Syst. Biol. 60: 150-160. \n"); |
---|
2307 | MrBayesPrint (" \n"); |
---|
2308 | MrBayesPrint (" \n"); |
---|
2309 | MrBayesPrint (" \n"); |
---|
2310 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
2311 | |
---|
2312 | return (NO_ERROR); |
---|
2313 | |
---|
2314 | } |
---|
2315 | |
---|
2316 | |
---|
2317 | |
---|
2318 | |
---|
2319 | |
---|
2320 | int DoConstraint (void) |
---|
2321 | |
---|
2322 | { |
---|
2323 | |
---|
2324 | int i, howMany; |
---|
2325 | int *tset; |
---|
2326 | |
---|
2327 | if( consrtainType == PARTIAL ) |
---|
2328 | tset=tempSetNeg; |
---|
2329 | else |
---|
2330 | tset=tempSet; |
---|
2331 | |
---|
2332 | /* add set to tempSet */ |
---|
2333 | if (fromI >= 0 && toJ < 0) |
---|
2334 | { |
---|
2335 | if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR) |
---|
2336 | return (ERROR); |
---|
2337 | } |
---|
2338 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
2339 | { |
---|
2340 | if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR) |
---|
2341 | return (ERROR); |
---|
2342 | } |
---|
2343 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
2344 | { |
---|
2345 | if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR) |
---|
2346 | return (ERROR); |
---|
2347 | } |
---|
2348 | |
---|
2349 | /* check that this is not a stupid constraint */ |
---|
2350 | howMany = 0; |
---|
2351 | for (i=0; i<numTaxa; i++) |
---|
2352 | if (tempSet[i] != 0) |
---|
2353 | howMany++; |
---|
2354 | |
---|
2355 | if (howMany == 0) |
---|
2356 | { |
---|
2357 | MrBayesPrint ("%s This constraint does not include any taxa and will not be defined\n", spacer); |
---|
2358 | return (ERROR); |
---|
2359 | } |
---|
2360 | |
---|
2361 | if( consrtainType == HARD ) |
---|
2362 | { |
---|
2363 | if (howMany == numTaxa) |
---|
2364 | { |
---|
2365 | /* We allow this so we can report states from and calibrate root */ |
---|
2366 | } |
---|
2367 | |
---|
2368 | } /*end consrtainType == HARD */ |
---|
2369 | else if( consrtainType == PARTIAL ) |
---|
2370 | { |
---|
2371 | if (howMany == 1) |
---|
2372 | { |
---|
2373 | MrBayesPrint ("%s This partial constraint include only one taxa. It is alwayes satisfied and will not be defined.\n", spacer); |
---|
2374 | return (ERROR); |
---|
2375 | } |
---|
2376 | |
---|
2377 | howMany = 0; |
---|
2378 | for (i=0; i<numTaxa; i++) |
---|
2379 | { |
---|
2380 | if (tempSetNeg[i] != 0) |
---|
2381 | { |
---|
2382 | howMany++; |
---|
2383 | if (tempSetNeg[i] == tempSet[i]) |
---|
2384 | { |
---|
2385 | MrBayesPrint ("%s Two sets of taxa in partial constraint are not allowed to intersect. Constraint will not be defined\n", spacer); |
---|
2386 | return (ERROR); |
---|
2387 | } |
---|
2388 | } |
---|
2389 | } |
---|
2390 | if (howMany == 0) |
---|
2391 | { |
---|
2392 | MrBayesPrint ("%s This partial constraint does not include any taxa in the second set and will not be defined\n", spacer); |
---|
2393 | return (ERROR); |
---|
2394 | } |
---|
2395 | } |
---|
2396 | else if( consrtainType == NEGATIVE) |
---|
2397 | { |
---|
2398 | if (howMany == 1) |
---|
2399 | { |
---|
2400 | MrBayesPrint ("%s Negative constraint should include more than one taxa. Constraint will not be defined\n", spacer); |
---|
2401 | return (ERROR); |
---|
2402 | } |
---|
2403 | } |
---|
2404 | |
---|
2405 | /* add name to constraintNames */ |
---|
2406 | if (AddString (&constraintNames, numDefinedConstraints, tempSetName) == ERROR) |
---|
2407 | { |
---|
2408 | MrBayesPrint ("%s Problem adding constraint %s to list\n", spacer, tempSetName); |
---|
2409 | return (ERROR); |
---|
2410 | } |
---|
2411 | |
---|
2412 | /* store tempSet */ |
---|
2413 | AddBitfield (&definedConstraint, numDefinedConstraints, tempSet, numTaxa); |
---|
2414 | if( consrtainType == PARTIAL) |
---|
2415 | { |
---|
2416 | AddBitfield (&definedConstraintTwo, numDefinedConstraints, tempSetNeg, numTaxa); |
---|
2417 | } |
---|
2418 | else |
---|
2419 | { |
---|
2420 | definedConstraintTwo = (SafeLong **) SafeRealloc ((void *)(definedConstraintTwo), (size_t)((numDefinedConstraints+1)*sizeof(SafeLong *))); |
---|
2421 | if ( definedConstraintTwo==NULL ) |
---|
2422 | return ERROR; |
---|
2423 | definedConstraintTwo[numDefinedConstraints]=NULL; |
---|
2424 | } |
---|
2425 | |
---|
2426 | /* add a default node calibration */ |
---|
2427 | nodeCalibration = (Calibration *) SafeRealloc ((void *)nodeCalibration, (size_t)((numDefinedConstraints+1)*sizeof(Calibration))); |
---|
2428 | nodeCalibration[numDefinedConstraints].prior = defaultCalibration.prior; |
---|
2429 | nodeCalibration[numDefinedConstraints].offset = defaultCalibration.offset; |
---|
2430 | nodeCalibration[numDefinedConstraints].lambda = defaultCalibration.lambda; |
---|
2431 | nodeCalibration[numDefinedConstraints].min = defaultCalibration.min; |
---|
2432 | nodeCalibration[numDefinedConstraints].max = defaultCalibration.max; |
---|
2433 | nodeCalibration[numDefinedConstraints].age = defaultCalibration.age; |
---|
2434 | strcpy(nodeCalibration[numDefinedConstraints].name, defaultCalibration.name); |
---|
2435 | |
---|
2436 | /* increment number of defined constraints */ |
---|
2437 | numDefinedConstraints++; |
---|
2438 | |
---|
2439 | /* reallocate and initialize space for activeConstraints */ |
---|
2440 | for (i=0; i<numCurrentDivisions; i++) |
---|
2441 | { |
---|
2442 | modelParams[i].activeConstraints = (int *) SafeRealloc((void *)(modelParams[i].activeConstraints), (size_t)(numDefinedConstraints*sizeof(int))); |
---|
2443 | modelParams[i].activeConstraints[numDefinedConstraints-1] = NO; |
---|
2444 | } |
---|
2445 | |
---|
2446 | /* reallocate and initialize space for tempActiveConstraints */ |
---|
2447 | tempActiveConstraints = (int *) SafeRealloc((void *)(tempActiveConstraints), (size_t)(numDefinedConstraints*sizeof(int))); |
---|
2448 | tempActiveConstraints[numDefinedConstraints-1] = NO; |
---|
2449 | |
---|
2450 | definedConstraintsType = (enum ConstraintType *) SafeRealloc((void *)(definedConstraintsType), (size_t)(numDefinedConstraints*sizeof(enum ConstraintType))); |
---|
2451 | if ( definedConstraintsType==NULL ) |
---|
2452 | return ERROR; |
---|
2453 | definedConstraintsType[numDefinedConstraints-1] = consrtainType; |
---|
2454 | |
---|
2455 | definedConstraintPruned = (SafeLong **) SafeRealloc ((void *)(definedConstraintPruned), (size_t)((numDefinedConstraints)*sizeof(SafeLong *))); |
---|
2456 | if ( definedConstraintPruned==NULL ) |
---|
2457 | return ERROR; |
---|
2458 | definedConstraintPruned[numDefinedConstraints-1]=NULL; |
---|
2459 | |
---|
2460 | |
---|
2461 | definedConstraintTwoPruned = (SafeLong **) SafeRealloc ((void *)(definedConstraintTwoPruned), (size_t)((numDefinedConstraints)*sizeof(SafeLong *))); |
---|
2462 | if ( definedConstraintTwoPruned==NULL ) |
---|
2463 | return ERROR; |
---|
2464 | definedConstraintTwoPruned[numDefinedConstraints-1]=NULL; |
---|
2465 | |
---|
2466 | |
---|
2467 | |
---|
2468 | /* show taxset (for debugging) */ |
---|
2469 | # if 0 |
---|
2470 | for (i=0; i<numTaxa; i++) |
---|
2471 | MrBayesPrint ("%4d %4d\n", i+1, taxaInfo[i].constraints[numDefinedConstraints-1]); |
---|
2472 | # endif |
---|
2473 | |
---|
2474 | return (NO_ERROR); |
---|
2475 | |
---|
2476 | } |
---|
2477 | |
---|
2478 | |
---|
2479 | |
---|
2480 | |
---|
2481 | |
---|
2482 | int DoConstraintParm (char *parmName, char *tkn) |
---|
2483 | |
---|
2484 | { |
---|
2485 | |
---|
2486 | int i, index, tempInt; |
---|
2487 | MrBFlt tempD; |
---|
2488 | static int *tempSetCurrent; |
---|
2489 | |
---|
2490 | if (defMatrix == NO) |
---|
2491 | { |
---|
2492 | MrBayesPrint ("%s A matrix must be specified before constraints can be defined\n", spacer); |
---|
2493 | return (ERROR); |
---|
2494 | } |
---|
2495 | |
---|
2496 | if (expecting == Expecting(PARAMETER)) |
---|
2497 | { |
---|
2498 | if (!strcmp(parmName, "Xxxxxxxxxx")) |
---|
2499 | { |
---|
2500 | /* check size of constraint name */ |
---|
2501 | if (strlen(tkn) > 99) |
---|
2502 | { |
---|
2503 | MrBayesPrint ("%s Constraint name is too long\n", spacer); |
---|
2504 | return (ERROR); |
---|
2505 | } |
---|
2506 | |
---|
2507 | /* check to see if the name has already been used as a constraint */ |
---|
2508 | if (numDefinedConstraints > 0) |
---|
2509 | { |
---|
2510 | if (CheckString (constraintNames, numDefinedConstraints, tkn, &index) == ERROR) |
---|
2511 | { |
---|
2512 | /* if the constraint name has not been used, then we should have an ERROR returned */ |
---|
2513 | /* we _want_ to be here */ |
---|
2514 | } |
---|
2515 | else |
---|
2516 | { |
---|
2517 | MrBayesPrint ("%s Constraint name '%s' has been used previously\n", spacer, tkn); |
---|
2518 | return (ERROR); |
---|
2519 | } |
---|
2520 | } |
---|
2521 | |
---|
2522 | /* copy the name to the temporary constraint names string */ |
---|
2523 | strcpy (tempSetName, tkn); |
---|
2524 | |
---|
2525 | /* clear tempSet */ |
---|
2526 | for (i=0; i<numTaxa; i++) |
---|
2527 | tempSet[i] = 0; |
---|
2528 | |
---|
2529 | consrtainType=HARD; /*set default constrain type*/ |
---|
2530 | tempSetCurrent=tempSet; |
---|
2531 | fromI = toJ = everyK = -1; |
---|
2532 | foundDash = foundSlash = NO; |
---|
2533 | MrBayesPrint ("%s Defining constraint called '%s'\n", spacer, tkn); |
---|
2534 | foundExp = NO; |
---|
2535 | foundFirst = YES; |
---|
2536 | foundEqual = NO; |
---|
2537 | isNegative = NO; |
---|
2538 | foundColon = NO; |
---|
2539 | expecting = Expecting(ALPHA); |
---|
2540 | expecting |= Expecting(NUMBER); |
---|
2541 | expecting |= Expecting(DASH); |
---|
2542 | expecting |= Expecting(EQUALSIGN); |
---|
2543 | } |
---|
2544 | else |
---|
2545 | return (ERROR); |
---|
2546 | } |
---|
2547 | |
---|
2548 | else if (expecting == Expecting(EQUALSIGN)) |
---|
2549 | { |
---|
2550 | foundEqual = YES; |
---|
2551 | expecting = Expecting(ALPHA); |
---|
2552 | expecting |= Expecting(NUMBER); |
---|
2553 | } |
---|
2554 | else if (expecting == Expecting(LEFTPAR)) |
---|
2555 | { |
---|
2556 | isNegative = NO; |
---|
2557 | expecting = Expecting(NUMBER); |
---|
2558 | expecting |= Expecting(DASH); |
---|
2559 | } |
---|
2560 | else if (expecting == Expecting(RIGHTPAR)) |
---|
2561 | { |
---|
2562 | isNegative = NO; |
---|
2563 | foundExp = NO; |
---|
2564 | expecting = Expecting(EQUALSIGN); |
---|
2565 | } |
---|
2566 | else if (expecting == Expecting(DASH)) |
---|
2567 | { |
---|
2568 | if (foundExp == YES) |
---|
2569 | isNegative = YES; |
---|
2570 | else |
---|
2571 | foundDash = YES; |
---|
2572 | expecting = Expecting(NUMBER); |
---|
2573 | } |
---|
2574 | else if (expecting == Expecting(ALPHA)) |
---|
2575 | { |
---|
2576 | if (foundFirst == YES && foundEqual == NO) |
---|
2577 | { |
---|
2578 | /* We are filling in the probability for the constraint. Specifically, we expect exp(number). */ |
---|
2579 | if(IsSame ("Partial", tkn) == SAME) |
---|
2580 | { |
---|
2581 | for (i=0; i<numTaxa; i++) |
---|
2582 | tempSetNeg[i] = 0; |
---|
2583 | |
---|
2584 | consrtainType=PARTIAL; |
---|
2585 | expecting = Expecting(EQUALSIGN); |
---|
2586 | expecting |= Expecting(ALPHA); |
---|
2587 | } |
---|
2588 | else if(IsSame ("Hard", tkn) == SAME) |
---|
2589 | { |
---|
2590 | consrtainType=HARD; |
---|
2591 | expecting = Expecting(EQUALSIGN); |
---|
2592 | expecting |= Expecting(ALPHA); |
---|
2593 | } |
---|
2594 | else if(IsSame ("Negative", tkn) == SAME) |
---|
2595 | { |
---|
2596 | consrtainType=NEGATIVE; |
---|
2597 | expecting = Expecting(EQUALSIGN); |
---|
2598 | expecting |= Expecting(ALPHA); |
---|
2599 | } |
---|
2600 | else if (IsSame ("Exp", tkn) == SAME || IsSame ("Exp", tkn) == CONSISTENT_WITH) |
---|
2601 | { |
---|
2602 | foundExp = YES; |
---|
2603 | foundDash = NO; |
---|
2604 | isNegative = NO; |
---|
2605 | expecting = Expecting(LEFTPAR); |
---|
2606 | } |
---|
2607 | else |
---|
2608 | { |
---|
2609 | MrBayesPrint ("%s Do not understand %s\n", spacer, tkn); |
---|
2610 | return (ERROR); |
---|
2611 | } |
---|
2612 | } |
---|
2613 | else |
---|
2614 | { |
---|
2615 | /* We are defining a constraint in terms of a taxon set (called tkn, here) or we are referring to |
---|
2616 | the taxon name. We should be able to find tkn in the list of taxon set names or in the list |
---|
2617 | of taxon names. If we cannot, then we have a problem and return an error. */ |
---|
2618 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
2619 | { |
---|
2620 | if (numTaxaSets < 1) |
---|
2621 | { |
---|
2622 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
2623 | return (ERROR); |
---|
2624 | } |
---|
2625 | if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR) |
---|
2626 | { |
---|
2627 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
2628 | return (ERROR); |
---|
2629 | } |
---|
2630 | /* add taxa from taxset tkn to new tempSet */ |
---|
2631 | for (i=0; i<numTaxa; i++) |
---|
2632 | { |
---|
2633 | if (IsBitSet(i, taxaSet[index]) == YES) |
---|
2634 | { |
---|
2635 | tempSetCurrent[i] = 1; |
---|
2636 | } |
---|
2637 | } |
---|
2638 | } |
---|
2639 | else |
---|
2640 | { |
---|
2641 | tempSetCurrent[index] = 1; |
---|
2642 | } |
---|
2643 | fromI = toJ = everyK = -1; |
---|
2644 | |
---|
2645 | expecting = Expecting(ALPHA); |
---|
2646 | expecting |= Expecting(NUMBER); |
---|
2647 | if( consrtainType != PARTIAL || foundColon == YES ) |
---|
2648 | expecting |= Expecting(SEMICOLON); |
---|
2649 | else |
---|
2650 | expecting |= Expecting(COLON); |
---|
2651 | } |
---|
2652 | } |
---|
2653 | else if (expecting == Expecting(NUMBER)) |
---|
2654 | { |
---|
2655 | if (foundFirst == YES && foundEqual == NO) |
---|
2656 | { |
---|
2657 | /* We are filling in the probability for the constraint. Specifically, we expect number. */ |
---|
2658 | sscanf (tkn, "%lf", &tempD); |
---|
2659 | if (foundExp == NO && tempD < 0.0) |
---|
2660 | { |
---|
2661 | MrBayesPrint ("%s The probability of a clade cannot be less than zero\n", spacer, tkn); |
---|
2662 | return (ERROR); |
---|
2663 | } |
---|
2664 | if (isNegative == YES || foundDash == YES) |
---|
2665 | tempD *= -1.0; |
---|
2666 | if (foundExp == YES) |
---|
2667 | { |
---|
2668 | expecting = Expecting(RIGHTPAR); |
---|
2669 | } |
---|
2670 | else |
---|
2671 | { |
---|
2672 | expecting = Expecting(EQUALSIGN); |
---|
2673 | } |
---|
2674 | foundFirst = NO; |
---|
2675 | foundDash = NO; |
---|
2676 | } |
---|
2677 | else |
---|
2678 | { |
---|
2679 | if (strlen(tkn) == 1 && !strcmp(tkn, ".")) |
---|
2680 | { |
---|
2681 | tempInt = numTaxa; |
---|
2682 | } |
---|
2683 | else |
---|
2684 | { |
---|
2685 | sscanf (tkn, "%d", &tempInt); |
---|
2686 | if (tempInt <= 0 || tempInt > numTaxa) |
---|
2687 | { |
---|
2688 | MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa); |
---|
2689 | return (ERROR); |
---|
2690 | } |
---|
2691 | } |
---|
2692 | tempInt--; |
---|
2693 | if (foundDash == YES) |
---|
2694 | { |
---|
2695 | if (fromI >= 0) |
---|
2696 | toJ = tempInt; |
---|
2697 | else |
---|
2698 | { |
---|
2699 | MrBayesPrint ("%s Improperly formatted constraint\n", spacer); |
---|
2700 | return (ERROR); |
---|
2701 | } |
---|
2702 | foundDash = NO; |
---|
2703 | } |
---|
2704 | else if (foundSlash == YES) |
---|
2705 | { |
---|
2706 | tempInt++; |
---|
2707 | if (tempInt <= 1) |
---|
2708 | { |
---|
2709 | MrBayesPrint ("%s Improperly formatted constraint\n", spacer); |
---|
2710 | return (ERROR); |
---|
2711 | } |
---|
2712 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
2713 | everyK = tempInt; |
---|
2714 | else |
---|
2715 | { |
---|
2716 | MrBayesPrint ("%s Improperly formatted constraint\n", spacer); |
---|
2717 | return (ERROR); |
---|
2718 | } |
---|
2719 | foundSlash = NO; |
---|
2720 | } |
---|
2721 | else |
---|
2722 | { |
---|
2723 | if (fromI >= 0 && toJ < 0) |
---|
2724 | { |
---|
2725 | if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR) |
---|
2726 | return (ERROR); |
---|
2727 | fromI = tempInt; |
---|
2728 | } |
---|
2729 | else if (fromI < 0 && toJ < 0) |
---|
2730 | { |
---|
2731 | fromI = tempInt; |
---|
2732 | } |
---|
2733 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
2734 | { |
---|
2735 | if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR) |
---|
2736 | return (ERROR); |
---|
2737 | fromI = tempInt; |
---|
2738 | toJ = everyK = -1; |
---|
2739 | } |
---|
2740 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
2741 | { |
---|
2742 | if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR) |
---|
2743 | return (ERROR); |
---|
2744 | fromI = tempInt; |
---|
2745 | toJ = everyK = -1; |
---|
2746 | } |
---|
2747 | else |
---|
2748 | { |
---|
2749 | MrBayesPrint ("%s Improperly formatted constraint\n", spacer); |
---|
2750 | { |
---|
2751 | return (ERROR); |
---|
2752 | } |
---|
2753 | } |
---|
2754 | } |
---|
2755 | |
---|
2756 | expecting = Expecting(ALPHA); |
---|
2757 | expecting |= Expecting(NUMBER); |
---|
2758 | expecting |= Expecting(DASH); |
---|
2759 | expecting |= Expecting(BACKSLASH); |
---|
2760 | if( consrtainType != PARTIAL || foundColon == YES ) |
---|
2761 | expecting |= Expecting(SEMICOLON); |
---|
2762 | else |
---|
2763 | expecting |= Expecting(COLON); |
---|
2764 | } |
---|
2765 | } |
---|
2766 | else if (expecting == Expecting(BACKSLASH)) |
---|
2767 | { |
---|
2768 | foundSlash = YES; |
---|
2769 | expecting = Expecting(NUMBER); |
---|
2770 | } |
---|
2771 | else if (expecting == Expecting(COLON)) |
---|
2772 | { |
---|
2773 | if( foundColon == YES ) |
---|
2774 | { |
---|
2775 | MrBayesPrint ("%s Improperly formatted constraint: two colon charactors in constraint command.\n", spacer); |
---|
2776 | return (ERROR); |
---|
2777 | } |
---|
2778 | |
---|
2779 | /* add set to tempSet */ |
---|
2780 | if (fromI >= 0 && toJ < 0) |
---|
2781 | { |
---|
2782 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
2783 | return (ERROR); |
---|
2784 | } |
---|
2785 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
2786 | { |
---|
2787 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
2788 | return (ERROR); |
---|
2789 | } |
---|
2790 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
2791 | { |
---|
2792 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
2793 | return (ERROR); |
---|
2794 | } |
---|
2795 | fromI = toJ = everyK = -1; |
---|
2796 | foundDash = foundSlash = NO; |
---|
2797 | |
---|
2798 | foundColon = YES; |
---|
2799 | tempSetCurrent = tempSetNeg; |
---|
2800 | expecting = Expecting(ALPHA); |
---|
2801 | expecting |= Expecting(NUMBER); |
---|
2802 | } |
---|
2803 | else |
---|
2804 | return (ERROR); |
---|
2805 | |
---|
2806 | return (NO_ERROR); |
---|
2807 | |
---|
2808 | } |
---|
2809 | |
---|
2810 | |
---|
2811 | |
---|
2812 | |
---|
2813 | |
---|
2814 | int DoCtype (void) |
---|
2815 | |
---|
2816 | { |
---|
2817 | |
---|
2818 | int i, foundIllegal, marks[5], numAppliedTo; |
---|
2819 | |
---|
2820 | /* add set to tempSet */ |
---|
2821 | if (fromI >= 0 && toJ < 0) |
---|
2822 | { |
---|
2823 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
2824 | return (ERROR); |
---|
2825 | } |
---|
2826 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
2827 | { |
---|
2828 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
2829 | return (ERROR); |
---|
2830 | } |
---|
2831 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
2832 | { |
---|
2833 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
2834 | return (ERROR); |
---|
2835 | } |
---|
2836 | |
---|
2837 | /* merge tempSet with ctype */ |
---|
2838 | numAppliedTo = 0; |
---|
2839 | for (i=0; i<5; i++) |
---|
2840 | marks[i] = NO; |
---|
2841 | for (i=0; i<numChar; i++) |
---|
2842 | { |
---|
2843 | if (tempSet[i] != 0) |
---|
2844 | { |
---|
2845 | foundIllegal = NO; |
---|
2846 | if (charOrdering != UNORD) |
---|
2847 | { |
---|
2848 | if (charInfo[i].charType == DNA) |
---|
2849 | { |
---|
2850 | foundIllegal = YES; |
---|
2851 | if (marks[0] == NO) |
---|
2852 | MrBayesPrint ("%s Ctype not applied to DNA states which must be unordered\n", spacer); |
---|
2853 | marks[0] = YES; |
---|
2854 | } |
---|
2855 | else if (charInfo[i].charType == RNA) |
---|
2856 | { |
---|
2857 | foundIllegal = YES; |
---|
2858 | if (marks[1] == NO) |
---|
2859 | MrBayesPrint ("%s Ctype not applied to RNA states which must be unordered\n", spacer); |
---|
2860 | marks[1] = YES; |
---|
2861 | } |
---|
2862 | else if (charInfo[i].charType == PROTEIN) |
---|
2863 | { |
---|
2864 | foundIllegal = YES; |
---|
2865 | if (marks[2] == NO) |
---|
2866 | MrBayesPrint ("%s Ctype not applied to amino acid states which must be unordered\n", spacer); |
---|
2867 | marks[2] = YES; |
---|
2868 | } |
---|
2869 | else if (charInfo[i].charType == RESTRICTION) |
---|
2870 | { |
---|
2871 | foundIllegal = YES; |
---|
2872 | if (marks[3] == NO) |
---|
2873 | MrBayesPrint ("%s Ctype not applied to restriction site states which must be unordered\n", spacer); |
---|
2874 | marks[3] = YES; |
---|
2875 | } |
---|
2876 | else if (charInfo[i].charType == CONTINUOUS) |
---|
2877 | { |
---|
2878 | foundIllegal = YES; |
---|
2879 | if (marks[4] == NO) |
---|
2880 | MrBayesPrint ("%s Ctype not applied to continuous characters\n", spacer); |
---|
2881 | marks[4] = YES; |
---|
2882 | } |
---|
2883 | } |
---|
2884 | if (foundIllegal == NO) |
---|
2885 | { |
---|
2886 | charInfo[i].ctype = charOrdering; |
---|
2887 | numAppliedTo++; |
---|
2888 | } |
---|
2889 | } |
---|
2890 | } |
---|
2891 | if (numAppliedTo > 0) |
---|
2892 | { |
---|
2893 | MrBayesPrint ("%s Ctype was applied to %d standard characters\n", spacer, numAppliedTo); |
---|
2894 | } |
---|
2895 | else |
---|
2896 | { |
---|
2897 | MrBayesPrint ("%s No standard characters found to apply ctype to\n", spacer); |
---|
2898 | } |
---|
2899 | |
---|
2900 | # if 0 |
---|
2901 | for (i=0; i<numChar; i++) |
---|
2902 | MrBayesPrint ("%4d -- %d\n", i, ctype[i]); |
---|
2903 | # endif |
---|
2904 | |
---|
2905 | return (NO_ERROR); |
---|
2906 | |
---|
2907 | } |
---|
2908 | |
---|
2909 | |
---|
2910 | |
---|
2911 | |
---|
2912 | |
---|
2913 | int DoCtypeParm (char *parmName, char *tkn) |
---|
2914 | |
---|
2915 | { |
---|
2916 | |
---|
2917 | int i, index, tempInt; |
---|
2918 | |
---|
2919 | if (defMatrix == NO) |
---|
2920 | { |
---|
2921 | MrBayesPrint ("%s A matrix must be specified before typesets can be defined\n", spacer); |
---|
2922 | return (ERROR); |
---|
2923 | } |
---|
2924 | |
---|
2925 | if (expecting == Expecting(PARAMETER)) |
---|
2926 | { |
---|
2927 | if (!strcmp(parmName, "Xxxxxxxxxx")) |
---|
2928 | { |
---|
2929 | if (IsSame ("Ordered", tkn) == SAME || IsSame ("Ordered", tkn) == CONSISTENT_WITH) |
---|
2930 | charOrdering = ORD; |
---|
2931 | else if (IsSame ("Unordered", tkn) == SAME || IsSame ("Unordered", tkn) == CONSISTENT_WITH) |
---|
2932 | charOrdering = UNORD; |
---|
2933 | else if (IsSame ("Dollo", tkn) == SAME || IsSame ("Dollo", tkn) == CONSISTENT_WITH) |
---|
2934 | charOrdering = DOLLO; |
---|
2935 | else if (IsSame ("Irreversible", tkn) == SAME || IsSame ("Irreversible", tkn) == CONSISTENT_WITH) |
---|
2936 | charOrdering = IRREV; |
---|
2937 | else |
---|
2938 | { |
---|
2939 | MrBayesPrint ("%s Do not understand delimiter \"%s\"\n", spacer, tkn); |
---|
2940 | return (ERROR); |
---|
2941 | } |
---|
2942 | |
---|
2943 | /* clear tempSet */ |
---|
2944 | for (i=0; i<numChar; i++) |
---|
2945 | tempSet[i] = 0; |
---|
2946 | |
---|
2947 | fromI = toJ = everyK = -1; |
---|
2948 | foundDash = foundSlash = NO; |
---|
2949 | MrBayesPrint ("%s Setting characters to %s\n", spacer, tkn); |
---|
2950 | expecting = Expecting(COLON); |
---|
2951 | } |
---|
2952 | else |
---|
2953 | return (ERROR); |
---|
2954 | } |
---|
2955 | else if (expecting == Expecting(COLON)) |
---|
2956 | { |
---|
2957 | expecting = Expecting(ALPHA) | Expecting(NUMBER); |
---|
2958 | } |
---|
2959 | else if (expecting == Expecting(ALPHA)) |
---|
2960 | { |
---|
2961 | /* first, check that we are not trying to put in another character ordering */ |
---|
2962 | if (IsSame ("Ordered", tkn) == SAME || IsSame ("Ordered", tkn) == CONSISTENT_WITH) |
---|
2963 | { |
---|
2964 | MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn); |
---|
2965 | return (ERROR); |
---|
2966 | } |
---|
2967 | else if (IsSame ("Unordered", tkn) == SAME || IsSame ("Unordered", tkn) == CONSISTENT_WITH) |
---|
2968 | { |
---|
2969 | MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn); |
---|
2970 | return (ERROR); |
---|
2971 | } |
---|
2972 | else if (IsSame ("Dollo", tkn) == SAME || IsSame ("Dollo", tkn) == CONSISTENT_WITH) |
---|
2973 | { |
---|
2974 | MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn); |
---|
2975 | return (ERROR); |
---|
2976 | } |
---|
2977 | else if (IsSame ("Irreversible", tkn) == SAME || IsSame ("Irreversible", tkn) == CONSISTENT_WITH) |
---|
2978 | { |
---|
2979 | MrBayesPrint ("%s You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn); |
---|
2980 | return (ERROR); |
---|
2981 | } |
---|
2982 | |
---|
2983 | /* We are defining a type set in terms of another (called tkn, here). We should be able |
---|
2984 | to find tkn in the list of character set names. If we cannot, then we have a problem and |
---|
2985 | return an error. */ |
---|
2986 | if (IsSame ("All", tkn) == SAME) |
---|
2987 | { |
---|
2988 | for (i=0; i<numChar; i++) |
---|
2989 | tempSet[i] = 1; |
---|
2990 | fromI = toJ = everyK = -1; |
---|
2991 | expecting = Expecting(SEMICOLON); |
---|
2992 | } |
---|
2993 | else |
---|
2994 | { |
---|
2995 | if (numCharSets < 1) |
---|
2996 | { |
---|
2997 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
2998 | return (ERROR); |
---|
2999 | } |
---|
3000 | if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR) |
---|
3001 | { |
---|
3002 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
3003 | return (ERROR); |
---|
3004 | } |
---|
3005 | |
---|
3006 | /* add characters from charset tkn to new tempset */ |
---|
3007 | for (i=0; i<numChar; i++) |
---|
3008 | { |
---|
3009 | if (IsBitSet(i, charSet[index]) == YES) |
---|
3010 | tempSet[i] = 1; |
---|
3011 | } |
---|
3012 | fromI = toJ = everyK = -1; |
---|
3013 | expecting = Expecting(ALPHA); |
---|
3014 | expecting |= Expecting(NUMBER); |
---|
3015 | expecting |= Expecting(SEMICOLON); |
---|
3016 | } |
---|
3017 | } |
---|
3018 | else if (expecting == Expecting(NUMBER)) |
---|
3019 | { |
---|
3020 | if (strlen(tkn) == 1 && tkn[0] == '.') |
---|
3021 | tempInt = numChar; |
---|
3022 | else |
---|
3023 | sscanf (tkn, "%d", &tempInt); |
---|
3024 | if (tempInt <= 0 || tempInt > numChar) |
---|
3025 | { |
---|
3026 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
3027 | return (ERROR); |
---|
3028 | } |
---|
3029 | tempInt--; |
---|
3030 | if (foundDash == YES) |
---|
3031 | { |
---|
3032 | if (fromI >= 0) |
---|
3033 | toJ = tempInt; |
---|
3034 | else |
---|
3035 | { |
---|
3036 | MrBayesPrint ("%s Improperly formatted ctype\n", spacer); |
---|
3037 | return (ERROR); |
---|
3038 | } |
---|
3039 | foundDash = NO; |
---|
3040 | } |
---|
3041 | else if (foundSlash == YES) |
---|
3042 | { |
---|
3043 | tempInt++; |
---|
3044 | if (tempInt <= 1) |
---|
3045 | { |
---|
3046 | MrBayesPrint ("%s Improperly formatted ctype\n", spacer); |
---|
3047 | return (ERROR); |
---|
3048 | } |
---|
3049 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
3050 | everyK = tempInt; |
---|
3051 | else |
---|
3052 | { |
---|
3053 | MrBayesPrint ("%s Improperly formatted ctype\n", spacer); |
---|
3054 | return (ERROR); |
---|
3055 | } |
---|
3056 | foundSlash = NO; |
---|
3057 | } |
---|
3058 | else |
---|
3059 | { |
---|
3060 | if (fromI >= 0 && toJ < 0) |
---|
3061 | { |
---|
3062 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3063 | return (ERROR); |
---|
3064 | fromI = tempInt; |
---|
3065 | } |
---|
3066 | else if (fromI < 0 && toJ < 0) |
---|
3067 | { |
---|
3068 | fromI = tempInt; |
---|
3069 | } |
---|
3070 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
3071 | { |
---|
3072 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3073 | return (ERROR); |
---|
3074 | fromI = tempInt; |
---|
3075 | toJ = everyK = -1; |
---|
3076 | } |
---|
3077 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
3078 | { |
---|
3079 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3080 | return (ERROR); |
---|
3081 | fromI = tempInt; |
---|
3082 | toJ = everyK = -1; |
---|
3083 | } |
---|
3084 | else |
---|
3085 | { |
---|
3086 | MrBayesPrint ("%s Improperly formatted ctype\n", spacer); |
---|
3087 | { |
---|
3088 | return (ERROR); |
---|
3089 | } |
---|
3090 | } |
---|
3091 | |
---|
3092 | } |
---|
3093 | |
---|
3094 | |
---|
3095 | expecting = Expecting(ALPHA); |
---|
3096 | expecting |= Expecting(NUMBER); |
---|
3097 | expecting |= Expecting(SEMICOLON); |
---|
3098 | expecting |= Expecting(DASH); |
---|
3099 | expecting |= Expecting(BACKSLASH); |
---|
3100 | } |
---|
3101 | else if (expecting == Expecting(DASH)) |
---|
3102 | { |
---|
3103 | foundDash = YES; |
---|
3104 | expecting = Expecting(NUMBER); |
---|
3105 | } |
---|
3106 | else if (expecting == Expecting(BACKSLASH)) |
---|
3107 | { |
---|
3108 | foundSlash = YES; |
---|
3109 | expecting = Expecting(NUMBER); |
---|
3110 | } |
---|
3111 | else |
---|
3112 | return (ERROR); |
---|
3113 | |
---|
3114 | return (NO_ERROR); |
---|
3115 | |
---|
3116 | } |
---|
3117 | |
---|
3118 | |
---|
3119 | |
---|
3120 | |
---|
3121 | |
---|
3122 | int DoDelete (void) |
---|
3123 | |
---|
3124 | { |
---|
3125 | |
---|
3126 | int i, alreadyDone; |
---|
3127 | |
---|
3128 | MrBayesPrint ("%s Excluding taxa\n", spacer); |
---|
3129 | |
---|
3130 | /* add set to tempSet */ |
---|
3131 | if (fromI >= 0 && toJ < 0) |
---|
3132 | { |
---|
3133 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3134 | return (ERROR); |
---|
3135 | } |
---|
3136 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
3137 | { |
---|
3138 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3139 | return (ERROR); |
---|
3140 | } |
---|
3141 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
3142 | { |
---|
3143 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3144 | return (ERROR); |
---|
3145 | } |
---|
3146 | |
---|
3147 | /* merge tempSet with taxaset */ |
---|
3148 | alreadyDone = NO; |
---|
3149 | for (i=0; i<numTaxa; i++) |
---|
3150 | { |
---|
3151 | if (tempSet[i] == 1) |
---|
3152 | { |
---|
3153 | if (taxaInfo[i].isDeleted == YES && alreadyDone == NO) |
---|
3154 | { |
---|
3155 | MrBayesPrint ("%s Some taxa already excluded\n", spacer); |
---|
3156 | alreadyDone = YES; |
---|
3157 | } |
---|
3158 | taxaInfo[i].isDeleted = YES; |
---|
3159 | } |
---|
3160 | } |
---|
3161 | |
---|
3162 | SetLocalTaxa (); |
---|
3163 | SetUpAnalysis(&globalSeed); |
---|
3164 | |
---|
3165 | /* show tempSet (for debugging) */ |
---|
3166 | # if 0 |
---|
3167 | for (i=0; i<numTaxa; i++) |
---|
3168 | MrBayesPrint ("%4d %4d\n", i+1, tempSet[i]); |
---|
3169 | # endif |
---|
3170 | |
---|
3171 | return (NO_ERROR); |
---|
3172 | |
---|
3173 | } |
---|
3174 | |
---|
3175 | |
---|
3176 | |
---|
3177 | |
---|
3178 | |
---|
3179 | int DoDeleteParm (char *parmName, char *tkn) |
---|
3180 | |
---|
3181 | { |
---|
3182 | |
---|
3183 | int i, index, tempInt; |
---|
3184 | |
---|
3185 | if (defMatrix == NO) |
---|
3186 | { |
---|
3187 | MrBayesPrint ("%s A matrix must be specified before you can delete taxa\n", spacer); |
---|
3188 | return (ERROR); |
---|
3189 | } |
---|
3190 | |
---|
3191 | if (foundFirst == NO) |
---|
3192 | { |
---|
3193 | /* this is the first time in */ |
---|
3194 | fromI = toJ = everyK = -1; |
---|
3195 | foundDash = NO; |
---|
3196 | for (i=0; i<numTaxa; i++) /* clear tempSet */ |
---|
3197 | tempSet[i] = 0; |
---|
3198 | foundFirst = YES; |
---|
3199 | } |
---|
3200 | |
---|
3201 | if (expecting == Expecting(ALPHA)) |
---|
3202 | { |
---|
3203 | if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH) |
---|
3204 | { |
---|
3205 | for (i=0; i<numTaxa; i++) |
---|
3206 | tempSet[i] = 1; |
---|
3207 | } |
---|
3208 | else |
---|
3209 | { |
---|
3210 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
3211 | { |
---|
3212 | /* we are using a pre-defined taxa set */ |
---|
3213 | if (numTaxaSets < 1) |
---|
3214 | { |
---|
3215 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
3216 | return (ERROR); |
---|
3217 | } |
---|
3218 | if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR) |
---|
3219 | { |
---|
3220 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
3221 | return (ERROR); |
---|
3222 | } |
---|
3223 | /* add taxa from taxset tkn to new tempSet */ |
---|
3224 | for (i=0; i<numTaxa; i++) |
---|
3225 | { |
---|
3226 | if (IsBitSet (i, taxaSet[index]) == YES) |
---|
3227 | tempSet[i] = 1; |
---|
3228 | } |
---|
3229 | } |
---|
3230 | else |
---|
3231 | { |
---|
3232 | /* we found the taxon name */ |
---|
3233 | if (fromI >= 0 && toJ < 0) |
---|
3234 | { |
---|
3235 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3236 | return (ERROR); |
---|
3237 | } |
---|
3238 | else if (fromI >= 0 && toJ >= 0) |
---|
3239 | { |
---|
3240 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3241 | return (ERROR); |
---|
3242 | } |
---|
3243 | |
---|
3244 | tempSet[index] = 1; |
---|
3245 | } |
---|
3246 | } |
---|
3247 | foundDash = NO; |
---|
3248 | fromI = toJ = everyK = -1; |
---|
3249 | |
---|
3250 | expecting = Expecting(ALPHA); |
---|
3251 | expecting |= Expecting(NUMBER); |
---|
3252 | expecting |= Expecting(SEMICOLON); |
---|
3253 | } |
---|
3254 | else if (expecting == Expecting(NUMBER)) |
---|
3255 | { |
---|
3256 | if (strlen(tkn) == 1 && !strcmp(tkn, ".")) |
---|
3257 | tempInt = numTaxa; |
---|
3258 | else |
---|
3259 | { |
---|
3260 | sscanf (tkn, "%d", &tempInt); |
---|
3261 | if (tempInt <= 0 || tempInt > numTaxa) |
---|
3262 | { |
---|
3263 | MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa); |
---|
3264 | return (ERROR); |
---|
3265 | } |
---|
3266 | } |
---|
3267 | tempInt--; |
---|
3268 | if (foundDash == YES) |
---|
3269 | { |
---|
3270 | if (fromI >= 0) |
---|
3271 | toJ = tempInt; |
---|
3272 | else |
---|
3273 | { |
---|
3274 | MrBayesPrint ("%s Improperly formatted delete set\n", spacer); |
---|
3275 | return (ERROR); |
---|
3276 | } |
---|
3277 | foundDash = NO; |
---|
3278 | } |
---|
3279 | else |
---|
3280 | { |
---|
3281 | if (fromI >= 0 && toJ < 0) |
---|
3282 | { |
---|
3283 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3284 | return (ERROR); |
---|
3285 | fromI = tempInt; |
---|
3286 | } |
---|
3287 | else if (fromI < 0 && toJ < 0) |
---|
3288 | { |
---|
3289 | fromI = tempInt; |
---|
3290 | } |
---|
3291 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
3292 | { |
---|
3293 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3294 | return (ERROR); |
---|
3295 | fromI = tempInt; |
---|
3296 | toJ = everyK = -1; |
---|
3297 | } |
---|
3298 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
3299 | { |
---|
3300 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3301 | return (ERROR); |
---|
3302 | fromI = tempInt; |
---|
3303 | toJ = everyK = -1; |
---|
3304 | } |
---|
3305 | else |
---|
3306 | { |
---|
3307 | MrBayesPrint ("%s Improperly formatted delete set\n", spacer); |
---|
3308 | { |
---|
3309 | return (ERROR); |
---|
3310 | } |
---|
3311 | } |
---|
3312 | } |
---|
3313 | expecting = Expecting(ALPHA); |
---|
3314 | expecting |= Expecting(NUMBER); |
---|
3315 | expecting |= Expecting(SEMICOLON); |
---|
3316 | expecting |= Expecting(DASH); |
---|
3317 | } |
---|
3318 | else if (expecting == Expecting(DASH)) |
---|
3319 | { |
---|
3320 | foundDash = YES; |
---|
3321 | expecting = Expecting(NUMBER); |
---|
3322 | } |
---|
3323 | else |
---|
3324 | return (ERROR); |
---|
3325 | |
---|
3326 | return (NO_ERROR); |
---|
3327 | MrBayesPrint ("%s", parmName); /*just because I am tired of seeing the unused parameter error msg */ |
---|
3328 | |
---|
3329 | } |
---|
3330 | |
---|
3331 | |
---|
3332 | |
---|
3333 | |
---|
3334 | |
---|
3335 | int DoDimensions (void) |
---|
3336 | |
---|
3337 | { |
---|
3338 | |
---|
3339 | if (inDataBlock == NO && inTaxaBlock == NO && inCharactersBlock == NO) |
---|
3340 | { |
---|
3341 | MrBayesPrint ("%s Dimensions can only be defined in a data, characters or taxa block\n", spacer); |
---|
3342 | return (ERROR); |
---|
3343 | } |
---|
3344 | |
---|
3345 | /* other problems are detected already when reading in DoDimensionsParm */ |
---|
3346 | if (inDataBlock == YES && (defTaxa == NO || defChars == NO)) |
---|
3347 | { |
---|
3348 | MrBayesPrint ("%s Expecting both Ntax and Nchar to be defined in a data block\n", spacer); |
---|
3349 | return (ERROR); |
---|
3350 | } |
---|
3351 | |
---|
3352 | /* allocate matrix */ |
---|
3353 | if (inTaxaBlock == YES) |
---|
3354 | { |
---|
3355 | if (AllocTaxa () == ERROR) |
---|
3356 | return ERROR; |
---|
3357 | MrBayesPrint ("%s Defining new set of %d taxa\n", spacer, numTaxa); |
---|
3358 | } |
---|
3359 | |
---|
3360 | if (inCharactersBlock == YES) |
---|
3361 | { |
---|
3362 | if (AllocMatrix() == ERROR) |
---|
3363 | return (ERROR); |
---|
3364 | MrBayesPrint ("%s Defining new character matrix with %d characters\n", spacer, numChar); |
---|
3365 | } |
---|
3366 | |
---|
3367 | if (inDataBlock == YES) |
---|
3368 | { |
---|
3369 | if (AllocMatrix() == ERROR) |
---|
3370 | return (ERROR); |
---|
3371 | MrBayesPrint ("%s Defining new matrix with %d taxa and %d characters\n", spacer, numTaxa, numChar); |
---|
3372 | } |
---|
3373 | |
---|
3374 | return (NO_ERROR); |
---|
3375 | |
---|
3376 | } |
---|
3377 | |
---|
3378 | |
---|
3379 | |
---|
3380 | |
---|
3381 | |
---|
3382 | int DoDimensionsParm (char *parmName, char *tkn) |
---|
3383 | |
---|
3384 | { |
---|
3385 | |
---|
3386 | if (expecting == Expecting(PARAMETER)) |
---|
3387 | { |
---|
3388 | expecting = Expecting(EQUALSIGN); |
---|
3389 | } |
---|
3390 | else |
---|
3391 | { |
---|
3392 | /* set Ntax (numTaxa) *****************************************************************/ |
---|
3393 | if (!strcmp(parmName, "Ntax")) |
---|
3394 | { |
---|
3395 | if (inCharactersBlock == YES) |
---|
3396 | { |
---|
3397 | MrBayesPrint ("%s You cannot define ntax in a characters block\n"); |
---|
3398 | return (ERROR); |
---|
3399 | } |
---|
3400 | if (expecting == Expecting(EQUALSIGN)) |
---|
3401 | expecting = Expecting(NUMBER); |
---|
3402 | else if (expecting == Expecting(NUMBER)) |
---|
3403 | { |
---|
3404 | sscanf (tkn, "%d", &numTaxa); |
---|
3405 | defTaxa = YES; |
---|
3406 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
3407 | } |
---|
3408 | else |
---|
3409 | return (ERROR); |
---|
3410 | } |
---|
3411 | /* set Nchar (numChar) ****************************************************************/ |
---|
3412 | else if (!strcmp(parmName, "Nchar")) |
---|
3413 | { |
---|
3414 | if (inTaxaBlock == YES) |
---|
3415 | { |
---|
3416 | MrBayesPrint ("%s You cannot define nchar in a taxa block\n"); |
---|
3417 | return (ERROR); |
---|
3418 | } |
---|
3419 | if (expecting == Expecting(EQUALSIGN)) |
---|
3420 | expecting = Expecting(NUMBER); |
---|
3421 | else if (expecting == Expecting(NUMBER)) |
---|
3422 | { |
---|
3423 | sscanf (tkn, "%d", &numChar); |
---|
3424 | defChars = YES; |
---|
3425 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
3426 | } |
---|
3427 | else |
---|
3428 | return (ERROR); |
---|
3429 | } |
---|
3430 | else |
---|
3431 | return (ERROR); |
---|
3432 | } |
---|
3433 | |
---|
3434 | return (NO_ERROR); |
---|
3435 | } |
---|
3436 | |
---|
3437 | |
---|
3438 | |
---|
3439 | |
---|
3440 | |
---|
3441 | int DoDisclaimer (void) |
---|
3442 | |
---|
3443 | { |
---|
3444 | |
---|
3445 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
3446 | MrBayesPrint (" Disclaimer \n"); |
---|
3447 | MrBayesPrint (" \n"); |
---|
3448 | MrBayesPrint (" Copyright 2003 by John P. Huelsenbeck and Fredrik Ronquist \n"); |
---|
3449 | MrBayesPrint (" \n"); |
---|
3450 | MrBayesPrint (" This software package is provided \"as is\" and without a warranty of any \n"); |
---|
3451 | MrBayesPrint (" kind. In no event shall the authors be held responsible for any damage \n"); |
---|
3452 | MrBayesPrint (" resulting from the use of this software. The program--including source code, \n"); |
---|
3453 | MrBayesPrint (" example data sets, and executables--is distributed free of charge for \n"); |
---|
3454 | MrBayesPrint (" academic use only. \n"); |
---|
3455 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
3456 | |
---|
3457 | return (NO_ERROR); |
---|
3458 | |
---|
3459 | } |
---|
3460 | |
---|
3461 | |
---|
3462 | |
---|
3463 | |
---|
3464 | |
---|
3465 | int DoEndBlock (void) |
---|
3466 | |
---|
3467 | { |
---|
3468 | |
---|
3469 | if (inMrbayesBlock == YES) |
---|
3470 | { |
---|
3471 | MrBayesPrint (" Exiting mrbayes block\n"); |
---|
3472 | inMrbayesBlock = NO; |
---|
3473 | } |
---|
3474 | else if (inDataBlock == YES) |
---|
3475 | { |
---|
3476 | MrBayesPrint (" Exiting data block\n"); |
---|
3477 | inDataBlock = NO; |
---|
3478 | } |
---|
3479 | else if (inCharactersBlock == YES) |
---|
3480 | { |
---|
3481 | MrBayesPrint (" Exiting characters block\n"); |
---|
3482 | inCharactersBlock = NO; |
---|
3483 | } |
---|
3484 | else if (inTaxaBlock == YES) |
---|
3485 | { |
---|
3486 | MrBayesPrint (" Exiting taxa block\n"); |
---|
3487 | if (numNamedTaxa < numTaxa) |
---|
3488 | { |
---|
3489 | MrBayesPrint ("%s Leaving taxa block without taxon labels being defined\n", spacer); |
---|
3490 | FreeTaxa(); |
---|
3491 | } |
---|
3492 | inTaxaBlock = NO; |
---|
3493 | } |
---|
3494 | else if (inTreesBlock == YES) |
---|
3495 | { |
---|
3496 | MrBayesPrint (" Exiting trees block\n"); |
---|
3497 | inTreesBlock = NO; |
---|
3498 | ResetTranslateTable(); |
---|
3499 | } |
---|
3500 | else if (inForeignBlock == YES) |
---|
3501 | { |
---|
3502 | MrBayesPrint (" Exiting foreign block\n"); |
---|
3503 | inForeignBlock = NO; |
---|
3504 | } |
---|
3505 | else |
---|
3506 | { |
---|
3507 | MrBayesPrint (" Unknown \"end\" statement\n"); |
---|
3508 | return (ERROR); |
---|
3509 | } |
---|
3510 | |
---|
3511 | strcpy(spacer,""); /* reset indentation */ |
---|
3512 | return (NO_ERROR); |
---|
3513 | |
---|
3514 | } |
---|
3515 | |
---|
3516 | |
---|
3517 | |
---|
3518 | |
---|
3519 | |
---|
3520 | int DoExecute (void) |
---|
3521 | |
---|
3522 | { |
---|
3523 | |
---|
3524 | int c, i, rc, cmdLine, lineTerm, longestLineLength, nErrors; |
---|
3525 | char *s, exeFileName[100]; |
---|
3526 | FILE *fp; |
---|
3527 | CmdType *oldCommandPtr; |
---|
3528 | # if defined (MPI_ENABLED) |
---|
3529 | int sumErrors; |
---|
3530 | # endif |
---|
3531 | |
---|
3532 | nErrors = 0; |
---|
3533 | cmdLine = 0; |
---|
3534 | numOpenExeFiles++; |
---|
3535 | s = NULL; |
---|
3536 | strncpy(exeFileName, inputFileName, 98); |
---|
3537 | |
---|
3538 | if (numOpenExeFiles > 1) |
---|
3539 | MrBayesPrint ("\n%s Executing file \"%s\"...\n\n", spacer, inputFileName); |
---|
3540 | else |
---|
3541 | MrBayesPrint ("%s Executing file \"%s\"\n", spacer, inputFileName); |
---|
3542 | |
---|
3543 | /* Save old command ptr */ |
---|
3544 | oldCommandPtr = commandPtr; |
---|
3545 | |
---|
3546 | /* open binary file */ |
---|
3547 | if ((fp = OpenBinaryFileR(inputFileName)) == NULL) |
---|
3548 | nErrors++; |
---|
3549 | |
---|
3550 | /* set indentation to 0 */ |
---|
3551 | strcpy (spacer, ""); |
---|
3552 | |
---|
3553 | # if defined (MPI_ENABLED) |
---|
3554 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3555 | if (sumErrors > 0) |
---|
3556 | { |
---|
3557 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3558 | goto errorExit; |
---|
3559 | } |
---|
3560 | # else |
---|
3561 | if (nErrors > 0) |
---|
3562 | goto errorExit; |
---|
3563 | # endif |
---|
3564 | |
---|
3565 | /* find out what type of line termination is used */ |
---|
3566 | lineTerm = LineTermType (fp); |
---|
3567 | if (lineTerm == LINETERM_MAC) |
---|
3568 | MrBayesPrint ("%s Macintosh line termination\n", spacer); |
---|
3569 | else if (lineTerm == LINETERM_DOS) |
---|
3570 | MrBayesPrint ("%s DOS line termination\n", spacer); |
---|
3571 | else if (lineTerm == LINETERM_UNIX) |
---|
3572 | MrBayesPrint ("%s UNIX line termination\n", spacer); |
---|
3573 | else |
---|
3574 | { |
---|
3575 | MrBayesPrint ("%s Unknown line termination\n", spacer); |
---|
3576 | nErrors++; |
---|
3577 | } |
---|
3578 | # if defined (MPI_ENABLED) |
---|
3579 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3580 | if (sumErrors > 0) |
---|
3581 | { |
---|
3582 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3583 | goto errorExit; |
---|
3584 | } |
---|
3585 | # else |
---|
3586 | if (nErrors > 0) |
---|
3587 | goto errorExit; |
---|
3588 | # endif |
---|
3589 | |
---|
3590 | /* find length of longest line */ |
---|
3591 | longestLineLength = LongestLine (fp); |
---|
3592 | MrBayesPrint ("%s Longest line length = %d\n", spacer, longestLineLength); |
---|
3593 | longestLineLength += 50; |
---|
3594 | |
---|
3595 | /* check that longest line is not longer than CMD_STRING_LENGTH */ |
---|
3596 | if (longestLineLength >= CMD_STRING_LENGTH - 100) |
---|
3597 | { |
---|
3598 | /*MrBayesPrint ("%s A maximum of %d characters is allowed on a single line\n", spacer, CMD_STRING_LENGTH - 100);*/ |
---|
3599 | MrBayesPrint ("%s The longest line of the file %s\n", spacer, inputFileName); |
---|
3600 | MrBayesPrint ("%s contains at least one line with %d characters.\n", spacer, longestLineLength); |
---|
3601 | } |
---|
3602 | /* |
---|
3603 | # if defined (MPI_ENABLED) |
---|
3604 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3605 | if (sumErrors > 0) |
---|
3606 | { |
---|
3607 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3608 | goto errorExit; |
---|
3609 | } |
---|
3610 | # else |
---|
3611 | if (nErrors > 0) |
---|
3612 | goto errorExit; |
---|
3613 | # endif |
---|
3614 | */ |
---|
3615 | |
---|
3616 | /* allocate a string long enough to hold a line */ |
---|
3617 | s = (char *)SafeMalloc((size_t) (longestLineLength * sizeof(char))); |
---|
3618 | if (!s) |
---|
3619 | { |
---|
3620 | MrBayesPrint ("%s Problem allocating string for reading file\n", spacer); |
---|
3621 | nErrors++; |
---|
3622 | } |
---|
3623 | # if defined (MPI_ENABLED) |
---|
3624 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3625 | if (sumErrors > 0) |
---|
3626 | { |
---|
3627 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3628 | goto errorExit; |
---|
3629 | } |
---|
3630 | # else |
---|
3631 | if (nErrors > 0) |
---|
3632 | goto errorExit; |
---|
3633 | # endif |
---|
3634 | |
---|
3635 | /* close binary file */ |
---|
3636 | SafeFclose (&fp); |
---|
3637 | |
---|
3638 | /* open text file */ |
---|
3639 | if ((fp = OpenTextFileR(inputFileName)) == NULL) |
---|
3640 | { |
---|
3641 | nErrors++; |
---|
3642 | } |
---|
3643 | # if defined (MPI_ENABLED) |
---|
3644 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3645 | if (sumErrors > 0) |
---|
3646 | { |
---|
3647 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3648 | goto errorExit; |
---|
3649 | } |
---|
3650 | # else |
---|
3651 | if (nErrors > 0) |
---|
3652 | goto errorExit; |
---|
3653 | # endif |
---|
3654 | |
---|
3655 | /* parse file, reading each line in turn */ |
---|
3656 | MrBayesPrint ("%s Parsing file\n", spacer); |
---|
3657 | |
---|
3658 | inMrbayesBlock = inDataBlock = inForeignBlock = inTreesBlock = NO; |
---|
3659 | foundNewLine = NO; |
---|
3660 | expecting = Expecting(COMMAND); |
---|
3661 | cmdLine = 0; |
---|
3662 | |
---|
3663 | do { |
---|
3664 | /* read in a new line into s */ |
---|
3665 | i = 0; |
---|
3666 | do { |
---|
3667 | c = fgetc(fp); |
---|
3668 | if (c == '\r' || c == '\n' || c == EOF) |
---|
3669 | s[i++] = '\n'; |
---|
3670 | else |
---|
3671 | s[i++] = c; |
---|
3672 | } while (s[i-1] != '\n'); |
---|
3673 | s[i] = '\0'; |
---|
3674 | foundNewLine = YES; |
---|
3675 | cmdLine++; |
---|
3676 | |
---|
3677 | /* process string if not empty */ |
---|
3678 | if (strlen(s) > 1) |
---|
3679 | { |
---|
3680 | /* check that all characters in the string are valid */ |
---|
3681 | if (CheckStringValidity (s) == ERROR) |
---|
3682 | { |
---|
3683 | nErrors++; |
---|
3684 | } |
---|
3685 | # if defined (MPI_ENABLED) |
---|
3686 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3687 | if (sumErrors > 0) |
---|
3688 | { |
---|
3689 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3690 | goto errorExit; |
---|
3691 | } |
---|
3692 | # else |
---|
3693 | if (nErrors > 0) |
---|
3694 | goto errorExit; |
---|
3695 | # endif |
---|
3696 | |
---|
3697 | /* interpret commands on line */ |
---|
3698 | rc = ParseCommand (s); |
---|
3699 | if (rc == ERROR) |
---|
3700 | nErrors++; |
---|
3701 | # if defined (MPI_ENABLED) |
---|
3702 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3703 | if (sumErrors > 0) |
---|
3704 | { |
---|
3705 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3706 | goto errorExit; |
---|
3707 | } |
---|
3708 | # else |
---|
3709 | if (nErrors > 0) |
---|
3710 | goto errorExit; |
---|
3711 | # endif |
---|
3712 | if (rc == NO_ERROR_QUIT) |
---|
3713 | nErrors++; |
---|
3714 | # if defined (MPI_ENABLED) |
---|
3715 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3716 | if (sumErrors > 0) |
---|
3717 | goto quitExit; |
---|
3718 | # else |
---|
3719 | if (nErrors > 0) |
---|
3720 | goto quitExit; |
---|
3721 | # endif |
---|
3722 | } |
---|
3723 | } while (c != EOF); |
---|
3724 | |
---|
3725 | MrBayesPrint ("%s Reached end of file\n", spacer); |
---|
3726 | |
---|
3727 | if (inComment == YES) |
---|
3728 | nErrors++; |
---|
3729 | |
---|
3730 | # if defined (MPI_ENABLED) |
---|
3731 | MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
---|
3732 | if (sumErrors > 0) |
---|
3733 | { |
---|
3734 | MrBayesPrint ("%s There was an error on at least one processor\n", spacer); |
---|
3735 | goto errorExit; |
---|
3736 | } |
---|
3737 | # else |
---|
3738 | if (nErrors > 0) |
---|
3739 | goto errorExit; |
---|
3740 | # endif |
---|
3741 | |
---|
3742 | if (s) |
---|
3743 | free (s); |
---|
3744 | SafeFclose (&fp); |
---|
3745 | numOpenExeFiles--; |
---|
3746 | |
---|
3747 | if (numOpenExeFiles > 0) |
---|
3748 | { |
---|
3749 | inMrbayesBlock = YES; |
---|
3750 | MrBayesPrint ("\n Returning execution to calling file ...\n\n"); |
---|
3751 | strcpy (spacer, " "); |
---|
3752 | } |
---|
3753 | else |
---|
3754 | strcpy (spacer, ""); |
---|
3755 | |
---|
3756 | commandPtr = oldCommandPtr; |
---|
3757 | |
---|
3758 | return (NO_ERROR); |
---|
3759 | |
---|
3760 | quitExit: |
---|
3761 | if (s) |
---|
3762 | free (s); |
---|
3763 | SafeFclose (&fp); |
---|
3764 | numOpenExeFiles--; |
---|
3765 | if (numOpenExeFiles > 0) |
---|
3766 | { |
---|
3767 | inMrbayesBlock = YES; |
---|
3768 | strcpy (spacer, " "); |
---|
3769 | } |
---|
3770 | else |
---|
3771 | strcpy (spacer, ""); |
---|
3772 | |
---|
3773 | commandPtr = oldCommandPtr; |
---|
3774 | |
---|
3775 | return (NO_ERROR_QUIT); |
---|
3776 | |
---|
3777 | errorExit: |
---|
3778 | if (inComment == YES) |
---|
3779 | { |
---|
3780 | MrBayesPrint ("%s ERROR: Reached end of file while in comment.\n", spacer); |
---|
3781 | inComment = NO; |
---|
3782 | numComments = 0; |
---|
3783 | } |
---|
3784 | if (fp) |
---|
3785 | { |
---|
3786 | MrBayesPrint ("%s The error occurred when reading char. %d on line %d\n", spacer, tokenP-cmdStr-strlen(token)+1, cmdLine); |
---|
3787 | MrBayesPrint ("%s in the file '%s'\n", spacer, exeFileName); |
---|
3788 | } |
---|
3789 | if (s) |
---|
3790 | free (s); |
---|
3791 | SafeFclose (&fp); |
---|
3792 | numOpenExeFiles--; /* we increase the value above even if no file is successfully opened */ |
---|
3793 | |
---|
3794 | /* make sure we exit the block we were reading from correctly */ |
---|
3795 | if (inMrbayesBlock == YES) |
---|
3796 | inMrbayesBlock = NO; |
---|
3797 | else if (inDataBlock == YES) |
---|
3798 | inDataBlock = NO; |
---|
3799 | else if (inTreesBlock == YES) |
---|
3800 | { |
---|
3801 | inTreesBlock = NO; |
---|
3802 | ResetTranslateTable(); |
---|
3803 | } |
---|
3804 | else if (inForeignBlock == YES) |
---|
3805 | inForeignBlock = NO; |
---|
3806 | |
---|
3807 | /* make sure correct return if we came from mrbayes block in another execute file */ |
---|
3808 | if (numOpenExeFiles > 0) |
---|
3809 | { |
---|
3810 | inMrbayesBlock = YES; |
---|
3811 | MrBayesPrint ("\n Returning execution to calling file ...\n\n"); |
---|
3812 | strcpy (spacer, " "); |
---|
3813 | commandPtr = oldCommandPtr; |
---|
3814 | return (ERROR); |
---|
3815 | } |
---|
3816 | else |
---|
3817 | strcpy (spacer, ""); |
---|
3818 | |
---|
3819 | commandPtr = oldCommandPtr; |
---|
3820 | |
---|
3821 | return (ERROR); |
---|
3822 | |
---|
3823 | } |
---|
3824 | |
---|
3825 | |
---|
3826 | |
---|
3827 | |
---|
3828 | |
---|
3829 | int DoExecuteParm (char *parmName, char *tkn) |
---|
3830 | |
---|
3831 | { |
---|
3832 | |
---|
3833 | if(strlen(tkn)>99) |
---|
3834 | { |
---|
3835 | MrBayesPrint ("%s Maximum allowed length of file name is 99 characters. The given name:\n", spacer); |
---|
3836 | MrBayesPrint ("%s '%s'\n", spacer,tkn); |
---|
3837 | MrBayesPrint ("%s has %d characters.\n", spacer,strlen(tkn)); |
---|
3838 | return (ERROR); |
---|
3839 | } |
---|
3840 | strcpy (inputFileName, tkn); |
---|
3841 | |
---|
3842 | expecting = Expecting (SEMICOLON); |
---|
3843 | |
---|
3844 | return (NO_ERROR); |
---|
3845 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
3846 | |
---|
3847 | } |
---|
3848 | |
---|
3849 | |
---|
3850 | |
---|
3851 | |
---|
3852 | |
---|
3853 | int DoExclude (void) |
---|
3854 | |
---|
3855 | { |
---|
3856 | |
---|
3857 | int i, alreadyDone; |
---|
3858 | |
---|
3859 | MrBayesPrint ("%s Excluding character(s)\n", spacer); |
---|
3860 | |
---|
3861 | /* add set to tempSet */ |
---|
3862 | if (fromI >= 0 && toJ < 0) |
---|
3863 | { |
---|
3864 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3865 | return (ERROR); |
---|
3866 | } |
---|
3867 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
3868 | { |
---|
3869 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3870 | return (ERROR); |
---|
3871 | } |
---|
3872 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
3873 | { |
---|
3874 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
3875 | return (ERROR); |
---|
3876 | } |
---|
3877 | |
---|
3878 | /* merge tempSet with charset */ |
---|
3879 | alreadyDone = NO; |
---|
3880 | for (i=0; i<numChar; i++) |
---|
3881 | { |
---|
3882 | if (tempSet[i] == 1) |
---|
3883 | { |
---|
3884 | if (charInfo[i].isExcluded == YES && alreadyDone == NO) |
---|
3885 | { |
---|
3886 | MrBayesPrint ("%s Some characters already excluded\n", spacer); |
---|
3887 | alreadyDone = YES; |
---|
3888 | } |
---|
3889 | charInfo[i].isExcluded = YES; |
---|
3890 | } |
---|
3891 | } |
---|
3892 | |
---|
3893 | foundFirst = NO; |
---|
3894 | |
---|
3895 | /* reset analysis to recompress data */ |
---|
3896 | SetUpAnalysis(&globalSeed); |
---|
3897 | |
---|
3898 | return (NO_ERROR); |
---|
3899 | |
---|
3900 | } |
---|
3901 | |
---|
3902 | |
---|
3903 | |
---|
3904 | |
---|
3905 | |
---|
3906 | int DoExcludeParm (char *parmName, char *tkn) |
---|
3907 | |
---|
3908 | { |
---|
3909 | |
---|
3910 | int i, index, tempInt; |
---|
3911 | |
---|
3912 | if (defMatrix == NO) |
---|
3913 | { |
---|
3914 | MrBayesPrint ("%s A matrix must be specified before you can exclude characters\n", spacer); |
---|
3915 | return (ERROR); |
---|
3916 | } |
---|
3917 | |
---|
3918 | if (foundFirst == NO) |
---|
3919 | { |
---|
3920 | /* this is the first time in */ |
---|
3921 | fromI = toJ = everyK = -1; |
---|
3922 | foundDash = foundSlash = NO; |
---|
3923 | for (i=0; i<numChar; i++) /* clear tempSet */ |
---|
3924 | tempSet[i] = 0; |
---|
3925 | foundFirst = YES; |
---|
3926 | } |
---|
3927 | |
---|
3928 | if (expecting == Expecting(ALPHA)) |
---|
3929 | { |
---|
3930 | if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH) |
---|
3931 | { |
---|
3932 | for (i=0; i<numChar; i++) |
---|
3933 | tempSet[i] = 1; |
---|
3934 | } |
---|
3935 | else if (IsSame ("Missambig", tkn) == SAME || IsSame ("Missambig", tkn) == CONSISTENT_WITH) |
---|
3936 | { |
---|
3937 | for (i=0; i<numChar; i++) |
---|
3938 | { |
---|
3939 | if (charInfo[i].isMissAmbig == YES) |
---|
3940 | tempSet[i] = 1; |
---|
3941 | } |
---|
3942 | } |
---|
3943 | else |
---|
3944 | { |
---|
3945 | /* we are using a pre-defined character set */ |
---|
3946 | if (numCharSets < 1) |
---|
3947 | { |
---|
3948 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
3949 | return (ERROR); |
---|
3950 | } |
---|
3951 | if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR) |
---|
3952 | { |
---|
3953 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
3954 | return (ERROR); |
---|
3955 | } |
---|
3956 | /* add characters from charset tkn to new tempSet */ |
---|
3957 | for (i=0; i<numChar; i++) |
---|
3958 | { |
---|
3959 | if (IsBitSet(i, charSet[index]) == YES) |
---|
3960 | tempSet[i] = 1; |
---|
3961 | } |
---|
3962 | fromI = toJ = everyK = -1; |
---|
3963 | } |
---|
3964 | |
---|
3965 | expecting = Expecting(ALPHA); |
---|
3966 | expecting |= Expecting(NUMBER); |
---|
3967 | expecting |= Expecting(SEMICOLON); |
---|
3968 | } |
---|
3969 | else if (expecting == Expecting(NUMBER)) |
---|
3970 | { |
---|
3971 | if (strlen(tkn) == 1 && tkn[0] == '.') |
---|
3972 | tempInt = numChar; |
---|
3973 | else |
---|
3974 | sscanf (tkn, "%d", &tempInt); |
---|
3975 | if (tempInt <= 0 || tempInt > numChar) |
---|
3976 | { |
---|
3977 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
3978 | return (ERROR); |
---|
3979 | } |
---|
3980 | tempInt--; |
---|
3981 | if (foundDash == YES) |
---|
3982 | { |
---|
3983 | if (fromI >= 0) |
---|
3984 | toJ = tempInt; |
---|
3985 | else |
---|
3986 | { |
---|
3987 | MrBayesPrint ("%s Improperly formatted exclude set\n", spacer); |
---|
3988 | return (ERROR); |
---|
3989 | } |
---|
3990 | foundDash = NO; |
---|
3991 | } |
---|
3992 | else if (foundSlash == YES) |
---|
3993 | { |
---|
3994 | tempInt++; |
---|
3995 | if (tempInt <= 1) |
---|
3996 | { |
---|
3997 | MrBayesPrint ("%s Improperly formatted exclude set\n", spacer); |
---|
3998 | return (ERROR); |
---|
3999 | } |
---|
4000 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
4001 | everyK = tempInt; |
---|
4002 | else |
---|
4003 | { |
---|
4004 | MrBayesPrint ("%s Improperly formatted exclude set\n", spacer); |
---|
4005 | return (ERROR); |
---|
4006 | } |
---|
4007 | foundSlash = NO; |
---|
4008 | } |
---|
4009 | else |
---|
4010 | { |
---|
4011 | if (fromI >= 0 && toJ < 0) |
---|
4012 | { |
---|
4013 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4014 | return (ERROR); |
---|
4015 | fromI = tempInt; |
---|
4016 | } |
---|
4017 | else if (fromI < 0 && toJ < 0) |
---|
4018 | { |
---|
4019 | fromI = tempInt; |
---|
4020 | } |
---|
4021 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
4022 | { |
---|
4023 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4024 | return (ERROR); |
---|
4025 | fromI = tempInt; |
---|
4026 | toJ = everyK = -1; |
---|
4027 | } |
---|
4028 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
4029 | { |
---|
4030 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4031 | return (ERROR); |
---|
4032 | fromI = tempInt; |
---|
4033 | toJ = everyK = -1; |
---|
4034 | } |
---|
4035 | else |
---|
4036 | { |
---|
4037 | MrBayesPrint ("%s Improperly formatted exclude set\n", spacer); |
---|
4038 | { |
---|
4039 | return (ERROR); |
---|
4040 | } |
---|
4041 | } |
---|
4042 | } |
---|
4043 | expecting = Expecting(ALPHA); |
---|
4044 | expecting |= Expecting(NUMBER); |
---|
4045 | expecting |= Expecting(SEMICOLON); |
---|
4046 | expecting |= Expecting(DASH); |
---|
4047 | expecting |= Expecting(BACKSLASH); |
---|
4048 | } |
---|
4049 | else if (expecting == Expecting(DASH)) |
---|
4050 | { |
---|
4051 | foundDash = YES; |
---|
4052 | expecting = Expecting(NUMBER); |
---|
4053 | } |
---|
4054 | else if (expecting == Expecting(BACKSLASH)) |
---|
4055 | { |
---|
4056 | foundSlash = YES; |
---|
4057 | expecting = Expecting(NUMBER); |
---|
4058 | } |
---|
4059 | else |
---|
4060 | return (ERROR); |
---|
4061 | |
---|
4062 | return (NO_ERROR); |
---|
4063 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
4064 | |
---|
4065 | } |
---|
4066 | |
---|
4067 | |
---|
4068 | |
---|
4069 | |
---|
4070 | |
---|
4071 | int DoFormat (void) |
---|
4072 | |
---|
4073 | { |
---|
4074 | |
---|
4075 | if (inDataBlock == NO && inCharactersBlock == NO) |
---|
4076 | { |
---|
4077 | MrBayesPrint ("%s Formats can only be defined in a data or characters block\n", spacer); |
---|
4078 | return (ERROR); |
---|
4079 | } |
---|
4080 | |
---|
4081 | return CheckInitialPartitions(); |
---|
4082 | } |
---|
4083 | |
---|
4084 | |
---|
4085 | |
---|
4086 | |
---|
4087 | |
---|
4088 | int DoFormatParm (char *parmName, char *tkn) |
---|
4089 | |
---|
4090 | { |
---|
4091 | |
---|
4092 | int i, tempInt; |
---|
4093 | char tempStr[100]; |
---|
4094 | static int foundQuote; |
---|
4095 | |
---|
4096 | if (inDataBlock == NO && inCharactersBlock == NO) |
---|
4097 | { |
---|
4098 | MrBayesPrint ("%s Formats can only be defined in a data or characters block\n", spacer); |
---|
4099 | return (ERROR); |
---|
4100 | } |
---|
4101 | if (defTaxa == NO || defChars == NO) |
---|
4102 | { |
---|
4103 | MrBayesPrint ("%s The dimensions of the matrix must be defined before the format\n", spacer); |
---|
4104 | return (ERROR); |
---|
4105 | } |
---|
4106 | |
---|
4107 | if (expecting == Expecting(PARAMETER)) |
---|
4108 | { |
---|
4109 | expecting = Expecting(EQUALSIGN); |
---|
4110 | if (!strcmp(parmName, "Interleave")) |
---|
4111 | { |
---|
4112 | expecting = Expecting(EQUALSIGN) | Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4113 | isInterleaved = YES; |
---|
4114 | } |
---|
4115 | } |
---|
4116 | else |
---|
4117 | { |
---|
4118 | /* set Datatype (dataType) ************************************************************/ |
---|
4119 | if (!strcmp(parmName, "Datatype")) |
---|
4120 | { |
---|
4121 | if (expecting == Expecting(EQUALSIGN)) |
---|
4122 | expecting = Expecting(ALPHA); |
---|
4123 | else if (expecting == Expecting(ALPHA)) |
---|
4124 | { |
---|
4125 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
4126 | { |
---|
4127 | if (isMixed == NO) |
---|
4128 | { |
---|
4129 | if (!strcmp(tempStr, "Dna")) |
---|
4130 | dataType = DNA; |
---|
4131 | else if (!strcmp(tempStr, "Rna")) |
---|
4132 | dataType = RNA; |
---|
4133 | else if (!strcmp(tempStr, "Protein")) |
---|
4134 | dataType = PROTEIN; |
---|
4135 | else if (!strcmp(tempStr, "Restriction")) |
---|
4136 | dataType = RESTRICTION; |
---|
4137 | else if (!strcmp(tempStr, "Standard")) |
---|
4138 | dataType = STANDARD; |
---|
4139 | else if (!strcmp(tempStr, "Continuous")) |
---|
4140 | dataType = CONTINUOUS; |
---|
4141 | else if (!strcmp(tempStr, "Mixed")) |
---|
4142 | { |
---|
4143 | dataType = MIXED; |
---|
4144 | isMixed = YES; |
---|
4145 | for (i=0; i<numChar; i++) |
---|
4146 | tempSet[i] = 0; |
---|
4147 | fromI = toJ = everyK = -1; |
---|
4148 | foundDash = foundSlash = NO; |
---|
4149 | numDivisions = 0; |
---|
4150 | MrBayesPrint ("%s Data is Mixed\n", spacer); |
---|
4151 | } |
---|
4152 | if (dataType == MIXED) |
---|
4153 | expecting = Expecting(LEFTPAR); |
---|
4154 | else |
---|
4155 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4156 | } |
---|
4157 | else |
---|
4158 | { |
---|
4159 | if (!strcmp(tempStr, "Dna")) |
---|
4160 | dataType = DNA; |
---|
4161 | else if (!strcmp(tempStr, "Rna")) |
---|
4162 | dataType = RNA; |
---|
4163 | else if (!strcmp(tempStr, "Protein")) |
---|
4164 | dataType = PROTEIN; |
---|
4165 | else if (!strcmp(tempStr, "Restriction")) |
---|
4166 | dataType = RESTRICTION; |
---|
4167 | else if (!strcmp(tempStr, "Standard")) |
---|
4168 | dataType = STANDARD; |
---|
4169 | else if (!strcmp(tempStr, "Continuous")) |
---|
4170 | dataType = CONTINUOUS; |
---|
4171 | else if (!strcmp(tempStr, "Mixed")) |
---|
4172 | { |
---|
4173 | MrBayesPrint ("%s Cannot have mixed datatype within a mixed datatype\n", spacer); |
---|
4174 | return (ERROR); |
---|
4175 | } |
---|
4176 | expecting = Expecting(COLON); |
---|
4177 | for (i=0; i<numChar; i++) |
---|
4178 | tempSet[i] = 0; |
---|
4179 | fromI = toJ = everyK = -1; |
---|
4180 | foundDash = foundSlash = NO; |
---|
4181 | } |
---|
4182 | if (isMixed == NO) |
---|
4183 | { |
---|
4184 | numDivisions = 1; |
---|
4185 | for (i=0; i<numChar; i++) |
---|
4186 | { |
---|
4187 | charInfo[i].charType = dataType; |
---|
4188 | partitionId[i][0] = numDivisions; |
---|
4189 | } |
---|
4190 | } |
---|
4191 | } |
---|
4192 | else |
---|
4193 | { |
---|
4194 | MrBayesPrint ("%s Invalid data type argument\n", spacer); |
---|
4195 | return (ERROR); |
---|
4196 | } |
---|
4197 | if (isMixed == NO) |
---|
4198 | MrBayesPrint ("%s Data is %s\n", spacer, tempStr); |
---|
4199 | else if (strcmp(tempStr, "Mixed")) |
---|
4200 | MrBayesPrint ("%s Data for partition %d is %s\n", spacer, numDivisions+1, tempStr); |
---|
4201 | } |
---|
4202 | else if (expecting == Expecting(LEFTPAR)) |
---|
4203 | { |
---|
4204 | expecting = Expecting(ALPHA); |
---|
4205 | } |
---|
4206 | else if (expecting == Expecting(COLON)) |
---|
4207 | { |
---|
4208 | expecting = Expecting(NUMBER); |
---|
4209 | } |
---|
4210 | else if (expecting == Expecting(NUMBER)) |
---|
4211 | { |
---|
4212 | if (strlen(tkn) == 1 && tkn[0] == '.') |
---|
4213 | tempInt = numChar; |
---|
4214 | else |
---|
4215 | sscanf (tkn, "%d", &tempInt); |
---|
4216 | if (tempInt <= 0 || tempInt > numChar) |
---|
4217 | { |
---|
4218 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
4219 | return (ERROR); |
---|
4220 | } |
---|
4221 | tempInt--; |
---|
4222 | if (foundDash == YES) |
---|
4223 | { |
---|
4224 | if (fromI >= 0) |
---|
4225 | toJ = tempInt; |
---|
4226 | else |
---|
4227 | { |
---|
4228 | MrBayesPrint ("%s Improperly formatted partition\n", spacer); |
---|
4229 | return (ERROR); |
---|
4230 | } |
---|
4231 | foundDash = NO; |
---|
4232 | } |
---|
4233 | else if (foundSlash == YES) |
---|
4234 | { |
---|
4235 | tempInt++; |
---|
4236 | if (tempInt <= 1) |
---|
4237 | { |
---|
4238 | MrBayesPrint ("%s Improperly formatted partition\n", spacer); |
---|
4239 | return (ERROR); |
---|
4240 | } |
---|
4241 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
4242 | everyK = tempInt; |
---|
4243 | else |
---|
4244 | { |
---|
4245 | MrBayesPrint ("%s Improperly formatted partition\n", spacer); |
---|
4246 | return (ERROR); |
---|
4247 | } |
---|
4248 | foundSlash = NO; |
---|
4249 | } |
---|
4250 | else |
---|
4251 | { |
---|
4252 | if (fromI >= 0 && toJ < 0) |
---|
4253 | { |
---|
4254 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4255 | return (ERROR); |
---|
4256 | fromI = tempInt; |
---|
4257 | } |
---|
4258 | else if (fromI < 0 && toJ < 0) |
---|
4259 | { |
---|
4260 | fromI = tempInt; |
---|
4261 | } |
---|
4262 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
4263 | { |
---|
4264 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4265 | return (ERROR); |
---|
4266 | fromI = tempInt; |
---|
4267 | toJ = everyK = -1; |
---|
4268 | } |
---|
4269 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
4270 | { |
---|
4271 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4272 | return (ERROR); |
---|
4273 | fromI = tempInt; |
---|
4274 | toJ = everyK = -1; |
---|
4275 | } |
---|
4276 | else |
---|
4277 | { |
---|
4278 | MrBayesPrint ("%s Improperly formatted partition\n", spacer); |
---|
4279 | { |
---|
4280 | return (ERROR); |
---|
4281 | } |
---|
4282 | } |
---|
4283 | |
---|
4284 | } |
---|
4285 | expecting = Expecting(NUMBER); |
---|
4286 | expecting |= Expecting(DASH); |
---|
4287 | expecting |= Expecting(BACKSLASH); |
---|
4288 | expecting |= Expecting(COMMA); |
---|
4289 | expecting |= Expecting(RIGHTPAR); |
---|
4290 | } |
---|
4291 | else if (expecting == Expecting(DASH)) |
---|
4292 | { |
---|
4293 | foundDash = YES; |
---|
4294 | expecting = Expecting(NUMBER); |
---|
4295 | } |
---|
4296 | else if (expecting == Expecting(BACKSLASH)) |
---|
4297 | { |
---|
4298 | foundSlash = YES; |
---|
4299 | expecting = Expecting(NUMBER); |
---|
4300 | } |
---|
4301 | else if (expecting == Expecting(COMMA)) |
---|
4302 | { |
---|
4303 | /* add set to tempSet */ |
---|
4304 | if (fromI >= 0 && toJ < 0) |
---|
4305 | { |
---|
4306 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4307 | return (ERROR); |
---|
4308 | } |
---|
4309 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
4310 | { |
---|
4311 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4312 | return (ERROR); |
---|
4313 | } |
---|
4314 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
4315 | { |
---|
4316 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4317 | return (ERROR); |
---|
4318 | } |
---|
4319 | for (i=0; i<numChar; i++) |
---|
4320 | { |
---|
4321 | if (tempSet[i] == numDivisions) |
---|
4322 | charInfo[i].charType = dataType; |
---|
4323 | } |
---|
4324 | |
---|
4325 | /* merge tempSet */ |
---|
4326 | for (i=0; i<numChar; i++) |
---|
4327 | { |
---|
4328 | if (tempSet[i] != 0) |
---|
4329 | { |
---|
4330 | if (partitionId[i][0] == 0) |
---|
4331 | { |
---|
4332 | charInfo[i].charType = dataType; |
---|
4333 | partitionId[i][0] = numDivisions + 1; |
---|
4334 | } |
---|
4335 | else |
---|
4336 | { |
---|
4337 | MrBayesPrint ("%s Improperly formatted partition (same character found in multiple partitions)\n", spacer); |
---|
4338 | return (ERROR); |
---|
4339 | } |
---|
4340 | } |
---|
4341 | } |
---|
4342 | |
---|
4343 | /* increment number of partitions */ |
---|
4344 | numDivisions++; |
---|
4345 | expecting = Expecting(ALPHA); |
---|
4346 | } |
---|
4347 | else if (expecting == Expecting(RIGHTPAR)) |
---|
4348 | { |
---|
4349 | /* add set to tempSet */ |
---|
4350 | if (fromI >= 0 && toJ < 0) |
---|
4351 | { |
---|
4352 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4353 | return (ERROR); |
---|
4354 | } |
---|
4355 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
4356 | { |
---|
4357 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4358 | return (ERROR); |
---|
4359 | } |
---|
4360 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
4361 | { |
---|
4362 | if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR) |
---|
4363 | return (ERROR); |
---|
4364 | } |
---|
4365 | |
---|
4366 | /* merge tempSet */ |
---|
4367 | for (i=0; i<numChar; i++) |
---|
4368 | { |
---|
4369 | if (tempSet[i] != 0) |
---|
4370 | { |
---|
4371 | if (partitionId[i][0] == 0) |
---|
4372 | { |
---|
4373 | charInfo[i].charType = dataType; |
---|
4374 | partitionId[i][0] = numDivisions + 1; |
---|
4375 | } |
---|
4376 | else |
---|
4377 | { |
---|
4378 | MrBayesPrint ("%s Improperly formatted partition (same character found in multiple partitions)\n", spacer); |
---|
4379 | return (ERROR); |
---|
4380 | } |
---|
4381 | } |
---|
4382 | } |
---|
4383 | |
---|
4384 | /* increment number of partitions */ |
---|
4385 | numDivisions++; |
---|
4386 | if (isMixed == YES) |
---|
4387 | dataType = MIXED; |
---|
4388 | |
---|
4389 | if (numDivisions > 1) |
---|
4390 | MrBayesPrint ("%s There are a total of %d default data divisions\n", spacer, numDivisions); |
---|
4391 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4392 | } |
---|
4393 | else |
---|
4394 | return (ERROR); |
---|
4395 | } |
---|
4396 | /* set Interleave (isInterleaved) *****************************************************/ |
---|
4397 | else if (!strcmp(parmName, "Interleave")) |
---|
4398 | { |
---|
4399 | if (expecting == Expecting(EQUALSIGN)) |
---|
4400 | expecting = Expecting(ALPHA); |
---|
4401 | else if (expecting == Expecting(ALPHA)) |
---|
4402 | { |
---|
4403 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
4404 | { |
---|
4405 | if (!strcmp(tempStr, "Yes")) |
---|
4406 | isInterleaved = YES; |
---|
4407 | else |
---|
4408 | isInterleaved = NO; |
---|
4409 | } |
---|
4410 | else |
---|
4411 | { |
---|
4412 | MrBayesPrint ("%s Invalid argument for interleaved data\n", spacer); |
---|
4413 | return (ERROR); |
---|
4414 | } |
---|
4415 | if (isInterleaved == YES) |
---|
4416 | MrBayesPrint ("%s Data matrix is interleaved\n", spacer); |
---|
4417 | else |
---|
4418 | MrBayesPrint ("%s Data matrix is not interleaved\n", spacer); |
---|
4419 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4420 | } |
---|
4421 | else |
---|
4422 | return (ERROR); |
---|
4423 | } |
---|
4424 | /* set Gap (gapId) ********************************************************************/ |
---|
4425 | else if (!strcmp(parmName, "Gap")) |
---|
4426 | { |
---|
4427 | if (expecting == Expecting(EQUALSIGN)) |
---|
4428 | { |
---|
4429 | expecting = Expecting(ALPHA); |
---|
4430 | expecting |= Expecting(QUESTIONMARK); |
---|
4431 | expecting |= Expecting(DASH); |
---|
4432 | expecting |= Expecting(NUMBER); |
---|
4433 | expecting |= Expecting(ASTERISK); |
---|
4434 | expecting |= Expecting(EXCLAMATIONMARK); |
---|
4435 | expecting |= Expecting(PERCENT); |
---|
4436 | expecting |= Expecting(WEIRD); |
---|
4437 | } |
---|
4438 | else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) || |
---|
4439 | ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) || |
---|
4440 | ((expecting & Expecting(DASH)) == Expecting(DASH)) || |
---|
4441 | ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) || |
---|
4442 | ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) || |
---|
4443 | ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) || |
---|
4444 | ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) || |
---|
4445 | ((expecting & Expecting(WEIRD)) == Expecting(WEIRD))) |
---|
4446 | { |
---|
4447 | if (strlen(tkn) == 1) |
---|
4448 | { |
---|
4449 | if (tkn[0] == matchId || tkn[0] == missingId) |
---|
4450 | { |
---|
4451 | MrBayesPrint ("%s Gap character matches matching or missing characters\n", spacer); |
---|
4452 | return (ERROR); |
---|
4453 | } |
---|
4454 | gapId = tkn[0]; |
---|
4455 | } |
---|
4456 | else |
---|
4457 | { |
---|
4458 | MrBayesPrint ("%s Invalid gap argument %s\n", spacer, tkn); |
---|
4459 | return (ERROR); |
---|
4460 | } |
---|
4461 | MrBayesPrint ("%s Gaps coded as %s\n", spacer, tkn); |
---|
4462 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4463 | } |
---|
4464 | else |
---|
4465 | return (ERROR); |
---|
4466 | } |
---|
4467 | /* set Missing (missingId) ************************************************************/ |
---|
4468 | else if (!strcmp(parmName, "Missing")) |
---|
4469 | { |
---|
4470 | if (expecting == Expecting(EQUALSIGN)) |
---|
4471 | { |
---|
4472 | expecting = Expecting(ALPHA); |
---|
4473 | expecting |= Expecting(QUESTIONMARK); |
---|
4474 | expecting |= Expecting(DASH); |
---|
4475 | expecting |= Expecting(NUMBER); |
---|
4476 | expecting |= Expecting(ASTERISK); |
---|
4477 | expecting |= Expecting(EXCLAMATIONMARK); |
---|
4478 | expecting |= Expecting(PERCENT); |
---|
4479 | expecting |= Expecting(WEIRD); |
---|
4480 | } |
---|
4481 | else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) || |
---|
4482 | ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) || |
---|
4483 | ((expecting & Expecting(DASH)) == Expecting(DASH)) || |
---|
4484 | ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) || |
---|
4485 | ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) || |
---|
4486 | ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) || |
---|
4487 | ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) || |
---|
4488 | ((expecting & Expecting(WEIRD)) == Expecting(WEIRD))) |
---|
4489 | { |
---|
4490 | if (strlen(tkn) == 1) |
---|
4491 | { |
---|
4492 | if (tkn[0] == gapId || tkn[0] == matchId) |
---|
4493 | { |
---|
4494 | MrBayesPrint ("%s Missing character matches matching or gap characters\n", spacer); |
---|
4495 | return (ERROR); |
---|
4496 | } |
---|
4497 | missingId = tkn[0]; |
---|
4498 | } |
---|
4499 | else |
---|
4500 | { |
---|
4501 | MrBayesPrint ("%s Invalid missing argument %s\n", spacer, tkn); |
---|
4502 | return (ERROR); |
---|
4503 | } |
---|
4504 | MrBayesPrint ("%s Missing data coded as %s\n", spacer, tkn); |
---|
4505 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4506 | } |
---|
4507 | else |
---|
4508 | return (ERROR); |
---|
4509 | } |
---|
4510 | /* set Matchchar (matchId) ************************************************************/ |
---|
4511 | else if (!strcmp(parmName, "Matchchar")) |
---|
4512 | { |
---|
4513 | if (expecting == Expecting(EQUALSIGN)) |
---|
4514 | { |
---|
4515 | expecting = Expecting(ALPHA); |
---|
4516 | expecting |= Expecting(QUESTIONMARK); |
---|
4517 | expecting |= Expecting(DASH); |
---|
4518 | expecting |= Expecting(NUMBER); |
---|
4519 | expecting |= Expecting(ASTERISK); |
---|
4520 | expecting |= Expecting(EXCLAMATIONMARK); |
---|
4521 | expecting |= Expecting(PERCENT); |
---|
4522 | expecting |= Expecting(WEIRD); |
---|
4523 | } |
---|
4524 | else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) || |
---|
4525 | ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) || |
---|
4526 | ((expecting & Expecting(DASH)) == Expecting(DASH)) || |
---|
4527 | ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) || |
---|
4528 | ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) || |
---|
4529 | ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) || |
---|
4530 | ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) || |
---|
4531 | ((expecting & Expecting(WEIRD)) == Expecting(WEIRD))) |
---|
4532 | { |
---|
4533 | if (strlen(tkn) == 1) |
---|
4534 | { |
---|
4535 | if (tkn[0] == gapId || tkn[0] == missingId) |
---|
4536 | { |
---|
4537 | MrBayesPrint ("%s Matching character matches gap or missing characters\n", spacer); |
---|
4538 | return (ERROR); |
---|
4539 | } |
---|
4540 | matchId = tkn[0]; |
---|
4541 | } |
---|
4542 | else |
---|
4543 | { |
---|
4544 | MrBayesPrint ("%s Invalid matchchar argument %s\n", spacer, tkn); |
---|
4545 | return (ERROR); |
---|
4546 | } |
---|
4547 | MrBayesPrint ("%s Matching characters coded as %s\n", spacer, tkn); |
---|
4548 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4549 | } |
---|
4550 | else |
---|
4551 | return (ERROR); |
---|
4552 | } |
---|
4553 | /* skip Symbols ***************************************************************/ |
---|
4554 | else if (!strcmp(parmName, "Symbols")) |
---|
4555 | { |
---|
4556 | if (expecting == Expecting(EQUALSIGN)) |
---|
4557 | { |
---|
4558 | MrBayesPrint ("%s Warning: MrBayes does not support 'symbols' specifications; default symbols assumed\n", spacer); |
---|
4559 | expecting = Expecting(QUOTATIONMARK); |
---|
4560 | foundQuote = NO; |
---|
4561 | } |
---|
4562 | else if (expecting == Expecting(QUOTATIONMARK)) |
---|
4563 | { |
---|
4564 | if (foundQuote == NO) |
---|
4565 | { |
---|
4566 | foundQuote = YES; |
---|
4567 | expecting = Expecting(ALPHA); |
---|
4568 | } |
---|
4569 | else /* if (foundQuote == YES) */ |
---|
4570 | { |
---|
4571 | foundQuote = NO; |
---|
4572 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4573 | } |
---|
4574 | } |
---|
4575 | else if (expecting == Expecting(ALPHA)) |
---|
4576 | { |
---|
4577 | expecting = Expecting(ALPHA) | Expecting(COMMA); |
---|
4578 | } |
---|
4579 | else |
---|
4580 | return (ERROR); |
---|
4581 | } |
---|
4582 | /* on Equate return ERROR ***************************************************************/ |
---|
4583 | else if (!strcmp(parmName, "Equate")) |
---|
4584 | { |
---|
4585 | MrBayesPrint ("%s Error: MrBayes does not support 'Equate' macros; please remove or comment out\n", spacer); |
---|
4586 | return (ERROR); |
---|
4587 | } |
---|
4588 | else |
---|
4589 | return (ERROR); |
---|
4590 | } |
---|
4591 | |
---|
4592 | return (NO_ERROR); |
---|
4593 | |
---|
4594 | } |
---|
4595 | |
---|
4596 | |
---|
4597 | |
---|
4598 | |
---|
4599 | |
---|
4600 | int DoHelp (void) |
---|
4601 | |
---|
4602 | { |
---|
4603 | |
---|
4604 | int i, j, longestDescription; |
---|
4605 | CmdType *p; |
---|
4606 | |
---|
4607 | if (foundFirst == NO) |
---|
4608 | { |
---|
4609 | longestDescription = 0; |
---|
4610 | for (i=1; i<NUMCOMMANDS; i++) |
---|
4611 | { |
---|
4612 | p = commands + i; |
---|
4613 | if ((int)strlen(p->string) > longestDescription) |
---|
4614 | longestDescription = (int) strlen(p->string); |
---|
4615 | } |
---|
4616 | |
---|
4617 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
4618 | MrBayesPrint (" Commands that are available from the command \n"); |
---|
4619 | MrBayesPrint (" line or from a MrBayes block include: \n"); |
---|
4620 | MrBayesPrint (" \n"); |
---|
4621 | for (i=1; i<NUMCOMMANDS; i++) |
---|
4622 | { |
---|
4623 | p = commands + i; |
---|
4624 | if (p->cmdUse == IN_CMD && p->hiding == SHOW) |
---|
4625 | { |
---|
4626 | MrBayesPrint (" %s", p->string); |
---|
4627 | for (j=0; j<longestDescription - (int) strlen(p->string); j++) |
---|
4628 | MrBayesPrint (" "); |
---|
4629 | MrBayesPrint (" -- %s\n", p->cmdDescription); |
---|
4630 | } |
---|
4631 | } |
---|
4632 | MrBayesPrint (" \n"); |
---|
4633 | MrBayesPrint (" Commands that should be in a NEXUS file (data \n"); |
---|
4634 | MrBayesPrint (" block, trees block or taxa block) include: \n"); |
---|
4635 | MrBayesPrint (" \n"); |
---|
4636 | for (i=1; i<NUMCOMMANDS; i++) |
---|
4637 | { |
---|
4638 | p = commands + i; |
---|
4639 | if (p->cmdUse == IN_FILE && p->hiding == SHOW) |
---|
4640 | { |
---|
4641 | MrBayesPrint (" %s", p->string); |
---|
4642 | for (j=0; j<longestDescription - (int) strlen(p->string); j++) |
---|
4643 | MrBayesPrint (" "); |
---|
4644 | MrBayesPrint (" -- %s\n", p->cmdDescription); |
---|
4645 | } |
---|
4646 | } |
---|
4647 | MrBayesPrint (" \n"); |
---|
4648 | MrBayesPrint (" Note that this program supports the use of the shortest unambiguous \n"); |
---|
4649 | MrBayesPrint (" spelling of the above commands (e.g., \"exe\" instead of \"execute\"). \n"); |
---|
4650 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
4651 | } |
---|
4652 | foundFirst = NO; |
---|
4653 | |
---|
4654 | return (NO_ERROR); |
---|
4655 | |
---|
4656 | } |
---|
4657 | |
---|
4658 | |
---|
4659 | |
---|
4660 | |
---|
4661 | |
---|
4662 | int DoHelpParm (char *parmName, char *tkn) |
---|
4663 | |
---|
4664 | { |
---|
4665 | |
---|
4666 | int i, j, tkLen, targetLen, numDiff, numMatches; |
---|
4667 | CmdType *p, *q=NULL; |
---|
4668 | |
---|
4669 | if (expecting == Expecting(ALPHA)) |
---|
4670 | { |
---|
4671 | p = commands + 0; |
---|
4672 | tkLen = (int) strlen(tkn); |
---|
4673 | numMatches = 0; |
---|
4674 | for (i=0; i<NUMCOMMANDS; i++) |
---|
4675 | { |
---|
4676 | targetLen = (int) strlen(p->string); |
---|
4677 | if (tkLen <= targetLen) |
---|
4678 | { |
---|
4679 | for (j=0, numDiff=0; j<tkLen; j++) |
---|
4680 | { |
---|
4681 | if (ChangeCase(tkn[j]) != ChangeCase(p->string[j])) |
---|
4682 | numDiff++; |
---|
4683 | } |
---|
4684 | if (numDiff == 0) |
---|
4685 | { |
---|
4686 | numMatches++; |
---|
4687 | q = p; |
---|
4688 | if (tkLen == targetLen) |
---|
4689 | break; |
---|
4690 | } |
---|
4691 | } |
---|
4692 | p++; |
---|
4693 | } |
---|
4694 | if (numMatches == 0) |
---|
4695 | { |
---|
4696 | MrBayesPrint ("%s Could not find command \"%s\"\n", spacer, tkn); |
---|
4697 | return (ERROR); |
---|
4698 | } |
---|
4699 | else if (numMatches == 1) |
---|
4700 | { |
---|
4701 | if (GetUserHelp (q->string) == ERROR) |
---|
4702 | { |
---|
4703 | MrBayesPrint ("%s Problem getting help for command \"%s\"\n", spacer, q->string); |
---|
4704 | } |
---|
4705 | } |
---|
4706 | else |
---|
4707 | { |
---|
4708 | MrBayesPrint ("%s Ambiguous command \"%s\"\n", spacer, tkn); |
---|
4709 | return (ERROR); |
---|
4710 | } |
---|
4711 | |
---|
4712 | expecting = Expecting(SEMICOLON); |
---|
4713 | foundFirst = YES; |
---|
4714 | } |
---|
4715 | else |
---|
4716 | return (ERROR); |
---|
4717 | |
---|
4718 | return (NO_ERROR); |
---|
4719 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
4720 | |
---|
4721 | } |
---|
4722 | |
---|
4723 | |
---|
4724 | |
---|
4725 | |
---|
4726 | |
---|
4727 | int DoInclude (void) |
---|
4728 | |
---|
4729 | { |
---|
4730 | |
---|
4731 | int i, alreadyDone; |
---|
4732 | |
---|
4733 | MrBayesPrint ("%s Including character(s)\n", spacer); |
---|
4734 | |
---|
4735 | /* add set to tempSet */ |
---|
4736 | if (fromI >= 0 && toJ < 0) |
---|
4737 | { |
---|
4738 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4739 | return (ERROR); |
---|
4740 | } |
---|
4741 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
4742 | { |
---|
4743 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4744 | return (ERROR); |
---|
4745 | } |
---|
4746 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
4747 | { |
---|
4748 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4749 | return (ERROR); |
---|
4750 | } |
---|
4751 | |
---|
4752 | /* merge tempSet with excludedChars */ |
---|
4753 | alreadyDone = NO; |
---|
4754 | for (i=0; i<numChar; i++) |
---|
4755 | { |
---|
4756 | if (tempSet[i] == 1) |
---|
4757 | { |
---|
4758 | if (charInfo[i].isExcluded == NO && alreadyDone == NO) |
---|
4759 | { |
---|
4760 | MrBayesPrint ("%s Some characters already included\n", spacer); |
---|
4761 | alreadyDone = YES; |
---|
4762 | } |
---|
4763 | charInfo[i].isExcluded = NO; |
---|
4764 | } |
---|
4765 | } |
---|
4766 | |
---|
4767 | return (NO_ERROR); |
---|
4768 | |
---|
4769 | } |
---|
4770 | |
---|
4771 | |
---|
4772 | |
---|
4773 | |
---|
4774 | |
---|
4775 | int DoIncludeParm (char *parmName, char *tkn) |
---|
4776 | |
---|
4777 | { |
---|
4778 | |
---|
4779 | int i, index, tempInt; |
---|
4780 | |
---|
4781 | if (defMatrix == NO) |
---|
4782 | { |
---|
4783 | MrBayesPrint ("%s A matrix must be specified before you can include characters\n", spacer); |
---|
4784 | return (ERROR); |
---|
4785 | } |
---|
4786 | |
---|
4787 | if (foundFirst == NO) |
---|
4788 | { |
---|
4789 | /* this is the first time in */ |
---|
4790 | fromI = toJ = everyK = -1; |
---|
4791 | foundDash = foundSlash = NO; |
---|
4792 | for (i=0; i<numChar; i++) /* clear tempSet */ |
---|
4793 | tempSet[i] = 0; |
---|
4794 | foundFirst = YES; |
---|
4795 | } |
---|
4796 | |
---|
4797 | if (expecting == Expecting(ALPHA)) |
---|
4798 | { |
---|
4799 | if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH) |
---|
4800 | { |
---|
4801 | for (i=0; i<numChar; i++) |
---|
4802 | tempSet[i] = 1; |
---|
4803 | } |
---|
4804 | else if (IsSame ("Missambig", tkn) == SAME || IsSame ("Missambig", tkn) == CONSISTENT_WITH) |
---|
4805 | { |
---|
4806 | for (i=0; i<numChar; i++) |
---|
4807 | { |
---|
4808 | if (charInfo[i].isMissAmbig == YES) |
---|
4809 | tempSet[i] = 1; |
---|
4810 | } |
---|
4811 | } |
---|
4812 | else |
---|
4813 | { |
---|
4814 | /* we are using a pre-defined character set */ |
---|
4815 | if (numCharSets < 1) |
---|
4816 | { |
---|
4817 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
4818 | return (ERROR); |
---|
4819 | } |
---|
4820 | if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR) |
---|
4821 | { |
---|
4822 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
4823 | return (ERROR); |
---|
4824 | } |
---|
4825 | /* add characters from charset tkn to new tempSet */ |
---|
4826 | for (i=0; i<numChar; i++) |
---|
4827 | { |
---|
4828 | if (IsBitSet(i, charSet[index]) == YES) |
---|
4829 | tempSet[i] = 1; |
---|
4830 | } |
---|
4831 | fromI = toJ = everyK = -1; |
---|
4832 | } |
---|
4833 | |
---|
4834 | expecting = Expecting(ALPHA); |
---|
4835 | expecting |= Expecting(NUMBER); |
---|
4836 | expecting |= Expecting(SEMICOLON); |
---|
4837 | } |
---|
4838 | else if (expecting == Expecting(NUMBER)) |
---|
4839 | { |
---|
4840 | if (strlen(tkn) == 1 && tkn[0] == '.') |
---|
4841 | tempInt = numChar; |
---|
4842 | else |
---|
4843 | sscanf (tkn, "%d", &tempInt); |
---|
4844 | if (tempInt <= 0 || tempInt > numChar) |
---|
4845 | { |
---|
4846 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
4847 | return (ERROR); |
---|
4848 | } |
---|
4849 | tempInt--; |
---|
4850 | if (foundDash == YES) |
---|
4851 | { |
---|
4852 | if (fromI >= 0) |
---|
4853 | toJ = tempInt; |
---|
4854 | else |
---|
4855 | { |
---|
4856 | MrBayesPrint ("%s Improperly formatted include set\n", spacer); |
---|
4857 | return (ERROR); |
---|
4858 | } |
---|
4859 | foundDash = NO; |
---|
4860 | } |
---|
4861 | else if (foundSlash == YES) |
---|
4862 | { |
---|
4863 | tempInt++; |
---|
4864 | if (tempInt <= 1) |
---|
4865 | { |
---|
4866 | MrBayesPrint ("%s Improperly formatted include set\n", spacer); |
---|
4867 | return (ERROR); |
---|
4868 | } |
---|
4869 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
4870 | everyK = tempInt; |
---|
4871 | else |
---|
4872 | { |
---|
4873 | MrBayesPrint ("%s Improperly formatted include set\n", spacer); |
---|
4874 | return (ERROR); |
---|
4875 | } |
---|
4876 | foundSlash = NO; |
---|
4877 | } |
---|
4878 | else |
---|
4879 | { |
---|
4880 | if (fromI >= 0 && toJ < 0) |
---|
4881 | { |
---|
4882 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4883 | return (ERROR); |
---|
4884 | fromI = tempInt; |
---|
4885 | } |
---|
4886 | else if (fromI < 0 && toJ < 0) |
---|
4887 | { |
---|
4888 | fromI = tempInt; |
---|
4889 | } |
---|
4890 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
4891 | { |
---|
4892 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4893 | return (ERROR); |
---|
4894 | fromI = tempInt; |
---|
4895 | toJ = everyK = -1; |
---|
4896 | } |
---|
4897 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
4898 | { |
---|
4899 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
4900 | return (ERROR); |
---|
4901 | fromI = tempInt; |
---|
4902 | toJ = everyK = -1; |
---|
4903 | } |
---|
4904 | else |
---|
4905 | { |
---|
4906 | MrBayesPrint ("%s Improperly formatted include set\n", spacer); |
---|
4907 | { |
---|
4908 | return (ERROR); |
---|
4909 | } |
---|
4910 | } |
---|
4911 | } |
---|
4912 | expecting = Expecting(ALPHA); |
---|
4913 | expecting |= Expecting(NUMBER); |
---|
4914 | expecting |= Expecting(SEMICOLON); |
---|
4915 | expecting |= Expecting(DASH); |
---|
4916 | expecting |= Expecting(BACKSLASH); |
---|
4917 | } |
---|
4918 | else if (expecting == Expecting(DASH)) |
---|
4919 | { |
---|
4920 | foundDash = YES; |
---|
4921 | expecting = Expecting(NUMBER); |
---|
4922 | } |
---|
4923 | else if (expecting == Expecting(BACKSLASH)) |
---|
4924 | { |
---|
4925 | foundSlash = YES; |
---|
4926 | expecting = Expecting(NUMBER); |
---|
4927 | } |
---|
4928 | else |
---|
4929 | return (ERROR); |
---|
4930 | |
---|
4931 | return (NO_ERROR); |
---|
4932 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
4933 | |
---|
4934 | } |
---|
4935 | |
---|
4936 | |
---|
4937 | |
---|
4938 | |
---|
4939 | |
---|
4940 | int DoLog (void) |
---|
4941 | |
---|
4942 | { |
---|
4943 | |
---|
4944 | if (logToFile == YES) |
---|
4945 | { |
---|
4946 | SafeFclose (&logFileFp); |
---|
4947 | if (replaceLogFile == YES) |
---|
4948 | { |
---|
4949 | if ((logFileFp = OpenTextFileW (logFileName)) == NULL) |
---|
4950 | { |
---|
4951 | logToFile = NO; |
---|
4952 | return (ERROR); |
---|
4953 | } |
---|
4954 | } |
---|
4955 | else |
---|
4956 | { |
---|
4957 | if ((logFileFp = OpenTextFileA (logFileName)) == NULL) |
---|
4958 | { |
---|
4959 | logToFile = NO; |
---|
4960 | return (ERROR); |
---|
4961 | } |
---|
4962 | } |
---|
4963 | MrBayesPrint ("%s Logging screen output to file \"%s\"\n", spacer, logFileName); |
---|
4964 | } |
---|
4965 | else |
---|
4966 | { |
---|
4967 | SafeFclose (&logFileFp); |
---|
4968 | MrBayesPrint ("%s Terminating log output\n", spacer); |
---|
4969 | } |
---|
4970 | |
---|
4971 | return (NO_ERROR); |
---|
4972 | |
---|
4973 | } |
---|
4974 | |
---|
4975 | |
---|
4976 | |
---|
4977 | |
---|
4978 | |
---|
4979 | int DoLogParm (char *parmName, char *tkn) |
---|
4980 | |
---|
4981 | { |
---|
4982 | |
---|
4983 | if (expecting == Expecting(PARAMETER)) |
---|
4984 | { |
---|
4985 | if (!strcmp(parmName, "Start")) |
---|
4986 | { |
---|
4987 | if (logToFile == YES) |
---|
4988 | MrBayesPrint ("%s Logging to file is already on\n", spacer, logFileName); |
---|
4989 | else |
---|
4990 | logToFile = YES; |
---|
4991 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
4992 | } |
---|
4993 | else if (!strcmp(parmName, "Stop")) |
---|
4994 | { |
---|
4995 | if (logToFile == NO) |
---|
4996 | MrBayesPrint ("%s Logging to file is already off\n", spacer, logFileName); |
---|
4997 | else |
---|
4998 | logToFile = NO; |
---|
4999 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
5000 | } |
---|
5001 | else if (!strcmp(parmName, "Replace")) |
---|
5002 | { |
---|
5003 | replaceLogFile = YES; |
---|
5004 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
5005 | } |
---|
5006 | else if (!strcmp(parmName, "Append")) |
---|
5007 | { |
---|
5008 | replaceLogFile = NO; |
---|
5009 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
5010 | } |
---|
5011 | else |
---|
5012 | expecting = Expecting(EQUALSIGN); |
---|
5013 | } |
---|
5014 | else |
---|
5015 | { |
---|
5016 | if (!strcmp(parmName, "Filename")) |
---|
5017 | { |
---|
5018 | if (expecting == Expecting(EQUALSIGN)) |
---|
5019 | { |
---|
5020 | expecting = Expecting(ALPHA); |
---|
5021 | readWord = YES; |
---|
5022 | } |
---|
5023 | else if (expecting == Expecting(ALPHA)) |
---|
5024 | { |
---|
5025 | strcpy (logFileName, tkn); |
---|
5026 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
5027 | } |
---|
5028 | else |
---|
5029 | return (ERROR); |
---|
5030 | } |
---|
5031 | else |
---|
5032 | { |
---|
5033 | MrBayesPrint ("%s Unknown parameter in Log\n", spacer); |
---|
5034 | return (ERROR); |
---|
5035 | } |
---|
5036 | } |
---|
5037 | |
---|
5038 | return (NO_ERROR); |
---|
5039 | |
---|
5040 | } |
---|
5041 | |
---|
5042 | |
---|
5043 | |
---|
5044 | |
---|
5045 | |
---|
5046 | int DoManual (void) |
---|
5047 | |
---|
5048 | { |
---|
5049 | |
---|
5050 | int i, j, logSetting; |
---|
5051 | char title[100]; |
---|
5052 | FILE *fp, *logfp; |
---|
5053 | CmdType *p; |
---|
5054 | |
---|
5055 | /* try to open file, return error if present */ |
---|
5056 | if ((fp = OpenTextFileRQuait(manFileName)) != NULL) |
---|
5057 | { |
---|
5058 | MrBayesPrint ("%s File \"%s\" already exists \n", spacer, manFileName); |
---|
5059 | SafeFclose(&fp); |
---|
5060 | return (ERROR); |
---|
5061 | } |
---|
5062 | |
---|
5063 | /* try to open file for writing, return error if not possible */ |
---|
5064 | if ((fp = OpenTextFileW(manFileName)) == NULL) |
---|
5065 | return (ERROR); |
---|
5066 | |
---|
5067 | /* print message */ |
---|
5068 | MrBayesPrint ("%s Producing command reference file \"%s\"\n", spacer, manFileName); |
---|
5069 | |
---|
5070 | /* temporarily disable normal logging and switch echoing off */ |
---|
5071 | logSetting = logToFile; |
---|
5072 | logfp = logFileFp; |
---|
5073 | echoMB = NO; |
---|
5074 | logToFile = YES; |
---|
5075 | logFileFp = fp; |
---|
5076 | |
---|
5077 | /* produce command reference file */ |
---|
5078 | /* header */ |
---|
5079 | strcpy (title, "Command Reference for MrBayes ver. "); |
---|
5080 | strcat (title, VERSION_NUMBER); |
---|
5081 | |
---|
5082 | i = (70 - (int) strlen (title)) / 2; |
---|
5083 | j = 70 - i - (int) strlen(title); |
---|
5084 | |
---|
5085 | MrBayesPrint (" \n"); |
---|
5086 | MrBayesPrint (" \n"); |
---|
5087 | MrBayesPrint (" \n"); |
---|
5088 | MrBayesPrint (" \n"); |
---|
5089 | MrBayesPrint (" %*c%s%*c \n", i, ' ', title, j, ' '); |
---|
5090 | MrBayesPrint (" \n"); |
---|
5091 | MrBayesPrint (" (c) John P. Huelsenbeck, Fredrik Ronquist \n"); |
---|
5092 | MrBayesPrint (" and Maxim Teslenko \n"); |
---|
5093 | MrBayesPrint (" \n"); |
---|
5094 | |
---|
5095 | /* summary */ |
---|
5096 | MrBayesPrint (" \n"); |
---|
5097 | MrBayesPrint (" *************************************************************************** \n"); |
---|
5098 | MrBayesPrint (" * * \n"); |
---|
5099 | MrBayesPrint (" * 1. Command summary * \n"); |
---|
5100 | MrBayesPrint (" * * \n"); |
---|
5101 | MrBayesPrint (" *************************************************************************** \n"); |
---|
5102 | MrBayesPrint (" \n"); |
---|
5103 | foundFirst = NO; |
---|
5104 | if (DoHelp() == ERROR) |
---|
5105 | { |
---|
5106 | MrBayesPrint ("%s Could not produce command reference summary\n", spacer); |
---|
5107 | goto errorExit; |
---|
5108 | } |
---|
5109 | |
---|
5110 | /* list of MrBayes commands */ |
---|
5111 | MrBayesPrint (" \n"); |
---|
5112 | MrBayesPrint (" *************************************************************************** \n"); |
---|
5113 | MrBayesPrint (" * * \n"); |
---|
5114 | MrBayesPrint (" * 2. MrBayes commands * \n"); |
---|
5115 | MrBayesPrint (" * * \n"); |
---|
5116 | MrBayesPrint (" *************************************************************************** \n"); |
---|
5117 | MrBayesPrint (" \n"); |
---|
5118 | for (i=1; i<NUMCOMMANDS; i++) |
---|
5119 | { |
---|
5120 | p = commands + i; |
---|
5121 | if (p->cmdUse == IN_CMD && p->hiding == SHOW) |
---|
5122 | { |
---|
5123 | if (GetUserHelp(p->string)==ERROR) |
---|
5124 | goto errorExit; |
---|
5125 | } |
---|
5126 | } |
---|
5127 | |
---|
5128 | /* list of data or tree block commands */ |
---|
5129 | MrBayesPrint (" \n"); |
---|
5130 | MrBayesPrint (" *************************************************************************** \n"); |
---|
5131 | MrBayesPrint (" * * \n"); |
---|
5132 | MrBayesPrint (" * 3. 'Data' or 'tree' block commands (in #NEXUS file) * \n"); |
---|
5133 | MrBayesPrint (" * * \n"); |
---|
5134 | MrBayesPrint (" *************************************************************************** \n"); |
---|
5135 | MrBayesPrint (" \n"); |
---|
5136 | for (i=1; i<NUMCOMMANDS; i++) |
---|
5137 | { |
---|
5138 | p = commands + i; |
---|
5139 | if (p->cmdUse == IN_FILE && p->hiding == SHOW) |
---|
5140 | { |
---|
5141 | if (GetUserHelp(p->string) == ERROR) |
---|
5142 | goto errorExit; |
---|
5143 | } |
---|
5144 | } |
---|
5145 | |
---|
5146 | /* return logging to previous setings and switch echoing on */ |
---|
5147 | SafeFclose (&fp); |
---|
5148 | logToFile = logSetting; |
---|
5149 | logFileFp = logfp; |
---|
5150 | echoMB = YES; |
---|
5151 | |
---|
5152 | MrBayesPrint ("%s Successfully produced command reference file \"%s\"\n", spacer, manFileName); |
---|
5153 | |
---|
5154 | return (NO_ERROR); |
---|
5155 | |
---|
5156 | errorExit: |
---|
5157 | SafeFclose (&fp); |
---|
5158 | logToFile = logSetting; |
---|
5159 | logFileFp = logfp; |
---|
5160 | echoMB = YES; |
---|
5161 | |
---|
5162 | return (ERROR); |
---|
5163 | |
---|
5164 | } |
---|
5165 | |
---|
5166 | |
---|
5167 | |
---|
5168 | |
---|
5169 | |
---|
5170 | int DoManualParm (char *parmName, char *tkn) |
---|
5171 | |
---|
5172 | { |
---|
5173 | |
---|
5174 | if (expecting == Expecting(PARAMETER)) |
---|
5175 | { |
---|
5176 | expecting = Expecting(EQUALSIGN); |
---|
5177 | } |
---|
5178 | else |
---|
5179 | { |
---|
5180 | if (!strcmp(parmName, "Filename")) |
---|
5181 | { |
---|
5182 | if (expecting == Expecting(EQUALSIGN)) |
---|
5183 | { |
---|
5184 | expecting = Expecting(ALPHA); |
---|
5185 | readWord = YES; |
---|
5186 | } |
---|
5187 | else if (expecting == Expecting(ALPHA)) |
---|
5188 | { |
---|
5189 | strcpy (manFileName, tkn); |
---|
5190 | expecting = Expecting(SEMICOLON); |
---|
5191 | } |
---|
5192 | else |
---|
5193 | return (ERROR); |
---|
5194 | } |
---|
5195 | else |
---|
5196 | { |
---|
5197 | MrBayesPrint ("%s Unknown parameter in Manual\n", spacer); |
---|
5198 | return (ERROR); |
---|
5199 | } |
---|
5200 | } |
---|
5201 | |
---|
5202 | return (NO_ERROR); |
---|
5203 | |
---|
5204 | } |
---|
5205 | |
---|
5206 | |
---|
5207 | |
---|
5208 | |
---|
5209 | |
---|
5210 | int DoMatrix (void) |
---|
5211 | |
---|
5212 | { |
---|
5213 | |
---|
5214 | int i, j, hasMissingAmbig; |
---|
5215 | |
---|
5216 | if (taxonCount != numTaxa) |
---|
5217 | { |
---|
5218 | MrBayesPrint ("%s Problem with number of taxa read in (%d taxa read in, while expecting %d)\n", spacer, taxonCount, numTaxa); |
---|
5219 | FreeMatrix(); |
---|
5220 | return (ERROR); |
---|
5221 | } |
---|
5222 | for (i=0; i<numTaxa; i++) |
---|
5223 | { |
---|
5224 | if (taxaInfo[i].charCount != numChar) |
---|
5225 | { |
---|
5226 | MrBayesPrint ("%s Problem with number of characters read in (%d expected for taxon %d, %d read in)\n", spacer, numChar, i, taxaInfo[i].charCount); |
---|
5227 | FreeMatrix(); |
---|
5228 | return (ERROR); |
---|
5229 | } |
---|
5230 | } |
---|
5231 | |
---|
5232 | /* find out which characters have missing or ambiguous states (one time only, so no special function) */ |
---|
5233 | for (i=0; i<numChar; i++) |
---|
5234 | { |
---|
5235 | hasMissingAmbig = NO; |
---|
5236 | for (j=0; j<numTaxa; j++) |
---|
5237 | { |
---|
5238 | if (IsMissing (matrix[pos(j,i,numChar)], charInfo[i].charType) == YES) |
---|
5239 | hasMissingAmbig = YES; |
---|
5240 | if (IsAmbig (matrix[pos(j,i,numChar)], charInfo[i].charType) == YES) |
---|
5241 | hasMissingAmbig = YES; |
---|
5242 | } |
---|
5243 | if (hasMissingAmbig == YES) |
---|
5244 | charInfo[i].isMissAmbig = YES; |
---|
5245 | } |
---|
5246 | |
---|
5247 | MrBayesPrint ("%s Successfully read matrix\n", spacer); |
---|
5248 | if (matrixHasPoly == YES) |
---|
5249 | MrBayesPrint ("%s Matrix contains polymorphisms, interpreted as ambiguity\n", spacer); |
---|
5250 | defMatrix = YES; |
---|
5251 | isTaxsetDef = YES; |
---|
5252 | |
---|
5253 | /* add name of default partition */ |
---|
5254 | if (AddString (&partitionNames, 0, "Default") == ERROR) |
---|
5255 | { |
---|
5256 | MrBayesPrint ("%s Problem adding Default name to partition list\n", spacer); |
---|
5257 | return (ERROR); |
---|
5258 | } |
---|
5259 | numDefinedPartitions = 1; |
---|
5260 | |
---|
5261 | if (numDefinedSpeciespartitions == 0) /* the default species partition could have been added already in DoTaxLabels */ |
---|
5262 | { |
---|
5263 | /* add default speciespartition name to list of valid speciespartitions */ |
---|
5264 | if (AddString (&speciespartitionNames, 0, "Default") == ERROR) |
---|
5265 | { |
---|
5266 | MrBayesPrint ("%s Problem adding Default speciespartition to list\n", spacer); |
---|
5267 | return (ERROR); |
---|
5268 | } |
---|
5269 | |
---|
5270 | /* add default species name set */ |
---|
5271 | AddNameSet(&speciesNameSets, 0, taxaNames, numTaxa); |
---|
5272 | |
---|
5273 | /* set number of defined speciespartitions to 1 */ |
---|
5274 | numDefinedSpeciespartitions = 1; |
---|
5275 | } |
---|
5276 | |
---|
5277 | if (SetPartition (0) == ERROR) |
---|
5278 | return ERROR; |
---|
5279 | |
---|
5280 | if (SetSpeciespartition (0) == ERROR) |
---|
5281 | return ERROR; |
---|
5282 | |
---|
5283 | if (numCurrentDivisions == 1) |
---|
5284 | MrBayesPrint ("%s Setting default partition (does not divide up characters)\n", spacer); |
---|
5285 | else |
---|
5286 | MrBayesPrint ("%s Setting default partition, dividing characters into %d parts\n", spacer, numCurrentDivisions); |
---|
5287 | |
---|
5288 | if (SetModelDefaults () == ERROR) |
---|
5289 | return (ERROR); |
---|
5290 | |
---|
5291 | if (SetUpAnalysis (&globalSeed) == ERROR) |
---|
5292 | return (ERROR); |
---|
5293 | |
---|
5294 | /* set default names for some output file names based on processed file */ |
---|
5295 | strcpy (sumtParams.sumtFileName, inputFileName); |
---|
5296 | strcpy (sumtParams.sumtOutfile, inputFileName); |
---|
5297 | strcpy (sumpParams.sumpFileName, inputFileName); |
---|
5298 | strcpy (sumpParams.sumpOutfile, inputFileName); |
---|
5299 | strcpy (comptreeParams.comptOutfile, inputFileName); |
---|
5300 | |
---|
5301 | if (chainParams.numRuns == 1) |
---|
5302 | { |
---|
5303 | sprintf (comptreeParams.comptFileName1, "%s.t", inputFileName); |
---|
5304 | sprintf (comptreeParams.comptFileName2, "%s.t", inputFileName); |
---|
5305 | } |
---|
5306 | else /* if (chainParams.numRuns > 1) */ |
---|
5307 | { |
---|
5308 | sprintf (comptreeParams.comptFileName1, "%s.run1.t", inputFileName); |
---|
5309 | sprintf (comptreeParams.comptFileName2, "%s.run2.t", inputFileName); |
---|
5310 | } |
---|
5311 | |
---|
5312 | if (chainParams.numRuns == 1) |
---|
5313 | sprintf (plotParams.plotFileName, "%s.p", inputFileName); |
---|
5314 | else /* if (chainParams.numRuns > 1) */ |
---|
5315 | sprintf (plotParams.plotFileName, "%s.run1.p", inputFileName); |
---|
5316 | |
---|
5317 | strcpy (chainParams.chainFileName, inputFileName); |
---|
5318 | |
---|
5319 | if (chainParams.numRuns > 1) |
---|
5320 | MrBayesPrint ("%s Setting output file names to \"%s.run<i>.<p|t>\"\n", spacer, chainParams.chainFileName); |
---|
5321 | else |
---|
5322 | MrBayesPrint ("%s Setting output file names to \"%s.<p|t>\"\n", spacer, chainParams.chainFileName); |
---|
5323 | |
---|
5324 | # if 0 |
---|
5325 | for (i=0; i<numChar; i++) |
---|
5326 | { |
---|
5327 | int j; |
---|
5328 | MrBayesPrint ("%4d -- ", i+1); |
---|
5329 | for (j=0; j<numTaxa; j++) |
---|
5330 | MrBayesPrint ("%2d ", matrix[pos(j,i,numChar)]); |
---|
5331 | MrBayesPrint ("\n"); |
---|
5332 | } |
---|
5333 | # endif |
---|
5334 | |
---|
5335 | return (NO_ERROR); |
---|
5336 | |
---|
5337 | } |
---|
5338 | |
---|
5339 | |
---|
5340 | |
---|
5341 | |
---|
5342 | |
---|
5343 | int DoMatrixParm (char *parmName, char *tkn) |
---|
5344 | |
---|
5345 | { |
---|
5346 | |
---|
5347 | int i, j, charCode, index; |
---|
5348 | MrBFlt charValue; |
---|
5349 | |
---|
5350 | expecting = Expecting(ALPHA); |
---|
5351 | expecting |= Expecting(QUESTIONMARK); |
---|
5352 | expecting |= Expecting(DASH); |
---|
5353 | expecting |= Expecting(NUMBER); |
---|
5354 | expecting |= Expecting(ASTERISK); |
---|
5355 | expecting |= Expecting(EXCLAMATIONMARK); |
---|
5356 | expecting |= Expecting(PERCENT); |
---|
5357 | expecting |= Expecting(WEIRD); |
---|
5358 | expecting |= Expecting(SEMICOLON); |
---|
5359 | expecting |= Expecting(LEFTPAR); |
---|
5360 | expecting |= Expecting(RIGHTPAR); |
---|
5361 | expecting |= Expecting(LEFTCURL); |
---|
5362 | expecting |= Expecting(RIGHTCURL); |
---|
5363 | |
---|
5364 | if (defTaxa == NO || defChars == NO) |
---|
5365 | { |
---|
5366 | MrBayesPrint ("%s Number of taxa and characters needs to be defined before matrix is read\n", spacer); |
---|
5367 | goto errorExit; |
---|
5368 | } |
---|
5369 | if (inDataBlock == NO && inCharactersBlock == NO) |
---|
5370 | { |
---|
5371 | MrBayesPrint ("%s Must be in data or characters block to read in character matrix\n", spacer); |
---|
5372 | goto errorExit; |
---|
5373 | } |
---|
5374 | |
---|
5375 | if (isFirstMatrixRead == YES) |
---|
5376 | { |
---|
5377 | foundNewLine = YES; |
---|
5378 | isFirstInterleavedBlock = YES; |
---|
5379 | taxonCount = 0; |
---|
5380 | isNegative = NO; |
---|
5381 | } |
---|
5382 | isFirstMatrixRead = NO; |
---|
5383 | |
---|
5384 | /* allow line breaks in non-interleaved matrices */ |
---|
5385 | if (isInterleaved == NO) |
---|
5386 | { |
---|
5387 | if (foundNewLine == YES && taxonCount > 0) |
---|
5388 | { |
---|
5389 | if (taxaInfo[taxonCount-1].charCount < numChar) |
---|
5390 | foundNewLine = NO; |
---|
5391 | } |
---|
5392 | } |
---|
5393 | |
---|
5394 | if (taxonCount >= numTaxa && foundNewLine == YES) |
---|
5395 | { |
---|
5396 | if (isInterleaved == YES) |
---|
5397 | { |
---|
5398 | taxonCount = 0; |
---|
5399 | isFirstInterleavedBlock = NO; |
---|
5400 | } |
---|
5401 | else |
---|
5402 | { |
---|
5403 | MrBayesPrint ("%s Too many taxa in matrix\n", spacer); |
---|
5404 | goto errorExit; |
---|
5405 | } |
---|
5406 | } |
---|
5407 | |
---|
5408 | if (taxaInfo[0].charCount > 4010) |
---|
5409 | i = 1; |
---|
5410 | |
---|
5411 | if (foundNewLine == YES) |
---|
5412 | { |
---|
5413 | /* Should be a taxon. */ |
---|
5414 | if (isFirstInterleavedBlock == YES) |
---|
5415 | { |
---|
5416 | /* If this is the first interleaved block, then we need to add the taxon |
---|
5417 | to the set of taxon names unless there is already a defined taxon set. */ |
---|
5418 | if ( strlen(tkn)>99 ) |
---|
5419 | { |
---|
5420 | MrBayesPrint ("%s Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, tkn); |
---|
5421 | goto errorExit; |
---|
5422 | } |
---|
5423 | if (isTaxsetDef == NO && AddString (&taxaNames, taxonCount, tkn) == ERROR) |
---|
5424 | { |
---|
5425 | MrBayesPrint ("%s Problem adding taxon %s to taxon set\n", spacer, tkn); |
---|
5426 | goto errorExit; |
---|
5427 | } |
---|
5428 | if (numTaxa < 10) |
---|
5429 | MrBayesPrint ("%s Taxon %d -> %s\n", spacer, taxonCount+1, tkn); |
---|
5430 | else if (numTaxa < 100 && numTaxa >= 10) |
---|
5431 | MrBayesPrint ("%s Taxon %2d -> %s\n", spacer, taxonCount+1, tkn); |
---|
5432 | else if (numTaxa < 1000 && numTaxa >= 100) |
---|
5433 | MrBayesPrint ("%s Taxon %3d -> %s\n", spacer, taxonCount+1, tkn); |
---|
5434 | else |
---|
5435 | MrBayesPrint ("%s Taxon %4d -> %s\n", spacer, taxonCount+1, tkn); |
---|
5436 | } |
---|
5437 | else |
---|
5438 | { |
---|
5439 | /* If this is not the first interleaved block, then we need to |
---|
5440 | check to see if taxon name is present and in correct place. */ |
---|
5441 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
5442 | { |
---|
5443 | MrBayesPrint ("%s Could not find taxon %s in list of taxa\n", spacer, tkn); |
---|
5444 | goto errorExit; |
---|
5445 | } |
---|
5446 | if (index != taxonCount) |
---|
5447 | { |
---|
5448 | MrBayesPrint ("%s Could not find taxon %s in correct position in list of taxa\n", spacer, tkn); |
---|
5449 | goto errorExit; |
---|
5450 | } |
---|
5451 | } |
---|
5452 | foundNewLine = NO; |
---|
5453 | isNegative = NO; |
---|
5454 | taxonCount++; |
---|
5455 | } |
---|
5456 | else |
---|
5457 | { |
---|
5458 | /* Should be a character (either continuous or otherwise). */ |
---|
5459 | if (charInfo[taxaInfo[taxonCount-1].charCount].charType == CONTINUOUS) |
---|
5460 | { |
---|
5461 | /* If we have a CONTINUOUS character, then the entire token should either be |
---|
5462 | a number or a dash (for a negative sign). */ |
---|
5463 | if (!strcmp(tkn, "-")) |
---|
5464 | { |
---|
5465 | /* Dealing with a negative number. We will multiply the next tkn, which |
---|
5466 | had better be a number, by -1. */ |
---|
5467 | isNegative = YES; |
---|
5468 | } |
---|
5469 | else |
---|
5470 | { |
---|
5471 | /* We have a number, we hope. */ |
---|
5472 | if (tkn[0] == matchId) |
---|
5473 | { |
---|
5474 | /* If the token is a matchchar, then things are simple. */ |
---|
5475 | if (taxonCount == 1) |
---|
5476 | { |
---|
5477 | MrBayesPrint ("%s Matching characters cannot be in first taxon\n", spacer); |
---|
5478 | goto errorExit; |
---|
5479 | } |
---|
5480 | charCode = matrix[pos(0,taxaInfo[taxonCount-1].charCount,numChar)]; |
---|
5481 | matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount,numChar)] = charCode; |
---|
5482 | } |
---|
5483 | else |
---|
5484 | { |
---|
5485 | /* Otherwise, we have a number. Check that it is a valid number first... */ |
---|
5486 | if (!IsIn(tkn[0],"0123456789.")) |
---|
5487 | { |
---|
5488 | MrBayesPrint ("%s Expecting a number for the continuous character\n", spacer); |
---|
5489 | goto errorExit; |
---|
5490 | } |
---|
5491 | /* ... and then put the character into the matrix. Note that matrix |
---|
5492 | is defined as an integer, but we may have floating precision continuous |
---|
5493 | characters. To get around this, we multiply the value of the character |
---|
5494 | by 1000 before putting it into matrix. We will divide by 1000 later on |
---|
5495 | when/if we use the characters. */ |
---|
5496 | sscanf (tkn, "%lf", &charValue); |
---|
5497 | charValue *= 1000.0; |
---|
5498 | if (isNegative == YES) |
---|
5499 | { |
---|
5500 | charValue *= -1.0; |
---|
5501 | isNegative = NO; |
---|
5502 | } |
---|
5503 | /*MrBayesPrint ("%d \n", (int)charValue);*/ |
---|
5504 | matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = (int)charValue; |
---|
5505 | } |
---|
5506 | } |
---|
5507 | } |
---|
5508 | else |
---|
5509 | { |
---|
5510 | /* Otherwise, we are dealing with a run-of-the-mill character, and we |
---|
5511 | cannot expect the entire token to contain only a single character. We |
---|
5512 | must, therefore, go through the token character-by-character. */ |
---|
5513 | i = 0; |
---|
5514 | while (tkn[i] != '\0') |
---|
5515 | { |
---|
5516 | /*MrBayesPrint ("%c", tkn[i]);*/ |
---|
5517 | if (tkn[i] == matchId) |
---|
5518 | { |
---|
5519 | if (taxonCount == 1) |
---|
5520 | { |
---|
5521 | MrBayesPrint ("%s Matching characters cannot be in first taxon\n", spacer); |
---|
5522 | goto errorExit; |
---|
5523 | } |
---|
5524 | charCode = matrix[pos(0,taxaInfo[taxonCount-1].charCount,numChar)]; |
---|
5525 | matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode; |
---|
5526 | } |
---|
5527 | else |
---|
5528 | { |
---|
5529 | if ((tkn[i] == ')' && isInAmbig == YES) || (tkn[i] == '}' && isInPoly == YES)) |
---|
5530 | { |
---|
5531 | isInAmbig = isInPoly = NO; |
---|
5532 | charCode = theAmbigChar; |
---|
5533 | j = CharacterNumber (charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType); |
---|
5534 | if (j > charInfo[taxaInfo[taxonCount-1].charCount].numStates) |
---|
5535 | charInfo[taxaInfo[taxonCount-1].charCount].numStates = j; |
---|
5536 | matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode; |
---|
5537 | theAmbigChar = 0; |
---|
5538 | } |
---|
5539 | else if ((tkn[i] == '(' && isInAmbig == YES) || (tkn[i] == '{' && isInPoly == YES)) |
---|
5540 | { |
---|
5541 | if (isInAmbig == YES) |
---|
5542 | MrBayesPrint ("%s Found an inappropriate \"(\"\n", spacer); |
---|
5543 | else |
---|
5544 | MrBayesPrint ("%s Found an inappropriate \"{\"\n", spacer); |
---|
5545 | goto errorExit; |
---|
5546 | } |
---|
5547 | else if (isInAmbig == YES || isInPoly == YES) |
---|
5548 | { |
---|
5549 | if (tkn[i] == ',') |
---|
5550 | expecting |= Expecting (COMMA); |
---|
5551 | else |
---|
5552 | { |
---|
5553 | if (CharacterCode(tkn[i], &charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType) == ERROR) |
---|
5554 | goto errorExit; |
---|
5555 | if (charCode == MISSING || charCode == GAP) |
---|
5556 | goto errorExit; |
---|
5557 | theAmbigChar |= charCode; |
---|
5558 | expecting ^= Expecting (COMMA); |
---|
5559 | } |
---|
5560 | } |
---|
5561 | else if (tkn[i] == '{' && isInPoly == NO && isInAmbig == NO) |
---|
5562 | { |
---|
5563 | isInPoly = YES; |
---|
5564 | matrixHasPoly = YES; |
---|
5565 | theAmbigChar = 0; |
---|
5566 | } |
---|
5567 | else if (tkn[i] == '(' && isInPoly == NO && isInAmbig == NO) |
---|
5568 | { |
---|
5569 | isInAmbig = YES; |
---|
5570 | theAmbigChar = 0; |
---|
5571 | } |
---|
5572 | else if (tkn[i] == '(' && isInPoly == NO && isInAmbig == NO) |
---|
5573 | { |
---|
5574 | isInAmbig = YES; |
---|
5575 | theAmbigChar = 0; |
---|
5576 | } |
---|
5577 | else |
---|
5578 | { |
---|
5579 | if (CharacterCode(tkn[i], &charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType) == ERROR) |
---|
5580 | { |
---|
5581 | MrBayesPrint ("%s Error while reading character position %d (charCode %d)\n", spacer, taxaInfo[taxonCount-1].charCount+1, charCode); |
---|
5582 | goto errorExit; |
---|
5583 | } |
---|
5584 | if (charCode != MISSING && charCode != GAP) |
---|
5585 | { |
---|
5586 | j = CharacterNumber (charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType); |
---|
5587 | if (j > charInfo[taxaInfo[taxonCount-1].charCount].numStates) |
---|
5588 | charInfo[taxaInfo[taxonCount-1].charCount].numStates = j; |
---|
5589 | } |
---|
5590 | matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode; |
---|
5591 | } |
---|
5592 | } |
---|
5593 | i++; |
---|
5594 | } |
---|
5595 | } |
---|
5596 | } |
---|
5597 | |
---|
5598 | return (NO_ERROR); |
---|
5599 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
5600 | errorExit: |
---|
5601 | numTaxa=taxonCount; |
---|
5602 | FreeMatrix(); |
---|
5603 | return (ERROR); |
---|
5604 | |
---|
5605 | } |
---|
5606 | |
---|
5607 | |
---|
5608 | |
---|
5609 | |
---|
5610 | |
---|
5611 | int DoNexusParm (char *parmName, char *tkn) |
---|
5612 | |
---|
5613 | { |
---|
5614 | |
---|
5615 | if (!strcmp(parmName, "NEXUS")) |
---|
5616 | { |
---|
5617 | MrBayesPrint ("%s Expecting NEXUS formatted file\n", spacer); |
---|
5618 | expecting = Expecting(COMMAND); |
---|
5619 | } |
---|
5620 | else |
---|
5621 | { |
---|
5622 | MrBayesPrint ("%s Found %s\n", spacer, tkn); |
---|
5623 | return (ERROR); |
---|
5624 | } |
---|
5625 | |
---|
5626 | return (NO_ERROR); |
---|
5627 | |
---|
5628 | } |
---|
5629 | |
---|
5630 | |
---|
5631 | |
---|
5632 | |
---|
5633 | |
---|
5634 | int DoOutgroup (void) |
---|
5635 | |
---|
5636 | { |
---|
5637 | |
---|
5638 | MrBayesPrint ("%s Setting outgroup to taxon \"%s\"\n", spacer, taxaNames[outGroupNum]); |
---|
5639 | |
---|
5640 | return (NO_ERROR); |
---|
5641 | |
---|
5642 | } |
---|
5643 | |
---|
5644 | |
---|
5645 | |
---|
5646 | |
---|
5647 | |
---|
5648 | int DoOutgroupParm (char *parmName, char *tkn) |
---|
5649 | |
---|
5650 | |
---|
5651 | { |
---|
5652 | |
---|
5653 | int index, tempInt; |
---|
5654 | |
---|
5655 | if (expecting == Expecting(ALPHA)) |
---|
5656 | { |
---|
5657 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
5658 | { |
---|
5659 | MrBayesPrint ("%s Could not find taxon %s in list of taxa\n", spacer, tkn); |
---|
5660 | return (ERROR); |
---|
5661 | } |
---|
5662 | outGroupNum = index; |
---|
5663 | |
---|
5664 | expecting = Expecting(SEMICOLON); |
---|
5665 | } |
---|
5666 | else if (expecting == Expecting(NUMBER)) |
---|
5667 | { |
---|
5668 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
5669 | { |
---|
5670 | /* OK, as we expect, the taxon is not a digit. So, now we assume that |
---|
5671 | the user is assigning the outgroup by its number */ |
---|
5672 | sscanf (tkn, "%d", &tempInt); |
---|
5673 | if (tempInt < 1 || tempInt > numTaxa) |
---|
5674 | { |
---|
5675 | MrBayesPrint ("%s Taxon number %d is out of range\n", spacer, tempInt); |
---|
5676 | return (ERROR); |
---|
5677 | } |
---|
5678 | outGroupNum = tempInt - 1; |
---|
5679 | } |
---|
5680 | else |
---|
5681 | { |
---|
5682 | outGroupNum = index; |
---|
5683 | } |
---|
5684 | |
---|
5685 | expecting = Expecting(SEMICOLON); |
---|
5686 | } |
---|
5687 | else |
---|
5688 | return (ERROR); |
---|
5689 | |
---|
5690 | return (NO_ERROR); |
---|
5691 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
5692 | |
---|
5693 | } |
---|
5694 | |
---|
5695 | |
---|
5696 | |
---|
5697 | |
---|
5698 | |
---|
5699 | int DoPairs (void) |
---|
5700 | |
---|
5701 | { |
---|
5702 | |
---|
5703 | MrBayesPrint ("\n"); |
---|
5704 | MrBayesPrint ("%s Successfully defined character pairings\n", spacer); |
---|
5705 | |
---|
5706 | defPairs = YES; |
---|
5707 | foundFirst = NO; |
---|
5708 | |
---|
5709 | return (NO_ERROR); |
---|
5710 | |
---|
5711 | } |
---|
5712 | |
---|
5713 | |
---|
5714 | |
---|
5715 | |
---|
5716 | |
---|
5717 | int DoPairsParm (char *parmName, char *tkn) |
---|
5718 | |
---|
5719 | { |
---|
5720 | |
---|
5721 | int i, tempInt; |
---|
5722 | |
---|
5723 | if (defMatrix == NO) |
---|
5724 | { |
---|
5725 | MrBayesPrint ("%s A matrix must be specified before you can define pairs of characters\n", spacer); |
---|
5726 | return (ERROR); |
---|
5727 | } |
---|
5728 | |
---|
5729 | if (defPairs == YES) |
---|
5730 | { |
---|
5731 | MrBayesPrint ("%s Character pairs have been previously defined \n", spacer); |
---|
5732 | MrBayesPrint ("%s Now overwriting old pairings\n", spacer); |
---|
5733 | for (i=0; i<numChar; i++) |
---|
5734 | charInfo[i].pairsId = 0; |
---|
5735 | defPairs = NO; |
---|
5736 | } |
---|
5737 | |
---|
5738 | if (foundFirst == NO) |
---|
5739 | { |
---|
5740 | /* this is the first time in */ |
---|
5741 | pairId = 1; |
---|
5742 | firstPair = YES; |
---|
5743 | foundFirst = YES; |
---|
5744 | MrBayesPrint ("%s Defining character pairings:\n\n", spacer); |
---|
5745 | MrBayesPrint ("%s Pair -- First Second \n", spacer); |
---|
5746 | } |
---|
5747 | |
---|
5748 | if (expecting == Expecting(NUMBER)) |
---|
5749 | { |
---|
5750 | sscanf (tkn, "%d", &tempInt); |
---|
5751 | if (tempInt <= 0 || tempInt > numChar) |
---|
5752 | { |
---|
5753 | MrBayesPrint ("\n"); |
---|
5754 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
5755 | for (i=0; i<numChar; i++) |
---|
5756 | charInfo[i].pairsId = 0; |
---|
5757 | return (ERROR); |
---|
5758 | } |
---|
5759 | tempInt--; |
---|
5760 | |
---|
5761 | if (charInfo[tempInt].pairsId != 0) |
---|
5762 | { |
---|
5763 | MrBayesPrint ("\n"); |
---|
5764 | MrBayesPrint ("%s Character number %d has already been included in a pairing\n", spacer, tempInt+1); |
---|
5765 | for (i=0; i<numChar; i++) |
---|
5766 | charInfo[i].pairsId = 0; |
---|
5767 | return (ERROR); |
---|
5768 | } |
---|
5769 | if (charInfo[tempInt].charType != DNA && charInfo[tempInt].charType != RNA) |
---|
5770 | { |
---|
5771 | MrBayesPrint ("\n"); |
---|
5772 | MrBayesPrint ("%s Pairings may only include nucleotide data\n", spacer); |
---|
5773 | if (charInfo[tempInt].charType == PROTEIN) |
---|
5774 | MrBayesPrint ("%s Character %d is an amino acid character\n", spacer, tempInt+1); |
---|
5775 | else if (charInfo[tempInt].charType == RESTRICTION) |
---|
5776 | MrBayesPrint ("%s Character %d is a restriction site character\n", spacer, tempInt+1); |
---|
5777 | else if (charInfo[tempInt].charType == STANDARD) |
---|
5778 | MrBayesPrint ("%s Character %d is a \"standard\" character\n", spacer, tempInt+1); |
---|
5779 | else if (charInfo[tempInt].charType == CONTINUOUS) |
---|
5780 | MrBayesPrint ("%s Character %d is a continuously varying character\n", spacer, tempInt+1); |
---|
5781 | for (i=0; i<numChar; i++) |
---|
5782 | charInfo[i].pairsId = 0; |
---|
5783 | return (ERROR); |
---|
5784 | } |
---|
5785 | |
---|
5786 | charInfo[tempInt].pairsId = pairId; |
---|
5787 | |
---|
5788 | if (firstPair == YES) |
---|
5789 | { |
---|
5790 | MrBayesPrint ("%s %4d -- %5d ", spacer, pairId, tempInt+1); |
---|
5791 | expecting = Expecting(COLON); |
---|
5792 | firstPair = NO; |
---|
5793 | } |
---|
5794 | else |
---|
5795 | { |
---|
5796 | MrBayesPrint ("%5d\n", tempInt+1); |
---|
5797 | expecting = (Expecting(COMMA) | Expecting(SEMICOLON)); |
---|
5798 | firstPair = YES; |
---|
5799 | } |
---|
5800 | } |
---|
5801 | else if (expecting == Expecting(COMMA)) |
---|
5802 | { |
---|
5803 | pairId++; |
---|
5804 | expecting = Expecting(NUMBER); |
---|
5805 | } |
---|
5806 | else if (expecting == Expecting(COLON)) |
---|
5807 | { |
---|
5808 | expecting = Expecting(NUMBER); |
---|
5809 | } |
---|
5810 | else |
---|
5811 | { |
---|
5812 | for (i=0; i<numChar; i++) |
---|
5813 | charInfo[i].pairsId = 0; |
---|
5814 | return (ERROR); |
---|
5815 | } |
---|
5816 | |
---|
5817 | return (NO_ERROR); |
---|
5818 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
5819 | |
---|
5820 | } |
---|
5821 | |
---|
5822 | |
---|
5823 | |
---|
5824 | |
---|
5825 | |
---|
5826 | int DoPartition (void) |
---|
5827 | |
---|
5828 | { |
---|
5829 | |
---|
5830 | int i, *partTypes; |
---|
5831 | |
---|
5832 | /* add set to tempSet */ |
---|
5833 | if (fromI >= 0) |
---|
5834 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
5835 | return (ERROR); |
---|
5836 | |
---|
5837 | /* check that all characters are included */ |
---|
5838 | for (i=0; i<numChar; i++) |
---|
5839 | { |
---|
5840 | if (tempSet[i] == 0) |
---|
5841 | { |
---|
5842 | MrBayesPrint ("%s Character %d not included in partition\n", spacer, i+1); |
---|
5843 | return (ERROR); |
---|
5844 | } |
---|
5845 | /*MrBayesPrint ("%4d %4d \n", i, tempSet[i]);*/ |
---|
5846 | } |
---|
5847 | |
---|
5848 | |
---|
5849 | /* check how many partitions were found against how many were expected */ |
---|
5850 | if (whichPartition != numDivisions - 1) |
---|
5851 | { |
---|
5852 | MrBayesPrint ("%s Did not find correct number of partitions (expecting %d, found %d)\n", spacer, numDivisions, whichPartition + 1); |
---|
5853 | return (ERROR); |
---|
5854 | } |
---|
5855 | |
---|
5856 | partTypes = (int *) SafeCalloc (numDivisions, sizeof(int)); |
---|
5857 | if (!partTypes) |
---|
5858 | return ERROR; |
---|
5859 | |
---|
5860 | /* make certain that the partition labels go from 1 - numDivisions, inclusive */ |
---|
5861 | for (i=0; i<numChar; i++) |
---|
5862 | partTypes[tempSet[i] - 1] = -1; //partTypes is temporary used here not as an indicator of partition type |
---|
5863 | for (i=0; i<numDivisions; i++) |
---|
5864 | { |
---|
5865 | if (partTypes[i] == 0) |
---|
5866 | { |
---|
5867 | MrBayesPrint ("%s Could not find a single character for division %d\n", spacer, i+1); |
---|
5868 | return (ERROR); |
---|
5869 | } |
---|
5870 | } |
---|
5871 | |
---|
5872 | /* check if partition overruns data types */ |
---|
5873 | /* partTypes[i] = -1 is already set in previouse loop |
---|
5874 | for (i=0; i<numDivisions; i++) |
---|
5875 | partTypes[i] = -1; |
---|
5876 | */ |
---|
5877 | for (i=0; i<numChar; i++) |
---|
5878 | { |
---|
5879 | if (partTypes[ tempSet[i]-1 ] == -1) |
---|
5880 | partTypes[ tempSet[i]-1 ] = charInfo[i].charType; |
---|
5881 | else |
---|
5882 | { |
---|
5883 | if (partTypes[ tempSet[i]-1 ] != charInfo[i].charType) |
---|
5884 | { |
---|
5885 | MrBayesPrint ("%s There are two different data types for partition division %d\n", spacer, tempSet[i]); |
---|
5886 | free (partTypes); |
---|
5887 | return (ERROR); |
---|
5888 | } |
---|
5889 | } |
---|
5890 | } |
---|
5891 | free (partTypes); |
---|
5892 | |
---|
5893 | /* add name to list of valid partitions */ |
---|
5894 | if (AddString (&partitionNames, numDefinedPartitions, tempSetName) == ERROR) |
---|
5895 | { |
---|
5896 | MrBayesPrint ("%s Problem adding partition %s to list\n", spacer, tempSetName); |
---|
5897 | return (ERROR); |
---|
5898 | } |
---|
5899 | |
---|
5900 | /* add new partition */ |
---|
5901 | for (i=0; i<numChar; i++) { |
---|
5902 | partitionId[i] = (int *) SafeRealloc ((void *)(partitionId[i]), (size_t)((numDefinedPartitions + 1) * sizeof(int))); |
---|
5903 | if (!partitionId[i]) |
---|
5904 | return ERROR; |
---|
5905 | } |
---|
5906 | |
---|
5907 | /* set new partition */ |
---|
5908 | for (i=0; i<numChar; i++) |
---|
5909 | partitionId[i][numDefinedPartitions] = tempSet[i]; |
---|
5910 | |
---|
5911 | /* increment number of defined partitions */ |
---|
5912 | numDefinedPartitions++; |
---|
5913 | |
---|
5914 | return (NO_ERROR); |
---|
5915 | |
---|
5916 | } |
---|
5917 | |
---|
5918 | |
---|
5919 | |
---|
5920 | |
---|
5921 | |
---|
5922 | int DoPartitionParm (char *parmName, char *tkn) |
---|
5923 | |
---|
5924 | { |
---|
5925 | |
---|
5926 | int i, index, tempInt; |
---|
5927 | |
---|
5928 | if (defMatrix == NO) |
---|
5929 | { |
---|
5930 | MrBayesPrint ("%s A matrix must be specified before partitions can be defined\n", spacer); |
---|
5931 | return (ERROR); |
---|
5932 | } |
---|
5933 | |
---|
5934 | if (expecting == Expecting(PARAMETER)) |
---|
5935 | { |
---|
5936 | /* set Partition ( ) ******************************************************************/ |
---|
5937 | if (!strcmp(parmName, "Xxxxxxxxxx")) |
---|
5938 | { |
---|
5939 | /* check size of partition name */ |
---|
5940 | if (strlen(tkn) > 99) |
---|
5941 | { |
---|
5942 | MrBayesPrint ("%s Partition name is too long. Max 100 characters\n", spacer); |
---|
5943 | return (ERROR); |
---|
5944 | } |
---|
5945 | |
---|
5946 | /* check to see if the name has already been used as a partition */ |
---|
5947 | if (numDefinedPartitions > 1) |
---|
5948 | { |
---|
5949 | if (CheckString (partitionNames, numDefinedPartitions, tkn, &index) == ERROR) |
---|
5950 | { |
---|
5951 | /* if the partition name has not been used, then we should have an ERROR returned */ |
---|
5952 | /* we _want_ to be here */ |
---|
5953 | |
---|
5954 | } |
---|
5955 | else |
---|
5956 | { |
---|
5957 | MrBayesPrint ("%s Partition name '%s' has been used previously\n", spacer, tkn); |
---|
5958 | return (ERROR); |
---|
5959 | } |
---|
5960 | } |
---|
5961 | |
---|
5962 | /* add the name temporarily to tempSetName */ |
---|
5963 | strcpy (tempSetName, tkn); |
---|
5964 | |
---|
5965 | /* clear tempSet */ |
---|
5966 | for (i=0; i<numChar; i++) |
---|
5967 | tempSet[i] = 0; |
---|
5968 | |
---|
5969 | fromI = toJ = everyK = -1; |
---|
5970 | foundDash = foundSlash = NO; |
---|
5971 | whichPartition = 0; |
---|
5972 | foundFirst = NO; |
---|
5973 | numDivisions = 0; |
---|
5974 | MrBayesPrint ("%s Defining partition called %s\n", spacer, tkn); |
---|
5975 | expecting = Expecting(EQUALSIGN); |
---|
5976 | } |
---|
5977 | else |
---|
5978 | return (ERROR); |
---|
5979 | } |
---|
5980 | else if (expecting == Expecting(EQUALSIGN)) |
---|
5981 | { |
---|
5982 | expecting = Expecting(NUMBER); |
---|
5983 | } |
---|
5984 | else if (expecting == Expecting(ALPHA)) |
---|
5985 | { |
---|
5986 | /* We are defining a partition in terms of a character set (called tkn, here). We should be able |
---|
5987 | to find tkn in the list of character set names. If we cannot, then we have a problem and |
---|
5988 | return an error. */ |
---|
5989 | if (numCharSets < 1) |
---|
5990 | { |
---|
5991 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
5992 | return (ERROR); |
---|
5993 | } |
---|
5994 | if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR) |
---|
5995 | { |
---|
5996 | MrBayesPrint ("%s Could not find a character set called %s\n", spacer, tkn); |
---|
5997 | return (ERROR); |
---|
5998 | } |
---|
5999 | /* add characters from charset tkn to new tempSet */ |
---|
6000 | for (i=0; i<numChar; i++) |
---|
6001 | { |
---|
6002 | if (IsBitSet (i, charSet[index]) == YES) |
---|
6003 | tempSet[i] = whichPartition + 1; |
---|
6004 | } |
---|
6005 | fromI = toJ = everyK = -1; |
---|
6006 | |
---|
6007 | expecting = Expecting(ALPHA); |
---|
6008 | expecting |= Expecting(NUMBER); |
---|
6009 | expecting |= Expecting(SEMICOLON); |
---|
6010 | expecting |= Expecting(COMMA); |
---|
6011 | } |
---|
6012 | else if (expecting == Expecting(NUMBER)) |
---|
6013 | { |
---|
6014 | if (foundFirst == NO) |
---|
6015 | { |
---|
6016 | sscanf (tkn, "%d", &tempInt); |
---|
6017 | numDivisions = tempInt; |
---|
6018 | expecting = Expecting(COLON); |
---|
6019 | foundFirst = YES; |
---|
6020 | } |
---|
6021 | else |
---|
6022 | { |
---|
6023 | if (strlen(tkn) == 1 && tkn[0] == '.') |
---|
6024 | tempInt = numChar; |
---|
6025 | else |
---|
6026 | sscanf (tkn, "%d", &tempInt); |
---|
6027 | if (tempInt <= 0 || tempInt > numChar) |
---|
6028 | { |
---|
6029 | MrBayesPrint ("%s Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar); |
---|
6030 | return (ERROR); |
---|
6031 | } |
---|
6032 | tempInt--; |
---|
6033 | if (foundDash == YES) |
---|
6034 | { |
---|
6035 | if (fromI >= 0) |
---|
6036 | toJ = tempInt; |
---|
6037 | else |
---|
6038 | { |
---|
6039 | MrBayesPrint ("%s Improperly formatted partition\n", spacer); |
---|
6040 | return (ERROR); |
---|
6041 | } |
---|
6042 | foundDash = NO; |
---|
6043 | } |
---|
6044 | else if (foundSlash == YES) |
---|
6045 | { |
---|
6046 | tempInt++; |
---|
6047 | if (tempInt <= 1) |
---|
6048 | { |
---|
6049 | MrBayesPrint ("%s Improperly formatted charset\n", spacer); |
---|
6050 | return (ERROR); |
---|
6051 | } |
---|
6052 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
6053 | everyK = tempInt; |
---|
6054 | else |
---|
6055 | { |
---|
6056 | MrBayesPrint ("%s Improperly formatted charset\n", spacer); |
---|
6057 | return (ERROR); |
---|
6058 | } |
---|
6059 | foundSlash = NO; |
---|
6060 | } |
---|
6061 | else |
---|
6062 | { |
---|
6063 | if (fromI >= 0 && toJ < 0) |
---|
6064 | { |
---|
6065 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
6066 | return (ERROR); |
---|
6067 | fromI = tempInt; |
---|
6068 | } |
---|
6069 | else if (fromI < 0 && toJ < 0) |
---|
6070 | { |
---|
6071 | fromI = tempInt; |
---|
6072 | } |
---|
6073 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
6074 | { |
---|
6075 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
6076 | return (ERROR); |
---|
6077 | fromI = tempInt; |
---|
6078 | toJ = everyK = -1; |
---|
6079 | } |
---|
6080 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
6081 | { |
---|
6082 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
6083 | return (ERROR); |
---|
6084 | fromI = tempInt; |
---|
6085 | toJ = everyK = -1; |
---|
6086 | } |
---|
6087 | else |
---|
6088 | { |
---|
6089 | MrBayesPrint ("%s Improperly formatted charset\n", spacer); |
---|
6090 | { |
---|
6091 | return (ERROR); |
---|
6092 | } |
---|
6093 | } |
---|
6094 | } |
---|
6095 | |
---|
6096 | expecting = Expecting(ALPHA); |
---|
6097 | expecting |= Expecting(NUMBER); |
---|
6098 | expecting |= Expecting(SEMICOLON); |
---|
6099 | expecting |= Expecting(DASH); |
---|
6100 | expecting |= Expecting(BACKSLASH); |
---|
6101 | expecting |= Expecting(COMMA); |
---|
6102 | } |
---|
6103 | } |
---|
6104 | else if (expecting == Expecting(COMMA)) |
---|
6105 | { |
---|
6106 | /* add set to tempSet */ |
---|
6107 | if (fromI >= 0) |
---|
6108 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
6109 | return (ERROR); |
---|
6110 | |
---|
6111 | fromI = toJ = everyK = -1; |
---|
6112 | foundDash = foundSlash = NO; |
---|
6113 | whichPartition++; |
---|
6114 | if (whichPartition > numDivisions) |
---|
6115 | { |
---|
6116 | MrBayesPrint ("%s Too many partitions of the data (expecting %d)\n", spacer, numDivisions); |
---|
6117 | return (ERROR); |
---|
6118 | } |
---|
6119 | expecting = Expecting(NUMBER); |
---|
6120 | expecting |= Expecting(ALPHA); |
---|
6121 | } |
---|
6122 | else if (expecting == Expecting(COLON)) |
---|
6123 | { |
---|
6124 | expecting = Expecting(NUMBER); |
---|
6125 | expecting |= Expecting(ALPHA); |
---|
6126 | } |
---|
6127 | else if (expecting == Expecting(DASH)) |
---|
6128 | { |
---|
6129 | foundDash = YES; |
---|
6130 | expecting = Expecting(NUMBER); |
---|
6131 | } |
---|
6132 | else if (expecting == Expecting(BACKSLASH)) |
---|
6133 | { |
---|
6134 | foundSlash = YES; |
---|
6135 | expecting = Expecting(NUMBER); |
---|
6136 | } |
---|
6137 | else |
---|
6138 | return (ERROR); |
---|
6139 | |
---|
6140 | return (NO_ERROR); |
---|
6141 | |
---|
6142 | } |
---|
6143 | |
---|
6144 | |
---|
6145 | int DoRestore (void) |
---|
6146 | |
---|
6147 | { |
---|
6148 | |
---|
6149 | int i, alreadyDone; |
---|
6150 | |
---|
6151 | MrBayesPrint ("%s Restore taxa\n", spacer); |
---|
6152 | |
---|
6153 | /* add set to tempSet */ |
---|
6154 | if (fromI >= 0 && toJ < 0) |
---|
6155 | { |
---|
6156 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6157 | return (ERROR); |
---|
6158 | } |
---|
6159 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
6160 | { |
---|
6161 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6162 | return (ERROR); |
---|
6163 | } |
---|
6164 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
6165 | { |
---|
6166 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6167 | return (ERROR); |
---|
6168 | } |
---|
6169 | |
---|
6170 | /* merge tempSet with excludedTaxa */ |
---|
6171 | alreadyDone = NO; |
---|
6172 | for (i=0; i<numTaxa; i++) |
---|
6173 | { |
---|
6174 | if (tempSet[i] == 1) |
---|
6175 | { |
---|
6176 | if (taxaInfo[i].isDeleted == NO && alreadyDone == NO) |
---|
6177 | { |
---|
6178 | MrBayesPrint ("%s Some taxa already included\n", spacer); |
---|
6179 | alreadyDone = YES; |
---|
6180 | } |
---|
6181 | taxaInfo[i].isDeleted = NO; |
---|
6182 | } |
---|
6183 | } |
---|
6184 | |
---|
6185 | SetLocalTaxa(); |
---|
6186 | |
---|
6187 | /* show tempSet (for debugging) */ |
---|
6188 | # if 0 |
---|
6189 | for (i=0; i<numTaxa; i++) |
---|
6190 | MrBayesPrint ("%4d %4d\n", i+1, tempSet[i]); |
---|
6191 | # endif |
---|
6192 | |
---|
6193 | return (NO_ERROR); |
---|
6194 | |
---|
6195 | } |
---|
6196 | |
---|
6197 | |
---|
6198 | |
---|
6199 | |
---|
6200 | |
---|
6201 | int DoRestoreParm (char *parmName, char *tkn) |
---|
6202 | |
---|
6203 | { |
---|
6204 | |
---|
6205 | int i, index, tempInt; |
---|
6206 | |
---|
6207 | if (defMatrix == NO) |
---|
6208 | { |
---|
6209 | MrBayesPrint ("%s A matrix must be specified before you can restore taxa\n", spacer); |
---|
6210 | return (ERROR); |
---|
6211 | } |
---|
6212 | |
---|
6213 | if (foundFirst == NO) |
---|
6214 | { |
---|
6215 | /* this is the first time in */ |
---|
6216 | fromI = toJ = everyK = -1; |
---|
6217 | foundDash = NO; |
---|
6218 | for (i=0; i<numTaxa; i++) /* clear tempSet */ |
---|
6219 | tempSet[i] = 0; |
---|
6220 | foundFirst = YES; |
---|
6221 | } |
---|
6222 | |
---|
6223 | if (expecting == Expecting(ALPHA)) |
---|
6224 | { |
---|
6225 | if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH) |
---|
6226 | { |
---|
6227 | for (i=0; i<numTaxa; i++) |
---|
6228 | tempSet[i] = 1; |
---|
6229 | } |
---|
6230 | else |
---|
6231 | { |
---|
6232 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
6233 | { |
---|
6234 | /* we are using a pre-defined taxa set */ |
---|
6235 | if (numTaxaSets < 1) |
---|
6236 | { |
---|
6237 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
6238 | return (ERROR); |
---|
6239 | } |
---|
6240 | if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR) |
---|
6241 | { |
---|
6242 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
6243 | return (ERROR); |
---|
6244 | } |
---|
6245 | /* add taxa from taxset tkn to new tempSet */ |
---|
6246 | for (i=0; i<numTaxa; i++) |
---|
6247 | { |
---|
6248 | if (IsBitSet (i, taxaSet[index]) == YES) |
---|
6249 | tempSet[i] = 1; |
---|
6250 | } |
---|
6251 | } |
---|
6252 | else |
---|
6253 | { |
---|
6254 | /* we found the taxon name */ |
---|
6255 | if (fromI >= 0 && toJ < 0) |
---|
6256 | { |
---|
6257 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6258 | return (ERROR); |
---|
6259 | } |
---|
6260 | else if (fromI >= 0 && toJ >= 0) |
---|
6261 | { |
---|
6262 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6263 | return (ERROR); |
---|
6264 | } |
---|
6265 | tempSet[index] = 1; |
---|
6266 | } |
---|
6267 | fromI = toJ = everyK = -1; |
---|
6268 | } |
---|
6269 | |
---|
6270 | expecting = Expecting(ALPHA); |
---|
6271 | expecting |= Expecting(NUMBER); |
---|
6272 | expecting |= Expecting(SEMICOLON); |
---|
6273 | } |
---|
6274 | else if (expecting == Expecting(NUMBER)) |
---|
6275 | { |
---|
6276 | if (strlen(tkn) == 1 && !strcmp(tkn, ".")) |
---|
6277 | { |
---|
6278 | tempInt = numTaxa; |
---|
6279 | } |
---|
6280 | else |
---|
6281 | { |
---|
6282 | sscanf (tkn, "%d", &tempInt); |
---|
6283 | if (tempInt <= 0 || tempInt > numTaxa) |
---|
6284 | { |
---|
6285 | MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa); |
---|
6286 | return (ERROR); |
---|
6287 | } |
---|
6288 | } |
---|
6289 | tempInt--; |
---|
6290 | if (foundDash == YES) |
---|
6291 | { |
---|
6292 | if (fromI >= 0) |
---|
6293 | toJ = tempInt; |
---|
6294 | else |
---|
6295 | { |
---|
6296 | MrBayesPrint ("%s Improperly formatted restore set\n", spacer); |
---|
6297 | return (ERROR); |
---|
6298 | } |
---|
6299 | foundDash = NO; |
---|
6300 | } |
---|
6301 | else |
---|
6302 | { |
---|
6303 | if (fromI >= 0 && toJ < 0) |
---|
6304 | { |
---|
6305 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6306 | return (ERROR); |
---|
6307 | fromI = tempInt; |
---|
6308 | } |
---|
6309 | else if (fromI < 0 && toJ < 0) |
---|
6310 | { |
---|
6311 | fromI = tempInt; |
---|
6312 | } |
---|
6313 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
6314 | { |
---|
6315 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6316 | return (ERROR); |
---|
6317 | fromI = tempInt; |
---|
6318 | toJ = everyK = -1; |
---|
6319 | } |
---|
6320 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
6321 | { |
---|
6322 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
6323 | return (ERROR); |
---|
6324 | fromI = tempInt; |
---|
6325 | toJ = everyK = -1; |
---|
6326 | } |
---|
6327 | else |
---|
6328 | { |
---|
6329 | MrBayesPrint ("%s Improperly formatted restore set\n", spacer); |
---|
6330 | { |
---|
6331 | return (ERROR); |
---|
6332 | } |
---|
6333 | } |
---|
6334 | } |
---|
6335 | expecting = Expecting(ALPHA); |
---|
6336 | expecting |= Expecting(NUMBER); |
---|
6337 | expecting |= Expecting(SEMICOLON); |
---|
6338 | expecting |= Expecting(DASH); |
---|
6339 | } |
---|
6340 | else if (expecting == Expecting(DASH)) |
---|
6341 | { |
---|
6342 | foundDash = YES; |
---|
6343 | expecting = Expecting(NUMBER); |
---|
6344 | } |
---|
6345 | else |
---|
6346 | return (ERROR); |
---|
6347 | |
---|
6348 | return (NO_ERROR); |
---|
6349 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
6350 | |
---|
6351 | } |
---|
6352 | |
---|
6353 | |
---|
6354 | |
---|
6355 | |
---|
6356 | |
---|
6357 | int DoSet (void) |
---|
6358 | |
---|
6359 | { |
---|
6360 | |
---|
6361 | return (NO_ERROR); |
---|
6362 | |
---|
6363 | } |
---|
6364 | |
---|
6365 | |
---|
6366 | |
---|
6367 | |
---|
6368 | |
---|
6369 | int DoSetParm (char *parmName, char *tkn) |
---|
6370 | |
---|
6371 | { |
---|
6372 | |
---|
6373 | int index; |
---|
6374 | char tempStr[100]; |
---|
6375 | int tempI; |
---|
6376 | |
---|
6377 | if (expecting == Expecting(PARAMETER)) |
---|
6378 | { |
---|
6379 | expecting = Expecting(EQUALSIGN); |
---|
6380 | } |
---|
6381 | else |
---|
6382 | { |
---|
6383 | /* set Autoclose (autoClose) **********************************************************/ |
---|
6384 | if (!strcmp(parmName, "Autoclose")) |
---|
6385 | { |
---|
6386 | if (expecting == Expecting(EQUALSIGN)) |
---|
6387 | expecting = Expecting(ALPHA); |
---|
6388 | else if (expecting == Expecting(ALPHA)) |
---|
6389 | { |
---|
6390 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6391 | { |
---|
6392 | if (!strcmp(tempStr, "Yes")) |
---|
6393 | autoClose = YES; |
---|
6394 | else |
---|
6395 | autoClose = NO; |
---|
6396 | } |
---|
6397 | else |
---|
6398 | { |
---|
6399 | MrBayesPrint ("%s Invalid argument for autoclose\n", spacer); |
---|
6400 | return (ERROR); |
---|
6401 | } |
---|
6402 | if (autoClose == YES) |
---|
6403 | MrBayesPrint ("%s Setting autoclose to yes\n", spacer); |
---|
6404 | else |
---|
6405 | MrBayesPrint ("%s Setting autoclose to no\n", spacer); |
---|
6406 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6407 | } |
---|
6408 | else |
---|
6409 | return (ERROR); |
---|
6410 | } |
---|
6411 | /* set Nowarnings (noWarn) **********************************************************/ |
---|
6412 | else if (!strcmp(parmName, "Nowarnings")) |
---|
6413 | { |
---|
6414 | if (expecting == Expecting(EQUALSIGN)) |
---|
6415 | expecting = Expecting(ALPHA); |
---|
6416 | else if (expecting == Expecting(ALPHA)) |
---|
6417 | { |
---|
6418 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6419 | { |
---|
6420 | if (!strcmp(tempStr, "Yes")) |
---|
6421 | noWarn = YES; |
---|
6422 | else |
---|
6423 | noWarn = NO; |
---|
6424 | } |
---|
6425 | else |
---|
6426 | { |
---|
6427 | MrBayesPrint ("%s Invalid argument for nowarnings\n", spacer); |
---|
6428 | return (ERROR); |
---|
6429 | } |
---|
6430 | if (noWarn == YES) |
---|
6431 | MrBayesPrint ("%s Setting nowarnings to yes\n", spacer); |
---|
6432 | else |
---|
6433 | MrBayesPrint ("%s Setting nowarnings to no\n", spacer); |
---|
6434 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6435 | } |
---|
6436 | else |
---|
6437 | return (ERROR); |
---|
6438 | } |
---|
6439 | /* set Quitonerror (quitOnError) **************************************************/ |
---|
6440 | else if (!strcmp(parmName, "Quitonerror")) |
---|
6441 | { |
---|
6442 | if (expecting == Expecting(EQUALSIGN)) |
---|
6443 | expecting = Expecting(ALPHA); |
---|
6444 | else if (expecting == Expecting(ALPHA)) |
---|
6445 | { |
---|
6446 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6447 | { |
---|
6448 | if (!strcmp(tempStr, "Yes")) |
---|
6449 | quitOnError = YES; |
---|
6450 | else |
---|
6451 | quitOnError = NO; |
---|
6452 | } |
---|
6453 | else |
---|
6454 | { |
---|
6455 | MrBayesPrint ("%s Invalid argument for quitonerror\n", spacer); |
---|
6456 | return (ERROR); |
---|
6457 | } |
---|
6458 | if (quitOnError == YES) |
---|
6459 | MrBayesPrint ("%s Setting quitonerror to yes\n", spacer); |
---|
6460 | else |
---|
6461 | MrBayesPrint ("%s Setting quitonerror to no\n", spacer); |
---|
6462 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6463 | } |
---|
6464 | else |
---|
6465 | return (ERROR); |
---|
6466 | } |
---|
6467 | /* set Autoreplace (autoOverwrite) **************************************************/ |
---|
6468 | else if (!strcmp(parmName, "Autoreplace")) |
---|
6469 | { |
---|
6470 | if (expecting == Expecting(EQUALSIGN)) |
---|
6471 | expecting = Expecting(ALPHA); |
---|
6472 | else if (expecting == Expecting(ALPHA)) |
---|
6473 | { |
---|
6474 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6475 | { |
---|
6476 | if (!strcmp(tempStr, "Yes")) |
---|
6477 | { |
---|
6478 | autoOverwrite = YES; |
---|
6479 | MrBayesPrint ("%s Setting autoreplace to yes\n", spacer); |
---|
6480 | } |
---|
6481 | else |
---|
6482 | { |
---|
6483 | autoOverwrite = NO; |
---|
6484 | MrBayesPrint ("%s Setting autoreplace to no\n", spacer); |
---|
6485 | } |
---|
6486 | } |
---|
6487 | else |
---|
6488 | { |
---|
6489 | MrBayesPrint ("%s Invalid argument for autoreplace\n", spacer); |
---|
6490 | return (ERROR); |
---|
6491 | } |
---|
6492 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6493 | } |
---|
6494 | else |
---|
6495 | return (ERROR); |
---|
6496 | } |
---|
6497 | /* set Scientific (scientific) *********************************************/ |
---|
6498 | else if (!strcmp(parmName, "Scientific")) |
---|
6499 | { |
---|
6500 | if (expecting == Expecting(EQUALSIGN)) |
---|
6501 | expecting = Expecting(ALPHA); |
---|
6502 | else if (expecting == Expecting(ALPHA)) |
---|
6503 | { |
---|
6504 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6505 | { |
---|
6506 | if (!strcmp(tempStr, "Yes")) |
---|
6507 | scientific = YES; |
---|
6508 | else |
---|
6509 | scientific = NO; |
---|
6510 | } |
---|
6511 | else |
---|
6512 | { |
---|
6513 | MrBayesPrint ("%s Invalid argument for Scientific\n", spacer); |
---|
6514 | return (ERROR); |
---|
6515 | } |
---|
6516 | if ( scientific == YES) |
---|
6517 | MrBayesPrint ("%s Setting Scientific to Yes\n", spacer); |
---|
6518 | else |
---|
6519 | MrBayesPrint ("%s Setting Scientific to No\n", spacer); |
---|
6520 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6521 | } |
---|
6522 | else |
---|
6523 | return (ERROR); |
---|
6524 | } |
---|
6525 | /* set Userlevel (userLevel) **********************************************************/ |
---|
6526 | else if (!strcmp(parmName, "Userlevel")) |
---|
6527 | { |
---|
6528 | if (expecting == Expecting(EQUALSIGN)) |
---|
6529 | expecting = Expecting(ALPHA); |
---|
6530 | else if (expecting == Expecting(ALPHA)) |
---|
6531 | { |
---|
6532 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6533 | { |
---|
6534 | if (!strcmp(tempStr, "Standard")) |
---|
6535 | userLevel = STANDARD_USER; |
---|
6536 | else if (!strcmp (tempStr,"Developer")) |
---|
6537 | userLevel = DEVELOPER; |
---|
6538 | } |
---|
6539 | else |
---|
6540 | { |
---|
6541 | MrBayesPrint ("%s Invalid argument for userlevel\n", spacer); |
---|
6542 | return (ERROR); |
---|
6543 | } |
---|
6544 | MrBayesPrint ("%s Setting userlevel to %s\n", spacer, tempStr); |
---|
6545 | if (SetMoves() == ERROR) |
---|
6546 | { |
---|
6547 | MrBayesPrint ("%s Problem seting up the moves for this user level\n", spacer); |
---|
6548 | return (ERROR); |
---|
6549 | } |
---|
6550 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6551 | } |
---|
6552 | else |
---|
6553 | return (ERROR); |
---|
6554 | } |
---|
6555 | /* set Npthreads (number of pthreads) ****************************************************/ |
---|
6556 | else if (!strcmp(parmName, "Npthreads")) |
---|
6557 | { |
---|
6558 | if (expecting == Expecting(EQUALSIGN)) |
---|
6559 | expecting = Expecting(NUMBER); |
---|
6560 | else if (expecting == Expecting(NUMBER)) |
---|
6561 | { |
---|
6562 | sscanf (tkn, "%d", &tempI); |
---|
6563 | nPThreads = tempI; |
---|
6564 | MrBayesPrint ("%s Setting Npthreads to %ld\n", spacer, nPThreads); |
---|
6565 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6566 | } |
---|
6567 | else |
---|
6568 | return (ERROR); |
---|
6569 | } |
---|
6570 | /* set Precision (number of decimals) ****************************************************/ |
---|
6571 | else if (!strcmp(parmName, "Precision")) |
---|
6572 | { |
---|
6573 | if (expecting == Expecting(EQUALSIGN)) |
---|
6574 | expecting = Expecting(NUMBER); |
---|
6575 | else if (expecting == Expecting(NUMBER)) |
---|
6576 | { |
---|
6577 | sscanf (tkn, "%d", &tempI); |
---|
6578 | if (tempI < 3 || tempI > 15) |
---|
6579 | { |
---|
6580 | MrBayesPrint ("%s Precision must be in the range 3 to 15\n", spacer); |
---|
6581 | return ERROR; |
---|
6582 | } |
---|
6583 | precision = tempI; |
---|
6584 | MrBayesPrint ("%s Setting Precision to %d\n", spacer, precision); |
---|
6585 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6586 | } |
---|
6587 | else |
---|
6588 | return (ERROR); |
---|
6589 | } |
---|
6590 | /* set Partition (partitionNum) *******************************************************/ |
---|
6591 | else if (!strcmp(parmName, "Partition")) |
---|
6592 | { |
---|
6593 | if (defMatrix == NO) |
---|
6594 | { |
---|
6595 | MrBayesPrint ("%s A character matrix must be defined first\n", spacer); |
---|
6596 | return (ERROR); |
---|
6597 | } |
---|
6598 | if (expecting == Expecting(EQUALSIGN)) |
---|
6599 | expecting = Expecting(ALPHA) | Expecting(NUMBER); |
---|
6600 | else if (expecting == Expecting(ALPHA)) |
---|
6601 | { |
---|
6602 | /* first check to see if name is there */ |
---|
6603 | if (CheckString (partitionNames, numDefinedPartitions, tkn, &index) == ERROR) |
---|
6604 | { |
---|
6605 | MrBayesPrint ("%s Could not find \"%s\" as a defined partition\n", spacer, tkn); |
---|
6606 | return (ERROR); |
---|
6607 | } |
---|
6608 | if (SetPartition (index) == ERROR) |
---|
6609 | return ERROR; |
---|
6610 | if (numCurrentDivisions == 1) |
---|
6611 | MrBayesPrint ("%s Setting %s as the partition (does not divide up characters).\n", spacer, tkn); |
---|
6612 | else |
---|
6613 | MrBayesPrint ("%s Setting %s as the partition, dividing characters into %d parts.\n", spacer, tkn, numCurrentDivisions); |
---|
6614 | if (SetModelDefaults () == ERROR) |
---|
6615 | return (ERROR); |
---|
6616 | if (SetUpAnalysis (&globalSeed) == ERROR) |
---|
6617 | return (ERROR); |
---|
6618 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6619 | } |
---|
6620 | else if (expecting == Expecting(NUMBER)) |
---|
6621 | { |
---|
6622 | sscanf (tkn, "%d", &index); |
---|
6623 | if (index > numDefinedPartitions) |
---|
6624 | { |
---|
6625 | MrBayesPrint ("%s Partition number %d is not a valid partition. Only %d partitions\n", spacer, index, numDefinedPartitions); |
---|
6626 | MrBayesPrint ("%s have been defined.\n", spacer); |
---|
6627 | return (ERROR); |
---|
6628 | } |
---|
6629 | if (index < 1) |
---|
6630 | { |
---|
6631 | MrBayesPrint ("%s Partition number %d is not a valid partition. Must be between 1 and %d.\n", spacer, index+1, numDefinedPartitions); |
---|
6632 | return (ERROR); |
---|
6633 | } |
---|
6634 | if (SetPartition (index) == ERROR) |
---|
6635 | return ERROR; |
---|
6636 | if (numCurrentDivisions == 1) |
---|
6637 | MrBayesPrint ("%s Setting %s as the partition (does not divide up characters).\n", spacer, partitionNames[index]); |
---|
6638 | else |
---|
6639 | MrBayesPrint ("%s Setting %s as the partition, dividing characters into %d parts.\n", spacer, partitionNames[index], numCurrentDivisions); |
---|
6640 | if (SetModelDefaults () == ERROR) |
---|
6641 | return (ERROR); |
---|
6642 | if (SetUpAnalysis (&globalSeed) == ERROR) |
---|
6643 | return (ERROR); |
---|
6644 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6645 | } |
---|
6646 | else |
---|
6647 | return (ERROR); |
---|
6648 | } |
---|
6649 | /* set Speciespartition (speciespartitionNum) *******************************************************/ |
---|
6650 | else if (!strcmp(parmName, "Speciespartition")) |
---|
6651 | { |
---|
6652 | if (defTaxa == NO) |
---|
6653 | { |
---|
6654 | MrBayesPrint ("%s A taxaset must be defined first\n", spacer); |
---|
6655 | return (ERROR); |
---|
6656 | } |
---|
6657 | if (expecting == Expecting(EQUALSIGN)) |
---|
6658 | expecting = Expecting(ALPHA) | Expecting(NUMBER); |
---|
6659 | else if (expecting == Expecting(ALPHA)) |
---|
6660 | { |
---|
6661 | /* first check to see if name is there */ |
---|
6662 | if (CheckString (speciespartitionNames, numDefinedSpeciespartitions, tkn, &index) == ERROR) |
---|
6663 | { |
---|
6664 | MrBayesPrint ("%s Could not find \"%s\" as a defined speciespartition\n", spacer, tkn); |
---|
6665 | return (ERROR); |
---|
6666 | } |
---|
6667 | if (SetSpeciespartition (index) == ERROR) |
---|
6668 | return ERROR; |
---|
6669 | MrBayesPrint ("%s Setting %s as the speciespartition, dividing taxa into %d species.\n", spacer, tkn, numSpecies); |
---|
6670 | if (SetModelDefaults () == ERROR) |
---|
6671 | return (ERROR); |
---|
6672 | if (SetUpAnalysis (&globalSeed) == ERROR) |
---|
6673 | return (ERROR); |
---|
6674 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6675 | } |
---|
6676 | else if (expecting == Expecting(NUMBER)) |
---|
6677 | { |
---|
6678 | sscanf (tkn, "%d", &index); |
---|
6679 | if (index > numDefinedSpeciespartitions) |
---|
6680 | { |
---|
6681 | MrBayesPrint ("%s Speciespartition number %d is not valid. Only %d speciespartitions\n", spacer, index, numDefinedSpeciespartitions); |
---|
6682 | MrBayesPrint ("%s have been defined.\n", spacer); |
---|
6683 | return (ERROR); |
---|
6684 | } |
---|
6685 | if (index < 1) |
---|
6686 | { |
---|
6687 | MrBayesPrint ("%s Speciespartition number %d is not valid. Must be between 1 and %d.\n", spacer, index, numDefinedSpeciespartitions); |
---|
6688 | return (ERROR); |
---|
6689 | } |
---|
6690 | if (SetSpeciespartition (index-1) == ERROR) |
---|
6691 | return ERROR; |
---|
6692 | MrBayesPrint ("%s Setting %s as the speciespartition, dividing taxa into %d species.\n", spacer, speciespartitionNames[index-1], numSpecies); |
---|
6693 | if (SetModelDefaults () == ERROR) |
---|
6694 | return (ERROR); |
---|
6695 | if (SetUpAnalysis (&globalSeed) == ERROR) |
---|
6696 | return (ERROR); |
---|
6697 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6698 | } |
---|
6699 | else |
---|
6700 | return (ERROR); |
---|
6701 | } |
---|
6702 | /* set Seed (global variable globalSeed) ****************************************************/ |
---|
6703 | else if (!strcmp(parmName, "Seed")) |
---|
6704 | { |
---|
6705 | if (expecting == Expecting(EQUALSIGN)) |
---|
6706 | expecting = Expecting(NUMBER); |
---|
6707 | else if (expecting == Expecting(NUMBER)) |
---|
6708 | { |
---|
6709 | sscanf (tkn, "%d", &tempI); |
---|
6710 | if( tempI == 0 || tempI == 2147483647 ) |
---|
6711 | { |
---|
6712 | MrBayesPrint ("%s Error: Seed can be any natural number except 0 and 2147483647\n", spacer); |
---|
6713 | return (ERROR); |
---|
6714 | } |
---|
6715 | globalSeed = tempI; |
---|
6716 | MrBayesPrint ("%s Setting seed to %ld\n", spacer, globalSeed); |
---|
6717 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6718 | } |
---|
6719 | else |
---|
6720 | return (ERROR); |
---|
6721 | } |
---|
6722 | /* set Swapseed (global variable swapSeed) ***************************************************************/ |
---|
6723 | else if (!strcmp(parmName, "Swapseed")) |
---|
6724 | { |
---|
6725 | if (expecting == Expecting(EQUALSIGN)) |
---|
6726 | expecting = Expecting(NUMBER); |
---|
6727 | else if (expecting == Expecting(NUMBER)) |
---|
6728 | { |
---|
6729 | sscanf (tkn, "%d", &tempI); |
---|
6730 | if( tempI == 0 || tempI == 2147483647 ) |
---|
6731 | { |
---|
6732 | MrBayesPrint ("%s Error: Swapseed can be any natural number except 0 and 2147483647\n", spacer); |
---|
6733 | return (ERROR); |
---|
6734 | } |
---|
6735 | swapSeed = tempI; |
---|
6736 | MrBayesPrint ("%s Setting swapseed to %ld\n", spacer, swapSeed); |
---|
6737 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6738 | } |
---|
6739 | else |
---|
6740 | return (ERROR); |
---|
6741 | } |
---|
6742 | /* set Dir (global variable workingDir) ***************************************************************/ |
---|
6743 | else if (!strcmp(parmName, "Dir")) |
---|
6744 | { |
---|
6745 | if (expecting == Expecting(EQUALSIGN)) |
---|
6746 | { |
---|
6747 | expecting = Expecting(ALPHA); |
---|
6748 | readWord = YES; |
---|
6749 | } |
---|
6750 | else if (expecting == Expecting(ALPHA)) |
---|
6751 | { |
---|
6752 | if(strlen(tkn)>99) |
---|
6753 | { |
---|
6754 | MrBayesPrint ("%s Maximum allowed length of working directory name is 99 characters. The given name:\n", spacer); |
---|
6755 | MrBayesPrint ("%s '%s'\n", spacer,tkn); |
---|
6756 | MrBayesPrint ("%s has %d characters.\n", spacer,strlen(tkn)); |
---|
6757 | return (ERROR); |
---|
6758 | } |
---|
6759 | strcpy (workingDir, tkn); |
---|
6760 | #if defined (WIN_VERSION) |
---|
6761 | /* Reformat to Windows with trailing '\' */ |
---|
6762 | for (index=0; index<(int)strlen(workingDir); index++) |
---|
6763 | { |
---|
6764 | if (workingDir[index] == ':' || workingDir[index] == '/') |
---|
6765 | workingDir[index] = '\\'; |
---|
6766 | } |
---|
6767 | if (strlen(workingDir) > 0 && workingDir[strlen(workingDir)-1] != '\\') |
---|
6768 | strcat(workingDir,"\\"); |
---|
6769 | #else |
---|
6770 | /* Reformat to Unix with trailing '/' */ |
---|
6771 | for (index=0; index<(int)strlen(workingDir); index++) |
---|
6772 | { |
---|
6773 | if (workingDir[index] == ':' || workingDir[index] == '\\') |
---|
6774 | workingDir[index] = '/'; |
---|
6775 | } |
---|
6776 | if (strlen(workingDir) > 0 && workingDir[strlen(workingDir)-1] != '/') |
---|
6777 | strcat(workingDir,"/"); |
---|
6778 | #endif |
---|
6779 | MrBayesPrint ("%s Setting working directory to \"%s\"\n", spacer, workingDir); |
---|
6780 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6781 | } |
---|
6782 | else |
---|
6783 | return (ERROR); |
---|
6784 | } |
---|
6785 | /* set Usebeagle (global variable BEAGLE usage) ***************************************************************/ |
---|
6786 | else if (!strcmp(parmName, "Usebeagle")) |
---|
6787 | { |
---|
6788 | if (expecting == Expecting(EQUALSIGN)) |
---|
6789 | expecting = Expecting(ALPHA); |
---|
6790 | else if (expecting == Expecting(ALPHA)) |
---|
6791 | { |
---|
6792 | #if defined (BEAGLE_ENABLED) |
---|
6793 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6794 | { |
---|
6795 | if (!strcmp(tempStr, "Yes")) |
---|
6796 | tryToUseBEAGLE = YES; |
---|
6797 | else |
---|
6798 | tryToUseBEAGLE = NO; |
---|
6799 | } |
---|
6800 | else |
---|
6801 | { |
---|
6802 | MrBayesPrint ("%s Invalid argument for usebeagle\n", spacer); |
---|
6803 | return (ERROR); |
---|
6804 | } |
---|
6805 | if (tryToUseBEAGLE == YES) |
---|
6806 | MrBayesPrint ("%s Setting usebeagle to yes\n", spacer); |
---|
6807 | else |
---|
6808 | MrBayesPrint ("%s Setting usebeagle to no\n", spacer); |
---|
6809 | #else |
---|
6810 | BeagleNotLinked(); |
---|
6811 | #endif |
---|
6812 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6813 | } |
---|
6814 | else |
---|
6815 | return (ERROR); |
---|
6816 | } |
---|
6817 | /* set Beagle resources requirements (global variable BEAGLE flag) ****************************************/ |
---|
6818 | else if (!strcmp(parmName, "Beagledevice")) |
---|
6819 | { |
---|
6820 | if (expecting == Expecting(EQUALSIGN)) |
---|
6821 | expecting = Expecting(ALPHA); |
---|
6822 | else if (expecting == Expecting(ALPHA)) |
---|
6823 | { |
---|
6824 | #if defined (BEAGLE_ENABLED) |
---|
6825 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6826 | { |
---|
6827 | long oldFlags = beagleFlags; |
---|
6828 | if (!strcmp(tempStr, "Gpu")) |
---|
6829 | { |
---|
6830 | beagleFlags &= ~BEAGLE_FLAG_PROCESSOR_CPU; |
---|
6831 | beagleFlags |= BEAGLE_FLAG_PROCESSOR_GPU; |
---|
6832 | BeagleAddGPUDevicesToList(&beagleResource, &beagleResourceCount); |
---|
6833 | } |
---|
6834 | else |
---|
6835 | { |
---|
6836 | beagleFlags &= ~BEAGLE_FLAG_PROCESSOR_GPU; |
---|
6837 | beagleFlags |= BEAGLE_FLAG_PROCESSOR_CPU; |
---|
6838 | BeagleRemoveGPUDevicesFromList(&beagleResource, &beagleResourceCount); |
---|
6839 | } |
---|
6840 | if (BeagleCheckFlagCompatability(beagleFlags) == NO) { |
---|
6841 | beagleFlags = oldFlags; |
---|
6842 | } else { |
---|
6843 | if (beagleFlags & BEAGLE_FLAG_PROCESSOR_GPU) |
---|
6844 | MrBayesPrint ("%s Setting beagledevice to GPU\n", spacer); |
---|
6845 | else |
---|
6846 | MrBayesPrint ("%s Setting beagledevice to CPU\n", spacer); |
---|
6847 | } |
---|
6848 | } |
---|
6849 | else |
---|
6850 | { |
---|
6851 | MrBayesPrint ("%s Invalid argument for beagledevice\n", spacer); |
---|
6852 | return (ERROR); |
---|
6853 | } |
---|
6854 | #else |
---|
6855 | BeagleNotLinked(); |
---|
6856 | #endif |
---|
6857 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6858 | } |
---|
6859 | else |
---|
6860 | return (ERROR); |
---|
6861 | } |
---|
6862 | else if (!strcmp(parmName, "Beagleprecision")) |
---|
6863 | { |
---|
6864 | if (expecting == Expecting(EQUALSIGN)) |
---|
6865 | expecting = Expecting(ALPHA); |
---|
6866 | else if (expecting == Expecting(ALPHA)) |
---|
6867 | { |
---|
6868 | #if defined (BEAGLE_ENABLED) |
---|
6869 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6870 | { |
---|
6871 | long oldFlags = beagleFlags; |
---|
6872 | if (!strcmp(tempStr, "Single")) |
---|
6873 | { |
---|
6874 | beagleFlags &= ~BEAGLE_FLAG_PRECISION_DOUBLE; |
---|
6875 | beagleFlags |= BEAGLE_FLAG_PRECISION_SINGLE; |
---|
6876 | } |
---|
6877 | else |
---|
6878 | { |
---|
6879 | beagleFlags &= ~BEAGLE_FLAG_PRECISION_SINGLE; |
---|
6880 | beagleFlags |= BEAGLE_FLAG_PRECISION_DOUBLE; |
---|
6881 | } |
---|
6882 | if (BeagleCheckFlagCompatability(beagleFlags) == NO) { |
---|
6883 | beagleFlags = oldFlags; |
---|
6884 | } else { |
---|
6885 | if (beagleFlags & BEAGLE_FLAG_PRECISION_DOUBLE) |
---|
6886 | MrBayesPrint ("%s Setting beagleprecision to double\n", spacer); |
---|
6887 | else |
---|
6888 | MrBayesPrint ("%s Setting beagleprecision to single\n", spacer); |
---|
6889 | } |
---|
6890 | } |
---|
6891 | else |
---|
6892 | { |
---|
6893 | MrBayesPrint ("%s Invalid argument for beagleprecision\n", spacer); |
---|
6894 | return (ERROR); |
---|
6895 | } |
---|
6896 | #else |
---|
6897 | BeagleNotLinked(); |
---|
6898 | #endif |
---|
6899 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6900 | } |
---|
6901 | else |
---|
6902 | return (ERROR); |
---|
6903 | } |
---|
6904 | else if (!strcmp(parmName, "Beagleopenmp")) |
---|
6905 | { |
---|
6906 | if (expecting == Expecting(EQUALSIGN)) |
---|
6907 | expecting = Expecting(ALPHA); |
---|
6908 | else if (expecting == Expecting(ALPHA)) |
---|
6909 | { |
---|
6910 | #if defined (BEAGLE_ENABLED) |
---|
6911 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6912 | { |
---|
6913 | long oldFlags = beagleFlags; |
---|
6914 | if (!strcmp(tempStr, "Yes")) |
---|
6915 | { |
---|
6916 | beagleFlags |= BEAGLE_FLAG_THREADING_OPENMP; |
---|
6917 | } |
---|
6918 | else |
---|
6919 | { |
---|
6920 | beagleFlags &= ~BEAGLE_FLAG_THREADING_OPENMP; |
---|
6921 | } |
---|
6922 | if (BeagleCheckFlagCompatability(beagleFlags) == NO) { |
---|
6923 | beagleFlags = oldFlags; |
---|
6924 | } else { |
---|
6925 | if (beagleFlags & BEAGLE_FLAG_THREADING_OPENMP) |
---|
6926 | MrBayesPrint ("%s Setting beagleopenmp to Yes\n", spacer); |
---|
6927 | else |
---|
6928 | MrBayesPrint ("%s Setting beagleopenmp to No\n", spacer); |
---|
6929 | } |
---|
6930 | } |
---|
6931 | else |
---|
6932 | { |
---|
6933 | MrBayesPrint ("%s Invalid argument for beagleopenmp\n", spacer); |
---|
6934 | return (ERROR); |
---|
6935 | } |
---|
6936 | #else |
---|
6937 | BeagleNotLinked(); |
---|
6938 | #endif |
---|
6939 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6940 | } |
---|
6941 | else |
---|
6942 | return (ERROR); |
---|
6943 | } |
---|
6944 | else if (!strcmp(parmName, "Beaglefreq")) |
---|
6945 | { |
---|
6946 | if (expecting == Expecting(EQUALSIGN)) |
---|
6947 | expecting = Expecting(NUMBER); |
---|
6948 | else if (expecting == Expecting(NUMBER)) |
---|
6949 | { |
---|
6950 | #if defined (BEAGLE_ENABLED) |
---|
6951 | sscanf (tkn, "%d", &tempI); |
---|
6952 | if (tempI < 0) |
---|
6953 | { |
---|
6954 | MrBayesPrint ("%s Beaglefreq must be greater than 0\n", spacer); |
---|
6955 | return ERROR; |
---|
6956 | } |
---|
6957 | beagleScalingFrequency= tempI; |
---|
6958 | MrBayesPrint ("%s Setting Beaglefreq to %d\n", spacer, beagleScalingFrequency); |
---|
6959 | #else |
---|
6960 | BeagleNotLinked(); |
---|
6961 | #endif |
---|
6962 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
6963 | } |
---|
6964 | else |
---|
6965 | return (ERROR); |
---|
6966 | } |
---|
6967 | else if (!strcmp(parmName, "Beaglesse")) |
---|
6968 | { |
---|
6969 | if (expecting == Expecting(EQUALSIGN)) |
---|
6970 | expecting = Expecting(ALPHA); |
---|
6971 | else if (expecting == Expecting(ALPHA)) |
---|
6972 | { |
---|
6973 | #if defined (BEAGLE_ENABLED) |
---|
6974 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
6975 | { |
---|
6976 | long oldFlags = beagleFlags; |
---|
6977 | if (!strcmp(tempStr, "Yes")) |
---|
6978 | { |
---|
6979 | beagleFlags |= BEAGLE_FLAG_VECTOR_SSE; |
---|
6980 | } |
---|
6981 | else |
---|
6982 | { |
---|
6983 | beagleFlags &= ~BEAGLE_FLAG_VECTOR_SSE; |
---|
6984 | } |
---|
6985 | if (BeagleCheckFlagCompatability(beagleFlags) == NO) { |
---|
6986 | beagleFlags = oldFlags; |
---|
6987 | } else { |
---|
6988 | if (beagleFlags & BEAGLE_FLAG_VECTOR_SSE) |
---|
6989 | MrBayesPrint ("%s Setting beaglesse to Yes\n", spacer); |
---|
6990 | else |
---|
6991 | MrBayesPrint ("%s Setting beaglesse to No\n", spacer); |
---|
6992 | } |
---|
6993 | } |
---|
6994 | else |
---|
6995 | { |
---|
6996 | MrBayesPrint ("%s Invalid argument for beagleopenmp\n", spacer); |
---|
6997 | return (ERROR); |
---|
6998 | } |
---|
6999 | #else |
---|
7000 | BeagleNotLinked(); |
---|
7001 | #endif |
---|
7002 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
7003 | } |
---|
7004 | else |
---|
7005 | return (ERROR); |
---|
7006 | } |
---|
7007 | else if (!strcmp(parmName, "Beaglethreads")) |
---|
7008 | { |
---|
7009 | if (expecting == Expecting(EQUALSIGN)) |
---|
7010 | expecting = Expecting(ALPHA); |
---|
7011 | else if (expecting == Expecting(ALPHA)) |
---|
7012 | { |
---|
7013 | #if defined (BEAGLE_ENABLED) && defined (THREADS_ENABLED) |
---|
7014 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
7015 | { |
---|
7016 | if (!strcmp(tempStr, "Yes")) |
---|
7017 | { |
---|
7018 | tryToUseThreads = YES; |
---|
7019 | } |
---|
7020 | else |
---|
7021 | { |
---|
7022 | tryToUseThreads = NO; |
---|
7023 | } |
---|
7024 | |
---|
7025 | if (tryToUseThreads == YES) |
---|
7026 | MrBayesPrint ("%s Setting beaglethreads to Yes\n", spacer); |
---|
7027 | else |
---|
7028 | MrBayesPrint ("%s Setting beaglethreads to No\n", spacer); |
---|
7029 | } |
---|
7030 | else |
---|
7031 | { |
---|
7032 | MrBayesPrint ("%s Invalid argument for beaglethreads\n", spacer); |
---|
7033 | return (ERROR); |
---|
7034 | } |
---|
7035 | #else |
---|
7036 | BeagleThreadsNotLinked(); |
---|
7037 | #endif |
---|
7038 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
7039 | } |
---|
7040 | } |
---|
7041 | else if (!strcmp(parmName, "Beaglescaling")) |
---|
7042 | { |
---|
7043 | if (expecting == Expecting(EQUALSIGN)) |
---|
7044 | expecting = Expecting(ALPHA); |
---|
7045 | else if (expecting == Expecting(ALPHA)) |
---|
7046 | { |
---|
7047 | #if defined (BEAGLE_ENABLED) |
---|
7048 | if (IsArgValid(tkn, tempStr) == NO_ERROR) |
---|
7049 | { |
---|
7050 | if (!strcmp(tempStr, "Always")) |
---|
7051 | { |
---|
7052 | beagleScalingScheme = MB_BEAGLE_SCALE_ALWAYS; |
---|
7053 | } |
---|
7054 | else |
---|
7055 | { |
---|
7056 | beagleScalingScheme = MB_BEAGLE_SCALE_DYNAMIC; |
---|
7057 | } |
---|
7058 | |
---|
7059 | if (beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS) |
---|
7060 | MrBayesPrint ("%s Setting beaglescaling to Always\n", spacer); |
---|
7061 | else |
---|
7062 | MrBayesPrint ("%s Setting beaglescaling to Dynamic\n", spacer); |
---|
7063 | } |
---|
7064 | else |
---|
7065 | { |
---|
7066 | MrBayesPrint ("%s Invalid argument for beaglescaling\n", spacer); |
---|
7067 | return (ERROR); |
---|
7068 | } |
---|
7069 | #else |
---|
7070 | BeagleThreadsNotLinked(); |
---|
7071 | #endif |
---|
7072 | expecting = Expecting(PARAMETER) | Expecting(SEMICOLON); |
---|
7073 | } |
---|
7074 | else |
---|
7075 | return (ERROR); |
---|
7076 | } |
---|
7077 | else |
---|
7078 | return (ERROR); |
---|
7079 | |
---|
7080 | } |
---|
7081 | |
---|
7082 | return (NO_ERROR); |
---|
7083 | |
---|
7084 | } |
---|
7085 | |
---|
7086 | |
---|
7087 | |
---|
7088 | |
---|
7089 | |
---|
7090 | int DoShowMatrix (void) |
---|
7091 | |
---|
7092 | { |
---|
7093 | |
---|
7094 | int i, j, nameLen, start, finish, ct, longestName; |
---|
7095 | char tempStr[100], stride; |
---|
7096 | |
---|
7097 | if (defMatrix == NO) |
---|
7098 | { |
---|
7099 | MrBayesPrint ("%s A character matrix must be defined first\n", spacer); |
---|
7100 | return (ERROR); |
---|
7101 | } |
---|
7102 | |
---|
7103 | longestName = 0; |
---|
7104 | for (i=0; i<numTaxa; i++) |
---|
7105 | { |
---|
7106 | nameLen = (int) strlen(taxaNames[i]); |
---|
7107 | if (nameLen > longestName) |
---|
7108 | longestName = nameLen; |
---|
7109 | } |
---|
7110 | |
---|
7111 | stride = 50; |
---|
7112 | start = finish = 0; |
---|
7113 | do |
---|
7114 | { |
---|
7115 | finish += stride; |
---|
7116 | if (finish > numChar) |
---|
7117 | finish = numChar; |
---|
7118 | |
---|
7119 | MrBayesPrint ("%s ", spacer); |
---|
7120 | for (j=0; j<longestName; j++) |
---|
7121 | MrBayesPrint (" "); |
---|
7122 | MrBayesPrint (" "); |
---|
7123 | MrBayesPrint ("%d\n", start+1); |
---|
7124 | |
---|
7125 | |
---|
7126 | for (i=0; i<numTaxa; i++) |
---|
7127 | { |
---|
7128 | strcpy (tempStr, taxaNames[i]); |
---|
7129 | nameLen = (int) strlen(tempStr); |
---|
7130 | |
---|
7131 | MrBayesPrint ("%s ", spacer); |
---|
7132 | if (nameLen >= longestName) |
---|
7133 | { |
---|
7134 | for (j=0; j<longestName; j++) |
---|
7135 | MrBayesPrint ("%c", tempStr[j]); |
---|
7136 | } |
---|
7137 | else |
---|
7138 | { |
---|
7139 | MrBayesPrint ("%s", tempStr); |
---|
7140 | for (j=0; j<longestName-nameLen; j++) |
---|
7141 | MrBayesPrint (" "); |
---|
7142 | } |
---|
7143 | MrBayesPrint (" "); |
---|
7144 | |
---|
7145 | for (j=start; j<finish; j++) |
---|
7146 | { |
---|
7147 | ct = charInfo[j].charType; |
---|
7148 | if (ct == DNA || ct == RNA) |
---|
7149 | MrBayesPrint ("%c", WhichNuc(matrix[pos(i,j,numChar)])); |
---|
7150 | else if (ct == PROTEIN) |
---|
7151 | MrBayesPrint ("%c", WhichAA(matrix[pos(i,j,numChar)])); |
---|
7152 | else if (ct == STANDARD) |
---|
7153 | MrBayesPrint ("%c", WhichStand(matrix[pos(i,j,numChar)])); |
---|
7154 | else if (ct == RESTRICTION) |
---|
7155 | MrBayesPrint ("%c", WhichRes(matrix[pos(i,j,numChar)])); |
---|
7156 | else if (ct == CONTINUOUS) |
---|
7157 | { |
---|
7158 | if (WhichCont(matrix[pos(i,j,numChar)]) < 0.0) |
---|
7159 | MrBayesPrint (" %2.2lf", WhichCont(matrix[pos(i,j,numChar)])); |
---|
7160 | else |
---|
7161 | MrBayesPrint (" %2.2lf", WhichCont(matrix[pos(i,j,numChar)])); |
---|
7162 | } |
---|
7163 | else |
---|
7164 | { |
---|
7165 | MrBayesPrint ("%s Unknown data type\n", spacer); |
---|
7166 | return (ERROR); |
---|
7167 | } |
---|
7168 | |
---|
7169 | } |
---|
7170 | MrBayesPrint ("\n"); |
---|
7171 | } |
---|
7172 | MrBayesPrint ("\n"); |
---|
7173 | start = finish; |
---|
7174 | } while (finish != numChar); |
---|
7175 | |
---|
7176 | return (NO_ERROR); |
---|
7177 | |
---|
7178 | } |
---|
7179 | |
---|
7180 | |
---|
7181 | |
---|
7182 | |
---|
7183 | |
---|
7184 | int DoShowUserTrees (void) |
---|
7185 | |
---|
7186 | { |
---|
7187 | |
---|
7188 | int i; |
---|
7189 | |
---|
7190 | if (numUserTrees == 0) |
---|
7191 | { |
---|
7192 | MrBayesPrint ("%s No user trees have been defined\n", spacer); |
---|
7193 | } |
---|
7194 | else |
---|
7195 | { |
---|
7196 | for (i=0; i<numUserTrees; i++) |
---|
7197 | { |
---|
7198 | MrBayesPrint ("\n Tree #%d -- '%s':\n\n", i+1, userTree[i]->name); |
---|
7199 | ShowConTree (stdout, userTree[i], 70, NO); |
---|
7200 | MrBayesPrint ("\n"); |
---|
7201 | } |
---|
7202 | } |
---|
7203 | |
---|
7204 | return (NO_ERROR); |
---|
7205 | |
---|
7206 | } |
---|
7207 | |
---|
7208 | |
---|
7209 | |
---|
7210 | |
---|
7211 | |
---|
7212 | int DoShowBeagle (void) |
---|
7213 | |
---|
7214 | { |
---|
7215 | #if defined (BEAGLE_ENABLED) |
---|
7216 | BeaglePrintResources(); |
---|
7217 | #else |
---|
7218 | BeagleNotLinked(); |
---|
7219 | #endif |
---|
7220 | return (NO_ERROR); |
---|
7221 | } |
---|
7222 | |
---|
7223 | |
---|
7224 | |
---|
7225 | |
---|
7226 | |
---|
7227 | int DoTaxlabels (void) |
---|
7228 | |
---|
7229 | { |
---|
7230 | |
---|
7231 | isTaxsetDef = YES; |
---|
7232 | |
---|
7233 | /* add default speciespartition name to list of valid speciespartitions */ |
---|
7234 | if (AddString (&speciespartitionNames, 0, "Default") == ERROR) |
---|
7235 | { |
---|
7236 | MrBayesPrint ("%s Problem adding Default speciespartition to list\n", spacer); |
---|
7237 | return (ERROR); |
---|
7238 | } |
---|
7239 | |
---|
7240 | /* add default species name set */ |
---|
7241 | AddNameSet(&speciesNameSets, 0, taxaNames, numTaxa); |
---|
7242 | |
---|
7243 | /* set number of defined speciespartitions to 1 */ |
---|
7244 | numDefinedSpeciespartitions = 1; |
---|
7245 | |
---|
7246 | return (NO_ERROR); |
---|
7247 | |
---|
7248 | } |
---|
7249 | |
---|
7250 | |
---|
7251 | |
---|
7252 | |
---|
7253 | |
---|
7254 | int DoTaxlabelsParm (char *parmName, char *tkn) |
---|
7255 | |
---|
7256 | { |
---|
7257 | |
---|
7258 | int index; |
---|
7259 | |
---|
7260 | if (inTaxaBlock == NO) |
---|
7261 | { |
---|
7262 | MrBayesPrint ("%s You must be in a taxa block to read a taxlabels command\n", spacer); |
---|
7263 | return (ERROR); |
---|
7264 | } |
---|
7265 | |
---|
7266 | if (defTaxa == NO) |
---|
7267 | { |
---|
7268 | MrBayesPrint ("%s The number of taxa must be given before a set of taxon labels can be read\n", spacer); |
---|
7269 | return ERROR; |
---|
7270 | } |
---|
7271 | |
---|
7272 | if (isTaxsetDef == YES) |
---|
7273 | { |
---|
7274 | MrBayesPrint ("%s A set of taxon labels has already been defined\n", spacer); |
---|
7275 | if (defMatrix == NO) |
---|
7276 | if (WantTo ("Do you want to delete the current set of taxon labels") == NO) |
---|
7277 | return (SKIP_COMMAND); |
---|
7278 | else |
---|
7279 | FreeTaxa(); |
---|
7280 | else |
---|
7281 | if (WantTo ("Do you want to delete the current character matrix") == NO) |
---|
7282 | return (SKIP_COMMAND); |
---|
7283 | else |
---|
7284 | FreeMatrix(); |
---|
7285 | } |
---|
7286 | |
---|
7287 | if (expecting == Expecting(ALPHA) || |
---|
7288 | expecting == Expecting(NUMBER)) |
---|
7289 | { |
---|
7290 | if (CheckString (taxaNames, numNamedTaxa, tkn, &index) == ERROR) |
---|
7291 | { |
---|
7292 | if ( strlen(tkn)>99 ) |
---|
7293 | { |
---|
7294 | MrBayesPrint ("%s Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, tkn); |
---|
7295 | return (ERROR); |
---|
7296 | } |
---|
7297 | if (AddString (&taxaNames, numNamedTaxa, tkn) == ERROR) |
---|
7298 | { |
---|
7299 | MrBayesPrint ("%s Problem adding label %s to list of taxon labels\n", spacer, tkn); |
---|
7300 | return (ERROR); |
---|
7301 | } |
---|
7302 | numNamedTaxa++; |
---|
7303 | } |
---|
7304 | else |
---|
7305 | { |
---|
7306 | MrBayesPrint ("%s Taxon label '%s' is included twice in list of taxon labels\n", spacer, tkn); |
---|
7307 | return (ERROR); |
---|
7308 | } |
---|
7309 | if (numNamedTaxa < numTaxa) |
---|
7310 | { |
---|
7311 | expecting = Expecting(ALPHA); |
---|
7312 | expecting |= Expecting(NUMBER); |
---|
7313 | } |
---|
7314 | else |
---|
7315 | expecting |= Expecting(SEMICOLON); |
---|
7316 | } |
---|
7317 | |
---|
7318 | return (NO_ERROR); |
---|
7319 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
7320 | MrBayesPrint ("%s", tkn); |
---|
7321 | |
---|
7322 | } |
---|
7323 | |
---|
7324 | |
---|
7325 | |
---|
7326 | |
---|
7327 | |
---|
7328 | int DoSpeciespartition (void) |
---|
7329 | |
---|
7330 | { |
---|
7331 | |
---|
7332 | int i, *partCount; |
---|
7333 | |
---|
7334 | /* add set to tempSet */ |
---|
7335 | if (fromI >= 0) |
---|
7336 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
7337 | { |
---|
7338 | for (i=0; i<numDivisions; i++) |
---|
7339 | free(tempNames[i]); |
---|
7340 | free (tempNames); |
---|
7341 | tempNames = NULL; |
---|
7342 | return (ERROR); |
---|
7343 | } |
---|
7344 | |
---|
7345 | /* set numDivisions; not set while reading the speciespartition */ |
---|
7346 | numDivisions = whichPartition + 1; |
---|
7347 | |
---|
7348 | /* check that all species are included */ |
---|
7349 | for (i=0; i<numTaxa; i++) |
---|
7350 | { |
---|
7351 | if (tempSet[i] == 0) |
---|
7352 | { |
---|
7353 | MrBayesPrint ("%s Tip %d not included in speciespartition\n", spacer, i+1); |
---|
7354 | for (i=0; i<numDivisions; i++) |
---|
7355 | free(tempNames[i]); |
---|
7356 | free (tempNames); |
---|
7357 | tempNames = NULL; |
---|
7358 | return (ERROR); |
---|
7359 | } |
---|
7360 | /*MrBayesPrint ("%4d %4d \n", i, tempSet[i]);*/ |
---|
7361 | } |
---|
7362 | |
---|
7363 | partCount = (int *) SafeCalloc (numDivisions, sizeof(int)); |
---|
7364 | if (!partCount) |
---|
7365 | { |
---|
7366 | for (i=0; i<numDivisions; i++) |
---|
7367 | free(tempNames[i]); |
---|
7368 | free (tempNames); |
---|
7369 | tempNames = NULL; |
---|
7370 | return ERROR; |
---|
7371 | } |
---|
7372 | |
---|
7373 | /* make certain that the partition labels go from 1 - numTaxa, inclusive */ |
---|
7374 | for (i=0; i<numTaxa; i++) |
---|
7375 | { |
---|
7376 | if (tempSet[i] < 1 || tempSet[i] > numTaxa) |
---|
7377 | { |
---|
7378 | MrBayesPrint ("%s Speciespartition index for tip %d out of bound (%d)\n", spacer, i+1, tempSet[i]); |
---|
7379 | free (partCount); |
---|
7380 | for (i=0; i<numDivisions; i++) |
---|
7381 | free(tempNames[i]); |
---|
7382 | free (tempNames); |
---|
7383 | tempNames = NULL; |
---|
7384 | return (ERROR); |
---|
7385 | } |
---|
7386 | partCount[tempSet[i] - 1]++; |
---|
7387 | } |
---|
7388 | for (i=0; i<numDivisions; i++) |
---|
7389 | { |
---|
7390 | if (partCount[i] == 0) |
---|
7391 | { |
---|
7392 | MrBayesPrint ("%s Could not find a single tip for species %d\n", spacer, i+1); |
---|
7393 | free (partCount); |
---|
7394 | for (i=0; i<numDivisions; i++) |
---|
7395 | free(tempNames[i]); |
---|
7396 | free (tempNames); |
---|
7397 | tempNames = NULL; |
---|
7398 | return (ERROR); |
---|
7399 | } |
---|
7400 | } |
---|
7401 | free (partCount); |
---|
7402 | |
---|
7403 | /* add name to list of valid partitions */ |
---|
7404 | if (AddString (&speciespartitionNames, numDefinedSpeciespartitions, tempSetName) == ERROR) |
---|
7405 | { |
---|
7406 | MrBayesPrint ("%s Problem adding speciespartition %s to list\n", spacer, tempSetName); |
---|
7407 | for (i=0; i<numDivisions; i++) |
---|
7408 | free(tempNames[i]); |
---|
7409 | free (tempNames); |
---|
7410 | tempNames = NULL; |
---|
7411 | return (ERROR); |
---|
7412 | } |
---|
7413 | |
---|
7414 | /* add new partition */ |
---|
7415 | for (i=0; i<numTaxa; i++) |
---|
7416 | { |
---|
7417 | speciespartitionId[i] = (int *) SafeRealloc ((void *)(speciespartitionId[i]), (size_t)((numDefinedSpeciespartitions + 1) * sizeof(int))); |
---|
7418 | if (!speciespartitionId[i]) |
---|
7419 | { |
---|
7420 | for (i=0; i<numDivisions; i++) |
---|
7421 | free(tempNames[i]); |
---|
7422 | free (tempNames); |
---|
7423 | tempNames = NULL; |
---|
7424 | return ERROR; |
---|
7425 | } |
---|
7426 | } |
---|
7427 | |
---|
7428 | /* set new partition */ |
---|
7429 | for (i=0; i<numTaxa; i++) |
---|
7430 | speciespartitionId[i][numDefinedSpeciespartitions] = tempSet[i]; |
---|
7431 | |
---|
7432 | /* add new set of species names */ |
---|
7433 | AddNameSet(&speciesNameSets, numDefinedSpeciespartitions, tempNames, numDivisions); |
---|
7434 | |
---|
7435 | /* free species names */ |
---|
7436 | for (i=0; i<numDivisions; i++) |
---|
7437 | free(tempNames[i]); |
---|
7438 | free (tempNames); |
---|
7439 | tempNames = NULL; |
---|
7440 | |
---|
7441 | /* increment number of defined partitions */ |
---|
7442 | numDefinedSpeciespartitions++; |
---|
7443 | |
---|
7444 | return (NO_ERROR); |
---|
7445 | |
---|
7446 | } |
---|
7447 | |
---|
7448 | |
---|
7449 | |
---|
7450 | |
---|
7451 | |
---|
7452 | int DoSpeciespartitionParm (char *parmName, char *tkn) |
---|
7453 | |
---|
7454 | { |
---|
7455 | |
---|
7456 | int i, index, tempInt; |
---|
7457 | |
---|
7458 | if (defTaxa == NO || numTaxa == 0) |
---|
7459 | { |
---|
7460 | MrBayesPrint ("%s A matrix or taxaset must be specified before partitions can be defined\n", spacer); |
---|
7461 | return (ERROR); |
---|
7462 | } |
---|
7463 | |
---|
7464 | if (expecting == Expecting(PARAMETER)) |
---|
7465 | { |
---|
7466 | /* set Speciespartition name ******************************************************************/ |
---|
7467 | if (!strcmp(parmName, "Xxxxxxxxxx")) |
---|
7468 | { |
---|
7469 | /* check size of partition name */ |
---|
7470 | if (strlen(tkn) > 99) |
---|
7471 | { |
---|
7472 | MrBayesPrint ("%s Partition name is too long. Max 100 characters\n", spacer); |
---|
7473 | return (ERROR); |
---|
7474 | } |
---|
7475 | |
---|
7476 | /* check to see if the name has already been used as a partition */ |
---|
7477 | if (numDefinedSpeciespartitions > 0) |
---|
7478 | { |
---|
7479 | if (CheckString (speciespartitionNames, numDefinedSpeciespartitions, tkn, &index) == ERROR) |
---|
7480 | { |
---|
7481 | /* if the partition name has not been used, then we should have an ERROR returned */ |
---|
7482 | /* we _want_ to be here */ |
---|
7483 | |
---|
7484 | } |
---|
7485 | else |
---|
7486 | { |
---|
7487 | MrBayesPrint ("%s Speciespartition name '%s' has been used previously\n", spacer, tkn); |
---|
7488 | return (ERROR); |
---|
7489 | } |
---|
7490 | } |
---|
7491 | |
---|
7492 | /* add the name temporarily to tempSetName */ |
---|
7493 | strcpy (tempSetName, tkn); |
---|
7494 | |
---|
7495 | /* clear tempSet */ |
---|
7496 | for (i=0; i<numTaxa; i++) |
---|
7497 | tempSet[i] = 0; |
---|
7498 | |
---|
7499 | /* make sure tempNames is NULL */ |
---|
7500 | assert (tempNames == NULL); |
---|
7501 | |
---|
7502 | fromI = toJ = everyK = -1; |
---|
7503 | foundDash = foundSlash = NO; |
---|
7504 | whichPartition = 0; |
---|
7505 | foundFirst = NO; |
---|
7506 | numDivisions = 0; |
---|
7507 | MrBayesPrint ("%s Defining speciespartition called %s\n", spacer, tkn); |
---|
7508 | expecting = Expecting(EQUALSIGN); |
---|
7509 | } |
---|
7510 | else |
---|
7511 | return (ERROR); |
---|
7512 | } |
---|
7513 | else if (expecting == Expecting(EQUALSIGN)) |
---|
7514 | { |
---|
7515 | expecting = Expecting(ALPHA); |
---|
7516 | } |
---|
7517 | else if (expecting == Expecting(ALPHA)) |
---|
7518 | { |
---|
7519 | if (foundFirst == NO) |
---|
7520 | { |
---|
7521 | AddString(&tempNames, whichPartition, tkn); |
---|
7522 | foundFirst = YES; |
---|
7523 | expecting = Expecting(COLON); |
---|
7524 | } |
---|
7525 | else |
---|
7526 | { |
---|
7527 | /* We are defining a species partition in terms of a tip name (called tkn, here). We should be able |
---|
7528 | to find tkn in the list of tip names. If we cannot, then we have a problem and |
---|
7529 | return an error. */ |
---|
7530 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
7531 | { |
---|
7532 | MrBayesPrint ("%s Could not find a tip called %s\n", spacer, tkn); |
---|
7533 | return (ERROR); |
---|
7534 | } |
---|
7535 | /* add index of the tip named tkn to new tempSet */ |
---|
7536 | tempSet[index] = whichPartition + 1; |
---|
7537 | fromI = toJ = everyK = -1; |
---|
7538 | |
---|
7539 | expecting = Expecting(ALPHA); |
---|
7540 | expecting |= Expecting(NUMBER); |
---|
7541 | expecting |= Expecting(SEMICOLON); |
---|
7542 | expecting |= Expecting(COMMA); |
---|
7543 | } |
---|
7544 | } |
---|
7545 | else if (expecting == Expecting(NUMBER)) |
---|
7546 | { |
---|
7547 | if (strlen(tkn) == 1 && tkn[0] == '.') |
---|
7548 | tempInt = numTaxa; |
---|
7549 | else |
---|
7550 | sscanf (tkn, "%d", &tempInt); |
---|
7551 | if (tempInt <= 0 || tempInt > numTaxa) |
---|
7552 | { |
---|
7553 | MrBayesPrint ("%s Tip number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa); |
---|
7554 | for (i=0; i<whichPartition; i++) |
---|
7555 | free(tempNames[i]); |
---|
7556 | free (tempNames); |
---|
7557 | tempNames = NULL; |
---|
7558 | return (ERROR); |
---|
7559 | } |
---|
7560 | tempInt--; |
---|
7561 | if (foundDash == YES) |
---|
7562 | { |
---|
7563 | if (fromI >= 0) |
---|
7564 | toJ = tempInt; |
---|
7565 | else |
---|
7566 | { |
---|
7567 | MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer); |
---|
7568 | for (i=0; i<whichPartition; i++) |
---|
7569 | free(tempNames[i]); |
---|
7570 | free (tempNames); |
---|
7571 | tempNames = NULL; |
---|
7572 | return (ERROR); |
---|
7573 | } |
---|
7574 | foundDash = NO; |
---|
7575 | } |
---|
7576 | else if (foundSlash == YES) |
---|
7577 | { |
---|
7578 | tempInt++; |
---|
7579 | if (tempInt <= 1) |
---|
7580 | { |
---|
7581 | MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer); |
---|
7582 | for (i=0; i<whichPartition; i++) |
---|
7583 | free(tempNames[i]); |
---|
7584 | free (tempNames); |
---|
7585 | tempNames = NULL; |
---|
7586 | return (ERROR); |
---|
7587 | } |
---|
7588 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
7589 | everyK = tempInt; |
---|
7590 | else |
---|
7591 | { |
---|
7592 | MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer); |
---|
7593 | for (i=0; i<whichPartition; i++) |
---|
7594 | free(tempNames[i]); |
---|
7595 | free (tempNames); |
---|
7596 | tempNames = NULL; |
---|
7597 | return (ERROR); |
---|
7598 | } |
---|
7599 | foundSlash = NO; |
---|
7600 | } |
---|
7601 | else |
---|
7602 | { |
---|
7603 | if (fromI >= 0 && toJ < 0) |
---|
7604 | { |
---|
7605 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
7606 | { |
---|
7607 | for (i=0; i<whichPartition; i++) |
---|
7608 | free(tempNames[i]); |
---|
7609 | free (tempNames); |
---|
7610 | tempNames = NULL; |
---|
7611 | return (ERROR); |
---|
7612 | } |
---|
7613 | fromI = tempInt; |
---|
7614 | } |
---|
7615 | else if (fromI < 0 && toJ < 0) |
---|
7616 | { |
---|
7617 | fromI = tempInt; |
---|
7618 | } |
---|
7619 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
7620 | { |
---|
7621 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
7622 | return (ERROR); |
---|
7623 | fromI = tempInt; |
---|
7624 | toJ = everyK = -1; |
---|
7625 | } |
---|
7626 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
7627 | { |
---|
7628 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
7629 | return (ERROR); |
---|
7630 | fromI = tempInt; |
---|
7631 | toJ = everyK = -1; |
---|
7632 | } |
---|
7633 | else |
---|
7634 | { |
---|
7635 | MrBayesPrint ("%s Improperly formatted speciespartition\n", spacer); |
---|
7636 | { |
---|
7637 | for (i=0; i<whichPartition; i++) |
---|
7638 | free(tempNames[i]); |
---|
7639 | free (tempNames); |
---|
7640 | tempNames = NULL; |
---|
7641 | return (ERROR); |
---|
7642 | } |
---|
7643 | } |
---|
7644 | } |
---|
7645 | expecting = Expecting(ALPHA); |
---|
7646 | expecting |= Expecting(NUMBER); |
---|
7647 | expecting |= Expecting(SEMICOLON); |
---|
7648 | expecting |= Expecting(DASH); |
---|
7649 | expecting |= Expecting(BACKSLASH); |
---|
7650 | expecting |= Expecting(COMMA); |
---|
7651 | } |
---|
7652 | else if (expecting == Expecting(COMMA)) |
---|
7653 | { |
---|
7654 | /* add set to tempSet */ |
---|
7655 | if (fromI >= 0) |
---|
7656 | if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR) |
---|
7657 | { |
---|
7658 | for (i=0; i<whichPartition; i++) |
---|
7659 | free(tempNames[i]); |
---|
7660 | free (tempNames); |
---|
7661 | tempNames = NULL; |
---|
7662 | return (ERROR); |
---|
7663 | } |
---|
7664 | |
---|
7665 | fromI = toJ = everyK = -1; |
---|
7666 | foundDash = foundSlash = foundFirst = NO; |
---|
7667 | whichPartition++; |
---|
7668 | if (whichPartition > numTaxa) |
---|
7669 | { |
---|
7670 | MrBayesPrint ("%s Too many speciespartitions (expecting maximum %d speciespartitions)\n", spacer, numTaxa); |
---|
7671 | for (i=0; i<whichPartition; i++) |
---|
7672 | free(tempNames[i]); |
---|
7673 | free (tempNames); |
---|
7674 | tempNames = NULL; |
---|
7675 | return (ERROR); |
---|
7676 | } |
---|
7677 | expecting = Expecting(ALPHA); |
---|
7678 | } |
---|
7679 | else if (expecting == Expecting(COLON)) |
---|
7680 | { |
---|
7681 | expecting = Expecting(NUMBER); |
---|
7682 | expecting |= Expecting(ALPHA); |
---|
7683 | } |
---|
7684 | else if (expecting == Expecting(DASH)) |
---|
7685 | { |
---|
7686 | foundDash = YES; |
---|
7687 | expecting = Expecting(NUMBER); |
---|
7688 | } |
---|
7689 | else if (expecting == Expecting(BACKSLASH)) |
---|
7690 | { |
---|
7691 | foundSlash = YES; |
---|
7692 | expecting = Expecting(NUMBER); |
---|
7693 | } |
---|
7694 | else |
---|
7695 | { |
---|
7696 | for (i=0; i<whichPartition; i++) |
---|
7697 | free(tempNames[i]); |
---|
7698 | free (tempNames); |
---|
7699 | tempNames = NULL; |
---|
7700 | return (ERROR); |
---|
7701 | } |
---|
7702 | |
---|
7703 | return (NO_ERROR); |
---|
7704 | |
---|
7705 | } |
---|
7706 | |
---|
7707 | |
---|
7708 | |
---|
7709 | |
---|
7710 | |
---|
7711 | int DoTaxaset (void) |
---|
7712 | |
---|
7713 | { |
---|
7714 | /* add set to tempSet */ |
---|
7715 | if (fromI >= 0 && toJ < 0) |
---|
7716 | { |
---|
7717 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
7718 | return (ERROR); |
---|
7719 | } |
---|
7720 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
7721 | { |
---|
7722 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
7723 | return (ERROR); |
---|
7724 | } |
---|
7725 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
7726 | { |
---|
7727 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
7728 | return (ERROR); |
---|
7729 | } |
---|
7730 | |
---|
7731 | /* add name to taxaSetNames */ |
---|
7732 | if (AddString (&taxaSetNames, numTaxaSets, tempSetName) == ERROR) |
---|
7733 | { |
---|
7734 | MrBayesPrint ("%s Problem adding taxset %s to list\n", spacer, tempSetName); |
---|
7735 | return (ERROR); |
---|
7736 | } |
---|
7737 | |
---|
7738 | /* merge tempSet with taxaSet */ |
---|
7739 | AddBitfield (&taxaSet, numTaxaSets, tempSet, numTaxa); |
---|
7740 | |
---|
7741 | /* increment number of char sets */ |
---|
7742 | numTaxaSets++; |
---|
7743 | |
---|
7744 | /* show taxset (for debugging) */ |
---|
7745 | # if 0 |
---|
7746 | for (i=0; i<numTaxa; i++) |
---|
7747 | MrBayesPrint ("%4d %4d\n", i+1, tempSet[i]); |
---|
7748 | # endif |
---|
7749 | |
---|
7750 | return (NO_ERROR); |
---|
7751 | |
---|
7752 | } |
---|
7753 | |
---|
7754 | |
---|
7755 | |
---|
7756 | |
---|
7757 | |
---|
7758 | int DoTaxasetParm (char *parmName, char *tkn) |
---|
7759 | |
---|
7760 | { |
---|
7761 | |
---|
7762 | int i, index, tempInt; |
---|
7763 | |
---|
7764 | if (defMatrix == NO) |
---|
7765 | { |
---|
7766 | MrBayesPrint ("%s A matrix must be specified before taxsets can be defined\n", spacer); |
---|
7767 | return (ERROR); |
---|
7768 | } |
---|
7769 | |
---|
7770 | if (expecting == Expecting(PARAMETER)) |
---|
7771 | { |
---|
7772 | if (!strcmp(parmName, "Xxxxxxxxxx")) |
---|
7773 | { |
---|
7774 | /* check size of taxset name */ |
---|
7775 | if (strlen(tkn) > 99) |
---|
7776 | { |
---|
7777 | MrBayesPrint ("%s Taxset name is too long\n", spacer); |
---|
7778 | return (ERROR); |
---|
7779 | } |
---|
7780 | |
---|
7781 | /* check to see if the name has already been used as a taxset */ |
---|
7782 | if (numTaxaSets > 0) |
---|
7783 | { |
---|
7784 | if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR) |
---|
7785 | { |
---|
7786 | /* if the taxset name has not been used, then we should have an ERROR returned */ |
---|
7787 | /* we _want_ to be here */ |
---|
7788 | |
---|
7789 | } |
---|
7790 | else |
---|
7791 | { |
---|
7792 | MrBayesPrint ("%s Taxset name has been used previously\n", spacer); |
---|
7793 | return (ERROR); |
---|
7794 | } |
---|
7795 | } |
---|
7796 | else if (numTaxaSets > 30) |
---|
7797 | { |
---|
7798 | MrBayesPrint ("%s You cannot define more than 30 taxsets\n", spacer); |
---|
7799 | return (ERROR); |
---|
7800 | } |
---|
7801 | |
---|
7802 | /* add the name to the taxa set */ |
---|
7803 | strcpy (tempSetName, tkn); |
---|
7804 | |
---|
7805 | /* clear tempSet */ |
---|
7806 | for (i=0; i<numTaxa; i++) |
---|
7807 | tempSet[i] = 0; |
---|
7808 | |
---|
7809 | fromI = toJ = everyK = -1; |
---|
7810 | foundDash = foundSlash = NO; |
---|
7811 | MrBayesPrint ("%s Defining taxset called %s\n", spacer, tkn); |
---|
7812 | expecting = Expecting(EQUALSIGN); |
---|
7813 | } |
---|
7814 | else |
---|
7815 | return (ERROR); |
---|
7816 | } |
---|
7817 | else if (expecting == Expecting(EQUALSIGN)) |
---|
7818 | { |
---|
7819 | expecting = Expecting(ALPHA); |
---|
7820 | expecting |= Expecting(NUMBER); |
---|
7821 | } |
---|
7822 | else if (expecting == Expecting(ALPHA)) |
---|
7823 | { |
---|
7824 | /* We are defining a taxon set in terms of another (called tkn, here) or we are referring to |
---|
7825 | the taxon name. We should be able to find tkn in the list of character set names or in the list |
---|
7826 | of taxon names. If we cannot, then we have a problem and return an error. */ |
---|
7827 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
7828 | { |
---|
7829 | if (numTaxaSets < 1) |
---|
7830 | { |
---|
7831 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
7832 | return (ERROR); |
---|
7833 | } |
---|
7834 | if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR) |
---|
7835 | { |
---|
7836 | MrBayesPrint ("%s Could not find a taxset called %s\n", spacer, tkn); |
---|
7837 | return (ERROR); |
---|
7838 | } |
---|
7839 | /* add taxa from taxset tkn to new tempSet */ |
---|
7840 | for (i=0; i<numTaxa; i++) |
---|
7841 | { |
---|
7842 | if (IsBitSet (i, taxaSet[index]) == YES) |
---|
7843 | tempSet[i] = 1; |
---|
7844 | } |
---|
7845 | } |
---|
7846 | else |
---|
7847 | { |
---|
7848 | tempSet[index] = 1; |
---|
7849 | } |
---|
7850 | fromI = toJ = everyK = -1; |
---|
7851 | |
---|
7852 | expecting = Expecting(ALPHA); |
---|
7853 | expecting |= Expecting(NUMBER); |
---|
7854 | expecting |= Expecting(SEMICOLON); |
---|
7855 | } |
---|
7856 | else if (expecting == Expecting(NUMBER)) |
---|
7857 | { |
---|
7858 | if (strlen(tkn) == 1 && !strcmp(tkn, ".")) |
---|
7859 | { |
---|
7860 | tempInt = numTaxa; |
---|
7861 | } |
---|
7862 | else |
---|
7863 | { |
---|
7864 | sscanf (tkn, "%d", &tempInt); |
---|
7865 | if (tempInt <= 0 || tempInt > numTaxa) |
---|
7866 | { |
---|
7867 | MrBayesPrint ("%s Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa); |
---|
7868 | return (ERROR); |
---|
7869 | } |
---|
7870 | } |
---|
7871 | tempInt--; |
---|
7872 | if (foundDash == YES) |
---|
7873 | { |
---|
7874 | if (fromI >= 0) |
---|
7875 | toJ = tempInt; |
---|
7876 | else |
---|
7877 | { |
---|
7878 | MrBayesPrint ("%s Improperly formatted taxset\n", spacer); |
---|
7879 | return (ERROR); |
---|
7880 | } |
---|
7881 | foundDash = NO; |
---|
7882 | } |
---|
7883 | else if (foundSlash == YES) |
---|
7884 | { |
---|
7885 | tempInt++; |
---|
7886 | if (tempInt <= 1) |
---|
7887 | { |
---|
7888 | MrBayesPrint ("%s Improperly formatted taxset\n", spacer); |
---|
7889 | return (ERROR); |
---|
7890 | } |
---|
7891 | if (fromI >= 0 && toJ >= 0 && fromI < toJ) |
---|
7892 | everyK = tempInt; |
---|
7893 | else |
---|
7894 | { |
---|
7895 | MrBayesPrint ("%s Improperly formatted taxset\n", spacer); |
---|
7896 | return (ERROR); |
---|
7897 | } |
---|
7898 | foundSlash = NO; |
---|
7899 | } |
---|
7900 | else |
---|
7901 | { |
---|
7902 | if (fromI >= 0 && toJ < 0) |
---|
7903 | { |
---|
7904 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
7905 | return (ERROR); |
---|
7906 | fromI = tempInt; |
---|
7907 | } |
---|
7908 | else if (fromI < 0 && toJ < 0) |
---|
7909 | { |
---|
7910 | fromI = tempInt; |
---|
7911 | } |
---|
7912 | else if (fromI >= 0 && toJ >= 0 && everyK < 0) |
---|
7913 | { |
---|
7914 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
7915 | return (ERROR); |
---|
7916 | fromI = tempInt; |
---|
7917 | toJ = everyK = -1; |
---|
7918 | } |
---|
7919 | else if (fromI >= 0 && toJ >= 0 && everyK >= 0) |
---|
7920 | { |
---|
7921 | if (AddToSet (fromI, toJ, everyK, 1) == ERROR) |
---|
7922 | return (ERROR); |
---|
7923 | fromI = tempInt; |
---|
7924 | toJ = everyK = -1; |
---|
7925 | } |
---|
7926 | else |
---|
7927 | { |
---|
7928 | MrBayesPrint ("%s Improperly formatted taxset\n", spacer); |
---|
7929 | { |
---|
7930 | return (ERROR); |
---|
7931 | } |
---|
7932 | } |
---|
7933 | } |
---|
7934 | |
---|
7935 | expecting = Expecting(ALPHA); |
---|
7936 | expecting |= Expecting(NUMBER); |
---|
7937 | expecting |= Expecting(SEMICOLON); |
---|
7938 | expecting |= Expecting(DASH); |
---|
7939 | expecting |= Expecting(BACKSLASH); |
---|
7940 | } |
---|
7941 | else if (expecting == Expecting(DASH)) |
---|
7942 | { |
---|
7943 | foundDash = YES; |
---|
7944 | expecting = Expecting(NUMBER); |
---|
7945 | } |
---|
7946 | else if (expecting == Expecting(BACKSLASH)) |
---|
7947 | { |
---|
7948 | foundSlash = YES; |
---|
7949 | expecting = Expecting(NUMBER); |
---|
7950 | } |
---|
7951 | else |
---|
7952 | return (ERROR); |
---|
7953 | |
---|
7954 | return (NO_ERROR); |
---|
7955 | |
---|
7956 | } |
---|
7957 | |
---|
7958 | |
---|
7959 | |
---|
7960 | |
---|
7961 | |
---|
7962 | int DoTaxaStat (void) |
---|
7963 | |
---|
7964 | { |
---|
7965 | |
---|
7966 | int i, j, maxLen, nameLen, nIncludedTaxa; |
---|
7967 | char tempName[100]; |
---|
7968 | |
---|
7969 | if (defMatrix == NO) |
---|
7970 | { |
---|
7971 | MrBayesPrint ("%s A character matrix must be defined first\n", spacer); |
---|
7972 | return (ERROR); |
---|
7973 | } |
---|
7974 | |
---|
7975 | /* find maximum length of taxon name */ |
---|
7976 | maxLen = nIncludedTaxa = 0; |
---|
7977 | for (i=0; i<numTaxa; i++) |
---|
7978 | { |
---|
7979 | strcpy (tempName, taxaNames[i]); |
---|
7980 | if ((int)strlen(tempName) > maxLen) |
---|
7981 | maxLen = (int) strlen(tempName); |
---|
7982 | if (taxaInfo[i].isDeleted == NO) |
---|
7983 | nIncludedTaxa++; |
---|
7984 | } |
---|
7985 | |
---|
7986 | MrBayesPrint ("%s Showing taxon status:\n\n", spacer); |
---|
7987 | if (nIncludedTaxa == numTaxa) |
---|
7988 | MrBayesPrint ("%s Number of taxa = %d (all of which are included)\n", spacer, numTaxa); |
---|
7989 | else |
---|
7990 | MrBayesPrint ("%s Number of taxa = %d (of which %d are included)\n", spacer, numTaxa, nIncludedTaxa); |
---|
7991 | MrBayesPrint ("%s Number of constraints = %d\n\n", spacer, numDefinedConstraints); |
---|
7992 | |
---|
7993 | if (numDefinedConstraints > 0) |
---|
7994 | { |
---|
7995 | for (j=0; j<numDefinedConstraints; j++) |
---|
7996 | { |
---|
7997 | strcpy (tempName, constraintNames[j]); |
---|
7998 | |
---|
7999 | /* for now, ignore the probability */ |
---|
8000 | if( definedConstraintsType[j] == HARD ) |
---|
8001 | MrBayesPrint ("%s %2d -- Trees with 'hard' constraint \"%s\" are infinitely\n", spacer, j+1, tempName); |
---|
8002 | else if( definedConstraintsType[j] == PARTIAL ) |
---|
8003 | MrBayesPrint ("%s %2d -- Trees with 'partial' constraint \"%s\" are infinitely\n", spacer, j+1, tempName); |
---|
8004 | else |
---|
8005 | MrBayesPrint ("%s %2d -- Trees with 'negative' constraint \"%s\" are infinitely\n", spacer, j+1, tempName); |
---|
8006 | MrBayesPrint ("%s more probable than those without \n", spacer); |
---|
8007 | |
---|
8008 | } |
---|
8009 | MrBayesPrint ("\n"); |
---|
8010 | for (j=0; j<maxLen; j++) |
---|
8011 | MrBayesPrint (" "); |
---|
8012 | MrBayesPrint (" Constraints\n"); |
---|
8013 | } |
---|
8014 | MrBayesPrint ("%s Taxon ", spacer); |
---|
8015 | for (j=0; j<maxLen; j++) |
---|
8016 | MrBayesPrint (" "); |
---|
8017 | MrBayesPrint (" Inclusion"); |
---|
8018 | MrBayesPrint (" "); |
---|
8019 | for (j=0; j<numDefinedConstraints; j++) |
---|
8020 | MrBayesPrint (" %2d", j+1); |
---|
8021 | MrBayesPrint ("\n"); |
---|
8022 | MrBayesPrint ("%s -------", spacer); |
---|
8023 | for (j=0; j<maxLen; j++) |
---|
8024 | MrBayesPrint ("-"); |
---|
8025 | MrBayesPrint ("--------------"); |
---|
8026 | |
---|
8027 | if (numDefinedConstraints > 0) |
---|
8028 | { |
---|
8029 | MrBayesPrint ("----"); |
---|
8030 | for (j=0; j<numDefinedConstraints; j++) |
---|
8031 | MrBayesPrint ("---"); |
---|
8032 | } |
---|
8033 | MrBayesPrint ("\n"); |
---|
8034 | for (i=0; i<numTaxa; i++) |
---|
8035 | { |
---|
8036 | strcpy (tempName, taxaNames[i]); |
---|
8037 | nameLen = (int) strlen(tempName); |
---|
8038 | |
---|
8039 | if (i == outGroupNum) |
---|
8040 | MrBayesPrint ("%s ->%4d (%s) ", spacer, i+1, tempName); |
---|
8041 | else |
---|
8042 | MrBayesPrint ("%s %4d (%s) ", spacer, i+1, tempName); |
---|
8043 | for (j=0; j<(maxLen-nameLen); j++) |
---|
8044 | MrBayesPrint (" "); |
---|
8045 | MrBayesPrint (" -- "); |
---|
8046 | |
---|
8047 | if (taxaInfo[i].isDeleted == YES) |
---|
8048 | MrBayesPrint ("Deleted "); |
---|
8049 | else |
---|
8050 | MrBayesPrint ("Included"); |
---|
8051 | |
---|
8052 | MrBayesPrint (" "); |
---|
8053 | |
---|
8054 | for (j=0; j<numDefinedConstraints; j++) |
---|
8055 | { |
---|
8056 | if( definedConstraintsType[j] == HARD ) |
---|
8057 | { |
---|
8058 | if (IsBitSet(i, definedConstraint[j]) == NO) |
---|
8059 | MrBayesPrint (" ."); |
---|
8060 | else |
---|
8061 | MrBayesPrint (" *"); |
---|
8062 | } |
---|
8063 | else if( definedConstraintsType[j] == PARTIAL ) |
---|
8064 | { |
---|
8065 | if (IsBitSet(i, definedConstraint[j]) == YES) |
---|
8066 | MrBayesPrint (" +"); |
---|
8067 | else if(IsBitSet(i, definedConstraintTwo[j]) == YES) |
---|
8068 | MrBayesPrint (" -"); |
---|
8069 | else |
---|
8070 | MrBayesPrint (" ."); |
---|
8071 | } |
---|
8072 | else if( definedConstraintsType[j] == NEGATIVE ) |
---|
8073 | { |
---|
8074 | if (IsBitSet(i, definedConstraint[j]) == NO) |
---|
8075 | MrBayesPrint (" ."); |
---|
8076 | else |
---|
8077 | MrBayesPrint (" #"); |
---|
8078 | } |
---|
8079 | } |
---|
8080 | MrBayesPrint ("\n"); |
---|
8081 | } |
---|
8082 | |
---|
8083 | MrBayesPrint ("\n"); |
---|
8084 | MrBayesPrint ("%s '.' indicate that the taxon is not present in the constraint. \n", spacer); |
---|
8085 | MrBayesPrint ("%s '*' indicate that the taxon is present in the 'hard' constraint. \n", spacer); |
---|
8086 | MrBayesPrint ("%s '+' indicate that the taxon is present in the first groupe of 'partial' constraint. \n", spacer); |
---|
8087 | MrBayesPrint ("%s '-' indicate that the taxon is present in the second groupe of 'partial' constraint. \n", spacer); |
---|
8088 | MrBayesPrint ("%s '#' indicate that the taxon is present in the 'negative' constraint. \n", spacer); |
---|
8089 | MrBayesPrint ("%s Arrow indicates current outgroup. \n", spacer); |
---|
8090 | |
---|
8091 | return (NO_ERROR); |
---|
8092 | |
---|
8093 | } |
---|
8094 | |
---|
8095 | |
---|
8096 | |
---|
8097 | |
---|
8098 | |
---|
8099 | int DoTranslate (void) |
---|
8100 | |
---|
8101 | { |
---|
8102 | int i, j; |
---|
8103 | |
---|
8104 | if (inTreesBlock == NO) |
---|
8105 | { |
---|
8106 | MrBayesPrint ("%s You must be in a trees block to read a translate command\n", spacer); |
---|
8107 | return (ERROR); |
---|
8108 | } |
---|
8109 | numTranslates++; /* number of taxa in translate table */ |
---|
8110 | isTranslateDef = YES; |
---|
8111 | |
---|
8112 | isTranslateDiff = NO; |
---|
8113 | if (isTaxsetDef == NO) |
---|
8114 | SetTaxaFromTranslateTable(); |
---|
8115 | else |
---|
8116 | { |
---|
8117 | for (i=0; i<numTranslates; i++) |
---|
8118 | { |
---|
8119 | strcpy (token, transFrom[i]); |
---|
8120 | if (CheckString (taxaNames, numTaxa, token, &j) == ERROR) |
---|
8121 | { |
---|
8122 | isTranslateDiff = YES; |
---|
8123 | } |
---|
8124 | } |
---|
8125 | if (numTranslates != numTaxa) |
---|
8126 | isTranslateDiff = YES; |
---|
8127 | } |
---|
8128 | |
---|
8129 | return (NO_ERROR); |
---|
8130 | |
---|
8131 | } |
---|
8132 | |
---|
8133 | |
---|
8134 | |
---|
8135 | |
---|
8136 | |
---|
8137 | int DoTranslateParm (char *parmName, char *tkn) |
---|
8138 | |
---|
8139 | { |
---|
8140 | |
---|
8141 | int index; |
---|
8142 | static int whichTranslate; |
---|
8143 | |
---|
8144 | if (inTreesBlock == NO) |
---|
8145 | { |
---|
8146 | MrBayesPrint ("%s You must be in a trees block to read a translate command\n", spacer); |
---|
8147 | return (ERROR); |
---|
8148 | } |
---|
8149 | |
---|
8150 | if (isTranslateDef == YES) |
---|
8151 | { |
---|
8152 | MrBayesPrint ("%s A translation has already been defined for this tree block\n", spacer); |
---|
8153 | return (ERROR); |
---|
8154 | } |
---|
8155 | |
---|
8156 | if (expecting == Expecting(ALPHA) || |
---|
8157 | expecting == Expecting(NUMBER)) |
---|
8158 | { |
---|
8159 | if( numTaxa == 0 ) |
---|
8160 | { |
---|
8161 | MrBayesPrint ("%s Data matrix should be defined before translation table could be set.\n", spacer); |
---|
8162 | return (ERROR); |
---|
8163 | } |
---|
8164 | if (numTranslates == numTaxa) |
---|
8165 | { |
---|
8166 | MrBayesPrint ("%s Too many entries in translation table. Maximum number of taxon names to translate is %d\n", spacer,numTaxa); |
---|
8167 | return (ERROR); |
---|
8168 | } |
---|
8169 | if (whichTranslate == 0) |
---|
8170 | { |
---|
8171 | if (CheckString (transTo, numTranslates, tkn, &index) == ERROR) |
---|
8172 | { |
---|
8173 | if (AddString (&transTo, numTranslates, tkn) == ERROR) |
---|
8174 | { |
---|
8175 | MrBayesPrint ("%s Problem adding taxon %s to list\n", spacer, tkn); |
---|
8176 | return (ERROR); |
---|
8177 | } |
---|
8178 | } |
---|
8179 | else |
---|
8180 | { |
---|
8181 | MrBayesPrint ("%s Already found name (%s) in list\n", spacer, tkn); |
---|
8182 | return (ERROR); |
---|
8183 | } |
---|
8184 | whichTranslate++; |
---|
8185 | expecting = Expecting(ALPHA); |
---|
8186 | expecting |= Expecting(NUMBER); |
---|
8187 | } |
---|
8188 | else |
---|
8189 | { |
---|
8190 | if (CheckString (transFrom, numTranslates, tkn, &index) == ERROR) |
---|
8191 | { |
---|
8192 | if (AddString (&transFrom, numTranslates, tkn) == ERROR) |
---|
8193 | { |
---|
8194 | MrBayesPrint ("%s Problem adding taxon %s to list\n", spacer, tkn); |
---|
8195 | return (ERROR); |
---|
8196 | } |
---|
8197 | } |
---|
8198 | else |
---|
8199 | { |
---|
8200 | MrBayesPrint ("%s Already found name (%s) in list\n", spacer, tkn); |
---|
8201 | return (ERROR); |
---|
8202 | } |
---|
8203 | whichTranslate = 0; |
---|
8204 | expecting = Expecting(COMMA); |
---|
8205 | expecting |= Expecting(SEMICOLON); |
---|
8206 | } |
---|
8207 | } |
---|
8208 | else if (expecting == Expecting(COMMA)) |
---|
8209 | { |
---|
8210 | numTranslates++; |
---|
8211 | expecting = Expecting(ALPHA); |
---|
8212 | expecting |= Expecting(NUMBER); |
---|
8213 | } |
---|
8214 | |
---|
8215 | return (NO_ERROR); |
---|
8216 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
8217 | MrBayesPrint ("%s", tkn); |
---|
8218 | } |
---|
8219 | |
---|
8220 | |
---|
8221 | |
---|
8222 | |
---|
8223 | |
---|
8224 | int DoTree (void) |
---|
8225 | |
---|
8226 | { |
---|
8227 | |
---|
8228 | readComment = NO; |
---|
8229 | |
---|
8230 | if (inSumtCommand == YES || inComparetreeCommand == YES) |
---|
8231 | return (DoSumtTree ()); |
---|
8232 | |
---|
8233 | return (NO_ERROR); |
---|
8234 | } |
---|
8235 | |
---|
8236 | |
---|
8237 | |
---|
8238 | |
---|
8239 | |
---|
8240 | int DoTreeParm (char *parmName, char *tkn) |
---|
8241 | |
---|
8242 | { |
---|
8243 | |
---|
8244 | int i, tempInt, index; |
---|
8245 | MrBFlt tempD; |
---|
8246 | char tempName[100]; |
---|
8247 | static SafeLong lastExpecting; /* keep track of what we expected before a comment, in case we want to skip a comment */ |
---|
8248 | static char *tempNameString=NULL; /* Contains multiple tokens which form name string of param set*/ |
---|
8249 | static int foundAmpersand, foundColon, foundComment, foundE, foundB, foundN, foundFirst, |
---|
8250 | foundCurly, /* is set to YES when we are between two curly bracets ONLY while processing CppEvent name */ |
---|
8251 | foundClockrate, |
---|
8252 | foundName, /*is set to YES when param set name token is found and set to NO once full param set name is processed*/ |
---|
8253 | eSetIndex, /* is set in the begining of reading CppEvent for a node/branch to the index of currently processed CppEvent set */ |
---|
8254 | bSetIndex, eventIndex, treeIndex, nextIntNodeIndex; |
---|
8255 | static PolyNode *pp, *qq; |
---|
8256 | static PolyTree *t; |
---|
8257 | |
---|
8258 | /* This function will read in components of a tree description. We expect one of the following formats: |
---|
8259 | |
---|
8260 | tree <name> = [&R] <newick-description>; |
---|
8261 | tree <name> = [&U] <newick-description>; |
---|
8262 | tree <name> [&E CppEvents{1,2,5}] = [&R] [&clockrate = 1.23] ((1:0.021[&E CppEvents{1,2,5} 2:(0.10 1.11,0.83 3.17)],2:0.021):0.038,3:0.059); |
---|
8263 | tree <name> [&B TK02BranchRates{1,2,5}] = [&R] [&clockrate = 1.23] ((1:0.021[&B TK02BranchRates{1,2,5} 1.12],2:0.021[&B TK02BranchRates{1,2,5}... |
---|
8264 | |
---|
8265 | Values will be stored in event sets that go with the tree and that are used to initialize the relaxed clock |
---|
8266 | parameters before a run is started. Note that several sets of events can be stored with each tree. |
---|
8267 | */ |
---|
8268 | |
---|
8269 | |
---|
8270 | if (isTaxsetDef == NO) |
---|
8271 | { |
---|
8272 | MrBayesPrint ("%s Taxon labels must be specified before a tree could be red in\n", spacer); |
---|
8273 | return (ERROR); |
---|
8274 | } |
---|
8275 | if (inTreesBlock == NO) |
---|
8276 | { |
---|
8277 | MrBayesPrint ("%s You must be in a trees block to read a tree\n", spacer); |
---|
8278 | return (ERROR); |
---|
8279 | } |
---|
8280 | |
---|
8281 | if (expecting == Expecting(PARAMETER)) |
---|
8282 | { |
---|
8283 | /* this is the name of the tree */ |
---|
8284 | if (inSumtCommand==YES || inComparetreeCommand == YES) |
---|
8285 | { |
---|
8286 | /* we are reading in a tree to sumt or comparetree counters */ |
---|
8287 | t = sumtParams.tree; |
---|
8288 | ResetPolyTree (t); |
---|
8289 | } |
---|
8290 | else |
---|
8291 | { |
---|
8292 | /* we are reading in a user tree */ |
---|
8293 | /* check if the tree exists */ |
---|
8294 | treeIndex = 0; |
---|
8295 | for (i=0; i<numUserTrees; i++) |
---|
8296 | if (strcmp(tkn,userTree[i]->name) == 0) |
---|
8297 | break; |
---|
8298 | treeIndex = i; |
---|
8299 | if (treeIndex < numUserTrees) |
---|
8300 | { |
---|
8301 | MrBayesPrint ("%s Overwriting tree '%s'.\n", spacer, userTree[treeIndex]); |
---|
8302 | FreePolyTree (userTree[treeIndex]); |
---|
8303 | } |
---|
8304 | if ((userTree[treeIndex] = AllocatePolyTree (numTaxa)) == NULL) |
---|
8305 | return (ERROR); |
---|
8306 | t = userTree[treeIndex]; |
---|
8307 | } |
---|
8308 | strncpy (t->name, tkn, 99); |
---|
8309 | foundColon = foundAmpersand = foundEqual = foundComment = NO; |
---|
8310 | foundE = foundB = foundN = foundFirst = foundClockrate = foundName = NO; |
---|
8311 | eSetIndex = bSetIndex = eventIndex = 0; |
---|
8312 | nextAvailableNode = 0; |
---|
8313 | if (isTranslateDef == YES && isTranslateDiff == YES) |
---|
8314 | nextIntNodeIndex = numTranslates; |
---|
8315 | else |
---|
8316 | nextIntNodeIndex = numTaxa; |
---|
8317 | pp = &t->nodes[nextAvailableNode++]; |
---|
8318 | t->root = pp; |
---|
8319 | t->isRooted = NO; /* expect unrooted tree */ |
---|
8320 | t->isClock = NO; /* expect nonclock tree */ |
---|
8321 | t->isCalibrated = NO; /* expect uncalibrated tree */ |
---|
8322 | t->isRelaxed = NO; /* expect strict clock if clock tree */ |
---|
8323 | t->clockRate = 0.0; /* expect no clock rate */ |
---|
8324 | t->popSizeSet = NO; |
---|
8325 | readComment = YES; |
---|
8326 | expecting = Expecting(EQUALSIGN) | Expecting(LEFTCOMMENT); |
---|
8327 | lastExpecting = expecting; |
---|
8328 | } |
---|
8329 | else if (expecting == Expecting(EQUALSIGN)) |
---|
8330 | { |
---|
8331 | if (foundClockrate == YES) |
---|
8332 | expecting = Expecting(NUMBER); |
---|
8333 | else |
---|
8334 | { |
---|
8335 | for (i=0; i<numTaxa; i++) |
---|
8336 | tempSet[i] = NO; |
---|
8337 | foundEqual = YES; |
---|
8338 | expecting = Expecting(LEFTPAR) | Expecting(LEFTCOMMENT); |
---|
8339 | lastExpecting = expecting; |
---|
8340 | } |
---|
8341 | } |
---|
8342 | else if (expecting == Expecting(LEFTPAR)) |
---|
8343 | { |
---|
8344 | if (foundE == YES) |
---|
8345 | { |
---|
8346 | expecting = Expecting(NUMBER); |
---|
8347 | } |
---|
8348 | else |
---|
8349 | { |
---|
8350 | if (nextAvailableNode >= 2*numTaxa) |
---|
8351 | { |
---|
8352 | MrBayesPrint ("%s Too many nodes on tree '%s'\n", spacer, t->name); |
---|
8353 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8354 | FreePolyTree (userTree[treeIndex]); |
---|
8355 | return (ERROR); |
---|
8356 | } |
---|
8357 | qq = &t->nodes[nextAvailableNode++]; |
---|
8358 | qq->anc = pp; |
---|
8359 | pp->left = qq; |
---|
8360 | pp->index = nextIntNodeIndex++; |
---|
8361 | pp = qq; |
---|
8362 | expecting = Expecting(LEFTPAR); |
---|
8363 | expecting |= Expecting(ALPHA); |
---|
8364 | expecting |= Expecting(NUMBER); |
---|
8365 | expecting |= Expecting(LEFTCOMMENT); |
---|
8366 | lastExpecting = expecting; |
---|
8367 | } |
---|
8368 | } |
---|
8369 | else if (expecting == Expecting(ALPHA)) |
---|
8370 | { |
---|
8371 | if (foundAmpersand == YES) |
---|
8372 | { |
---|
8373 | if (strcmp(tkn,"E") == 0) |
---|
8374 | { |
---|
8375 | foundE = YES; |
---|
8376 | expecting = Expecting(ALPHA); |
---|
8377 | } |
---|
8378 | else if (strcmp(tkn,"B") == 0) |
---|
8379 | { |
---|
8380 | foundB = YES; |
---|
8381 | expecting = Expecting(ALPHA); |
---|
8382 | } |
---|
8383 | else if (strcmp(tkn,"N") == 0) |
---|
8384 | { |
---|
8385 | foundN = YES; |
---|
8386 | expecting = Expecting(ALPHA); |
---|
8387 | } |
---|
8388 | else if (strcmp(tkn, "R") == 0) |
---|
8389 | { |
---|
8390 | t->isRooted = YES; |
---|
8391 | t->isClock = YES; /* assume clock if rooted */ |
---|
8392 | expecting = Expecting(RIGHTCOMMENT); |
---|
8393 | } |
---|
8394 | else if (strcmp(tkn, "U") == 0) |
---|
8395 | { |
---|
8396 | t->isRooted = NO; |
---|
8397 | expecting = Expecting(RIGHTCOMMENT); |
---|
8398 | } |
---|
8399 | else if (strcmp(tkn, "clockrate") == 0) |
---|
8400 | { |
---|
8401 | t->isCalibrated = YES; |
---|
8402 | foundClockrate = YES; |
---|
8403 | expecting = Expecting(EQUALSIGN); |
---|
8404 | } |
---|
8405 | else |
---|
8406 | { |
---|
8407 | inComment = YES; |
---|
8408 | numComments++; |
---|
8409 | expecting = lastExpecting; |
---|
8410 | } |
---|
8411 | foundAmpersand = NO; |
---|
8412 | } |
---|
8413 | else if (foundName == YES && foundCurly == YES) |
---|
8414 | { |
---|
8415 | if( strcmp("all",tkn) == 0 ) |
---|
8416 | { |
---|
8417 | SafeStrcat (&tempNameString,tkn); |
---|
8418 | expecting = Expecting(RIGHTCURL); |
---|
8419 | } |
---|
8420 | else |
---|
8421 | { |
---|
8422 | MrBayesPrint ("%s Urecognized argument '%s'\n", spacer, tkn); |
---|
8423 | return (ERROR); |
---|
8424 | } |
---|
8425 | } |
---|
8426 | else if (foundE == YES) /* We have seen &E */ |
---|
8427 | { |
---|
8428 | if (foundEqual == NO) /* We have not seen name before and we are in header */ |
---|
8429 | { |
---|
8430 | t->nESets++; |
---|
8431 | t->isRelaxed = YES; |
---|
8432 | t->nEvents = (int **) SafeRealloc ((void *)t->nEvents, t->nESets*sizeof(int *)); |
---|
8433 | t->position = (MrBFlt ***) SafeRealloc ((void *)t->position, t->nESets*sizeof(MrBFlt **)); |
---|
8434 | t->rateMult = (MrBFlt ***) SafeRealloc ((void *)t->rateMult, t->nESets*sizeof(MrBFlt **)); |
---|
8435 | t->nEvents[t->nESets-1] = (int *) SafeCalloc ((size_t)(2*numTaxa), sizeof(int)); |
---|
8436 | t->position[t->nESets-1] = (MrBFlt **) SafeCalloc ((size_t)(2*numTaxa), sizeof(MrBFlt *)); |
---|
8437 | t->rateMult[t->nESets-1] = (MrBFlt **) SafeCalloc ((size_t)(2*numTaxa), sizeof(MrBFlt *)); |
---|
8438 | t->eSetName = (char **) SafeRealloc ((void *)t->eSetName, t->nESets*sizeof(char **)); |
---|
8439 | } |
---|
8440 | SafeStrcpy (&tempNameString,tkn); |
---|
8441 | foundName = YES; |
---|
8442 | expecting = Expecting(LEFTCURL); |
---|
8443 | if (foundEqual == YES) |
---|
8444 | expecting |= Expecting(NUMBER); |
---|
8445 | else |
---|
8446 | expecting |= Expecting(RIGHTCOMMENT); |
---|
8447 | } |
---|
8448 | else if (foundB == YES) |
---|
8449 | { |
---|
8450 | if (foundEqual == NO) |
---|
8451 | { |
---|
8452 | t->nBSets++; |
---|
8453 | t->isRelaxed = YES; |
---|
8454 | t->effectiveBrLen = (MrBFlt **) SafeRealloc ((void *)t->effectiveBrLen, (size_t)(t->nBSets*sizeof(MrBFlt *))); |
---|
8455 | t->effectiveBrLen[t->nBSets-1] = (MrBFlt *) SafeCalloc ((size_t)(2*numTaxa),sizeof(MrBFlt)); |
---|
8456 | for (i=0; i<2*numTaxa; i++) |
---|
8457 | t->effectiveBrLen[t->nBSets-1][i] = 1.0; |
---|
8458 | t->bSetName = (char **) SafeRealloc ((void *)t->bSetName, t->nBSets*sizeof(char **)); |
---|
8459 | t->bSetName[t->nBSets-1] = (char *) SafeCalloc (strlen(tkn)+1,sizeof(char)); |
---|
8460 | } |
---|
8461 | SafeStrcpy (&tempNameString,tkn); |
---|
8462 | foundName = YES; |
---|
8463 | expecting = Expecting(LEFTCURL); |
---|
8464 | if (foundEqual == YES) |
---|
8465 | expecting |= Expecting(NUMBER); |
---|
8466 | else |
---|
8467 | expecting |= Expecting(RIGHTCOMMENT); |
---|
8468 | } |
---|
8469 | else if (foundN == YES) |
---|
8470 | { |
---|
8471 | if (foundEqual == NO) |
---|
8472 | { |
---|
8473 | if (t->popSizeSet == YES) |
---|
8474 | { |
---|
8475 | MrBayesPrint ("%s Cannot hold more than one population size set\n", spacer); |
---|
8476 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8477 | FreePolyTree (userTree[treeIndex]); |
---|
8478 | return (ERROR); |
---|
8479 | } |
---|
8480 | t->popSizeSet = YES; |
---|
8481 | if (isTranslateDef == YES && isTranslateDiff == YES) |
---|
8482 | t->popSize = (MrBFlt *) SafeCalloc (2*numTranslates-1, sizeof(MrBFlt)); |
---|
8483 | else |
---|
8484 | t->popSize = (MrBFlt *) SafeCalloc (2*numLocalTaxa-1, sizeof(MrBFlt)); |
---|
8485 | } |
---|
8486 | SafeStrcpy (&tempNameString,tkn); |
---|
8487 | foundName = YES; |
---|
8488 | expecting = Expecting(LEFTCURL); |
---|
8489 | if (foundEqual == YES) |
---|
8490 | expecting |= Expecting(NUMBER); |
---|
8491 | else |
---|
8492 | expecting |= Expecting(RIGHTCOMMENT); |
---|
8493 | } |
---|
8494 | else /* taxon name */ |
---|
8495 | { |
---|
8496 | if (isTranslateDef == YES) |
---|
8497 | { |
---|
8498 | /* we are using the translation table */ |
---|
8499 | if (CheckString (transTo, numTranslates, tkn, &index) == ERROR) |
---|
8500 | { |
---|
8501 | MrBayesPrint ("%s Could not find token '%s' in taxon translation table\n", spacer, tkn); |
---|
8502 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8503 | FreePolyTree (userTree[treeIndex]); |
---|
8504 | return (ERROR); |
---|
8505 | } |
---|
8506 | strcpy (tempName, transFrom[index]); |
---|
8507 | if (isTranslateDiff == NO && CheckString (taxaNames, numTaxa, tempName, &index) == ERROR) |
---|
8508 | { |
---|
8509 | MrBayesPrint ("%s Could not find taxon '%s' in list of taxa\n", spacer, tkn); |
---|
8510 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8511 | FreePolyTree (userTree[treeIndex]); |
---|
8512 | return (ERROR); |
---|
8513 | } |
---|
8514 | if (tempSet[index] == YES) |
---|
8515 | { |
---|
8516 | MrBayesPrint ("%s Taxon name '%s' already used in tree\n", spacer, tkn); |
---|
8517 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8518 | FreePolyTree (userTree[treeIndex]); |
---|
8519 | return (ERROR); |
---|
8520 | } |
---|
8521 | tempSet[index] = YES; |
---|
8522 | strcpy (pp->label, tempName); |
---|
8523 | pp->index = index; |
---|
8524 | } |
---|
8525 | else |
---|
8526 | { |
---|
8527 | /* Check to see if the name is in the list of taxon names. */ |
---|
8528 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
8529 | { |
---|
8530 | MrBayesPrint ("%s Could not find taxon '%s' in list of taxa\n", spacer, tkn); |
---|
8531 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8532 | FreePolyTree (userTree[treeIndex]); |
---|
8533 | return (ERROR); |
---|
8534 | } |
---|
8535 | if (tempSet[index] == YES) |
---|
8536 | { |
---|
8537 | MrBayesPrint ("%s Taxon name '%s' already used in tree\n", spacer, tkn); |
---|
8538 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8539 | FreePolyTree (userTree[treeIndex]); |
---|
8540 | return (ERROR); |
---|
8541 | } |
---|
8542 | tempSet[index] = YES; |
---|
8543 | strcpy (pp->label, tkn); |
---|
8544 | pp->index = index; |
---|
8545 | } |
---|
8546 | expecting = Expecting(COMMA); |
---|
8547 | expecting |= Expecting(COLON); |
---|
8548 | expecting |= Expecting(RIGHTPAR); |
---|
8549 | } |
---|
8550 | } |
---|
8551 | else if (expecting == Expecting(RIGHTPAR)) |
---|
8552 | { |
---|
8553 | if (foundE == YES) |
---|
8554 | expecting = Expecting(RIGHTCOMMENT); |
---|
8555 | else |
---|
8556 | { |
---|
8557 | if (pp->anc == NULL) |
---|
8558 | { |
---|
8559 | MrBayesPrint ("%s Incorrect tree format: cannot go down\n", spacer);//, tkn |
---|
8560 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8561 | FreePolyTree (userTree[treeIndex]); |
---|
8562 | return (ERROR); |
---|
8563 | } |
---|
8564 | if( pp->anc->left == pp ) |
---|
8565 | { |
---|
8566 | MrBayesPrint ("%s Incorrect tree format: all nodes except tips should have more then one child. Either a single\n", spacer); |
---|
8567 | MrBayesPrint ("%s taxon is surrounded with brackets or there is a clade surrounded by double brackets.\n", spacer); |
---|
8568 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8569 | FreePolyTree (userTree[treeIndex]); |
---|
8570 | return (ERROR); |
---|
8571 | } |
---|
8572 | pp = pp->anc; |
---|
8573 | if (pp->anc == NULL) |
---|
8574 | { |
---|
8575 | /* finish up tree */ |
---|
8576 | t->nNodes = nextAvailableNode; |
---|
8577 | t->nIntNodes = t->nNodes; |
---|
8578 | for (i=0; i<t->nNodes; i++) |
---|
8579 | { |
---|
8580 | if (t->nodes[i].left == NULL) |
---|
8581 | t->nIntNodes--; |
---|
8582 | } |
---|
8583 | GetPolyDownPass(t); |
---|
8584 | |
---|
8585 | /* check that number of taxa is correct */ |
---|
8586 | if (t->isRooted == NO && t->nNodes-t->nIntNodes == t->nIntNodes + 1) |
---|
8587 | t->isRooted = YES; |
---|
8588 | if ((t->isRooted == YES && t->nNodes-t->nIntNodes != t->nIntNodes + 1) || |
---|
8589 | (t->isRooted == NO && t->nNodes-t->nIntNodes != t->nIntNodes + 2)) |
---|
8590 | { |
---|
8591 | /* we are protected from adding too many taxa by taxon-matching code above */ |
---|
8592 | if (t->isRooted == YES && t->nNodes-t->nIntNodes == t->nIntNodes + 2) |
---|
8593 | { |
---|
8594 | MrBayesPrint ("%s The tree is declared as rooted (by comment [&R]) but\n", spacer); |
---|
8595 | MrBayesPrint ("%s the given tree has unrooted structure.\n", spacer); |
---|
8596 | } |
---|
8597 | else |
---|
8598 | MrBayesPrint ("%s Taxa missing in tree\n", spacer); |
---|
8599 | |
---|
8600 | return (ERROR); |
---|
8601 | } |
---|
8602 | |
---|
8603 | /* check other properties */ |
---|
8604 | if (t->isClock == YES && t->isRooted == NO) |
---|
8605 | { |
---|
8606 | MrBayesPrint ("%s Tree has clock rate but is not rooted\n", spacer); |
---|
8607 | return (ERROR); |
---|
8608 | /* Note: any deviation from an ultrametric tree must be assumed to be due to dated |
---|
8609 | tips at this point */ |
---|
8610 | } |
---|
8611 | if (t->isRelaxed == YES && t->isClock == NO) |
---|
8612 | { |
---|
8613 | MrBayesPrint ("%s Tree has relaxed clock rates but is not a clock tree\n", spacer); |
---|
8614 | return (ERROR); |
---|
8615 | } |
---|
8616 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8617 | { |
---|
8618 | if (treeIndex == numUserTrees) |
---|
8619 | numUserTrees++; |
---|
8620 | MrBayesPrint ("%s Successfully read tree '%s'\n", spacer, userTree[treeIndex]->name); |
---|
8621 | } |
---|
8622 | if (t->popSize == NULL) |
---|
8623 | { |
---|
8624 | readComment = NO; |
---|
8625 | expecting = Expecting(SEMICOLON); |
---|
8626 | } |
---|
8627 | else |
---|
8628 | { |
---|
8629 | readComment = YES; |
---|
8630 | expecting = Expecting(LEFTCOMMENT); |
---|
8631 | lastExpecting = expecting; |
---|
8632 | } |
---|
8633 | } |
---|
8634 | else |
---|
8635 | { |
---|
8636 | expecting = Expecting(COMMA); |
---|
8637 | expecting |= Expecting(COLON); |
---|
8638 | expecting |= Expecting(RIGHTPAR); |
---|
8639 | } |
---|
8640 | } |
---|
8641 | } |
---|
8642 | else if (expecting == Expecting(COLON)) |
---|
8643 | { |
---|
8644 | foundColon = YES; |
---|
8645 | if (foundE == YES) |
---|
8646 | expecting = Expecting(LEFTPAR); |
---|
8647 | else |
---|
8648 | expecting = Expecting(NUMBER); |
---|
8649 | expecting |= Expecting(LEFTCOMMENT); |
---|
8650 | lastExpecting = expecting; |
---|
8651 | } |
---|
8652 | else if (expecting == Expecting(COMMA)) |
---|
8653 | { |
---|
8654 | if (foundName == YES) |
---|
8655 | { |
---|
8656 | SafeStrcat (&tempNameString,","); |
---|
8657 | expecting = Expecting(NUMBER); |
---|
8658 | } |
---|
8659 | else if (foundE == YES) |
---|
8660 | { |
---|
8661 | expecting = Expecting(NUMBER); |
---|
8662 | } |
---|
8663 | else |
---|
8664 | { |
---|
8665 | if (nextAvailableNode >= 2*numTaxa) |
---|
8666 | { |
---|
8667 | MrBayesPrint ("%s Too many nodes on tree '%s'\n", spacer, t->name); |
---|
8668 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8669 | FreePolyTree (userTree[treeIndex]); |
---|
8670 | return (ERROR); |
---|
8671 | } |
---|
8672 | qq = &t->nodes[nextAvailableNode++]; |
---|
8673 | pp->sib = qq; |
---|
8674 | qq->anc = pp->anc; |
---|
8675 | pp = qq; |
---|
8676 | expecting = Expecting(LEFTPAR); |
---|
8677 | expecting |= Expecting(ALPHA); |
---|
8678 | expecting |= Expecting(NUMBER); |
---|
8679 | expecting |= Expecting(LEFTCOMMENT); |
---|
8680 | lastExpecting = expecting; |
---|
8681 | } |
---|
8682 | } |
---|
8683 | else if (expecting == Expecting(NUMBER)) |
---|
8684 | { |
---|
8685 | if (foundClockrate == YES) |
---|
8686 | { |
---|
8687 | sscanf (tkn, "%lf", &tempD); |
---|
8688 | t->clockRate = tempD; |
---|
8689 | foundClockrate = NO; |
---|
8690 | expecting = Expecting(RIGHTCOMMENT); |
---|
8691 | } |
---|
8692 | else if (foundName == YES && foundCurly == YES) |
---|
8693 | { |
---|
8694 | /* still assembling name of a param set */ |
---|
8695 | SafeStrcat (&tempNameString,tkn); |
---|
8696 | expecting = Expecting(RIGHTCURL) | Expecting(COMMA); |
---|
8697 | } |
---|
8698 | else if (foundN == YES) |
---|
8699 | { |
---|
8700 | /* we only know now that name is complete if it does not have curlies in it */ |
---|
8701 | foundName = NO; |
---|
8702 | |
---|
8703 | if (strcmp(tempNameString,t->popSizeSetName) != 0) |
---|
8704 | { |
---|
8705 | MrBayesPrint ("%s Could not find population size set '%s'\n", spacer, tempNameString); |
---|
8706 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8707 | FreePolyTree (userTree[treeIndex]); |
---|
8708 | return (ERROR); |
---|
8709 | } |
---|
8710 | |
---|
8711 | sscanf (tkn, "%lf", &tempD); |
---|
8712 | t->popSize[pp->index] = tempD; |
---|
8713 | foundN = NO; |
---|
8714 | expecting = Expecting(RIGHTCOMMENT); |
---|
8715 | } |
---|
8716 | else if (foundB == YES) |
---|
8717 | { |
---|
8718 | /* we only know now that name is complete if it does not have curlies in it */ |
---|
8719 | foundName = NO; |
---|
8720 | |
---|
8721 | /* find the right effective branch length set */ |
---|
8722 | for (i=0; i<t->nBSets; i++) |
---|
8723 | if (strcmp(t->bSetName[i],tempNameString) == 0) |
---|
8724 | break; |
---|
8725 | if (i == t->nBSets) |
---|
8726 | { |
---|
8727 | MrBayesPrint ("%s Could not find effective branch length set '%s'\n", spacer, tempNameString); |
---|
8728 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8729 | FreePolyTree (userTree[treeIndex]); |
---|
8730 | return (ERROR); |
---|
8731 | } |
---|
8732 | bSetIndex = i; |
---|
8733 | |
---|
8734 | sscanf (tkn, "%lf", &tempD); |
---|
8735 | t->effectiveBrLen[bSetIndex][pp->index] = tempD; |
---|
8736 | foundB = NO; |
---|
8737 | expecting = Expecting(RIGHTCOMMENT); |
---|
8738 | } |
---|
8739 | else if (foundE == YES) |
---|
8740 | { |
---|
8741 | if (foundColon == NO) |
---|
8742 | { |
---|
8743 | /* we only know now that name is complete if it does not have curlies in it */ |
---|
8744 | foundName = NO; |
---|
8745 | |
---|
8746 | /* find the right event set */ |
---|
8747 | for (i=0; i<t->nESets; i++) |
---|
8748 | if (strcmp(t->eSetName[i],tempNameString) == 0) |
---|
8749 | break; |
---|
8750 | if (i == t->nESets) |
---|
8751 | { |
---|
8752 | MrBayesPrint ("%s Could not find event set '%s'\n", spacer, tempNameString); |
---|
8753 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8754 | FreePolyTree (userTree[treeIndex]); |
---|
8755 | return (ERROR); |
---|
8756 | } |
---|
8757 | eSetIndex = i; |
---|
8758 | |
---|
8759 | sscanf (tkn, "%d", &tempInt); |
---|
8760 | if (tempInt < 0) |
---|
8761 | { |
---|
8762 | MrBayesPrint ("%s Wrong number of events (%d) for event set '%s'\n", spacer, tempInt, t->eSetName[eSetIndex]); |
---|
8763 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8764 | FreePolyTree (userTree[treeIndex]); |
---|
8765 | return (ERROR); |
---|
8766 | } |
---|
8767 | t->nEvents[eSetIndex][pp->index] = tempInt; |
---|
8768 | if (tempInt > 0) |
---|
8769 | { |
---|
8770 | t->position[eSetIndex][pp->index] = (MrBFlt *) SafeCalloc (tempInt, sizeof(MrBFlt)); |
---|
8771 | t->rateMult[eSetIndex][pp->index] = (MrBFlt *) SafeCalloc (tempInt, sizeof(MrBFlt)); |
---|
8772 | expecting = Expecting (COLON); |
---|
8773 | if (inSumtCommand == YES || inComparetreeCommand == YES) |
---|
8774 | expecting |= Expecting (RIGHTCOMMENT); /* we allow empty event specifications in sumt and comparetree */ |
---|
8775 | } |
---|
8776 | else |
---|
8777 | expecting = Expecting (RIGHTCOMMENT); |
---|
8778 | eventIndex = 0; |
---|
8779 | } |
---|
8780 | else if (foundFirst == NO) |
---|
8781 | { |
---|
8782 | /* processing the first number in the cpp event pair <position rate>*/ |
---|
8783 | sscanf (tkn, "%lf", &tempD); |
---|
8784 | t->position[eSetIndex][pp->index][eventIndex] = tempD; |
---|
8785 | expecting = Expecting(NUMBER); |
---|
8786 | foundFirst = YES; |
---|
8787 | } |
---|
8788 | else |
---|
8789 | { |
---|
8790 | /* processing the second number in the cpp event pair <position rate>*/ |
---|
8791 | foundFirst = NO; |
---|
8792 | sscanf (tkn, "%lf", &tempD); |
---|
8793 | t->rateMult[eSetIndex][pp->index][eventIndex] = tempD; |
---|
8794 | #if defined (PRINT_RATEMULTIPLIERS_CPP) |
---|
8795 | //if(rateMultfp!=NULL) |
---|
8796 | // fprintf(rateMultfp,"%s\n",tkn); |
---|
8797 | #endif |
---|
8798 | eventIndex++; |
---|
8799 | if (eventIndex == t->nEvents[eSetIndex][pp->index]) |
---|
8800 | { |
---|
8801 | expecting = Expecting(RIGHTPAR); |
---|
8802 | foundColon = NO; |
---|
8803 | } |
---|
8804 | else |
---|
8805 | expecting = Expecting(COMMA); |
---|
8806 | } |
---|
8807 | } |
---|
8808 | else if (foundColon == YES) |
---|
8809 | { |
---|
8810 | /* branch length */ |
---|
8811 | sscanf (tkn, "%lf", &tempD); |
---|
8812 | pp->length = tempD; |
---|
8813 | foundColon = NO; |
---|
8814 | t->brlensDef = YES; |
---|
8815 | expecting = Expecting(COMMA); |
---|
8816 | expecting |= Expecting(RIGHTPAR); |
---|
8817 | expecting |= Expecting(LEFTCOMMENT); |
---|
8818 | lastExpecting = expecting; |
---|
8819 | } |
---|
8820 | else /* taxon identifier */ |
---|
8821 | { |
---|
8822 | if (isTranslateDef == YES) |
---|
8823 | { |
---|
8824 | /* we are using the translation table */ |
---|
8825 | if (CheckString (transTo, numTranslates, tkn, &index) == ERROR) |
---|
8826 | { |
---|
8827 | MrBayesPrint ("%s Could not find token '%s' in taxon translation table\n", spacer, tkn); |
---|
8828 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8829 | FreePolyTree (userTree[treeIndex]); |
---|
8830 | return (ERROR); |
---|
8831 | } |
---|
8832 | strcpy (tempName, transFrom[index]); |
---|
8833 | if (isTranslateDiff == NO && CheckString (taxaNames, numTaxa, tempName, &index) == ERROR) |
---|
8834 | { |
---|
8835 | MrBayesPrint ("%s Could not find taxon '%s' in list of taxa\n", spacer, tkn); |
---|
8836 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8837 | FreePolyTree (userTree[treeIndex]); |
---|
8838 | return (ERROR); |
---|
8839 | } |
---|
8840 | if (tempSet[index] == YES) |
---|
8841 | { |
---|
8842 | MrBayesPrint ("%s Taxon name '%s' already used in tree\n", spacer, tkn); |
---|
8843 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8844 | FreePolyTree (userTree[treeIndex]); |
---|
8845 | return (ERROR); |
---|
8846 | } |
---|
8847 | tempSet[index] = YES; |
---|
8848 | strcpy (pp->label, tempName); |
---|
8849 | pp->index = index; |
---|
8850 | } |
---|
8851 | else |
---|
8852 | { |
---|
8853 | /* Simply use taxon number; first check to see if the name is in the list of taxon names. */ |
---|
8854 | if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR) |
---|
8855 | { |
---|
8856 | /* The number could not be found as a taxon name in the list of taxon names. We will |
---|
8857 | assume that the user has then input taxa as numbers and not the names. */ |
---|
8858 | sscanf (tkn, "%d", &index); |
---|
8859 | if (index < 1 || index > numTaxa) |
---|
8860 | { |
---|
8861 | MrBayesPrint ("%s Taxon number %d is out of range\n", spacer, index); |
---|
8862 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8863 | FreePolyTree (userTree[treeIndex]); |
---|
8864 | return (ERROR); |
---|
8865 | } |
---|
8866 | index--; |
---|
8867 | if (tempSet[index] == YES) |
---|
8868 | { |
---|
8869 | MrBayesPrint ("%s Taxon name %d has already been used in tree '%s'\n", spacer, index+1, t->name); |
---|
8870 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8871 | FreePolyTree (userTree[treeIndex]); |
---|
8872 | return (ERROR); |
---|
8873 | } |
---|
8874 | } |
---|
8875 | else |
---|
8876 | { |
---|
8877 | /* The number is in the list of taxon names */ |
---|
8878 | if (index < 0 || index >= numTaxa) |
---|
8879 | { |
---|
8880 | MrBayesPrint ("%s Taxon name %s could not be found\n", spacer, tkn); |
---|
8881 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8882 | FreePolyTree (userTree[treeIndex]); |
---|
8883 | return (ERROR); |
---|
8884 | } |
---|
8885 | if (tempSet[index] == YES) |
---|
8886 | { |
---|
8887 | MrBayesPrint ("%s Taxon %d has already been used in tree '%s'\n", spacer, index+1, t->name); |
---|
8888 | if (inSumtCommand == NO && inComparetreeCommand == NO) |
---|
8889 | FreePolyTree (userTree[treeIndex]); |
---|
8890 | return (ERROR); |
---|
8891 | } |
---|
8892 | } |
---|
8893 | tempSet[index] = YES; |
---|
8894 | strcpy (pp->label, taxaNames[index]); |
---|
8895 | pp->index = index; |
---|
8896 | } |
---|
8897 | expecting = Expecting(COMMA); |
---|
8898 | expecting |= Expecting(COLON); |
---|
8899 | expecting |= Expecting(RIGHTPAR); |
---|
8900 | expecting |= Expecting(LEFTCOMMENT); |
---|
8901 | lastExpecting = expecting; |
---|
8902 | } |
---|
8903 | } |
---|
8904 | else if (expecting == Expecting(LEFTCOMMENT)) |
---|
8905 | { |
---|
8906 | expecting = Expecting(AMPERSAND); |
---|
8907 | foundComment = YES; |
---|
8908 | } |
---|
8909 | else if (expecting == Expecting(RIGHTCOMMENT)) |
---|
8910 | { |
---|
8911 | if (foundEqual == NO) |
---|
8912 | { |
---|
8913 | /* We may have a complete name of a set of branch parameters, which needs to be recorded */ |
---|
8914 | if (foundName == YES) |
---|
8915 | { |
---|
8916 | if (foundE == YES) |
---|
8917 | { |
---|
8918 | t->eSetName[t->nESets-1] = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char)); |
---|
8919 | strcat(t->eSetName[t->nESets-1],tempNameString); |
---|
8920 | } |
---|
8921 | else if (foundB == YES) |
---|
8922 | { |
---|
8923 | t->bSetName[t->nBSets-1] = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char)); |
---|
8924 | strcat(t->bSetName[t->nBSets-1],tempNameString); |
---|
8925 | } |
---|
8926 | else if (foundN == YES) |
---|
8927 | { |
---|
8928 | t->popSizeSetName = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char)); |
---|
8929 | strcpy(t->popSizeSetName,tempNameString); |
---|
8930 | } |
---|
8931 | foundName = NO; |
---|
8932 | } |
---|
8933 | expecting = Expecting(EQUALSIGN); |
---|
8934 | } |
---|
8935 | else |
---|
8936 | { |
---|
8937 | if (pp->anc == NULL) |
---|
8938 | { |
---|
8939 | if (pp->left == NULL) |
---|
8940 | expecting = Expecting(LEFTPAR); |
---|
8941 | else |
---|
8942 | expecting = Expecting(SEMICOLON); |
---|
8943 | } |
---|
8944 | else if (pp == pp->anc->left) |
---|
8945 | expecting = Expecting(COMMA); |
---|
8946 | else |
---|
8947 | expecting = Expecting(RIGHTPAR); |
---|
8948 | } |
---|
8949 | foundE = foundB = foundN = NO; |
---|
8950 | expecting |= Expecting(LEFTCOMMENT); |
---|
8951 | } |
---|
8952 | else if (expecting == Expecting(AMPERSAND)) |
---|
8953 | { |
---|
8954 | foundAmpersand = YES; |
---|
8955 | foundComment = NO; |
---|
8956 | expecting = Expecting (ALPHA); |
---|
8957 | } |
---|
8958 | else if (foundComment == YES) |
---|
8959 | { |
---|
8960 | numComments++; |
---|
8961 | foundComment = NO; |
---|
8962 | } |
---|
8963 | else if (expecting == Expecting(LEFTCURL)) |
---|
8964 | { |
---|
8965 | if( foundName == YES) |
---|
8966 | { |
---|
8967 | foundCurly=YES; |
---|
8968 | SafeStrcat (&tempNameString,"{"); |
---|
8969 | expecting = Expecting(NUMBER) | Expecting(ALPHA); |
---|
8970 | } |
---|
8971 | else |
---|
8972 | return(ERROR); |
---|
8973 | } |
---|
8974 | else if (expecting == Expecting(RIGHTCURL)) |
---|
8975 | { |
---|
8976 | if( foundName == YES) |
---|
8977 | { |
---|
8978 | SafeStrcat (&tempNameString,"}"); |
---|
8979 | foundCurly=NO; |
---|
8980 | if (foundEqual == NO) |
---|
8981 | { |
---|
8982 | /* We are processing a name of a set of branch params in the header of a tree. */ |
---|
8983 | expecting = Expecting(RIGHTCOMMENT); |
---|
8984 | } |
---|
8985 | else |
---|
8986 | { |
---|
8987 | /* We are processing a param value of a branch param set */ |
---|
8988 | expecting = Expecting(NUMBER); |
---|
8989 | } |
---|
8990 | } |
---|
8991 | else |
---|
8992 | return(ERROR); |
---|
8993 | } |
---|
8994 | return (NO_ERROR); |
---|
8995 | |
---|
8996 | MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */ |
---|
8997 | |
---|
8998 | } |
---|
8999 | |
---|
9000 | |
---|
9001 | |
---|
9002 | |
---|
9003 | |
---|
9004 | |
---|
9005 | int DoUserTree (void) |
---|
9006 | |
---|
9007 | { |
---|
9008 | MrBayesPrint ("%s Usertree command deprecated. Define the tree in a treeblock and use 'Startvals' instead.\n", spacer); |
---|
9009 | return (ERROR); |
---|
9010 | } |
---|
9011 | |
---|
9012 | |
---|
9013 | |
---|
9014 | |
---|
9015 | |
---|
9016 | int DoUserTreeParm (char *parmName, char *tkn) |
---|
9017 | |
---|
9018 | { |
---|
9019 | if (expecting == Expecting(EQUALSIGN)) |
---|
9020 | { |
---|
9021 | expecting = Expecting(LEFTPAR); |
---|
9022 | expecting |= Expecting(RIGHTPAR); |
---|
9023 | expecting |= Expecting(COLON); |
---|
9024 | expecting |= Expecting(NUMBER); |
---|
9025 | expecting |= Expecting(ALPHA); |
---|
9026 | expecting |= Expecting(SEMICOLON); |
---|
9027 | } |
---|
9028 | else if (expecting == Expecting(LEFTPAR)) |
---|
9029 | { |
---|
9030 | expecting = Expecting(LEFTPAR); |
---|
9031 | expecting |= Expecting(ALPHA); |
---|
9032 | expecting |= Expecting(NUMBER); |
---|
9033 | } |
---|
9034 | else if (expecting == Expecting(ALPHA)) |
---|
9035 | { |
---|
9036 | expecting = Expecting(COLON); |
---|
9037 | expecting |= Expecting(COMMA); |
---|
9038 | expecting |= Expecting(RIGHTPAR); |
---|
9039 | } |
---|
9040 | else if (expecting == Expecting(NUMBER)) |
---|
9041 | { |
---|
9042 | expecting = Expecting(COLON); |
---|
9043 | expecting |= Expecting(COMMA); |
---|
9044 | expecting |= Expecting(RIGHTPAR); |
---|
9045 | } |
---|
9046 | else if (expecting == Expecting(COLON)) |
---|
9047 | { |
---|
9048 | expecting = Expecting(NUMBER); |
---|
9049 | } |
---|
9050 | else if (expecting == Expecting(COMMA)) |
---|
9051 | { |
---|
9052 | expecting = Expecting(LEFTPAR); |
---|
9053 | expecting |= Expecting(ALPHA); |
---|
9054 | expecting |= Expecting(NUMBER); |
---|
9055 | } |
---|
9056 | else if (expecting == Expecting(RIGHTPAR)) |
---|
9057 | { |
---|
9058 | expecting = Expecting(RIGHTPAR); |
---|
9059 | expecting |= Expecting(COMMA); |
---|
9060 | expecting |= Expecting(COLON); |
---|
9061 | expecting |= Expecting(SEMICOLON); |
---|
9062 | } |
---|
9063 | else |
---|
9064 | return (ERROR); |
---|
9065 | return (NO_ERROR); |
---|
9066 | } |
---|
9067 | |
---|
9068 | |
---|
9069 | |
---|
9070 | |
---|
9071 | |
---|
9072 | int DoVersion (void) |
---|
9073 | |
---|
9074 | { |
---|
9075 | |
---|
9076 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9077 | MrBayesPrint (" Version \n"); |
---|
9078 | MrBayesPrint (" \n"); |
---|
9079 | MrBayesPrint (" MrBayes v%s \n", VERSION_NUMBER); |
---|
9080 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9081 | |
---|
9082 | return (NO_ERROR); |
---|
9083 | |
---|
9084 | } |
---|
9085 | |
---|
9086 | |
---|
9087 | |
---|
9088 | |
---|
9089 | |
---|
9090 | SafeLong Expecting (int y) |
---|
9091 | |
---|
9092 | { |
---|
9093 | |
---|
9094 | SafeLong x; |
---|
9095 | |
---|
9096 | x = (SafeLong)pow(2.0, (MrBFlt)y); |
---|
9097 | |
---|
9098 | return (x); |
---|
9099 | |
---|
9100 | } |
---|
9101 | |
---|
9102 | |
---|
9103 | |
---|
9104 | |
---|
9105 | |
---|
9106 | #ifdef HAVE_LIBREADLINE |
---|
9107 | /* This function is for commandline substitution: first word is always a command */ |
---|
9108 | char *command_generator(const char *text, int state) { |
---|
9109 | static int list_index, len; |
---|
9110 | char *command; |
---|
9111 | |
---|
9112 | if(state==0) |
---|
9113 | { |
---|
9114 | list_index=0; |
---|
9115 | len= (int) strlen(text); |
---|
9116 | } |
---|
9117 | while ((command=commands[list_index].string)!=NULL) |
---|
9118 | { |
---|
9119 | list_index++; |
---|
9120 | if (strncasecmp(command,text,len)==0) |
---|
9121 | /* memory is freed by the readline library so we need a strdup here */ |
---|
9122 | return strdup(command); |
---|
9123 | } |
---|
9124 | return (char *)NULL; |
---|
9125 | } |
---|
9126 | #endif |
---|
9127 | |
---|
9128 | |
---|
9129 | |
---|
9130 | int FindValidCommand (char *tk, int *numMatches) |
---|
9131 | |
---|
9132 | { |
---|
9133 | |
---|
9134 | int i, j, tkLen, targetLen, numDiff; |
---|
9135 | CmdType *p; |
---|
9136 | |
---|
9137 | p = commands + 0; |
---|
9138 | tkLen = (int) strlen(tk); |
---|
9139 | |
---|
9140 | (*numMatches) = 0; |
---|
9141 | for (i=0; i<NUMCOMMANDS; i++) |
---|
9142 | { |
---|
9143 | targetLen = (int) strlen(p->string); |
---|
9144 | if (tkLen <= targetLen) |
---|
9145 | { |
---|
9146 | for (j=0, numDiff=0; j<tkLen; j++) |
---|
9147 | { |
---|
9148 | if (ChangeCase(tk[j]) != ChangeCase(p->string[j])) |
---|
9149 | numDiff++; |
---|
9150 | } |
---|
9151 | if (numDiff == 0) |
---|
9152 | { |
---|
9153 | (*numMatches)++; |
---|
9154 | commandPtr = p; |
---|
9155 | if (tkLen == targetLen) |
---|
9156 | break; |
---|
9157 | } |
---|
9158 | } |
---|
9159 | p++; |
---|
9160 | } |
---|
9161 | |
---|
9162 | inValidCommand = NO; |
---|
9163 | if (*numMatches == 1) |
---|
9164 | { |
---|
9165 | inValidCommand = YES; |
---|
9166 | return (NO_ERROR); |
---|
9167 | } |
---|
9168 | else |
---|
9169 | return (ERROR); |
---|
9170 | |
---|
9171 | } |
---|
9172 | |
---|
9173 | |
---|
9174 | |
---|
9175 | |
---|
9176 | |
---|
9177 | int FindValidParam (char *tk, int *numMatches) |
---|
9178 | |
---|
9179 | { |
---|
9180 | |
---|
9181 | int i, j, tkLen, targetLen, numDiff; |
---|
9182 | CmdType *p; |
---|
9183 | ParmInfoPtr q; |
---|
9184 | |
---|
9185 | if (commandPtr) |
---|
9186 | p = commandPtr; |
---|
9187 | else |
---|
9188 | { |
---|
9189 | MrBayesPrint ("%s Command pointer is NULL\n", spacer); |
---|
9190 | return (ERROR); |
---|
9191 | } |
---|
9192 | tkLen = (int) strlen(tk); |
---|
9193 | |
---|
9194 | *numMatches = 0; |
---|
9195 | for (i=0; i<p->numParms; i++) |
---|
9196 | { |
---|
9197 | q = paramTable + (p->parmList[i]); |
---|
9198 | targetLen = (int) strlen(q->string); |
---|
9199 | /*printf ("%s %d (%s %d)\n", q->string, targetLen, tk, p->numParms);*/ |
---|
9200 | if (!strcmp(q->string, "Xxxxxxxxxx")) |
---|
9201 | { |
---|
9202 | (*numMatches)++; |
---|
9203 | paramPtr = q; |
---|
9204 | } |
---|
9205 | else if (tkLen <= targetLen) |
---|
9206 | { |
---|
9207 | for (j=0, numDiff=0; j<tkLen; j++) |
---|
9208 | { |
---|
9209 | if (ChangeCase(tk[j]) != ChangeCase(q->string[j])) |
---|
9210 | numDiff++; |
---|
9211 | } |
---|
9212 | if (numDiff == 0) |
---|
9213 | { |
---|
9214 | (*numMatches)++; |
---|
9215 | paramPtr = q; |
---|
9216 | if (tkLen == targetLen) |
---|
9217 | break; |
---|
9218 | } |
---|
9219 | } |
---|
9220 | } |
---|
9221 | |
---|
9222 | if (*numMatches == 1) |
---|
9223 | return (NO_ERROR); |
---|
9224 | else |
---|
9225 | return (ERROR); |
---|
9226 | |
---|
9227 | } |
---|
9228 | |
---|
9229 | |
---|
9230 | |
---|
9231 | |
---|
9232 | |
---|
9233 | int FreeCharacters (void) |
---|
9234 | |
---|
9235 | { |
---|
9236 | |
---|
9237 | int i, memoryLetFree; |
---|
9238 | |
---|
9239 | memoryLetFree = NO; |
---|
9240 | |
---|
9241 | if (memAllocs[ALLOC_TMPSET] == YES) |
---|
9242 | { |
---|
9243 | if (numChar > numTaxa) |
---|
9244 | tempSet = (int *) SafeRealloc ((void *) tempSet, (size_t)(numTaxa*sizeof(int))); |
---|
9245 | tempSetNeg = (int *) SafeRealloc ((void *) tempSetNeg, (size_t)(numTaxa*sizeof(int))); |
---|
9246 | } |
---|
9247 | if (memAllocs[ALLOC_MATRIX] == YES) |
---|
9248 | { |
---|
9249 | free (matrix); |
---|
9250 | matrix = NULL; |
---|
9251 | defMatrix = NO; |
---|
9252 | memAllocs[ALLOC_MATRIX] = NO; |
---|
9253 | memoryLetFree = YES; |
---|
9254 | } |
---|
9255 | if (memAllocs[ALLOC_CHARINFO] == YES) |
---|
9256 | { |
---|
9257 | free (charInfo); |
---|
9258 | charInfo = NULL; |
---|
9259 | memAllocs[ALLOC_CHARINFO] = NO; |
---|
9260 | memoryLetFree = YES; |
---|
9261 | } |
---|
9262 | if (memAllocs[ALLOC_CHARSETS] == YES) |
---|
9263 | { |
---|
9264 | for (i=0; i<numCharSets; i++) |
---|
9265 | { |
---|
9266 | free (charSetNames[i]); |
---|
9267 | free (charSet[i]); |
---|
9268 | } |
---|
9269 | free (charSetNames); |
---|
9270 | free (charSet); |
---|
9271 | charSetNames = NULL; |
---|
9272 | charSet = NULL; |
---|
9273 | numCharSets = 0; |
---|
9274 | memAllocs[ALLOC_CHARSETS] = NO; |
---|
9275 | memoryLetFree = YES; |
---|
9276 | } |
---|
9277 | if (memAllocs[ALLOC_PARTITIONS] == YES) |
---|
9278 | { |
---|
9279 | for (i=0; i<numDefinedPartitions; i++) |
---|
9280 | free (partitionNames[i]); |
---|
9281 | free (partitionNames); |
---|
9282 | partitionNames = NULL; |
---|
9283 | for (i=0; i<numChar; i++) |
---|
9284 | free (partitionId[i]); |
---|
9285 | free (partitionId); |
---|
9286 | numDefinedPartitions = 0; |
---|
9287 | memAllocs[ALLOC_PARTITIONS] = NO; |
---|
9288 | memoryLetFree = YES; |
---|
9289 | } |
---|
9290 | if (memAllocs[ALLOC_PARTITIONVARS] == YES) |
---|
9291 | { |
---|
9292 | free (numVars); |
---|
9293 | numVars = NULL; |
---|
9294 | free (tempNum); |
---|
9295 | tempNum = NULL; |
---|
9296 | free (activeParams[0]); |
---|
9297 | activeParams[0] = NULL; |
---|
9298 | free (linkTable[0]); |
---|
9299 | linkTable[0] = NULL; |
---|
9300 | tempLinkUnlinkVec = NULL; |
---|
9301 | activeParts = NULL; |
---|
9302 | tempLinkUnlinkVec = NULL; |
---|
9303 | for (i=0; i<NUM_LINKED; i++) |
---|
9304 | { |
---|
9305 | linkTable[i] = NULL; |
---|
9306 | activeParams[i] = NULL; |
---|
9307 | } |
---|
9308 | memAllocs[ALLOC_PARTITIONVARS] = NO; |
---|
9309 | memoryLetFree = YES; |
---|
9310 | } |
---|
9311 | |
---|
9312 | ResetCharacterFlags(); |
---|
9313 | |
---|
9314 | return (NO_ERROR); |
---|
9315 | } |
---|
9316 | |
---|
9317 | |
---|
9318 | |
---|
9319 | |
---|
9320 | |
---|
9321 | int FreeMatrix (void) |
---|
9322 | |
---|
9323 | { |
---|
9324 | |
---|
9325 | if (FreeCharacters() == ERROR) |
---|
9326 | return ERROR; |
---|
9327 | |
---|
9328 | return (FreeTaxa()); |
---|
9329 | |
---|
9330 | } |
---|
9331 | |
---|
9332 | |
---|
9333 | |
---|
9334 | |
---|
9335 | |
---|
9336 | int FreeTaxa (void) |
---|
9337 | |
---|
9338 | { |
---|
9339 | int i, memoryLetFree; |
---|
9340 | |
---|
9341 | memoryLetFree = NO; |
---|
9342 | if (memAllocs[ALLOC_TAXA] == YES) |
---|
9343 | { |
---|
9344 | if (taxaNames) |
---|
9345 | { |
---|
9346 | for (i=0; i<numTaxa; i++) |
---|
9347 | free (taxaNames[i]); |
---|
9348 | } |
---|
9349 | free (taxaNames); |
---|
9350 | taxaNames = NULL; |
---|
9351 | free (taxaInfo); |
---|
9352 | taxaInfo = NULL; |
---|
9353 | free (tipCalibration); |
---|
9354 | tipCalibration = NULL; |
---|
9355 | numTaxa = 0; |
---|
9356 | memAllocs[ALLOC_TAXA] = NO; |
---|
9357 | memoryLetFree = YES; |
---|
9358 | } |
---|
9359 | if (memAllocs[ALLOC_TMPSET] == YES) |
---|
9360 | { |
---|
9361 | free (tempSet); |
---|
9362 | tempSet = NULL; |
---|
9363 | free (tempSetNeg); |
---|
9364 | tempSetNeg = NULL; |
---|
9365 | memAllocs[ALLOC_TMPSET] = NO; |
---|
9366 | memoryLetFree = YES; |
---|
9367 | } |
---|
9368 | if (memAllocs[ALLOC_TAXASETS] == YES) |
---|
9369 | { |
---|
9370 | for (i=0; i<numTaxaSets; i++) |
---|
9371 | { |
---|
9372 | free (taxaSetNames[i]); |
---|
9373 | free (taxaSet[i]); |
---|
9374 | } |
---|
9375 | free (taxaSetNames); |
---|
9376 | taxaSetNames = NULL; |
---|
9377 | free (taxaSet); |
---|
9378 | taxaSet = NULL; |
---|
9379 | numTaxaSets = 0; |
---|
9380 | memAllocs[ALLOC_TAXASETS] = NO; |
---|
9381 | memoryLetFree = YES; |
---|
9382 | } |
---|
9383 | if (memAllocs[ALLOC_SPECIESPARTITIONS] == YES) |
---|
9384 | { |
---|
9385 | for (i=0; i<numDefinedSpeciespartitions; i++) |
---|
9386 | free (speciespartitionNames[i]); |
---|
9387 | free (speciespartitionNames); |
---|
9388 | speciespartitionNames = NULL; |
---|
9389 | for (i=0; i<numTaxa; i++) |
---|
9390 | free (speciespartitionId[i]); |
---|
9391 | free (speciespartitionId); |
---|
9392 | speciespartitionId = NULL; |
---|
9393 | numDefinedSpeciespartitions = 0; |
---|
9394 | memAllocs[ALLOC_SPECIESPARTITIONS] = NO; |
---|
9395 | memoryLetFree = YES; |
---|
9396 | } |
---|
9397 | if (memAllocs[ALLOC_CONSTRAINTS] == YES) |
---|
9398 | { |
---|
9399 | for (i=0; i<numDefinedConstraints; i++) |
---|
9400 | { |
---|
9401 | free(definedConstraint[i]); |
---|
9402 | free(definedConstraintTwo[i]); |
---|
9403 | free(definedConstraintPruned[i]); |
---|
9404 | free(definedConstraintTwoPruned[i]); |
---|
9405 | free (constraintNames[i]); |
---|
9406 | } |
---|
9407 | free (definedConstraint); |
---|
9408 | definedConstraint = NULL; |
---|
9409 | free (definedConstraintTwo); |
---|
9410 | definedConstraintTwo = NULL; |
---|
9411 | free (definedConstraintsType); |
---|
9412 | definedConstraintsType = NULL; |
---|
9413 | free (constraintNames); |
---|
9414 | constraintNames = NULL; |
---|
9415 | free (nodeCalibration); |
---|
9416 | nodeCalibration = NULL; |
---|
9417 | numDefinedConstraints = 0; |
---|
9418 | free (tempActiveConstraints); |
---|
9419 | tempActiveConstraints = NULL; |
---|
9420 | memAllocs[ALLOC_CONSTRAINTS] = NO; |
---|
9421 | memoryLetFree = YES; |
---|
9422 | } |
---|
9423 | if (numUserTrees > 0) |
---|
9424 | { |
---|
9425 | MrBayesPrint ("%s Deleting user trees\n", spacer); |
---|
9426 | for (i=0; i<numUserTrees; i++) |
---|
9427 | { |
---|
9428 | FreePolyTree(userTree[i]); |
---|
9429 | userTree[i] = NULL; |
---|
9430 | } |
---|
9431 | numUserTrees = 0; |
---|
9432 | } |
---|
9433 | |
---|
9434 | FreeCharacters(); |
---|
9435 | |
---|
9436 | if (memoryLetFree == YES) |
---|
9437 | MrBayesPrint ("%s Deleting previously defined taxon set\n", spacer); |
---|
9438 | |
---|
9439 | /* reinitialize taxa variables */ |
---|
9440 | ResetTaxaFlags(); |
---|
9441 | |
---|
9442 | return NO_ERROR; |
---|
9443 | } |
---|
9444 | |
---|
9445 | |
---|
9446 | |
---|
9447 | |
---|
9448 | |
---|
9449 | int GetNumPartDivisions (int n) |
---|
9450 | |
---|
9451 | { |
---|
9452 | |
---|
9453 | int i, maxDiv, numDivs, *divFound; |
---|
9454 | |
---|
9455 | maxDiv = 0; |
---|
9456 | for (i=0; i<numChar; i++) |
---|
9457 | if (partitionId[i][n] > maxDiv) |
---|
9458 | maxDiv = partitionId[i][n]; |
---|
9459 | |
---|
9460 | divFound = (int *) SafeCalloc (maxDiv, sizeof(int)); |
---|
9461 | |
---|
9462 | for (i=0; i<maxDiv; i++) |
---|
9463 | divFound[i] = NO; |
---|
9464 | |
---|
9465 | for (i=0; i<numChar; i++) |
---|
9466 | divFound[partitionId[i][n]] = YES; |
---|
9467 | |
---|
9468 | numDivs = 0; |
---|
9469 | for (i=0; i<maxDiv; i++) |
---|
9470 | if (divFound[i] == YES) |
---|
9471 | numDivs++; |
---|
9472 | |
---|
9473 | free (divFound); |
---|
9474 | |
---|
9475 | return (numDivs); |
---|
9476 | |
---|
9477 | } |
---|
9478 | |
---|
9479 | |
---|
9480 | |
---|
9481 | |
---|
9482 | |
---|
9483 | int GetToken (char *token, int *tokenType, char **sourceH) |
---|
9484 | |
---|
9485 | { |
---|
9486 | |
---|
9487 | int allNumbers, foundExp, foundExpSign; |
---|
9488 | register char *temp; |
---|
9489 | char *tempMax; |
---|
9490 | |
---|
9491 | (*tokenType) = 0; |
---|
9492 | temp = token; |
---|
9493 | tempMax = temp + CMD_STRING_LENGTH - 10; |
---|
9494 | |
---|
9495 | while (IsWhite(**sourceH) == 1 || IsWhite(**sourceH) == 2) |
---|
9496 | { |
---|
9497 | if (IsWhite(**sourceH) == 2) |
---|
9498 | { |
---|
9499 | *tokenType = RETURNSYMBOL; |
---|
9500 | /* foundNewLine = YES; Why is this commented out?? */ |
---|
9501 | /* MrBayesPrint ("RETURN\n"); */ |
---|
9502 | } |
---|
9503 | ++(*sourceH); |
---|
9504 | } |
---|
9505 | |
---|
9506 | if (readWord == YES && **sourceH != '"') |
---|
9507 | { |
---|
9508 | if (**sourceH==';') |
---|
9509 | { |
---|
9510 | *temp++ = ';'; |
---|
9511 | *tokenType = SEMICOLON; |
---|
9512 | } |
---|
9513 | else |
---|
9514 | { |
---|
9515 | while (isgraph(**sourceH) && **sourceH!=';') |
---|
9516 | { |
---|
9517 | if( temp > tempMax ) |
---|
9518 | { |
---|
9519 | *tokenType = NOTHING; |
---|
9520 | token[20]='\0'; |
---|
9521 | MrBayesPrint ("%s Error while parsing a string. Token \"%s...[followed by at least %d more charectors]\" is too long.\n", spacer,token,tempMax-token-20 ); |
---|
9522 | MrBayesPrint ("%s Maximum allowed lenght of a token is %d\n", spacer,tempMax-token ); |
---|
9523 | return (ERROR); |
---|
9524 | } |
---|
9525 | *temp++ = *(*sourceH)++; |
---|
9526 | } |
---|
9527 | *tokenType = ALPHA; |
---|
9528 | } |
---|
9529 | *temp = '\0'; |
---|
9530 | readWord = NO; |
---|
9531 | return (NO_ERROR);; |
---|
9532 | } |
---|
9533 | |
---|
9534 | *tokenType = UNKNOWN_TOKEN_TYPE; |
---|
9535 | if (IsIn(**sourceH,"=")) |
---|
9536 | { |
---|
9537 | *temp++ = *(*sourceH)++; |
---|
9538 | *tokenType = EQUALSIGN; |
---|
9539 | } |
---|
9540 | else if (IsIn(**sourceH,";")) |
---|
9541 | { |
---|
9542 | *temp++ = *(*sourceH)++; |
---|
9543 | *tokenType = SEMICOLON; |
---|
9544 | } |
---|
9545 | else if (IsIn(**sourceH,":")) |
---|
9546 | { |
---|
9547 | *temp++ = *(*sourceH)++; |
---|
9548 | *tokenType = COLON; |
---|
9549 | } |
---|
9550 | else if (IsIn(**sourceH,",")) |
---|
9551 | { |
---|
9552 | *temp++ = *(*sourceH)++; |
---|
9553 | *tokenType = COMMA; |
---|
9554 | } |
---|
9555 | else if (IsIn(**sourceH,"#")) |
---|
9556 | { |
---|
9557 | *temp++ = *(*sourceH)++; |
---|
9558 | *tokenType = POUNDSIGN; |
---|
9559 | } |
---|
9560 | else if (IsIn(**sourceH,"(")) |
---|
9561 | { |
---|
9562 | *temp++ = *(*sourceH)++; |
---|
9563 | *tokenType = LEFTPAR; |
---|
9564 | } |
---|
9565 | else if (IsIn(**sourceH,")")) |
---|
9566 | { |
---|
9567 | *temp++ = *(*sourceH)++; |
---|
9568 | *tokenType = RIGHTPAR; |
---|
9569 | } |
---|
9570 | else if (IsIn(**sourceH,"{")) |
---|
9571 | { |
---|
9572 | *temp++ = *(*sourceH)++; |
---|
9573 | *tokenType = LEFTCURL; |
---|
9574 | } |
---|
9575 | else if (IsIn(**sourceH,"}")) |
---|
9576 | { |
---|
9577 | *temp++ = *(*sourceH)++; |
---|
9578 | *tokenType = RIGHTCURL; |
---|
9579 | } |
---|
9580 | else if (IsIn(**sourceH,"[")) |
---|
9581 | { |
---|
9582 | *temp++ = *(*sourceH)++; |
---|
9583 | *tokenType = LEFTCOMMENT; |
---|
9584 | } |
---|
9585 | else if (IsIn(**sourceH,"]")) |
---|
9586 | { |
---|
9587 | *temp++ = *(*sourceH)++; |
---|
9588 | *tokenType = RIGHTCOMMENT; |
---|
9589 | } |
---|
9590 | else if (IsIn(**sourceH,"?")) |
---|
9591 | { |
---|
9592 | *temp++ = *(*sourceH)++; |
---|
9593 | *tokenType = QUESTIONMARK; |
---|
9594 | } |
---|
9595 | else if (IsIn(**sourceH,"-")) |
---|
9596 | { |
---|
9597 | *temp++ = *(*sourceH)++; |
---|
9598 | *tokenType = DASH; |
---|
9599 | } |
---|
9600 | else if (IsIn(**sourceH,"$")) |
---|
9601 | { |
---|
9602 | *temp++ = *(*sourceH)++; |
---|
9603 | *tokenType = DOLLAR; |
---|
9604 | } |
---|
9605 | else if (IsIn(**sourceH,"\"") && readWord == YES) |
---|
9606 | { |
---|
9607 | (*sourceH)++; |
---|
9608 | while(**sourceH != '"' && **sourceH != '\0') |
---|
9609 | { |
---|
9610 | if( temp > tempMax ) |
---|
9611 | { |
---|
9612 | *tokenType = NOTHING; |
---|
9613 | token[20]='\0'; |
---|
9614 | MrBayesPrint ("%s Error while parsing a string. Token \"%s...[followed by at least %d more charectors]\" is too long.\n", spacer,token,tempMax-token-20 ); |
---|
9615 | MrBayesPrint ("%s Maximum allowed lenght of a token is %d\n", spacer,tempMax-token ); |
---|
9616 | return (ERROR); |
---|
9617 | } |
---|
9618 | *temp++ = *((*sourceH)++); |
---|
9619 | } |
---|
9620 | *temp='\0'; |
---|
9621 | *tokenType = ALPHA; |
---|
9622 | (*sourceH)++; |
---|
9623 | readWord = NO; |
---|
9624 | } |
---|
9625 | else if (IsIn(**sourceH,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.")) |
---|
9626 | { |
---|
9627 | if (IsIn(**sourceH,"0123456789.")) |
---|
9628 | allNumbers = TRUE; |
---|
9629 | else |
---|
9630 | allNumbers = FALSE; |
---|
9631 | foundExp = foundExpSign = FALSE; |
---|
9632 | *temp++ = *(*sourceH)++; |
---|
9633 | while(IsIn(**sourceH,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.-+")) |
---|
9634 | { |
---|
9635 | if( temp > tempMax ) |
---|
9636 | { |
---|
9637 | *tokenType = NOTHING; |
---|
9638 | token[20]='\0'; |
---|
9639 | MrBayesPrint ("%s Error while parsing a string. Token \"%s...[followed by at least %d more charectors]\" is too long.\n", spacer,token,tempMax-token-20 ); |
---|
9640 | MrBayesPrint ("%s Maximum allowed lenght of a token is %d\n", spacer,tempMax-token ); |
---|
9641 | return (ERROR); |
---|
9642 | } |
---|
9643 | if(allNumbers == TRUE && !IsIn((*sourceH)[-1],"Ee") && **sourceH=='-') |
---|
9644 | break; |
---|
9645 | else if (allNumbers == TRUE && IsIn(**sourceH,"Ee") && foundExp == NO) |
---|
9646 | foundExp = TRUE; |
---|
9647 | else if (allNumbers == TRUE && IsIn(**sourceH,"+-") && IsIn((*sourceH)[-1],"Ee")) |
---|
9648 | foundExpSign = TRUE; |
---|
9649 | else if (!IsIn(**sourceH,"0123456789.")) |
---|
9650 | allNumbers = FALSE; |
---|
9651 | *temp++ = *(*sourceH)++; |
---|
9652 | } |
---|
9653 | if (allNumbers == TRUE) |
---|
9654 | *tokenType = NUMBER; |
---|
9655 | else |
---|
9656 | *tokenType = ALPHA; |
---|
9657 | } |
---|
9658 | else if (IsIn(**sourceH,"*")) |
---|
9659 | { |
---|
9660 | *temp++ = *(*sourceH)++; |
---|
9661 | *tokenType = ASTERISK; |
---|
9662 | } |
---|
9663 | else if (IsIn(**sourceH,"/")) |
---|
9664 | { |
---|
9665 | *temp++ = *(*sourceH)++; |
---|
9666 | *tokenType = FORWARDSLASH; |
---|
9667 | } |
---|
9668 | else if (IsIn(**sourceH,"'\\'")) |
---|
9669 | { |
---|
9670 | *temp++ = *(*sourceH)++; |
---|
9671 | *tokenType = BACKSLASH; |
---|
9672 | } |
---|
9673 | else if (IsIn(**sourceH,"!")) |
---|
9674 | { |
---|
9675 | *temp++ = *(*sourceH)++; |
---|
9676 | *tokenType = EXCLAMATIONMARK; |
---|
9677 | } |
---|
9678 | else if (IsIn(**sourceH,"%")) |
---|
9679 | { |
---|
9680 | *temp++ = *(*sourceH)++; |
---|
9681 | *tokenType = PERCENT; |
---|
9682 | } |
---|
9683 | else if (IsIn(**sourceH,"\"")) |
---|
9684 | { |
---|
9685 | *temp++ = *(*sourceH)++; |
---|
9686 | *tokenType = QUOTATIONMARK; |
---|
9687 | } |
---|
9688 | else if (IsIn(**sourceH,"&")) |
---|
9689 | { |
---|
9690 | *temp++ = *(*sourceH)++; |
---|
9691 | *tokenType = AMPERSAND; |
---|
9692 | } |
---|
9693 | else if (IsIn(**sourceH,"~+^@|{}`><")) |
---|
9694 | { |
---|
9695 | *temp++ = *(*sourceH)++; |
---|
9696 | *tokenType = WEIRD; |
---|
9697 | } |
---|
9698 | |
---|
9699 | *temp = '\0'; |
---|
9700 | return (NO_ERROR); |
---|
9701 | |
---|
9702 | } |
---|
9703 | |
---|
9704 | |
---|
9705 | |
---|
9706 | |
---|
9707 | |
---|
9708 | int GetUserHelp (char *helpTkn) |
---|
9709 | |
---|
9710 | { |
---|
9711 | |
---|
9712 | int i, j, k, tempInt; |
---|
9713 | char yesNoStr[4], tempString[100]; |
---|
9714 | Model *mp; |
---|
9715 | |
---|
9716 | if (!strcmp(helpTkn, "Begin")) |
---|
9717 | { |
---|
9718 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9719 | MrBayesPrint (" Begin \n"); |
---|
9720 | MrBayesPrint (" \n"); |
---|
9721 | MrBayesPrint (" This command is used to format data or commands in the program. The correct \n"); |
---|
9722 | MrBayesPrint (" usage is \n"); |
---|
9723 | MrBayesPrint (" \n"); |
---|
9724 | MrBayesPrint (" begin <data or mrbayes>; \n"); |
---|
9725 | MrBayesPrint (" \n"); |
---|
9726 | MrBayesPrint (" The two valid uses of the \"begin\" command, then, are \n"); |
---|
9727 | MrBayesPrint (" \n"); |
---|
9728 | MrBayesPrint (" begin data; \n"); |
---|
9729 | MrBayesPrint (" begin mrbayes; \n"); |
---|
9730 | MrBayesPrint (" \n"); |
---|
9731 | MrBayesPrint (" The \"data\" specifier is used to specify the beginning of a data block; your \n"); |
---|
9732 | MrBayesPrint (" character data should follow. For example, the following is an example of \n"); |
---|
9733 | MrBayesPrint (" a data block for four taxa and ten DNA sites: \n"); |
---|
9734 | MrBayesPrint (" \n"); |
---|
9735 | MrBayesPrint (" begin data; \n"); |
---|
9736 | MrBayesPrint (" dimensions ntax=4 nchar=10; \n"); |
---|
9737 | MrBayesPrint (" format datatype=dna; \n"); |
---|
9738 | MrBayesPrint (" matrix \n"); |
---|
9739 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
9740 | MrBayesPrint (" taxon_2 AAGGATTCCA \n"); |
---|
9741 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
9742 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
9743 | MrBayesPrint (" ; \n"); |
---|
9744 | MrBayesPrint (" end; \n"); |
---|
9745 | MrBayesPrint (" \n"); |
---|
9746 | MrBayesPrint (" The other commands -- dimensions, format, and matrix -- are discussed \n"); |
---|
9747 | MrBayesPrint (" in the appropriate help menu. The only thing to note here is that the \n"); |
---|
9748 | MrBayesPrint (" block begins with a \"begin data\" command. The \"mrbayes\" command is \n"); |
---|
9749 | MrBayesPrint (" used to enter commands specific to the MrBayes program into the file. \n"); |
---|
9750 | MrBayesPrint (" This allows you to automatically process commands on execution of the \n"); |
---|
9751 | MrBayesPrint (" program. The following is a simple mrbayes block: \n"); |
---|
9752 | MrBayesPrint (" \n"); |
---|
9753 | MrBayesPrint (" begin mrbayes; \n"); |
---|
9754 | MrBayesPrint (" charset first = 1-10\\3; \n"); |
---|
9755 | MrBayesPrint (" charset second = 2-10\\3; \n"); |
---|
9756 | MrBayesPrint (" charset third = 3-10\\3; \n"); |
---|
9757 | MrBayesPrint (" end; \n"); |
---|
9758 | MrBayesPrint (" \n"); |
---|
9759 | MrBayesPrint (" This mrbayes block sets off the three \"charset\" commands, used to \n"); |
---|
9760 | MrBayesPrint (" predefine some blocks of characters. The mrbayes block can be very useful. \n"); |
---|
9761 | MrBayesPrint (" For example, in this case, it would save you the time of typing the char- \n"); |
---|
9762 | MrBayesPrint (" acter sets each time you executed the file. Also, note that every \n"); |
---|
9763 | MrBayesPrint (" \"begin <data or mrbayes>\" command ends with an \"end\". Finally, you can \n"); |
---|
9764 | MrBayesPrint (" have so-called foreign blocks in the file. An example of a foreign block \n"); |
---|
9765 | MrBayesPrint (" would be \"begin paup\". The program will simply skip this block. This is \n"); |
---|
9766 | MrBayesPrint (" useful because it means that you can use the same file for MrBayes, PAUP* \n"); |
---|
9767 | MrBayesPrint (" or MacClade (although it isn't clear why you would want to use those other \n"); |
---|
9768 | MrBayesPrint (" programs). \n"); |
---|
9769 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9770 | } |
---|
9771 | else if (!strcmp(helpTkn, "End")) |
---|
9772 | { |
---|
9773 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9774 | MrBayesPrint (" End \n"); |
---|
9775 | MrBayesPrint (" \n"); |
---|
9776 | MrBayesPrint (" This command is used to terminate a data or mrbayes block. The correct \n"); |
---|
9777 | MrBayesPrint (" usage is \n"); |
---|
9778 | MrBayesPrint (" \n"); |
---|
9779 | MrBayesPrint (" end; \n"); |
---|
9780 | MrBayesPrint (" \n"); |
---|
9781 | MrBayesPrint (" For more information on this, check the help for the \"begin\" command. \n"); |
---|
9782 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9783 | } |
---|
9784 | else if (!strcmp(helpTkn, "Endblock")) |
---|
9785 | { |
---|
9786 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9787 | MrBayesPrint (" Endblock \n"); |
---|
9788 | MrBayesPrint (" \n"); |
---|
9789 | MrBayesPrint (" This is an older, deprecated version of \"End\", see that command. \n"); |
---|
9790 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9791 | } |
---|
9792 | else if (!strcmp(helpTkn, "Plot")) |
---|
9793 | { |
---|
9794 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9795 | MrBayesPrint (" Plot \n"); |
---|
9796 | MrBayesPrint (" \n"); |
---|
9797 | MrBayesPrint (" This command plots specified parameters in the .p file or one of the .p files \n"); |
---|
9798 | MrBayesPrint (" created during an MCMC analysis. An x-y graph of the parameter over the course\n"); |
---|
9799 | MrBayesPrint (" of the chain is created. The command can be useful for visually diagnosing \n"); |
---|
9800 | MrBayesPrint (" convergence for many of the parameters of the phylogenetic model. The para- \n"); |
---|
9801 | MrBayesPrint (" meter to be plotted is specified by the \"parameter\" option. Several para- \n"); |
---|
9802 | MrBayesPrint (" meters can be plotted at once by using the \"match\" option, which has a \n"); |
---|
9803 | MrBayesPrint (" default value of \"perfect\". For example, if you were to set \"parameter = pi\"\n"); |
---|
9804 | MrBayesPrint (" and \"match = consistentwith\", then all of the state frequency parameters \n"); |
---|
9805 | MrBayesPrint (" would be plotted. You can also set \"match=all\", in which case all of the \n"); |
---|
9806 | MrBayesPrint (" parameters are plotted. \n"); |
---|
9807 | MrBayesPrint (" \n"); |
---|
9808 | MrBayesPrint (" Note that the \"Sump\" command provides a different set of convergence diag- \n"); |
---|
9809 | MrBayesPrint (" nostics tools that you may also want to explore. Unlike \"Plot\", \"Sump\" can\n"); |
---|
9810 | MrBayesPrint (" compare two or more parameter samples and will calculate convergence diagnos- \n"); |
---|
9811 | MrBayesPrint (" tics as wel as parameter summaries for the pooled sample. \n"); |
---|
9812 | MrBayesPrint (" \n"); |
---|
9813 | MrBayesPrint (" Options: \n"); |
---|
9814 | MrBayesPrint (" \n"); |
---|
9815 | MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n"); |
---|
9816 | MrBayesPrint (" samples will be discarded as burnin when creating the plot. \n"); |
---|
9817 | MrBayesPrint (" The proportion to be discarded is set with Burninfrac (see \n"); |
---|
9818 | MrBayesPrint (" Burninfrac below). When the Relburnin option is set to 'No', \n"); |
---|
9819 | MrBayesPrint (" then a specific number of samples is discarded instead. This \n"); |
---|
9820 | MrBayesPrint (" number is set by Burnin (see below). Note that the burnin \n"); |
---|
9821 | MrBayesPrint (" setting is shared across the 'comparetree', 'sump' and 'sumt'\n"); |
---|
9822 | MrBayesPrint (" commands. \n"); |
---|
9823 | MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n"); |
---|
9824 | MrBayesPrint (" be discarded when summary statistics are calculated. The \n"); |
---|
9825 | MrBayesPrint (" value of this option is only relevant when Relburnin is set \n"); |
---|
9826 | MrBayesPrint (" to 'No'. \n"); |
---|
9827 | MrBayesPrint (" Burninfrac -- Determines the fraction of samples that will be discarded \n"); |
---|
9828 | MrBayesPrint (" when creating a plot. The value of this parameter is only \n"); |
---|
9829 | MrBayesPrint (" relevant when Relburnin is set to 'Yes'. Example: A value of \n"); |
---|
9830 | MrBayesPrint (" this option of 0.25 means that 25%% of the samples will be \n"); |
---|
9831 | MrBayesPrint (" discarded. \n"); |
---|
9832 | MrBayesPrint (" Filename -- The name of the file to plot. \n"); |
---|
9833 | MrBayesPrint (" Parameter -- Specification of parameters to be plotted. See above for \n"); |
---|
9834 | MrBayesPrint (" details. \n"); |
---|
9835 | MrBayesPrint (" Match -- Specifies how to match parameter names to the Parameter \n"); |
---|
9836 | MrBayesPrint (" specification. See above for details. \n"); |
---|
9837 | MrBayesPrint (" \n"); |
---|
9838 | MrBayesPrint (" Current settings: \n"); |
---|
9839 | MrBayesPrint (" \n"); |
---|
9840 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
9841 | MrBayesPrint (" ------------------------------------------------------------ \n"); |
---|
9842 | MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No"); |
---|
9843 | MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn); |
---|
9844 | MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction); |
---|
9845 | MrBayesPrint (" Filename <name> %s \n", plotParams.plotFileName); |
---|
9846 | MrBayesPrint (" Parameter <name> %s \n", plotParams.parameter); |
---|
9847 | MrBayesPrint (" Match Perfect/Consistentwith/All %s \n", plotParams.match); |
---|
9848 | MrBayesPrint (" \n"); |
---|
9849 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9850 | } |
---|
9851 | else if (!strcmp(helpTkn, "Dimensions")) |
---|
9852 | { |
---|
9853 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9854 | MrBayesPrint (" Dimensions \n"); |
---|
9855 | MrBayesPrint (" \n"); |
---|
9856 | MrBayesPrint (" This command is used in a data block to define the number of taxa and \n"); |
---|
9857 | MrBayesPrint (" characters. The correct usage is \n"); |
---|
9858 | MrBayesPrint (" \n"); |
---|
9859 | MrBayesPrint (" dimensions ntax=<number> nchar=<number> \n"); |
---|
9860 | MrBayesPrint (" \n"); |
---|
9861 | MrBayesPrint (" The dimensions must be the first command in a data block. The following \n"); |
---|
9862 | MrBayesPrint (" provides an example of the proper use of this command: \n"); |
---|
9863 | MrBayesPrint (" \n"); |
---|
9864 | MrBayesPrint (" begin data; \n"); |
---|
9865 | MrBayesPrint (" dimensions ntax=4 nchar=10; \n"); |
---|
9866 | MrBayesPrint (" format datatype=dna; \n"); |
---|
9867 | MrBayesPrint (" matrix \n"); |
---|
9868 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
9869 | MrBayesPrint (" taxon_2 AAGGATTCCA \n"); |
---|
9870 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
9871 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
9872 | MrBayesPrint (" ; \n"); |
---|
9873 | MrBayesPrint (" end; \n"); |
---|
9874 | MrBayesPrint (" \n"); |
---|
9875 | MrBayesPrint (" Here, the dimensions command tells MrBayes to expect a matrix with four \n"); |
---|
9876 | MrBayesPrint (" taxa and 10 characters. \n"); |
---|
9877 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9878 | } |
---|
9879 | else if (!strcmp(helpTkn, "Format")) |
---|
9880 | { |
---|
9881 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9882 | MrBayesPrint (" Format \n"); |
---|
9883 | MrBayesPrint (" \n"); |
---|
9884 | MrBayesPrint (" This command is used in a data block to define the format of the char- \n"); |
---|
9885 | MrBayesPrint (" acter matrix. The correct usage is \n"); |
---|
9886 | MrBayesPrint (" \n"); |
---|
9887 | MrBayesPrint (" format datatype=<name> ... <parameter>=<option> \n"); |
---|
9888 | MrBayesPrint (" \n"); |
---|
9889 | MrBayesPrint (" The format command must be the second command in a data block. The following \n"); |
---|
9890 | MrBayesPrint (" provides an example of the proper use of this command: \n"); |
---|
9891 | MrBayesPrint (" \n"); |
---|
9892 | MrBayesPrint (" begin data; \n"); |
---|
9893 | MrBayesPrint (" dimensions ntax=4 nchar=10; \n"); |
---|
9894 | MrBayesPrint (" format datatype=dna gap=-; \n"); |
---|
9895 | MrBayesPrint (" matrix \n"); |
---|
9896 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
9897 | MrBayesPrint (" taxon_2 AAGGAT--CA \n"); |
---|
9898 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
9899 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
9900 | MrBayesPrint (" ; \n"); |
---|
9901 | MrBayesPrint (" end; \n"); |
---|
9902 | MrBayesPrint (" \n"); |
---|
9903 | MrBayesPrint (" Here, the format command tells MrBayes to expect a matrix with DNA char- \n"); |
---|
9904 | MrBayesPrint (" acters and with gaps coded as \"-\". \n"); |
---|
9905 | MrBayesPrint (" \n"); |
---|
9906 | MrBayesPrint (" The following are valid options for format: \n"); |
---|
9907 | MrBayesPrint (" \n"); |
---|
9908 | MrBayesPrint (" Datatype -- This parameter MUST BE INCLUDED in the format command. More- \n"); |
---|
9909 | MrBayesPrint (" over, it must be the first parameter in the line. The \n"); |
---|
9910 | MrBayesPrint (" datatype command specifies what type of characters are \n"); |
---|
9911 | MrBayesPrint (" in the matrix. The following are valid options: \n"); |
---|
9912 | MrBayesPrint (" Datatype = Dna: DNA states (A,C,G,T,R,Y,M,K,S,W,H,B, \n"); |
---|
9913 | MrBayesPrint (" V,D,N) \n"); |
---|
9914 | MrBayesPrint (" Datatype = Rna: DNA states (A,C,G,U,R,Y,M,K,S,W,H,B, \n"); |
---|
9915 | MrBayesPrint (" V,D,N) \n"); |
---|
9916 | MrBayesPrint (" Datatype = Protein: Amino acid states (A,R,N,D,C,Q,E, \n"); |
---|
9917 | MrBayesPrint (" G,H,I,L,K,M,F,P,S,T,W,Y,V) \n"); |
---|
9918 | MrBayesPrint (" Datatype = Restriction: Restriction site (0,1) states \n"); |
---|
9919 | MrBayesPrint (" Datatype = Standard: Morphological (0,1) states \n"); |
---|
9920 | MrBayesPrint (" Datatype = Continuous: Real number valued states \n"); |
---|
9921 | MrBayesPrint (" Datatype = Mixed(<type>:<range>,...,<type>:<range>): A \n"); |
---|
9922 | MrBayesPrint (" mixture of the above datatypes. For example, \n"); |
---|
9923 | MrBayesPrint (" \"datatype=mixed(dna:1-100,protein:101-200)\" \n"); |
---|
9924 | MrBayesPrint (" would specify a mixture of DNA and amino acid \n"); |
---|
9925 | MrBayesPrint (" characters with the DNA characters occupying \n"); |
---|
9926 | MrBayesPrint (" the first 100 sites and the amino acid char- \n"); |
---|
9927 | MrBayesPrint (" acters occupying the last 100 sites. \n"); |
---|
9928 | MrBayesPrint (" \n"); |
---|
9929 | MrBayesPrint (" Interleave -- This parameter specifies whether the data matrix is in \n"); |
---|
9930 | MrBayesPrint (" interleave format. The valid options are \"Yes\" or \"No\", \n"); |
---|
9931 | MrBayesPrint (" with \"No\" as the default. An interleaved matrix looks like \n"); |
---|
9932 | MrBayesPrint (" \n"); |
---|
9933 | MrBayesPrint (" format datatype=dna gap=- interleave=yes; \n"); |
---|
9934 | MrBayesPrint (" matrix \n"); |
---|
9935 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
9936 | MrBayesPrint (" taxon_2 AAGGAT--CA \n"); |
---|
9937 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
9938 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
9939 | MrBayesPrint (" \n"); |
---|
9940 | MrBayesPrint (" taxon_1 CCTGGTAC \n"); |
---|
9941 | MrBayesPrint (" taxon_2 CCTGGTAC \n"); |
---|
9942 | MrBayesPrint (" taxon_3 ---GGTAG \n"); |
---|
9943 | MrBayesPrint (" taxon_4 ---GGTAG \n"); |
---|
9944 | MrBayesPrint (" ; \n"); |
---|
9945 | MrBayesPrint (" \n"); |
---|
9946 | MrBayesPrint (" Gap -- This parameter specifies the format for gaps. Note that \n"); |
---|
9947 | MrBayesPrint (" gap character can only be a single character and that it \n"); |
---|
9948 | MrBayesPrint (" cannot correspond to a standard state (e.g., A,C,G,T,R,Y, \n"); |
---|
9949 | MrBayesPrint (" M,K,S,W,H,B,V,D,N for nucleotide data). \n"); |
---|
9950 | MrBayesPrint (" \n"); |
---|
9951 | MrBayesPrint (" Missing -- This parameter specifies the format for missing data. Note \n"); |
---|
9952 | MrBayesPrint (" that the missing character can only be a single character and \n"); |
---|
9953 | MrBayesPrint (" cannot correspond to a standard state (e.g., A,C,G,T,R,Y, \n"); |
---|
9954 | MrBayesPrint (" M,K,S,W,H,B,V,D,N for nucleotide data). This is often an \n"); |
---|
9955 | MrBayesPrint (" unnecessary parameter to set because many data types, such \n"); |
---|
9956 | MrBayesPrint (" as nucleotide or amino acid, already have a missing char- \n"); |
---|
9957 | MrBayesPrint (" acter specified. However, for morphological or restriction \n"); |
---|
9958 | MrBayesPrint (" site data, \"missing=?\" is often used to specify ambiguity \n"); |
---|
9959 | MrBayesPrint (" or unobserved data. \n"); |
---|
9960 | MrBayesPrint (" \n"); |
---|
9961 | MrBayesPrint (" Matchchar -- This parameter specifies the matching character for the \n"); |
---|
9962 | MrBayesPrint (" matrix. For example, \n"); |
---|
9963 | MrBayesPrint (" \n"); |
---|
9964 | MrBayesPrint (" format datatype=dna gap=- matchchar=.; \n"); |
---|
9965 | MrBayesPrint (" matrix \n"); |
---|
9966 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
9967 | MrBayesPrint (" taxon_2 ..G...--CA \n"); |
---|
9968 | MrBayesPrint (" taxon_3 .....C..C. \n"); |
---|
9969 | MrBayesPrint (" taxon_4 ..G.....C. \n"); |
---|
9970 | MrBayesPrint (" ; \n"); |
---|
9971 | MrBayesPrint (" \n"); |
---|
9972 | MrBayesPrint (" is equivalent to \n"); |
---|
9973 | MrBayesPrint (" \n"); |
---|
9974 | MrBayesPrint (" format datatype=dna gap=-; \n"); |
---|
9975 | MrBayesPrint (" matrix \n"); |
---|
9976 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
9977 | MrBayesPrint (" taxon_2 AAGGAT--CA \n"); |
---|
9978 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
9979 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
9980 | MrBayesPrint (" ; \n"); |
---|
9981 | MrBayesPrint (" \n"); |
---|
9982 | MrBayesPrint (" The only non-standard NEXUS format option is the use of the \"mixed\", \n"); |
---|
9983 | MrBayesPrint (" \"restriction\", \"standard\" and \"continuous\" datatypes. Hence, if \n"); |
---|
9984 | MrBayesPrint (" you use any of these datatype specifiers, a program like PAUP* or \n"); |
---|
9985 | MrBayesPrint (" MacClade will report an error (as they should because MrBayes is not \n"); |
---|
9986 | MrBayesPrint (" strictly NEXUS compliant). \n"); |
---|
9987 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9988 | } |
---|
9989 | else if (!strcmp(helpTkn, "Matrix")) |
---|
9990 | { |
---|
9991 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
9992 | MrBayesPrint (" Matrix \n"); |
---|
9993 | MrBayesPrint (" \n"); |
---|
9994 | MrBayesPrint (" This command specifies the actual data for the phylogenetic analysis. \n"); |
---|
9995 | MrBayesPrint (" The character matrix should follow the dimensions and format commands \n"); |
---|
9996 | MrBayesPrint (" in a data block. The matrix can have all of the characters for a taxon \n"); |
---|
9997 | MrBayesPrint (" on a single line: \n"); |
---|
9998 | MrBayesPrint (" \n"); |
---|
9999 | MrBayesPrint (" begin data; \n"); |
---|
10000 | MrBayesPrint (" dimensions ntax=4 nchar=10; \n"); |
---|
10001 | MrBayesPrint (" format datatype=dna gap=-; \n"); |
---|
10002 | MrBayesPrint (" matrix \n"); |
---|
10003 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
10004 | MrBayesPrint (" taxon_2 AAGGAT--CA \n"); |
---|
10005 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
10006 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
10007 | MrBayesPrint (" ; \n"); |
---|
10008 | MrBayesPrint (" end; \n"); |
---|
10009 | MrBayesPrint (" \n"); |
---|
10010 | MrBayesPrint (" or be in \"interleaved\" format: \n"); |
---|
10011 | MrBayesPrint (" \n"); |
---|
10012 | MrBayesPrint (" begin data; \n"); |
---|
10013 | MrBayesPrint (" dimensions ntax=4 nchar=20; \n"); |
---|
10014 | MrBayesPrint (" format datatype=dna gap=- interleave=yes; \n"); |
---|
10015 | MrBayesPrint (" matrix \n"); |
---|
10016 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
10017 | MrBayesPrint (" taxon_2 AAGGAT--CA \n"); |
---|
10018 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
10019 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
10020 | MrBayesPrint (" \n"); |
---|
10021 | MrBayesPrint (" taxon_1 TTTTCGAAGC \n"); |
---|
10022 | MrBayesPrint (" taxon_2 TTTTCGGAGC \n"); |
---|
10023 | MrBayesPrint (" taxon_3 TTTTTGATGC \n"); |
---|
10024 | MrBayesPrint (" taxon_4 TTTTCGGAGC \n"); |
---|
10025 | MrBayesPrint (" ; \n"); |
---|
10026 | MrBayesPrint (" end; \n"); |
---|
10027 | MrBayesPrint (" \n"); |
---|
10028 | MrBayesPrint (" Note that the taxon names must not have spaces. If you really want to \n"); |
---|
10029 | MrBayesPrint (" indicate a space in a taxon name (perhaps between a genus and species \n"); |
---|
10030 | MrBayesPrint (" name), then you might use an underline (\"_\"). There should be at \n"); |
---|
10031 | MrBayesPrint (" least a single space after the taxon name, separating the name from \n"); |
---|
10032 | MrBayesPrint (" the actual data on that line. There can be spaces between the char- \n"); |
---|
10033 | MrBayesPrint (" acters. \n"); |
---|
10034 | MrBayesPrint (" \n"); |
---|
10035 | MrBayesPrint (" If you have mixed data, then you specify all of the data in the same \n"); |
---|
10036 | MrBayesPrint (" matrix. Here is an example that includes two different data types: \n"); |
---|
10037 | MrBayesPrint (" \n"); |
---|
10038 | MrBayesPrint (" begin data; \n"); |
---|
10039 | MrBayesPrint (" dimensions ntax=4 nchar=20; \n"); |
---|
10040 | MrBayesPrint (" format datatype=mixed(dna:1-10,standard:21-30) interleave=yes; \n"); |
---|
10041 | MrBayesPrint (" matrix \n"); |
---|
10042 | MrBayesPrint (" taxon_1 AACGATTCGT \n"); |
---|
10043 | MrBayesPrint (" taxon_2 AAGGAT--CA \n"); |
---|
10044 | MrBayesPrint (" taxon_3 AACGACTCCT \n"); |
---|
10045 | MrBayesPrint (" taxon_4 AAGGATTCCT \n"); |
---|
10046 | MrBayesPrint (" \n"); |
---|
10047 | MrBayesPrint (" taxon_1 0001111111 \n"); |
---|
10048 | MrBayesPrint (" taxon_2 0111110000 \n"); |
---|
10049 | MrBayesPrint (" taxon_3 1110000000 \n"); |
---|
10050 | MrBayesPrint (" taxon_4 1000001111 \n"); |
---|
10051 | MrBayesPrint (" ; \n"); |
---|
10052 | MrBayesPrint (" end; \n"); |
---|
10053 | MrBayesPrint (" \n"); |
---|
10054 | MrBayesPrint (" The matrix command is terminated by a semicolon. \n"); |
---|
10055 | MrBayesPrint (" \n"); |
---|
10056 | MrBayesPrint (" Finally, just a note on data presentation. It is much easier for others \n"); |
---|
10057 | MrBayesPrint (" to (1) understand your data and (2) repeat your analyses if you make \n"); |
---|
10058 | MrBayesPrint (" your data clean, comment it liberally (using the square brackets), and \n"); |
---|
10059 | MrBayesPrint (" embed the commands you used in a publication in the mrbayes block. \n"); |
---|
10060 | MrBayesPrint (" Remember that the data took a long time for you to collect. You might \n"); |
---|
10061 | MrBayesPrint (" as well spend a little time making the data file look nice and clear to \n"); |
---|
10062 | MrBayesPrint (" any that may later request the data for further analysis. \n"); |
---|
10063 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10064 | } |
---|
10065 | else if (!strcmp(helpTkn, "Pairs")) |
---|
10066 | { |
---|
10067 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10068 | MrBayesPrint (" Pairs \n"); |
---|
10069 | MrBayesPrint (" \n"); |
---|
10070 | MrBayesPrint (" This command is used to specify pairs of nucleotides. For example, your \n"); |
---|
10071 | MrBayesPrint (" data may be RNA sequences with a known secondary structure of stems and \n"); |
---|
10072 | MrBayesPrint (" loops. Substitutions in nucleotides involved in a Watson-Crick pairing \n"); |
---|
10073 | MrBayesPrint (" in stems are not strictly independent; a change in one changes the prob- \n"); |
---|
10074 | MrBayesPrint (" ability of a change in the partner. A solution to this problem is to \n"); |
---|
10075 | MrBayesPrint (" expand the model around the pair of nucleotides in the stem. This \n"); |
---|
10076 | MrBayesPrint (" command allows you to do this. The correct usage is: \n"); |
---|
10077 | MrBayesPrint (" \n"); |
---|
10078 | MrBayesPrint (" pairs <NUC1>:<NUC2>, <NUC1>:<NUC2>,..., <NUC1>:<NUC2>; \n"); |
---|
10079 | MrBayesPrint (" \n"); |
---|
10080 | MrBayesPrint (" For example, \n"); |
---|
10081 | MrBayesPrint (" \n"); |
---|
10082 | MrBayesPrint (" pairs 30:56, 31:55, 32:54, 33:53, 34:52, 35:51, 36:50; \n"); |
---|
10083 | MrBayesPrint (" \n"); |
---|
10084 | MrBayesPrint (" specifies pairings between nucleotides 30 and 56, 31 and 55, etc. Only \n"); |
---|
10085 | MrBayesPrint (" nucleotide data (DNA or RNA) may be paired using this command. Note that \n"); |
---|
10086 | MrBayesPrint (" in order for the program to actually implement a \"doublet\" model \n"); |
---|
10087 | MrBayesPrint (" involving a 16 X 16 rate matrix, you must specify that the structure of \n"); |
---|
10088 | MrBayesPrint (" the model is 16 X 16 using \"lset nucmodel=doublet\". \n"); |
---|
10089 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10090 | } |
---|
10091 | else if (!strcmp(helpTkn, "Databreaks")) |
---|
10092 | { |
---|
10093 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10094 | MrBayesPrint (" Databreaks \n"); |
---|
10095 | MrBayesPrint (" \n"); |
---|
10096 | MrBayesPrint (" This command is used to specify breaks in your input data matrix. Your \n"); |
---|
10097 | MrBayesPrint (" data may be a mixture of genes or a mixture of different types of data. \n"); |
---|
10098 | MrBayesPrint (" Some of the models implemented by MrBayes account for nonindependence at \n"); |
---|
10099 | MrBayesPrint (" adjacent characters. The autocorrelated gamma model, for example, allows \n"); |
---|
10100 | MrBayesPrint (" rates at adjacent sites to be correlated. However, there is no way for \n"); |
---|
10101 | MrBayesPrint (" such a model to tell whether two sites, adjacent in the matrix, are \n"); |
---|
10102 | MrBayesPrint (" actually separated by many kilobases or megabases in the genome. The \n"); |
---|
10103 | MrBayesPrint (" databreaks command allows you to specify such breaks. The correct \n"); |
---|
10104 | MrBayesPrint (" usage is: \n"); |
---|
10105 | MrBayesPrint (" \n"); |
---|
10106 | MrBayesPrint (" databreaks <break 1> <break 2> <break 3> ... \n"); |
---|
10107 | MrBayesPrint (" \n"); |
---|
10108 | MrBayesPrint (" For example, say you have a data matrix of 3204 characters that include \n"); |
---|
10109 | MrBayesPrint (" nucleotide data from three genes. The first gene covers characters 1 to \n"); |
---|
10110 | MrBayesPrint (" 970, the second gene covers characters 971 to 2567, and the third gene \n"); |
---|
10111 | MrBayesPrint (" covers characters 2568 to 3204. Also, let's assume that the genes are \n"); |
---|
10112 | MrBayesPrint (" not directly adjacent to one another in the genome, as might be likely \n"); |
---|
10113 | MrBayesPrint (" if you have mitochondrial sequences. In this case, you can specify \n"); |
---|
10114 | MrBayesPrint (" breaks between the genes using: \n"); |
---|
10115 | MrBayesPrint (" \n"); |
---|
10116 | MrBayesPrint (" databreaks 970 2567; \n"); |
---|
10117 | MrBayesPrint (" \n"); |
---|
10118 | MrBayesPrint (" The first break, between genes one and two, is after character 970 and \n"); |
---|
10119 | MrBayesPrint (" the second break, between genes two and three, is after character 2567. \n"); |
---|
10120 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10121 | } |
---|
10122 | else if (!strcmp(helpTkn, "Acknowledgments")) |
---|
10123 | { |
---|
10124 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10125 | MrBayesPrint (" Acknowledgments \n"); |
---|
10126 | MrBayesPrint (" \n"); |
---|
10127 | MrBayesPrint (" This command shows the authors' acknowledgments. \n"); |
---|
10128 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10129 | } |
---|
10130 | else if (!strcmp(helpTkn, "About")) |
---|
10131 | { |
---|
10132 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10133 | MrBayesPrint (" About \n"); |
---|
10134 | MrBayesPrint (" \n"); |
---|
10135 | MrBayesPrint (" This command provides some general information about the program. \n"); |
---|
10136 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10137 | } |
---|
10138 | else if (!strcmp(helpTkn, "Version")) |
---|
10139 | { |
---|
10140 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10141 | MrBayesPrint (" Version \n"); |
---|
10142 | MrBayesPrint (" \n"); |
---|
10143 | MrBayesPrint (" This command shows the release version of the program. \n"); |
---|
10144 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10145 | } |
---|
10146 | else if (!strcmp(helpTkn, "Citations")) |
---|
10147 | { |
---|
10148 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10149 | MrBayesPrint (" Citations \n"); |
---|
10150 | MrBayesPrint (" \n"); |
---|
10151 | MrBayesPrint (" This command shows a thorough list of citations you may consider using \n"); |
---|
10152 | MrBayesPrint (" when publishing the results of a MrBayes analysis. \n"); |
---|
10153 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10154 | } |
---|
10155 | else if (!strcmp(helpTkn, "Showmatrix")) |
---|
10156 | { |
---|
10157 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10158 | MrBayesPrint (" Showmatrix \n"); |
---|
10159 | MrBayesPrint (" \n"); |
---|
10160 | MrBayesPrint (" This command shows the character matrix currently in memory. \n"); |
---|
10161 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10162 | } |
---|
10163 | else if (!strcmp(helpTkn, "Showbeagle")) |
---|
10164 | { |
---|
10165 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10166 | MrBayesPrint (" Showbeagle \n"); |
---|
10167 | MrBayesPrint (" \n"); |
---|
10168 | MrBayesPrint (" This command shows available BEAGLE resources. \n"); |
---|
10169 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10170 | } |
---|
10171 | else if (!strcmp(helpTkn, "Speciespartition")) |
---|
10172 | { |
---|
10173 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10174 | MrBayesPrint (" Speciespartition \n"); |
---|
10175 | MrBayesPrint (" \n"); |
---|
10176 | MrBayesPrint (" Defines a partition of tips into species. The format for the speciespartition \n"); |
---|
10177 | MrBayesPrint (" command is \n"); |
---|
10178 | MrBayesPrint (" \n"); |
---|
10179 | MrBayesPrint (" Speciespartition <name> = <species name>:<taxon list> ,...,<sp nm>:<tx lst>\n"); |
---|
10180 | MrBayesPrint (" \n"); |
---|
10181 | MrBayesPrint (" The command enumerates comma separated list of pairs consisting of 'species \n"); |
---|
10182 | MrBayesPrint (" name' and 'taxon list'. The 'taxon list' is a standard taxon list, as used by \n"); |
---|
10183 | MrBayesPrint (" the 'Taxset' command. This means that you can use either the index or the name\n"); |
---|
10184 | MrBayesPrint (" of a sequence ('taxon'). Ranges are specified using a dash, and a period can \n"); |
---|
10185 | MrBayesPrint (" be used as a synonym of the last sequence in the matrix. \n"); |
---|
10186 | MrBayesPrint (" \n"); |
---|
10187 | MrBayesPrint (" For exammple: speciespartition species = SpeciesA: 1, SpeciesB: 2-. \n"); |
---|
10188 | MrBayesPrint (" Here, we name two species. SpeciesA is represented by a single sequence while \n"); |
---|
10189 | MrBayesPrint (" SpeciesB is represented by all remaining sequences in the matrix. \n"); |
---|
10190 | MrBayesPrint (" Each sequence is specified by its row index in the data matrix. \n"); |
---|
10191 | MrBayesPrint (" \n"); |
---|
10192 | MrBayesPrint (" As with ordinary partitioning you may define multiple species partitioning \n"); |
---|
10193 | MrBayesPrint (" scheme. You have to use command 'set speciespartition' to enable use of one of\n"); |
---|
10194 | MrBayesPrint (" them. \n"); |
---|
10195 | MrBayesPrint (" \n"); |
---|
10196 | MrBayesPrint (" Currently defined Speciespartitions: \n"); |
---|
10197 | MrBayesPrint (" \n"); |
---|
10198 | MrBayesPrint (" Number Speciespartition name Number of species \n"); |
---|
10199 | MrBayesPrint (" -------------------------------------------------------------------------- \n"); |
---|
10200 | for (i=0; i<numDefinedSpeciespartitions; i++) |
---|
10201 | { |
---|
10202 | tempInt=0; |
---|
10203 | for (j=0; j<numTaxa; j++) |
---|
10204 | { |
---|
10205 | if (tempInt < speciespartitionId[j][i]) |
---|
10206 | tempInt = speciespartitionId[j][i]; |
---|
10207 | } |
---|
10208 | MrBayesPrint (" %4d %-24.24s %4d",i+1, speciespartitionNames[i], tempInt); |
---|
10209 | MrBayesPrint ("\n"); |
---|
10210 | } |
---|
10211 | MrBayesPrint (" \n"); |
---|
10212 | MrBayesPrint (" -------------------------------------------------------------------------- \n"); |
---|
10213 | |
---|
10214 | |
---|
10215 | } |
---|
10216 | else if (!strcmp(helpTkn, "Constraint")) |
---|
10217 | { |
---|
10218 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10219 | MrBayesPrint (" Constraint \n"); |
---|
10220 | MrBayesPrint (" \n"); |
---|
10221 | MrBayesPrint (" This command defines a tree constraint. The format for the constraint \n"); |
---|
10222 | MrBayesPrint (" command is \n"); |
---|
10223 | MrBayesPrint (" \n"); |
---|
10224 | MrBayesPrint (" constraint <name> [hard|negative|partial] = <taxon list> [:<taxon list>] \n"); |
---|
10225 | MrBayesPrint (" \n"); |
---|
10226 | MrBayesPrint (" There are three types of constraint implemented in MrBayes. The type of the \n"); |
---|
10227 | MrBayesPrint (" constraint is specified by using one of the three keywords 'hard', 'negative',\n"); |
---|
10228 | MrBayesPrint (" or 'partial' right after the name of the constraint. If no type is specified, \n"); |
---|
10229 | MrBayesPrint (" then the constraint is assumed to be 'hard'. \n"); |
---|
10230 | MrBayesPrint (" \n"); |
---|
10231 | MrBayesPrint (" In a rooted tree, a 'hard' constraint forces the taxa in the list to form a \n"); |
---|
10232 | MrBayesPrint (" monophyletic group. In an unrooted tree, the taxon split that separates the \n"); |
---|
10233 | MrBayesPrint (" taxa in the list from other taxa is forced to be present. The interpretation \n"); |
---|
10234 | MrBayesPrint (" of this depends on whether the tree is rooted on a taxon outside the list or \n"); |
---|
10235 | MrBayesPrint (" a taxon in the list. If the outgroup is excluded , the taxa in the list are \n"); |
---|
10236 | MrBayesPrint (" assumed to form a monophyletic group, but if the outgroup is included, it is \n"); |
---|
10237 | MrBayesPrint (" the taxa that are not in the list that are forced together. \n"); |
---|
10238 | MrBayesPrint (" \n"); |
---|
10239 | MrBayesPrint (" A 'negative' constraint bans all the trees that have the listed taxa in the \n"); |
---|
10240 | MrBayesPrint (" same subtree. In other words, it is the opposite of a hard constraint. \n"); |
---|
10241 | MrBayesPrint (" \n"); |
---|
10242 | MrBayesPrint (" A 'partial' or backbone constraint is defined in terms of two sets of taxa \n"); |
---|
10243 | MrBayesPrint (" separated by a colon character. The constraint forces all taxa in the first \n"); |
---|
10244 | MrBayesPrint (" list to form a monophyletic group that does not include any taxon in the \n"); |
---|
10245 | MrBayesPrint (" second list. Taxa that are not included in either list can be placed in any \n"); |
---|
10246 | MrBayesPrint (" position on the tree, either inside or outside the constrained group. In an \n"); |
---|
10247 | MrBayesPrint (" unrooted tree, the two taxon lists can be switched with each other with no \n"); |
---|
10248 | MrBayesPrint (" effect. For a rooted tree, it is the taxa in the first list that have to be \n"); |
---|
10249 | MrBayesPrint (" monophyletic, that is, these taxa must share a common ancestor not shared with\n"); |
---|
10250 | MrBayesPrint (" any taxon in the second list. The taxa in the second list may or may not fall \n"); |
---|
10251 | MrBayesPrint (" in a monophyletic group depending on the rooting of the tree. \n"); |
---|
10252 | MrBayesPrint (" \n"); |
---|
10253 | MrBayesPrint (" A list of taxa can be specified using a taxset, taxon names, taxon numbers, or\n"); |
---|
10254 | MrBayesPrint (" any combination of the above, sepatated by spaces. The constraint is treated \n"); |
---|
10255 | MrBayesPrint (" as an absolute requirement of trees, that is, trees that are not compatible \n"); |
---|
10256 | MrBayesPrint (" with the constraint have zero prior (and hence zero posterior) probabilty. \n"); |
---|
10257 | MrBayesPrint (" \n"); |
---|
10258 | MrBayesPrint (" If you are interested in inferring ancestral states for a particular node, \n"); |
---|
10259 | MrBayesPrint (" you need to 'hard' constrain that node first using the 'constraint' command. \n"); |
---|
10260 | MrBayesPrint (" The same applies if you wish to calibrate an interior node in a dated \n"); |
---|
10261 | MrBayesPrint (" analysis. For more information on how to infer ancestral states, see the help \n"); |
---|
10262 | MrBayesPrint (" for the 'report' command. For more on dating, see the 'calibrate' command. \n"); |
---|
10263 | MrBayesPrint (" \n"); |
---|
10264 | MrBayesPrint (" It is important to note that simply defining a constraint using this \n"); |
---|
10265 | MrBayesPrint (" command is not sufficient for the program to actually implement the \n"); |
---|
10266 | MrBayesPrint (" constraint in an analysis. You must also enforce the constraints using \n"); |
---|
10267 | MrBayesPrint (" 'prset topologypr = constraints (<list of constraints>)'. For more infor- \n"); |
---|
10268 | MrBayesPrint (" mation on this, see the help on the 'prset' command. \n"); |
---|
10269 | MrBayesPrint (" \n"); |
---|
10270 | MrBayesPrint (" Examples: \n"); |
---|
10271 | MrBayesPrint (" \n"); |
---|
10272 | MrBayesPrint (" constraint myclade = Homo Pan Gorilla \n"); |
---|
10273 | MrBayesPrint (" \n"); |
---|
10274 | MrBayesPrint (" Defines a hard constraint forcing Homo, Pan, and Gorilla to form a mono- \n"); |
---|
10275 | MrBayesPrint (" phyletic group or a split that does not include any other taxa. \n"); |
---|
10276 | MrBayesPrint (" \n"); |
---|
10277 | MrBayesPrint (" constraint forbiddenclade negative = Homo Pan Gorilla \n"); |
---|
10278 | MrBayesPrint (" \n"); |
---|
10279 | MrBayesPrint (" Defines a negative constraint that associates all trees where Homon, Pan, and \n"); |
---|
10280 | MrBayesPrint (" Gorilla form a monophyletic group with zero posterior probability. In other \n"); |
---|
10281 | MrBayesPrint (" words, such trees will not be sampled during MCMC. \n"); |
---|
10282 | MrBayesPrint (" \n"); |
---|
10283 | MrBayesPrint (" constraint backbone partial = Homo Gorilla : Mus \n"); |
---|
10284 | MrBayesPrint (" \n"); |
---|
10285 | MrBayesPrint (" Defines a partial constraint that keeps Mus outside of the clade defined by \n"); |
---|
10286 | MrBayesPrint (" the most recent common ancestor of Homo and Gorilla. Other taxa are allowed to\n"); |
---|
10287 | MrBayesPrint (" sit anywhere in the tree. \n"); |
---|
10288 | MrBayesPrint (" \n"); |
---|
10289 | MrBayesPrint (" To define a more complex constraint tree, simply combine constraints into a \n"); |
---|
10290 | MrBayesPrint (" list when issuing the 'prset topologypr' command. \n"); |
---|
10291 | MrBayesPrint (" \n"); |
---|
10292 | if (numDefinedConstraints > 0) |
---|
10293 | { |
---|
10294 | MrBayesPrint (" Currently defined constraints: \n"); |
---|
10295 | MrBayesPrint (" \n"); |
---|
10296 | MrBayesPrint (" Number Constraint name type Number of taxa in[:out] \n"); |
---|
10297 | MrBayesPrint (" -------------------------------------------------------------------------- \n"); |
---|
10298 | } |
---|
10299 | for (i=0; i<numDefinedConstraints; i++) |
---|
10300 | { |
---|
10301 | strncpy (tempString, constraintNames[i], 22); |
---|
10302 | MrBayesPrint (" %4d %-22.22s ",i+1, tempString); |
---|
10303 | if( definedConstraintsType[i] == HARD ) |
---|
10304 | MrBayesPrint ("hard "); |
---|
10305 | else if( definedConstraintsType[i] == PARTIAL ) |
---|
10306 | MrBayesPrint ("partial "); |
---|
10307 | else |
---|
10308 | { |
---|
10309 | assert(definedConstraintsType[i] == NEGATIVE ); |
---|
10310 | MrBayesPrint ("negative "); |
---|
10311 | } |
---|
10312 | k = NumBits (definedConstraint[i], numTaxa/nBitsInALong + 1); |
---|
10313 | MrBayesPrint ("%d", k); |
---|
10314 | if( definedConstraintsType[i] == PARTIAL ) |
---|
10315 | { |
---|
10316 | k = NumBits (definedConstraintTwo[i], numTaxa/nBitsInALong + 1); |
---|
10317 | MrBayesPrint (":%d", k); |
---|
10318 | } |
---|
10319 | MrBayesPrint ("\n"); |
---|
10320 | } |
---|
10321 | MrBayesPrint (" \n"); |
---|
10322 | MrBayesPrint (" -------------------------------------------------------------------------- \n"); |
---|
10323 | } |
---|
10324 | else if (!strcmp(helpTkn, "Calibrate")) |
---|
10325 | { |
---|
10326 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10327 | MrBayesPrint (" Calibrate \n"); |
---|
10328 | MrBayesPrint (" \n"); |
---|
10329 | MrBayesPrint (" This command dates a terminal or interior node in the tree. The format is \n"); |
---|
10330 | MrBayesPrint (" \n"); |
---|
10331 | MrBayesPrint (" calibrate <node_name> = <age_prior> \n"); |
---|
10332 | MrBayesPrint (" \n"); |
---|
10333 | MrBayesPrint (" where <node_name> is the name of a defined interior constraint node or the \n"); |
---|
10334 | MrBayesPrint (" name of a terminal node (tip) and <age_prior> is a prior probability distribu-\n"); |
---|
10335 | MrBayesPrint (" tion on the age of the node. The latter can either be a fixed date, a uniform \n"); |
---|
10336 | MrBayesPrint (" probability distribution between a minimum and a maximum age, or an offset \n"); |
---|
10337 | MrBayesPrint (" exponential distribution with a minimum age and a rate parameter. The \n"); |
---|
10338 | MrBayesPrint (" format is: \n"); |
---|
10339 | MrBayesPrint (" \n"); |
---|
10340 | MrBayesPrint (" calibrate <node_name> = fixed(<age>) \n"); |
---|
10341 | MrBayesPrint (" calibrate <node_name> = uniform(<min_age>,<max_age>) \n"); |
---|
10342 | MrBayesPrint (" calibrate <node_name> = offsetexponential(<min_age>,<rate>) \n"); |
---|
10343 | MrBayesPrint (" \n"); |
---|
10344 | MrBayesPrint (" For instance, assume that we had three fossil terminals in our analyses named \n"); |
---|
10345 | MrBayesPrint (" 'FossilA', 'FossilB', and 'FossilC'. Assume further that we want to fix the \n"); |
---|
10346 | MrBayesPrint (" age of FossilA to 100.0 million years, we think that FossilB is somewhere \n"); |
---|
10347 | MrBayesPrint (" between 100.0 and 200.0 million years old, and that FossilC is at least 300.0 \n"); |
---|
10348 | MrBayesPrint (" million years old, possibly older but relatively unlikely to be more than \n"); |
---|
10349 | MrBayesPrint (" 400.0 million years old. Then we might use the commands: \n"); |
---|
10350 | MrBayesPrint (" \n"); |
---|
10351 | MrBayesPrint (" calibrate FossilA = fixed(100) FossilB = uniform(100,200) \n"); |
---|
10352 | MrBayesPrint (" calibrate FossilC = offsetexponential(300,0.01) \n"); |
---|
10353 | MrBayesPrint (" \n"); |
---|
10354 | MrBayesPrint (" Note that it is possible to give more than one calibration for each \n"); |
---|
10355 | MrBayesPrint (" 'calibrate' statement. The offset exponential distribution has its expectation\n"); |
---|
10356 | MrBayesPrint (" at the minimum age plus the inverse of the rate parameter. That is, the \n"); |
---|
10357 | MrBayesPrint (" offsetexponential(300,0.01) has the minimum 300 , the expectation 400 = \n"); |
---|
10358 | MrBayesPrint (" = 300 + 1/0.01 and the mode < 400, so that most of the probability distribu- \n"); |
---|
10359 | MrBayesPrint (" tion is on values smaller than 400. \n"); |
---|
10360 | MrBayesPrint (" \n"); |
---|
10361 | MrBayesPrint (" To actually use the calibrations to obtain dated trees, you also need to set \n"); |
---|
10362 | MrBayesPrint (" a clock model using relevant 'brlenspr' and 'nodeagepr' options of the 'prset'\n"); |
---|
10363 | MrBayesPrint (" command. You may also want to examine the 'clockvarpr' and 'clockratepr' op- \n"); |
---|
10364 | MrBayesPrint (" tions. Furthermore, you need to activate the relevant constraint(s) using \n"); |
---|
10365 | MrBayesPrint (" 'topologypr', if you use any dated interior nodes in the tree. \n"); |
---|
10366 | MrBayesPrint (" \n"); |
---|
10367 | MrBayesPrint (" You may wish to remove a calibration from an interior or terminal node, which \n"); |
---|
10368 | MrBayesPrint (" has previously been calibrated. You can do that using \n"); |
---|
10369 | MrBayesPrint (" \n"); |
---|
10370 | MrBayesPrint (" calibrate <node_name> = unconstrained \n"); |
---|
10371 | MrBayesPrint (" \n"); |
---|
10372 | j = 0; |
---|
10373 | for (i=0; i<numTaxa; i++) |
---|
10374 | if (tipCalibration[i].prior != unconstrained) |
---|
10375 | j++; |
---|
10376 | for (i=0; i<numDefinedConstraints; i++) |
---|
10377 | if (nodeCalibration[i].prior != unconstrained) |
---|
10378 | j++; |
---|
10379 | if (j > 0) |
---|
10380 | { |
---|
10381 | MrBayesPrint (" \n"); |
---|
10382 | MrBayesPrint (" Currently defined calibrations: \n"); |
---|
10383 | MrBayesPrint (" \n"); |
---|
10384 | MrBayesPrint (" Node name Type Calibration \n"); |
---|
10385 | MrBayesPrint (" ------------------------------------------------------------------ \n"); |
---|
10386 | for (i=0; i<numTaxa+numDefinedConstraints; i++) |
---|
10387 | { |
---|
10388 | if (i<numTaxa) |
---|
10389 | calibrationPtr = &tipCalibration[i]; |
---|
10390 | else |
---|
10391 | calibrationPtr = &nodeCalibration[i-numTaxa]; |
---|
10392 | if (calibrationPtr != NULL && calibrationPtr->prior != unconstrained) |
---|
10393 | { |
---|
10394 | if (i<numTaxa) |
---|
10395 | strncpy (tempString, taxaNames[i], 22); |
---|
10396 | else |
---|
10397 | strncpy (tempString, constraintNames[i-numTaxa], 22); |
---|
10398 | if (i<numTaxa) |
---|
10399 | MrBayesPrint (" %-22.22s Terminal %s\n", tempString, calibrationPtr->name); |
---|
10400 | else |
---|
10401 | MrBayesPrint (" %-22.22s Interior %s\n", tempString, calibrationPtr->name); |
---|
10402 | } |
---|
10403 | } |
---|
10404 | } |
---|
10405 | MrBayesPrint (" \n"); |
---|
10406 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10407 | } |
---|
10408 | else if (!strcmp(helpTkn, "Showmodel")) |
---|
10409 | { |
---|
10410 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10411 | MrBayesPrint (" Showmodel \n"); |
---|
10412 | MrBayesPrint (" \n"); |
---|
10413 | MrBayesPrint (" This command shows the current model settings. The correct usage is \n"); |
---|
10414 | MrBayesPrint (" \n"); |
---|
10415 | MrBayesPrint (" showmodel \n"); |
---|
10416 | MrBayesPrint (" \n"); |
---|
10417 | MrBayesPrint (" After typing \"showmodel\", the modelling assumptions are shown on a \n"); |
---|
10418 | MrBayesPrint (" partition-by-partition basis. \n"); |
---|
10419 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10420 | } |
---|
10421 | else if (!strcmp(helpTkn, "Execute")) |
---|
10422 | { |
---|
10423 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10424 | MrBayesPrint (" Execute \n"); |
---|
10425 | MrBayesPrint (" \n"); |
---|
10426 | MrBayesPrint (" This command executes a file called <file name>. The correct usage is: \n"); |
---|
10427 | MrBayesPrint (" \n"); |
---|
10428 | MrBayesPrint (" execute <file name> \n"); |
---|
10429 | MrBayesPrint (" \n"); |
---|
10430 | MrBayesPrint (" For example, \n"); |
---|
10431 | MrBayesPrint (" \n"); |
---|
10432 | MrBayesPrint (" execute replicase.nex \n"); |
---|
10433 | MrBayesPrint (" \n"); |
---|
10434 | MrBayesPrint (" would execute the file named \"replicase.nex\". This file must be in the \n"); |
---|
10435 | MrBayesPrint (" same directory as the executable. \n"); |
---|
10436 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10437 | } |
---|
10438 | else if (!strcmp(helpTkn, "Lset")) |
---|
10439 | { |
---|
10440 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10441 | MrBayesPrint (" Lset \n"); |
---|
10442 | MrBayesPrint (" \n"); |
---|
10443 | MrBayesPrint (" This command sets the parameters of the likelihood model. The likelihood \n"); |
---|
10444 | MrBayesPrint (" function is the probability of observing the data conditional on the phylo- \n"); |
---|
10445 | MrBayesPrint (" genetic model. In order to calculate the likelihood, you must assume a \n"); |
---|
10446 | MrBayesPrint (" model of character change. This command lets you tailor the biological \n"); |
---|
10447 | MrBayesPrint (" assumptions made in the phylogenetic model. The correct usage is \n"); |
---|
10448 | MrBayesPrint (" \n"); |
---|
10449 | MrBayesPrint (" lset <parameter>=<option> ... <parameter>=<option> \n"); |
---|
10450 | MrBayesPrint (" \n"); |
---|
10451 | MrBayesPrint (" For example, \"lset nst=6 rates=gamma\" would set the model to a general \n"); |
---|
10452 | MrBayesPrint (" model of DNA substition (the GTR) with gamma-distributed rate variation \n"); |
---|
10453 | MrBayesPrint (" across sites. \n"); |
---|
10454 | MrBayesPrint (" \n"); |
---|
10455 | MrBayesPrint (" Options: \n"); |
---|
10456 | MrBayesPrint (" \n"); |
---|
10457 | MrBayesPrint (" Applyto -- This option allows you to apply the lset commands to specific \n"); |
---|
10458 | MrBayesPrint (" partitions. This command should be the first in the list of \n"); |
---|
10459 | MrBayesPrint (" commands specified in lset. Moreover, it only makes sense to \n"); |
---|
10460 | MrBayesPrint (" be using this command if the data have been partitioned. A \n"); |
---|
10461 | MrBayesPrint (" default partition is set on execution of a matrix. If the data \n"); |
---|
10462 | MrBayesPrint (" are homogeneous (i.e., all of the same data type), then this \n"); |
---|
10463 | MrBayesPrint (" partition will not subdivide the characters. Up to 30 other \n"); |
---|
10464 | MrBayesPrint (" partitions can be defined, and you can switch among them using \n"); |
---|
10465 | MrBayesPrint (" \"set partition=<partition name>\". Now, you may want to \n"); |
---|
10466 | MrBayesPrint (" specify different models to different partitions of the data. \n"); |
---|
10467 | MrBayesPrint (" Applyto allows you to do this. For example, say you have \n"); |
---|
10468 | MrBayesPrint (" partitioned the data by codon position, and you want to apply \n"); |
---|
10469 | MrBayesPrint (" a nst=2 model to the first two partitions and nst=6 to the \n"); |
---|
10470 | MrBayesPrint (" last. This could be implemented in two uses of lset: \n"); |
---|
10471 | MrBayesPrint (" \n"); |
---|
10472 | MrBayesPrint (" lset applyto=(1,2) nst=2 \n"); |
---|
10473 | MrBayesPrint (" \n"); |
---|
10474 | MrBayesPrint (" lset applyto=(3) nst=6 \n"); |
---|
10475 | MrBayesPrint (" \n"); |
---|
10476 | MrBayesPrint (" The first applies the parameters after \"applyto\" to the \n"); |
---|
10477 | MrBayesPrint (" first and second partitions. The second lset applies nst=6 \n"); |
---|
10478 | MrBayesPrint (" to the third partition. You can also use applyto=(all), which \n"); |
---|
10479 | MrBayesPrint (" attempts to apply the parameter settings to all of the data \n"); |
---|
10480 | MrBayesPrint (" partitions. Importantly, if the option is not consistent with \n"); |
---|
10481 | MrBayesPrint (" the data in the partition, the program will not apply the \n"); |
---|
10482 | MrBayesPrint (" lset option to that partition. \n"); |
---|
10483 | MrBayesPrint (" Nucmodel -- This specifies the general form of the nucleotide substitution \n"); |
---|
10484 | MrBayesPrint (" model. The options are \"4by4\" [the standard model of DNA \n"); |
---|
10485 | MrBayesPrint (" substitution in which there are only four states (A,C,G,T/U)], \n"); |
---|
10486 | MrBayesPrint (" \"doublet\" (a model appropriate for modelling the stem regions \n"); |
---|
10487 | MrBayesPrint (" of ribosomal genes where the state space is the 16 doublets of \n"); |
---|
10488 | MrBayesPrint (" nucleotides), \"codon\" (the substitution model is expanded \n"); |
---|
10489 | MrBayesPrint (" around triplets of nucleotides--a codon), and \"Protein\" \n"); |
---|
10490 | MrBayesPrint (" (triplets of nucleotides are translated to amino acids, which \n"); |
---|
10491 | MrBayesPrint (" form the basis of the substitution model). \n"); |
---|
10492 | MrBayesPrint (" Nst -- Sets the number of substitution types: \"1\" constrains all of \n"); |
---|
10493 | MrBayesPrint (" the rates to be the same (e.g., a JC69 or F81 model); \"2\" all- \n"); |
---|
10494 | MrBayesPrint (" ows transitions and transversions to have potentially different \n"); |
---|
10495 | MrBayesPrint (" rates (e.g., a K80 or HKY85 model); \"6\" allows all rates to \n"); |
---|
10496 | MrBayesPrint (" be different, subject to the constraint of time-reversibility \n"); |
---|
10497 | MrBayesPrint (" (e.g., a GTR model). Finally, 'nst' can be set to 'mixed', which \n"); |
---|
10498 | MrBayesPrint (" results in the Markov chain sampling over the space of all poss- \n"); |
---|
10499 | MrBayesPrint (" ible reversible substitution models, including the GTR model and \n"); |
---|
10500 | MrBayesPrint (" all models that can be derived from it model by grouping the six \n"); |
---|
10501 | MrBayesPrint (" rates in various combinations. This includes all the named models\n"); |
---|
10502 | MrBayesPrint (" above and a large number of others, with or without name. \n"); |
---|
10503 | MrBayesPrint (" Code -- Enforces the use of a particular genetic code. The default \n"); |
---|
10504 | MrBayesPrint (" is the universal code. Other options include \"vertmt\" for \n"); |
---|
10505 | MrBayesPrint (" vertebrate mitocondrial DNA, \"mycoplasma\", \"yeast\", \n"); |
---|
10506 | MrBayesPrint (" \"ciliates\", and \"metmt\" (for metazoan mitochondrial DNA \n"); |
---|
10507 | MrBayesPrint (" except vertebrates). \n"); |
---|
10508 | MrBayesPrint (" Ploidy -- Specifies the ploidy of the organism. Options are \"Haploid\", \n"); |
---|
10509 | MrBayesPrint (" \"Diploid\" or \"Zlinked\". This option is used when a coalescence\n"); |
---|
10510 | MrBayesPrint (" prior is used on trees. \n"); |
---|
10511 | MrBayesPrint (" Rates -- Sets the model for among-site rate variation. In general, the \n"); |
---|
10512 | MrBayesPrint (" rate at a site is considered to be an unknown random variable. \n"); |
---|
10513 | MrBayesPrint (" The valid options are: \n"); |
---|
10514 | MrBayesPrint (" * equal -- No rate variation across sites. \n"); |
---|
10515 | MrBayesPrint (" * gamma -- Gamma-distributed rates across sites. The rate \n"); |
---|
10516 | MrBayesPrint (" at a site is drawn from a gamma distribution. \n"); |
---|
10517 | MrBayesPrint (" The gamma distribution has a single parameter \n"); |
---|
10518 | MrBayesPrint (" that describes how much rates vary. \n"); |
---|
10519 | MrBayesPrint (" * adgamma -- Autocorrelated rates across sites. The marg- \n"); |
---|
10520 | MrBayesPrint (" inal rate distribution is gamma, but adjacent \n"); |
---|
10521 | MrBayesPrint (" sites have correlated rates. \n"); |
---|
10522 | MrBayesPrint (" * propinv -- A proportion of the sites are invariable. \n"); |
---|
10523 | MrBayesPrint (" * invgamma -- A proportion of the sites are invariable while \n"); |
---|
10524 | MrBayesPrint (" the rate for the remaining sites are drawn from \n"); |
---|
10525 | MrBayesPrint (" a gamma distribution. \n"); |
---|
10526 | MrBayesPrint (" Note that MrBayes versions 2.0 and earlier supported options \n"); |
---|
10527 | MrBayesPrint (" that allowed site specific rates (e.g., ssgamma). In versions \n"); |
---|
10528 | MrBayesPrint (" 3.0 and later, site specific rates are allowed, but set using \n"); |
---|
10529 | MrBayesPrint (" the 'prset ratepr' command for each partition. \n"); |
---|
10530 | MrBayesPrint (" Ngammacat -- Sets the number of rate categories for the gamma distribution. \n"); |
---|
10531 | MrBayesPrint (" The gamma distribution is continuous. However, it is virtually \n"); |
---|
10532 | MrBayesPrint (" impossible to calculate likelihoods under the continuous gamma \n"); |
---|
10533 | MrBayesPrint (" distribution. Hence, an approximation to the continuous gamma \n"); |
---|
10534 | MrBayesPrint (" is used; the gamma distribution is broken into ncat categories \n"); |
---|
10535 | MrBayesPrint (" of equal weight (1/ncat). The mean rate for each category rep- \n"); |
---|
10536 | MrBayesPrint (" resents the rate for the entire cateogry. This option allows \n"); |
---|
10537 | MrBayesPrint (" you to specify how many rate categories to use when approx- \n"); |
---|
10538 | MrBayesPrint (" imating the gamma. The approximation is better as ncat is inc- \n"); |
---|
10539 | MrBayesPrint (" reased. In practice, \"ncat=4\" does a reasonable job of \n"); |
---|
10540 | MrBayesPrint (" approximating the continuous gamma. \n"); |
---|
10541 | #if 0 |
---|
10542 | /* Temporarily disable this because of conflict with likelihood calculators. It should be renamed to samplerates when reintroduced. */ |
---|
10543 | MrBayesPrint (" Usegibbs -- Specifies whether site probabilities under the discrete gamma \n"); |
---|
10544 | MrBayesPrint (" model of rate variation across sites will be summed across rate \n"); |
---|
10545 | MrBayesPrint (" categories ('Usegibbs=No') or sampled using a Gibbs sampler \n"); |
---|
10546 | MrBayesPrint (" ('Usegibbs=Yes'). The Gibbs sampling approach is much faster and \n"); |
---|
10547 | MrBayesPrint (" requires less memory but the likelihood of the sampled points \n"); |
---|
10548 | MrBayesPrint (" will be considerably higher than with the standard approach of \n"); |
---|
10549 | MrBayesPrint (" summing probabilities, so you need to be aware of this when com- \n"); |
---|
10550 | MrBayesPrint (" paring your results with those you obtain with other programs. \n"); |
---|
10551 | MrBayesPrint (" Assume that you are using n rate categories in your discrete \n"); |
---|
10552 | MrBayesPrint (" gamma distribution. Then the Gibbs approach is up to n times \n"); |
---|
10553 | MrBayesPrint (" faster and requires 1/n as much memory as the standard method. \n"); |
---|
10554 | MrBayesPrint (" Unfortunately, the state space also becomes larger so the chain \n"); |
---|
10555 | MrBayesPrint (" may need more time to converge. The approach should work best \n"); |
---|
10556 | MrBayesPrint (" for large trees, where the uncertainty concerning the best rate \n"); |
---|
10557 | MrBayesPrint (" category for each site is negligible. Gibbs sampling cannot be \n"); |
---|
10558 | MrBayesPrint (" used for the autocorrelated discrete gamma model, for standard \n"); |
---|
10559 | MrBayesPrint (" data, or for restriction data. Also, MrBayes will not use Gibbs \n"); |
---|
10560 | MrBayesPrint (" sampling when you want to infer site rates. \n"); |
---|
10561 | MrBayesPrint (" Gibbsfreq -- Sets the frequency with which the rate categories of the discrete\n"); |
---|
10562 | MrBayesPrint (" gamma will be Gibbs sampled. In practice, we have found that a \n"); |
---|
10563 | MrBayesPrint (" resampling frequency of every 100 MCMC generations works well for\n"); |
---|
10564 | MrBayesPrint (" reasonably long runs. The more frequent the Gibbs sampling, the \n"); |
---|
10565 | MrBayesPrint (" slower the Gibbs sampling approach will be. If you have k rate \n"); |
---|
10566 | MrBayesPrint (" categories and Gibbs sample them every n generations, then the \n"); |
---|
10567 | MrBayesPrint (" time it takes to complete n generations will roughly be propor- \n"); |
---|
10568 | MrBayesPrint (" tional to n+k. Compare this with the traditional approach of \n"); |
---|
10569 | MrBayesPrint (" summing across the n rate categories in every generation, which \n"); |
---|
10570 | MrBayesPrint (" requires time proportional to n*k. In practice, however, the \n"); |
---|
10571 | MrBayesPrint (" speed difference is not quite as large as this. \n"); |
---|
10572 | #endif |
---|
10573 | MrBayesPrint (" Nbetacat -- Sets the number of rate categories for the beta distribution. \n"); |
---|
10574 | MrBayesPrint (" A symmetric beta distribution is used to model the station- \n"); |
---|
10575 | MrBayesPrint (" ary frequencies when morphological data are used. This option \n"); |
---|
10576 | MrBayesPrint (" specifies how well the beta distribution will be approx- \n"); |
---|
10577 | MrBayesPrint (" imated. \n"); |
---|
10578 | MrBayesPrint (" Omegavar -- Allows the nonsynonymous/synonymous rate ratio (omega) to vary \n"); |
---|
10579 | MrBayesPrint (" across codons. Ny98 assumes that there are three classes, with \n"); |
---|
10580 | MrBayesPrint (" potentially different omega values (omega1, omega2, omega3): \n"); |
---|
10581 | MrBayesPrint (" omega2 = 1; 0 < omega1 <1; and omega3 > 1. Like the Ny98 model, \n"); |
---|
10582 | MrBayesPrint (" the M3 model has three omega classes. However, their values are \n"); |
---|
10583 | MrBayesPrint (" less constrained, with omega1 < omega2 < omega3. The default \n"); |
---|
10584 | MrBayesPrint (" (omegavar = equal) has no variation on omega across sites. \n"); |
---|
10585 | MrBayesPrint (" Covarion -- This forces the use of a covarion-like model of substitution \n"); |
---|
10586 | MrBayesPrint (" for nucleotide or amino acid data. The valid options are \"yes\" \n"); |
---|
10587 | MrBayesPrint (" and \"no\". The covarion model allows the rate at a site to \n"); |
---|
10588 | MrBayesPrint (" change over its evolutionary history. Specifically, the site \n"); |
---|
10589 | MrBayesPrint (" is either on or off. When it is off, no substitutions are poss- \n"); |
---|
10590 | MrBayesPrint (" ible. When the process is on, substitutions occur according to \n"); |
---|
10591 | MrBayesPrint (" a specified substitution model (specified using the other \n"); |
---|
10592 | MrBayesPrint (" lset options). \n"); |
---|
10593 | MrBayesPrint (" Coding -- This specifies how characters were sampled. If all site pat- \n"); |
---|
10594 | MrBayesPrint (" terns had the possibility of being sampled, then \"all\" should \n"); |
---|
10595 | MrBayesPrint (" be specified (the default). Otherwise \"variable\" (only var- \n"); |
---|
10596 | MrBayesPrint (" iable characters had the possibility of being sampled), \n"); |
---|
10597 | MrBayesPrint (" \"noabsence\" (characters for which all taxa were coded as \n"); |
---|
10598 | MrBayesPrint (" absent were not sampled), and \"nopresence\" (characters for \n"); |
---|
10599 | MrBayesPrint (" which all taxa were coded as present were not sampled. \"All\" \n"); |
---|
10600 | MrBayesPrint (" works for all data types. However, the others only work for \n"); |
---|
10601 | MrBayesPrint (" morphological (all/variable) or restriction site (all/variable/ \n"); |
---|
10602 | MrBayesPrint (" noabsence/nopresence) data. \n"); |
---|
10603 | MrBayesPrint (" Parsmodel -- This forces calculation under the so-called parsimony model \n"); |
---|
10604 | MrBayesPrint (" described by Tuffley and Steel (1998). The options are \"yes\" \n"); |
---|
10605 | MrBayesPrint (" or \"no\". Note that the biological assumptions of this model \n"); |
---|
10606 | MrBayesPrint (" are anything but parsimonious. In fact, this model assumes many \n"); |
---|
10607 | MrBayesPrint (" more parameters than the next most complicated model imple- \n"); |
---|
10608 | MrBayesPrint (" mented in this program. If you really believe that the pars- \n"); |
---|
10609 | MrBayesPrint (" imony model makes the biological assumptions described by \n"); |
---|
10610 | MrBayesPrint (" Tuffley and Steel, then the parsimony method is miss-named. \n"); |
---|
10611 | /*MrBayesPrint (" Augment -- This allows the chain to consider the missing entries of \n"); |
---|
10612 | MrBayesPrint (" the data matrix as random variables. A Gibbs sampler is \n"); |
---|
10613 | MrBayesPrint (" used to sample states. \n");*/ |
---|
10614 | MrBayesPrint (" \n"); |
---|
10615 | if (numCurrentDivisions == 0) |
---|
10616 | tempInt = 1; |
---|
10617 | else |
---|
10618 | tempInt = numCurrentDivisions; |
---|
10619 | for (i=0; i<tempInt; i++) |
---|
10620 | { |
---|
10621 | if (numCurrentDivisions == 0) |
---|
10622 | { |
---|
10623 | MrBayesPrint (" Default model settings: \n"); |
---|
10624 | mp = &defaultModel; |
---|
10625 | } |
---|
10626 | else |
---|
10627 | { |
---|
10628 | MrBayesPrint (" Model settings for partition %d: \n", i+1); |
---|
10629 | mp = &modelParams[i]; |
---|
10630 | } |
---|
10631 | MrBayesPrint (" \n"); |
---|
10632 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
10633 | MrBayesPrint (" ------------------------------------------------------------------ \n"); |
---|
10634 | MrBayesPrint (" Nucmodel 4by4/Doublet/Codon/Protein %s \n", mp->nucModel); |
---|
10635 | MrBayesPrint (" Nst 1/2/6/Mixed %s \n", mp->nst); |
---|
10636 | MrBayesPrint (" Code Universal/Vertmt/Mycoplasma/ \n"); |
---|
10637 | MrBayesPrint (" Yeast/Ciliates/Metmt %s \n", mp->geneticCode); |
---|
10638 | MrBayesPrint (" Ploidy Haploid/Diploid/Zlinked %s \n", mp->ploidy); |
---|
10639 | MrBayesPrint (" Rates Equal/Gamma/Propinv/Invgamma/Adgamma %s \n", mp->ratesModel); |
---|
10640 | MrBayesPrint (" Ngammacat <number> %d \n", mp->numGammaCats); |
---|
10641 | #if 0 |
---|
10642 | /* Temporarily disable this because of conflict with likelihood calculators. It should be renamed to samplerates when reintroduced. */ |
---|
10643 | MrBayesPrint (" Usegibbs Yes/No %s \n", mp->useGibbs); |
---|
10644 | MrBayesPrint (" Gibbsfreq <number> %d \n", mp->gibbsFreq); |
---|
10645 | #endif |
---|
10646 | MrBayesPrint (" Nbetacat <number> %d \n", mp->numBetaCats); |
---|
10647 | MrBayesPrint (" Omegavar Equal/Ny98/M3 %s \n", mp->omegaVar); |
---|
10648 | MrBayesPrint (" Covarion No/Yes %s \n", mp->covarionModel); |
---|
10649 | MrBayesPrint (" Coding All/Variable/Noabsencesites/ \n"); |
---|
10650 | MrBayesPrint (" Nopresencesites %s \n", mp->coding); |
---|
10651 | MrBayesPrint (" Parsmodel No/Yes %s \n", mp->parsModel); |
---|
10652 | /*MrBayesPrint (" Augment No/Yes %s \n", mp->augmentData);*/ |
---|
10653 | MrBayesPrint (" ------------------------------------------------------------------ \n"); |
---|
10654 | MrBayesPrint (" \n"); |
---|
10655 | } |
---|
10656 | } |
---|
10657 | else if (!strcmp(helpTkn, "Prset")) |
---|
10658 | { |
---|
10659 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
10660 | MrBayesPrint (" Prset \n"); |
---|
10661 | MrBayesPrint (" \n"); |
---|
10662 | MrBayesPrint (" This command sets the priors for the phylogenetic model. Remember that \n"); |
---|
10663 | MrBayesPrint (" in a Bayesian analysis, you must specify a prior probability distribution \n"); |
---|
10664 | MrBayesPrint (" for the parameters of the likelihood model. The prior distribution rep- \n"); |
---|
10665 | MrBayesPrint (" resents your prior beliefs about the parameter before observation of the \n"); |
---|
10666 | MrBayesPrint (" data. This command allows you to tailor your prior assumptions to a large \n"); |
---|
10667 | MrBayesPrint (" extent. \n"); |
---|
10668 | MrBayesPrint (" \n"); |
---|
10669 | MrBayesPrint (" Options: \n"); |
---|
10670 | MrBayesPrint (" \n"); |
---|
10671 | MrBayesPrint (" Applyto -- This option allows you to apply the prset commands to \n"); |
---|
10672 | MrBayesPrint (" specific partitions. This command should be the first \n"); |
---|
10673 | MrBayesPrint (" in the list of commands specified in prset. Moreover, it \n"); |
---|
10674 | MrBayesPrint (" only makes sense to be using this command if the data \n"); |
---|
10675 | MrBayesPrint (" have been partitioned. A default partition is set on \n"); |
---|
10676 | MrBayesPrint (" execution of a matrix. If the data are homogeneous \n"); |
---|
10677 | MrBayesPrint (" (i.e., all of the same data type), then this partition \n"); |
---|
10678 | MrBayesPrint (" will not subdivide the characters. Up to 30 other part- \n"); |
---|
10679 | MrBayesPrint (" itions can be defined, and you can switch among them using \n"); |
---|
10680 | MrBayesPrint (" \"set partition=<partition name>\". Now, you may want to \n"); |
---|
10681 | MrBayesPrint (" specify different priors to different partitions of the \n"); |
---|
10682 | MrBayesPrint (" data. Applyto allows you to do this. For example, say \n"); |
---|
10683 | MrBayesPrint (" you have partitioned the data by codon position, and \n"); |
---|
10684 | MrBayesPrint (" you want to fix the statefreqs to equal for the first two \n"); |
---|
10685 | MrBayesPrint (" partitions but apply a flat Dirichlet prior to the state- \n"); |
---|
10686 | MrBayesPrint (" freqs of the last. This could be implemented in two uses of \n"); |
---|
10687 | MrBayesPrint (" prset: \n"); |
---|
10688 | MrBayesPrint (" \n"); |
---|
10689 | MrBayesPrint (" prset applyto=(1,2) statefreqs=fixed(equal) \n"); |
---|
10690 | MrBayesPrint (" \n"); |
---|
10691 | MrBayesPrint (" prset applyto=(3) statefreqs=dirichlet(1,1,1,1) \n"); |
---|
10692 | MrBayesPrint (" \n"); |
---|
10693 | MrBayesPrint (" The first applies the parameters after \"applyto\" \n"); |
---|
10694 | MrBayesPrint (" to the first and second partitions. The second prset \n"); |
---|
10695 | MrBayesPrint (" applies a flat Dirichlet to the third partition. You can \n"); |
---|
10696 | MrBayesPrint (" also use applyto=(all), which attempts to apply the para- \n"); |
---|
10697 | MrBayesPrint (" meter settings to all of the data partitions. Importantly, \n"); |
---|
10698 | MrBayesPrint (" if the option is not consistent with the data in the part- \n"); |
---|
10699 | MrBayesPrint (" ition, the program will not apply the prset option to \n"); |
---|
10700 | MrBayesPrint (" that partition. \n"); |
---|
10701 | MrBayesPrint (" Tratiopr -- This parameter sets the prior for the transition/trans- \n"); |
---|
10702 | MrBayesPrint (" version rate ratio (tratio). The options are: \n"); |
---|
10703 | MrBayesPrint (" \n"); |
---|
10704 | MrBayesPrint (" prset tratiopr = beta(<number>, <number>) \n"); |
---|
10705 | MrBayesPrint (" prset tratiopr = fixed(<number>) \n"); |
---|
10706 | MrBayesPrint (" \n"); |
---|
10707 | MrBayesPrint (" The program assumes that the transition and transversion \n"); |
---|
10708 | MrBayesPrint (" rates are independent gamma-distributed random variables \n"); |
---|
10709 | MrBayesPrint (" with the same scale parameter when beta is selected. If you \n"); |
---|
10710 | MrBayesPrint (" want a diffuse prior that puts equal emphasis on transition/ \n"); |
---|
10711 | MrBayesPrint (" transversion rate ratios above 1.0 and below 1.0, then use a \n"); |
---|
10712 | MrBayesPrint (" flat Beta, beta(1,1), which is the default. If you wish to \n"); |
---|
10713 | MrBayesPrint (" concentrate this distribution more in the equal-rates region,\n"); |
---|
10714 | MrBayesPrint (" then use a prior of the type beta(x,x), where the magnitude \n"); |
---|
10715 | MrBayesPrint (" of x determines how much the prior is concentrated in the \n"); |
---|
10716 | MrBayesPrint (" equal rates region. For instance, a beta(20,20) puts more \n"); |
---|
10717 | MrBayesPrint (" probability on rate ratios close to 1.0 than a beta(1,1). If \n"); |
---|
10718 | MrBayesPrint (" you think it is likely that the transition/transversion rate \n"); |
---|
10719 | MrBayesPrint (" ratio is 2.0, you can use a prior of the type beta(2x,x), \n"); |
---|
10720 | MrBayesPrint (" where x determines how strongly the prior is concentrated on \n"); |
---|
10721 | MrBayesPrint (" tratio values near 2.0. For instance, a beta(2,1) is much \n"); |
---|
10722 | MrBayesPrint (" more diffuse than a beta(80,40) but both have the expected \n"); |
---|
10723 | MrBayesPrint (" tratio 2.0 in the absence of data. The parameters of the \n"); |
---|
10724 | MrBayesPrint (" Beta can be interpreted as counts: if you have observed x \n"); |
---|
10725 | MrBayesPrint (" transitions and y transversions, then a beta(x+1,y+1) is a \n"); |
---|
10726 | MrBayesPrint (" good representation of this information. The fixed option \n"); |
---|
10727 | MrBayesPrint (" allows you to fix the tratio to a particular value. \n"); |
---|
10728 | MrBayesPrint (" Revmatpr -- This parameter sets the prior for the substitution rates \n"); |
---|
10729 | MrBayesPrint (" of the GTR model for nucleotide data. The options are: \n"); |
---|
10730 | MrBayesPrint (" \n"); |
---|
10731 | MrBayesPrint (" prset revmatpr = dirichlet(<number>,<number>,...,<number>)\n"); |
---|
10732 | MrBayesPrint (" prset revmatpr = fixed(<number>,<number>,...,<number>) \n"); |
---|
10733 | MrBayesPrint (" \n"); |
---|
10734 | MrBayesPrint (" The program assumes that the six substitution rates \n"); |
---|
10735 | MrBayesPrint (" are independent gamma-distributed random variables with the \n"); |
---|
10736 | MrBayesPrint (" same scale parameter when dirichlet is selected. The six \n"); |
---|
10737 | MrBayesPrint (" numbers in brackets each corresponds to a particular substi- \n"); |
---|
10738 | MrBayesPrint (" tution type. Together, they determine the shape of the prior.\n"); |
---|
10739 | MrBayesPrint (" The six rates are in the order A<->C, A<->G, A<->T, C<->G, \n"); |
---|
10740 | MrBayesPrint (" C<->T, and G<->T. If you want an uninformative prior you can \n"); |
---|
10741 | MrBayesPrint (" use dirichlet(1,1,1,1,1,1), also referred to as a 'flat' \n"); |
---|
10742 | MrBayesPrint (" Dirichlet. This is the default setting. If you wish a prior \n"); |
---|
10743 | MrBayesPrint (" where the C<->T rate is 5 times and the A<->G rate 2 times \n"); |
---|
10744 | MrBayesPrint (" higher, on average, than the transversion rates, which are \n"); |
---|
10745 | MrBayesPrint (" all the same, then you should use a prior of the form \n"); |
---|
10746 | MrBayesPrint (" dirichlet(x,2x,x,x,5x,x), where x determines how much the \n"); |
---|
10747 | MrBayesPrint (" prior is focused on these particular rates. For more info, \n"); |
---|
10748 | MrBayesPrint (" see tratiopr. The fixed option allows you to fix the substi- \n"); |
---|
10749 | MrBayesPrint (" tution rates to particular values. \n"); |
---|
10750 | MrBayesPrint (" Revratepr -- This parameter sets the prior for each substitution rate of \n"); |
---|
10751 | MrBayesPrint (" the GTR model subspace when 'nst' is set to 'mixed' (see the \n"); |
---|
10752 | MrBayesPrint (" 'lset' command). The only option is \n"); |
---|
10753 | MrBayesPrint (" \n"); |
---|
10754 | MrBayesPrint (" prset revratepr = symdir(<number>) \n"); |
---|
10755 | MrBayesPrint (" \n"); |
---|
10756 | MrBayesPrint (" which will associate each independent rate in the rate matrix\n"); |
---|
10757 | MrBayesPrint (" with a modified symmetric Dirichlet prior, where a singleton \n"); |
---|
10758 | MrBayesPrint (" rate has the specified alpha parameter, while a rate that \n"); |
---|
10759 | MrBayesPrint (" applies to n pairwise substitution types has an alpha that is\n"); |
---|
10760 | MrBayesPrint (" n times the specified number. The higher the specified num- \n"); |
---|
10761 | MrBayesPrint (" ber, the more focused the prior will be on equal rates. The \n"); |
---|
10762 | MrBayesPrint (" default value is 1, which gives an effect similar to a flat \n"); |
---|
10763 | MrBayesPrint (" Dirichlet. \n"); |
---|
10764 | MrBayesPrint (" Aamodelpr -- This parameter sets the rate matrix for amino acid data. \n"); |
---|
10765 | MrBayesPrint (" You can either fix the model by specifying aamodelpr= \n"); |
---|
10766 | MrBayesPrint (" fixed(<model name>), where <model name> is 'poisson' (a \n"); |
---|
10767 | MrBayesPrint (" glorified Jukes-Cantor model), 'jones', 'dayhoff', 'mtrev', \n"); |
---|
10768 | MrBayesPrint (" 'mtmam', 'wag', 'rtrev', 'cprev', 'vt', 'blosum', 'equalin' \n"); |
---|
10769 | MrBayesPrint (" (a glorified Felsenstein 1981 model), or 'gtr'. You can also \n"); |
---|
10770 | MrBayesPrint (" average over the first ten models by specifying aamodelpr= \n"); |
---|
10771 | MrBayesPrint (" mixed. If you do so, the Markov chain will sample each model \n"); |
---|
10772 | MrBayesPrint (" according to its probability. The sampled model is reported \n"); |
---|
10773 | MrBayesPrint (" as an index: poisson(0), jones(1), dayhoff(2), mtrev(3), \n"); |
---|
10774 | MrBayesPrint (" mtmam(4), wag(5), rtrev(6), cprev(7), vt(8), or blosum(9). \n"); |
---|
10775 | MrBayesPrint (" The 'Sump' command summarizes the MCMC samples and calculates\n"); |
---|
10776 | MrBayesPrint (" the posterior probability estimate for each of these models. \n"); |
---|
10777 | MrBayesPrint (" Aarevmatpr -- This parameter sets the prior for the substitution rates \n"); |
---|
10778 | MrBayesPrint (" of the GTR model for amino acid data. The options are: \n"); |
---|
10779 | MrBayesPrint (" \n"); |
---|
10780 | MrBayesPrint (" prset revmatpr = dirichlet(<number>,<number>,...,<number>)\n"); |
---|
10781 | MrBayesPrint (" prset revmatpr = fixed(<number>,<number>,...,<number>) \n"); |
---|
10782 | MrBayesPrint (" \n"); |
---|
10783 | MrBayesPrint (" The options are the same as those for 'Revmatpr' except that \n"); |
---|
10784 | MrBayesPrint (" they are defined over the 190 rates of the time-reversible \n"); |
---|
10785 | MrBayesPrint (" GTR model for amino acids instead of over the 6 rates of the \n"); |
---|
10786 | MrBayesPrint (" GTR model for nucleotides. The rates are in the order A<->R, \n"); |
---|
10787 | MrBayesPrint (" A<->N, etc to Y<->V. In other words, amino acids are listed \n"); |
---|
10788 | MrBayesPrint (" in alphabetic order based on their full name. The first amino\n"); |
---|
10789 | MrBayesPrint (" acid (Alanine) is then combined in turn with all amino acids \n"); |
---|
10790 | MrBayesPrint (" following it in the list, starting with amino acid 2 (Argi- \n"); |
---|
10791 | MrBayesPrint (" nine) and finishing with amino acid 20 (Valine). The second \n"); |
---|
10792 | MrBayesPrint (" amino acid (Arginine) is then combined in turn with all amino\n"); |
---|
10793 | MrBayesPrint (" acids following it, starting with amino acid 3 (Asparagine) \n"); |
---|
10794 | MrBayesPrint (" and finishing with amino acid 20 (Valine), and so on. \n"); |
---|
10795 | MrBayesPrint (" Omegapr -- This parameter specifies the prior on the nonsynonymous/ \n"); |
---|
10796 | MrBayesPrint (" synonymous rate ratio. The options are: \n"); |
---|
10797 | MrBayesPrint (" \n"); |
---|
10798 | MrBayesPrint (" prset omegapr = uniform(<number>,<number>) \n"); |
---|
10799 | MrBayesPrint (" prset omegapr = exponential(<number>) \n"); |
---|
10800 | MrBayesPrint (" prset omegapr = fixed(<number>) \n"); |
---|
10801 | MrBayesPrint (" \n"); |
---|
10802 | MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n"); |
---|
10803 | MrBayesPrint (" stitution model is set to codon using the lset command \n"); |
---|
10804 | MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n"); |
---|
10805 | MrBayesPrint (" case when there is no variation in omega across sites (i.e., \n"); |
---|
10806 | MrBayesPrint (" \"lset omegavar=equal\"). \n"); |
---|
10807 | MrBayesPrint (" Ny98omega1pr -- This parameter specifies the prior on the nonsynonymous/ \n"); |
---|
10808 | MrBayesPrint (" synonymous rate ratio for sites under purifying selection. \n"); |
---|
10809 | MrBayesPrint (" The options are: \n"); |
---|
10810 | MrBayesPrint (" \n"); |
---|
10811 | MrBayesPrint (" prset Ny98omega1pr = beta(<number>,<number>) \n"); |
---|
10812 | MrBayesPrint (" prset Ny98omega1pr = fixed(<number>) \n"); |
---|
10813 | MrBayesPrint (" \n"); |
---|
10814 | MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n"); |
---|
10815 | MrBayesPrint (" stitution model is set to codon using the lset command \n"); |
---|
10816 | MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n"); |
---|
10817 | MrBayesPrint (" case where omega varies across sites using the model of \n"); |
---|
10818 | MrBayesPrint (" Nielsen and Yang (1998) (i.e., \"lset omegavar=ny98\"). If \n"); |
---|
10819 | MrBayesPrint (" fixing the parameter, you must specify a number between \n"); |
---|
10820 | MrBayesPrint (" 0 and 1. \n"); |
---|
10821 | MrBayesPrint (" Ny98omega3pr -- This parameter specifies the prior on the nonsynonymous/ \n"); |
---|
10822 | MrBayesPrint (" synonymous rate ratio for positively selected sites. The \n"); |
---|
10823 | MrBayesPrint (" options are: \n"); |
---|
10824 | MrBayesPrint (" \n"); |
---|
10825 | MrBayesPrint (" prset Ny98omega3pr = uniform(<number>,<number>) \n"); |
---|
10826 | MrBayesPrint (" prset Ny98omega3pr = exponential(<number>) \n"); |
---|
10827 | MrBayesPrint (" prset Ny98omega3pr = fixed(<number>) \n"); |
---|
10828 | MrBayesPrint (" \n"); |
---|
10829 | MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n"); |
---|
10830 | MrBayesPrint (" stitution model is set to codon using the lset command \n"); |
---|
10831 | MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n"); |
---|
10832 | MrBayesPrint (" case where omega varies across sites according to the \n"); |
---|
10833 | MrBayesPrint (" NY98 model. Note that if the NY98 model is specified \n"); |
---|
10834 | MrBayesPrint (" that this parameter must be greater than 1, so you should \n"); |
---|
10835 | MrBayesPrint (" not specify a uniform(0,10) prior, for example. \n"); |
---|
10836 | MrBayesPrint (" M3omegapr -- This parameter specifies the prior on the nonsynonymous/ \n"); |
---|
10837 | MrBayesPrint (" synonymous rate ratios for all three classes of sites for \n"); |
---|
10838 | MrBayesPrint (" the M3 model. The options are: \n"); |
---|
10839 | MrBayesPrint (" \n"); |
---|
10840 | MrBayesPrint (" prset M3omegapr = exponential \n"); |
---|
10841 | MrBayesPrint (" prset M3omegapr = fixed(<number>,<number>,<number>) \n"); |
---|
10842 | MrBayesPrint (" \n"); |
---|
10843 | MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n"); |
---|
10844 | MrBayesPrint (" stitution model is set to codon using the lset command \n"); |
---|
10845 | MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n"); |
---|
10846 | MrBayesPrint (" case where omega varies across sites using the M3 model of \n"); |
---|
10847 | MrBayesPrint (" Yang et al. (2000) (i.e., \"lset omegavar=M3\"). Under the \n"); |
---|
10848 | MrBayesPrint (" exponential prior, the four rates (dN1, dN2, dN3, and dS) \n"); |
---|
10849 | MrBayesPrint (" are all considered to be independent draws from the same \n"); |
---|
10850 | MrBayesPrint (" exponential distribution (the parameter of the exponential \n"); |
---|
10851 | MrBayesPrint (" does not matter, and so you don't need to specify it). The \n"); |
---|
10852 | MrBayesPrint (" rates dN1, dN2, and dN3 are taken to be the order statistics \n"); |
---|
10853 | MrBayesPrint (" with dN1 < dN2 < dN3. These three rates are all scaled to \n"); |
---|
10854 | MrBayesPrint (" the same synonymous rate, dS. The other option is to simply \n"); |
---|
10855 | MrBayesPrint (" fix the three rate ratios to some values. \n"); |
---|
10856 | MrBayesPrint (" Codoncatfreqs -- This parameter specifies the prior on frequencies of sites \n"); |
---|
10857 | MrBayesPrint (" under purifying, neutral, and positive selection. The \n"); |
---|
10858 | MrBayesPrint (" options are: \n"); |
---|
10859 | MrBayesPrint (" \n"); |
---|
10860 | MrBayesPrint (" prset codoncatfreqs = dirichlet(<num>,<num>,<num>) \n"); |
---|
10861 | MrBayesPrint (" prset codoncatfreqs = fixed(<number>,<number>,<number>) \n"); |
---|
10862 | MrBayesPrint (" \n"); |
---|
10863 | MrBayesPrint (" This parameter is only in effect if the nucleotide sub- \n"); |
---|
10864 | MrBayesPrint (" stitution model is set to codon using the lset command \n"); |
---|
10865 | MrBayesPrint (" (lset nucmodel=codon). Moreover, it only applies to the \n"); |
---|
10866 | MrBayesPrint (" case where omega varies across sites using the models of \n"); |
---|
10867 | MrBayesPrint (" Nielsen and Yang (1998) (i.e., \"lset omegavar=ny98\") \n"); |
---|
10868 | MrBayesPrint (" or Yang et al. (2000) (i.e., \"lset omegavar=M3\") \n"); |
---|
10869 | MrBayesPrint (" Note that the sum of the three frequencies must be 1. \n"); |
---|
10870 | MrBayesPrint (" Statefreqpr -- This parameter specifies the prior on the state freq- \n"); |
---|
10871 | MrBayesPrint (" uencies. The options are: \n"); |
---|
10872 | MrBayesPrint (" \n"); |
---|
10873 | MrBayesPrint (" prset statefreqpr = dirichlet(<number>) \n"); |
---|
10874 | MrBayesPrint (" prset statefreqpr = dirichlet(<number>,...,<number>) \n"); |
---|
10875 | MrBayesPrint (" prset statefreqpr = fixed(equal) \n"); |
---|
10876 | MrBayesPrint (" prset statefreqpr = fixed(empirical) \n"); |
---|
10877 | MrBayesPrint (" prset statefreqpr = fixed(<number>,...,<number>) \n"); |
---|
10878 | MrBayesPrint (" \n"); |
---|
10879 | MrBayesPrint (" For the dirichlet, you can specify either a single number \n"); |
---|
10880 | MrBayesPrint (" or as many numbers as there are states. If you specify a \n"); |
---|
10881 | MrBayesPrint (" single number, then the prior has all states equally \n"); |
---|
10882 | MrBayesPrint (" probable with a variance related to the single parameter \n"); |
---|
10883 | MrBayesPrint (" passed in. \n"); |
---|
10884 | MrBayesPrint (" Shapepr -- This parameter specifies the prior for the gamma shape \n"); |
---|
10885 | MrBayesPrint (" parameter for among-site rate variation. The options are: \n"); |
---|
10886 | MrBayesPrint (" \n"); |
---|
10887 | MrBayesPrint (" prset shapepr = uniform(<number>,<number>) \n"); |
---|
10888 | MrBayesPrint (" prset shapepr = exponential(<number>) \n"); |
---|
10889 | MrBayesPrint (" prset shapepr = fixed(<number>) \n"); |
---|
10890 | MrBayesPrint (" \n"); |
---|
10891 | MrBayesPrint (" Pinvarpr -- This parameter specifies the prior for the proportion of \n"); |
---|
10892 | MrBayesPrint (" invariable sites. The options are: \n"); |
---|
10893 | MrBayesPrint (" \n"); |
---|
10894 | MrBayesPrint (" prset pinvarpr = uniform(<number>,<number>) \n"); |
---|
10895 | MrBayesPrint (" prset pinvarpr = fixed(<number>) \n"); |
---|
10896 | MrBayesPrint (" \n"); |
---|
10897 | MrBayesPrint (" Note that the valid range for the parameter is between 0 \n"); |
---|
10898 | MrBayesPrint (" and 1. Hence, \"prset pinvarpr=uniform(0,0.8)\" is valid \n"); |
---|
10899 | MrBayesPrint (" while \"prset pinvarpr=uniform(0,10)\" is not. The def- \n"); |
---|
10900 | MrBayesPrint (" ault setting is \"prset pinvarpr=uniform(0,1)\". \n"); |
---|
10901 | MrBayesPrint (" Ratecorrpr -- This parameter specifies the prior for the autocorrelation \n"); |
---|
10902 | MrBayesPrint (" parameter of the autocorrelated gamma distribution for \n"); |
---|
10903 | MrBayesPrint (" among-site rate variation. The options are: \n"); |
---|
10904 | MrBayesPrint (" \n"); |
---|
10905 | MrBayesPrint (" prset ratecorrpr = uniform(<number>,<number>) \n"); |
---|
10906 | MrBayesPrint (" prset ratecorrpr = fixed(<number>) \n"); |
---|
10907 | MrBayesPrint (" \n"); |
---|
10908 | MrBayesPrint (" Note that the valid range for the parameter is between -1 \n"); |
---|
10909 | MrBayesPrint (" and 1. Hence, \"prset ratecorrpr=uniform(-1,1)\" is valid \n"); |
---|
10910 | MrBayesPrint (" while \"prset ratecorrpr=uniform(-11,10)\" is not. The \n"); |
---|
10911 | MrBayesPrint (" default setting is \"prset ratecorrpr=uniform(-1,1)\". \n"); |
---|
10912 | MrBayesPrint (" Covswitchpr -- This option sets the prior for the covarion switching \n"); |
---|
10913 | MrBayesPrint (" rates. The options are: \n"); |
---|
10914 | MrBayesPrint (" \n"); |
---|
10915 | MrBayesPrint (" prset covswitchpr = uniform(<number>,<number>) \n"); |
---|
10916 | MrBayesPrint (" prset covswitchpr = exponential(<number>) \n"); |
---|
10917 | MrBayesPrint (" prset covswitchpr = fixed(<number>,<number>) \n"); |
---|
10918 | MrBayesPrint (" \n"); |
---|
10919 | MrBayesPrint (" The covarion model has two rates: a rate from on to off \n"); |
---|
10920 | MrBayesPrint (" and a rate from off to on. The rates are assumed to have \n"); |
---|
10921 | MrBayesPrint (" independent priors that individually are either uniformly \n"); |
---|
10922 | MrBayesPrint (" or exponentially distributed. The other option is to \n"); |
---|
10923 | MrBayesPrint (" fix the switching rates, in which case you must specify \n"); |
---|
10924 | MrBayesPrint (" both rates. (The first number is off->on and the second \n"); |
---|
10925 | MrBayesPrint (" is on->off). \n"); |
---|
10926 | MrBayesPrint (" Symdirihyperpr - This option sets the prior for the stationary frequencies \n"); |
---|
10927 | MrBayesPrint (" of the states for morphological (standard) data. There can \n"); |
---|
10928 | MrBayesPrint (" be as many as 10 states for standard data. However, the \n"); |
---|
10929 | MrBayesPrint (" labelling of the states is somewhat arbitrary. For example, \n"); |
---|
10930 | MrBayesPrint (" the state \"1\" for different characters does not have the \n"); |
---|
10931 | MrBayesPrint (" same meaning. This is not true for DNA characters, for ex- \n"); |
---|
10932 | MrBayesPrint (" ample, where a \"G\" has the same meaning across characters. \n"); |
---|
10933 | MrBayesPrint (" The fact that the labelling of morphological characters is \n"); |
---|
10934 | MrBayesPrint (" arbitrary makes it difficult to allow unequal character- \n"); |
---|
10935 | MrBayesPrint (" state frequencies. MrBayes gets around this problem by \n"); |
---|
10936 | MrBayesPrint (" assuming that the states have a dirichlet prior, with all \n"); |
---|
10937 | MrBayesPrint (" states having equal frequency. The variation in the diri- \n"); |
---|
10938 | MrBayesPrint (" chlet can be controlled by this parameter--symdirihyperpr. \n"); |
---|
10939 | MrBayesPrint (" Symdirihyperpr specifies the distribution on the variance \n"); |
---|
10940 | MrBayesPrint (" parameter of the dirichlet. The valid options are: \n"); |
---|
10941 | MrBayesPrint (" \n"); |
---|
10942 | MrBayesPrint (" prset Symdirihyperpr = uniform(<number>,<number>) \n"); |
---|
10943 | MrBayesPrint (" prset Symdirihyperpr = exponential(<number>) \n"); |
---|
10944 | MrBayesPrint (" prset Symdirihyperpr = fixed(<number>) \n"); |
---|
10945 | MrBayesPrint (" prset Symdirihyperpr = fixed(infinity) \n"); |
---|
10946 | MrBayesPrint (" \n"); |
---|
10947 | MrBayesPrint (" If \"fixed(infinity)\" is chosen, the dirichlet prior is \n"); |
---|
10948 | MrBayesPrint (" fixed such that all character states have equal frequency. \n"); |
---|
10949 | MrBayesPrint (" Topologypr -- This parameter specifies the prior probabilities of \n"); |
---|
10950 | MrBayesPrint (" phylogenies. The options are: \n"); |
---|
10951 | MrBayesPrint (" \n"); |
---|
10952 | MrBayesPrint (" prset topologypr = uniform \n"); |
---|
10953 | MrBayesPrint (" prset topologypr = speciestree \n"); |
---|
10954 | MrBayesPrint (" prset topologypr = constraints(<list>) \n"); |
---|
10955 | MrBayesPrint (" prset topologypr = fixed(<treename>) \n"); |
---|
10956 | MrBayesPrint (" \n"); |
---|
10957 | MrBayesPrint (" If the prior is selected to be \"uniform\", the default, \n"); |
---|
10958 | MrBayesPrint (" then all possible trees are considered a priori equally \n"); |
---|
10959 | MrBayesPrint (" probable. The 'speciestree' option is used when the topology \n"); |
---|
10960 | MrBayesPrint (" is constrained to fold inside a species tree together with \n"); |
---|
10961 | MrBayesPrint (" other (gene) trees. The constraints option allows you to \n"); |
---|
10962 | MrBayesPrint (" specify complicated prior probabilities on trees (constraints\n"); |
---|
10963 | MrBayesPrint (" are discussed more fully in \"help constraint\"). Note that \n"); |
---|
10964 | MrBayesPrint (" you must specify a list of constraints that you wish to be \n"); |
---|
10965 | MrBayesPrint (" obeyed. The list can be either the constraints' name or \n"); |
---|
10966 | MrBayesPrint (" number. Finally, you can fix the topology to that of a user \n"); |
---|
10967 | MrBayesPrint (" tree defined in a trees block. Branch lengths will still be \n"); |
---|
10968 | MrBayesPrint (" sampled as usual on the fixed topology. \n"); |
---|
10969 | MrBayesPrint (" Brlenspr -- This parameter specifies the prior probability dist- \n"); |
---|
10970 | MrBayesPrint (" ribution on branch lengths. The options are: \n"); |
---|
10971 | MrBayesPrint (" \n"); |
---|
10972 | MrBayesPrint (" prset brlenspr = unconstrained:uniform(<num>,<num>) \n"); |
---|
10973 | MrBayesPrint (" prset brlenspr = unconstrained:exponential(<number>) \n"); |
---|
10974 | MrBayesPrint (" prset brlenspr = clock:uniform \n"); |
---|
10975 | MrBayesPrint (" prset brlenspr = clock:birthdeath \n"); |
---|
10976 | MrBayesPrint (" prset brlenspr = clock:coalescence \n"); |
---|
10977 | MrBayesPrint (" prset brlenspr = clock:speciestreecoalescence \n"); |
---|
10978 | MrBayesPrint (" prset brlenspr = fixed(<treename>) \n"); |
---|
10979 | MrBayesPrint (" \n"); |
---|
10980 | MrBayesPrint (" Trees with unconstrained branch lengths are unrooted \n"); |
---|
10981 | MrBayesPrint (" whereas clock-constrained trees are rooted. The option \n"); |
---|
10982 | MrBayesPrint (" after the colon specifies the details of the probability \n"); |
---|
10983 | MrBayesPrint (" density of branch lengths. If you choose a birth-death \n"); |
---|
10984 | MrBayesPrint (" or coalescence prior, you may want to modify the details \n"); |
---|
10985 | MrBayesPrint (" of the parameters of those processes (speciation rate, \n"); |
---|
10986 | MrBayesPrint (" extinction rate and sample probability for the birth-death \n"); |
---|
10987 | MrBayesPrint (" prior; population size and clock rate parameter for the \n"); |
---|
10988 | MrBayesPrint (" coalescence prior). When gene trees are constrained to fold \n"); |
---|
10989 | MrBayesPrint (" inside species trees, the appropriate branch length prior is \n"); |
---|
10990 | MrBayesPrint (" 'clock:speciestreecoalescence'. Under this model, it is poss-\n"); |
---|
10991 | MrBayesPrint (" ible to control whether the population size is constant or \n"); |
---|
10992 | MrBayesPrint (" varies across the species tree using the 'popvarpr' setting. \n"); |
---|
10993 | MrBayesPrint (" Branch lengths can also be fixed but only if the topology is \n"); |
---|
10994 | MrBayesPrint (" fixed. \n"); |
---|
10995 | MrBayesPrint (" Treeagepr -- This parameter specifies the prior probability distribution \n"); |
---|
10996 | MrBayesPrint (" on the tree age when a uniform prior is used on the branch \n"); |
---|
10997 | MrBayesPrint (" lengths of a clock tree. \n"); |
---|
10998 | MrBayesPrint (" \n"); |
---|
10999 | MrBayesPrint (" The options are: \n"); |
---|
11000 | MrBayesPrint (" \n"); |
---|
11001 | MrBayesPrint (" prset treeagepr = Gamma(<num>,<num>) \n"); |
---|
11002 | MrBayesPrint (" prset treeagepr = Exponential(<number>) \n"); |
---|
11003 | MrBayesPrint (" prset treeagepr = Fixed(<number>) \n"); |
---|
11004 | MrBayesPrint (" \n"); |
---|
11005 | MrBayesPrint (" (And, yes, we know the exponential is a special case of the \n"); |
---|
11006 | MrBayesPrint (" gamma distribution.) The tree age is simply the age of the \n"); |
---|
11007 | MrBayesPrint (" most recent common ancestor of the tree. If the clock rate \n"); |
---|
11008 | MrBayesPrint (" is fixed to 1.0, which is the default, the tree age is equi- \n"); |
---|
11009 | MrBayesPrint (" valent to the expected number of substitutions from the root \n"); |
---|
11010 | MrBayesPrint (" to the tip of the tree. The tree age prior ensures that the \n"); |
---|
11011 | MrBayesPrint (" joint prior probability distribution for the uniform prior \n"); |
---|
11012 | MrBayesPrint (" model of branch lengths on a clock tree is proper. The de- \n"); |
---|
11013 | MrBayesPrint (" fault setting is 'Exponential(1)'. If the root node in the \n"); |
---|
11014 | MrBayesPrint (" tree is calibrated, the root calibration replaces the tree \n"); |
---|
11015 | MrBayesPrint (" age prior. \n"); |
---|
11016 | MrBayesPrint (" Speciationpr -- This parameter sets the prior on the net speciation rate, \n"); |
---|
11017 | MrBayesPrint (" that is, lambda - mu in the birth-death model. Options are: \n"); |
---|
11018 | MrBayesPrint (" \n"); |
---|
11019 | MrBayesPrint (" prset speciationpr = uniform(<number>,<number>) \n"); |
---|
11020 | MrBayesPrint (" prset speciationpr = exponential(<number>) \n"); |
---|
11021 | MrBayesPrint (" prset speciationpr = fixed(<number>) \n"); |
---|
11022 | MrBayesPrint (" \n"); |
---|
11023 | MrBayesPrint (" This parameter is only relevant if the birth-death \n"); |
---|
11024 | MrBayesPrint (" process is selected as the prior on branch lengths. \n"); |
---|
11025 | MrBayesPrint (" Extinctionpr -- This parameter sets the prior on the relative extinction \n"); |
---|
11026 | MrBayesPrint (" rate, that is, mu / lambda in the birth-death model; values \n"); |
---|
11027 | MrBayesPrint (" of this parameter are in the range (0,1). Prior options are: \n"); |
---|
11028 | MrBayesPrint (" \n"); |
---|
11029 | MrBayesPrint (" prset extinctionpr = beta(<number>,<number>) \n"); |
---|
11030 | MrBayesPrint (" prset extinctionpr = fixed(<number>) \n"); |
---|
11031 | MrBayesPrint (" \n"); |
---|
11032 | MrBayesPrint (" This parameter is only relevant if the birth-death \n"); |
---|
11033 | MrBayesPrint (" process is selected as the prior on branch lengths. \n"); |
---|
11034 | MrBayesPrint (" SampleStrat -- This parameter sets the strategy under which species \n"); |
---|
11035 | MrBayesPrint (" where sampled in the analysis. This is used with the \n"); |
---|
11036 | MrBayesPrint (" birth-death prior on trees (see Höhna et al, 2011). \n"); |
---|
11037 | MrBayesPrint (" Sampleprob -- This parameter sets the fraction of species that are \n"); |
---|
11038 | MrBayesPrint (" sampled in the analysis. This is used with the birth- \n"); |
---|
11039 | MrBayesPrint (" death prior on trees (see Yang and Rannala, 1997). \n"); |
---|
11040 | MrBayesPrint (" Popsizepr -- This parameter sets the prior on the population size compo- \n"); |
---|
11041 | MrBayesPrint (" nent of the coalescent parameter. The options are: \n"); |
---|
11042 | MrBayesPrint (" \n"); |
---|
11043 | MrBayesPrint (" prset popsizepr = uniform(<number>,<number>) \n"); |
---|
11044 | MrBayesPrint (" prset popsizepr = exponential(<number>) \n"); |
---|
11045 | MrBayesPrint (" prset popsizepr = fixed(<number>) \n"); |
---|
11046 | MrBayesPrint (" \n"); |
---|
11047 | MrBayesPrint (" This parameter is only relevant if the coalescence process is\n"); |
---|
11048 | MrBayesPrint (" selected as the prior on branch lengths. Note that the set- \n"); |
---|
11049 | MrBayesPrint (" ting of 'ploidy' in 'lset' is important for how this para- \n"); |
---|
11050 | MrBayesPrint (" meter is interpreted. \n"); |
---|
11051 | MrBayesPrint (" Popvarpr -- In a gene tree - species tree model, this parameter deter- \n"); |
---|
11052 | MrBayesPrint (" mines whether the population size is the same for the entire \n"); |
---|
11053 | MrBayesPrint (" species tree ('popvarpr = equal', the default), or varies \n"); |
---|
11054 | MrBayesPrint (" across branches of the species tree ('popvarpr=variable'). \n"); |
---|
11055 | /* MrBayesPrint (" Growthpr -- This parameter sets the prior on the exponential growth \n"); |
---|
11056 | MrBayesPrint (" parameter of the coalescence process. The options are: \n"); |
---|
11057 | MrBayesPrint (" \n"); |
---|
11058 | MrBayesPrint (" prset growthpr = uniform(<number>,<number>) \n"); |
---|
11059 | MrBayesPrint (" prset growthpr = exponential(<number>) \n"); |
---|
11060 | MrBayesPrint (" prset growthpr = fixed(<number>) \n"); |
---|
11061 | MrBayesPrint (" \n"); |
---|
11062 | MrBayesPrint (" This parameter is only relevant if the coalescence \n"); |
---|
11063 | MrBayesPrint (" process is selected as the prior on branch lengths. \n");*/ |
---|
11064 | MrBayesPrint (" Nodeagepr -- This parameter specifies the assumptions concerning the age \n"); |
---|
11065 | MrBayesPrint (" of the terminal and interior nodes in the tree. The default \n"); |
---|
11066 | MrBayesPrint (" model ('nodeagepr = unconstrained') assumes that all terminal\n"); |
---|
11067 | MrBayesPrint (" nodes are of the same age while the age of interior nodes is \n"); |
---|
11068 | MrBayesPrint (" unconstrained. The alternative ('nodeagepr = calibrated') \n"); |
---|
11069 | MrBayesPrint (" option derives a prior probability distribution on terminal \n"); |
---|
11070 | MrBayesPrint (" and interior node ages from the calibration settings (see \n"); |
---|
11071 | MrBayesPrint (" the 'calibrate' command). The 'nodeagepr' parameter is only \n"); |
---|
11072 | MrBayesPrint (" relevant for clock trees. \n"); |
---|
11073 | MrBayesPrint (" Clockratepr -- This parameter specifies the prior assumptions concerning the\n"); |
---|
11074 | MrBayesPrint (" base substitution rate of the tree, measured in expected num-\n"); |
---|
11075 | MrBayesPrint (" ber of substitutions per site per time unit. The default set-\n"); |
---|
11076 | MrBayesPrint (" ting is 'Fixed(1.0)', which effectively means that the time \n"); |
---|
11077 | MrBayesPrint (" unit is the number of expected substitutions per site. If you\n"); |
---|
11078 | MrBayesPrint (" apply age constraints to the tree, the default setting chan- \n"); |
---|
11079 | MrBayesPrint (" ges automatically to 'Exponential(<x>)', where '<x>' is set \n"); |
---|
11080 | MrBayesPrint (" such that the expectation of the exponential is ten times the\n"); |
---|
11081 | MrBayesPrint (" age of the maximum age constraint. This will give you a very \n"); |
---|
11082 | MrBayesPrint (" vague prior, which may or may not be adequate for your parti-\n"); |
---|
11083 | MrBayesPrint (" cular problem. \n"); |
---|
11084 | MrBayesPrint (" \n"); |
---|
11085 | MrBayesPrint (" If you do not have any age calibrations in the tree, you can \n"); |
---|
11086 | MrBayesPrint (" still calibrate the tree using 'Clockratepr'. For instance, \n"); |
---|
11087 | MrBayesPrint (" if you know that your sequence data evolve at a rate of 0.20 \n"); |
---|
11088 | MrBayesPrint (" substitutions per million years, you might calibrate the tree\n"); |
---|
11089 | MrBayesPrint (" by fixing the substitution rate to 0.20 using \n"); |
---|
11090 | MrBayesPrint (" \n"); |
---|
11091 | MrBayesPrint (" prset clockratepr = fixed(0.20) \n"); |
---|
11092 | MrBayesPrint (" \n"); |
---|
11093 | MrBayesPrint (" after which the tree will be calibrated using millions of \n"); |
---|
11094 | MrBayesPrint (" years as the unit. \n"); |
---|
11095 | MrBayesPrint (" \n"); |
---|
11096 | MrBayesPrint (" You can also assign a prior probability distribution to the \n"); |
---|
11097 | MrBayesPrint (" substitution rate, accommodating the uncertainty about its \n"); |
---|
11098 | MrBayesPrint (" value. You can choose between normal, lognormal, exponential \n"); |
---|
11099 | MrBayesPrint (" and gamma distributions for this purpose. For instance, if \n"); |
---|
11100 | MrBayesPrint (" you would like to associate the substitution rate with a \n"); |
---|
11101 | MrBayesPrint (" normal distribution truncated at 0, so that only positive \n"); |
---|
11102 | MrBayesPrint (" values are allowed, and with mean 0.20 and standard deviation\n"); |
---|
11103 | MrBayesPrint (" of 0.02, you would use \n"); |
---|
11104 | MrBayesPrint (" \n"); |
---|
11105 | MrBayesPrint (" prset clockratepr = normal(0.20,0.02) \n"); |
---|
11106 | MrBayesPrint (" \n"); |
---|
11107 | MrBayesPrint (" The lognormal distribution is parameterized in terms of the \n"); |
---|
11108 | MrBayesPrint (" mean and standard deviation on the log scale (natural logs). \n"); |
---|
11109 | MrBayesPrint (" For instance, \n"); |
---|
11110 | MrBayesPrint (" \n"); |
---|
11111 | MrBayesPrint (" prset clockratepr = lognormal(-1.61,0.10) \n"); |
---|
11112 | MrBayesPrint (" \n"); |
---|
11113 | MrBayesPrint (" specifies a lognormal distribution with a mean of log values \n"); |
---|
11114 | MrBayesPrint (" of -1.61 and a standard deviation of log values of 0.10. In \n"); |
---|
11115 | MrBayesPrint (" such a case, the mean value of the lognormal distribution is \n"); |
---|
11116 | MrBayesPrint (" equal to e^(-1.61 + 0.10^2/2) = 0.20. \n"); |
---|
11117 | MrBayesPrint (" \n"); |
---|
11118 | MrBayesPrint (" Note that the 'Clockratepr' parameter has no effect on non- \n"); |
---|
11119 | MrBayesPrint (" clock trees. \n"); |
---|
11120 | MrBayesPrint (" Clockvarpr -- This parameter allows you to specify the type of clock you \n"); |
---|
11121 | MrBayesPrint (" are assuming. The default is 'strict', which corresponds to \n"); |
---|
11122 | MrBayesPrint (" the standard clock model where the evolutionary rate is \n"); |
---|
11123 | MrBayesPrint (" constant throughout the tree. You can also use 'cpp', which \n"); |
---|
11124 | MrBayesPrint (" invokes a relaxed clock model where the rate evolves \n"); |
---|
11125 | MrBayesPrint (" according to a Compound Poisson Process (CPP) model (see \n"); |
---|
11126 | MrBayesPrint (" Huelsenbeck et al., 2000) or 'tk02', which invokes the \n"); |
---|
11127 | MrBayesPrint (" Brownian Motion (TK02) model described by Thorne and Kishino \n"); |
---|
11128 | MrBayesPrint (" (2002). Finally, you can use a model where each branch has an\n"); |
---|
11129 | MrBayesPrint (" independent rate drawn from a scaled gamma distribution, such\n"); |
---|
11130 | MrBayesPrint (" that there is a specified variance in the effective height of\n"); |
---|
11131 | MrBayesPrint (" the tree in the prior, the Independent Gamma Rate (IGR) \n"); |
---|
11132 | MrBayesPrint (" model (LePage et al., 2007). Each of the relaxed clock models\n"); |
---|
11133 | MrBayesPrint (" has additional parameters with priors. For the CPP model, it \n"); |
---|
11134 | MrBayesPrint (" is 'cppratepr' and 'cppmultdevpr'; for the TK02 model, it is \n"); |
---|
11135 | MrBayesPrint (" 'tk02varpr'; for the IGR model, it is 'igrvarpr'. The \n"); |
---|
11136 | MrBayesPrint (" 'clockvarpr' parameter is only relevant for clock trees. \n"); |
---|
11137 | MrBayesPrint (" \n"); |
---|
11138 | MrBayesPrint (" For backward compatibility, 'bm' is allowed as a synonym of \n"); |
---|
11139 | MrBayesPrint (" 'tk02', and 'ibr' as a synonym of 'igr'. \n"); |
---|
11140 | MrBayesPrint (" Cppratepr -- This parameter allows you to specify a prior probability \n"); |
---|
11141 | MrBayesPrint (" distribution on the rate of the Poisson process generating \n"); |
---|
11142 | MrBayesPrint (" changes in the evolutionary rate in the CPP relaxed clock \n"); |
---|
11143 | MrBayesPrint (" model. You can either fix the rate or associate it with an \n"); |
---|
11144 | MrBayesPrint (" exponential prior using \n"); |
---|
11145 | MrBayesPrint (" \n"); |
---|
11146 | MrBayesPrint (" prset cppratepr = fixed(<number>) \n"); |
---|
11147 | MrBayesPrint (" prset cppratepr = exponential(<number>) \n"); |
---|
11148 | MrBayesPrint (" \n"); |
---|
11149 | MrBayesPrint (" For instance, if you fix the rate to 2, then on a branch \n"); |
---|
11150 | MrBayesPrint (" with the length equual to one expresed in terms of average \n"); |
---|
11151 | MrBayesPrint (" expected number of substitution per site, you expect to see, \n"); |
---|
11152 | MrBayesPrint (" on average, two rate-modifying events. \n"); |
---|
11153 | MrBayesPrint (" If you put an exponential(0.1) on the rate, you will be \n"); |
---|
11154 | MrBayesPrint (" estimating the rate against a prior probability distribution \n"); |
---|
11155 | MrBayesPrint (" where the expected rate is 10 (= 1/0.1). \n"); |
---|
11156 | MrBayesPrint (" Cppmultdevpr -- This parameter allows you to specify the standard deviation \n"); |
---|
11157 | MrBayesPrint (" of the log-normal distribution from which the rate multi- \n"); |
---|
11158 | MrBayesPrint (" pliers of the CPP relaxed clock model are drawn. The standard\n"); |
---|
11159 | MrBayesPrint (" deviation is given on the log scale. The default value of 1.0\n"); |
---|
11160 | MrBayesPrint (" thus corresponds to rate multipliers varying from 0.37 (1/e) \n"); |
---|
11161 | MrBayesPrint (" to 2.7 (e) when they are +/- one standard deviation from the \n"); |
---|
11162 | MrBayesPrint (" expected mean. The expected mean of the logarithm of the mul-\n"); |
---|
11163 | MrBayesPrint (" pliers is fixed to 0, ensuring that the expected mean rate is\n"); |
---|
11164 | MrBayesPrint (" 1.0. You can change the default value by using \n"); |
---|
11165 | MrBayesPrint (" \n"); |
---|
11166 | MrBayesPrint (" prset cppmultdevpr = fixed(<number>) \n"); |
---|
11167 | MrBayesPrint (" \n"); |
---|
11168 | MrBayesPrint (" where <number> is the standard deviation on the log scale. \n"); |
---|
11169 | MrBayesPrint (" TK02varpr -- This parameter allows you to specify the prior probability \n"); |
---|
11170 | MrBayesPrint (" distribution for the variance of the rate multiplier in the \n"); |
---|
11171 | MrBayesPrint (" Thorne-Kishino ('Brownian motion') relaxed clock model. \n"); |
---|
11172 | MrBayesPrint (" Specifically, the parameter specifies the rate at which the \n"); |
---|
11173 | MrBayesPrint (" variance increases with respect to the base rate of the \n"); |
---|
11174 | MrBayesPrint (" clock. If you have a branch of a length corresponding to 0.4 \n"); |
---|
11175 | MrBayesPrint (" expected changes per site according to the base rate of the \n"); |
---|
11176 | MrBayesPrint (" clock, and the tk02var parameter has a value of 2.0, then the\n"); |
---|
11177 | MrBayesPrint (" rate multiplier at the end of the branch will be drawn from a\n"); |
---|
11178 | MrBayesPrint (" lognormal distribution with a variance of 0.4*2.0 (on the \n"); |
---|
11179 | MrBayesPrint (" linear, not the logarithm scale). The mean is the same as the\n"); |
---|
11180 | MrBayesPrint (" rate multiplier at the start of the branch (again on the \n"); |
---|
11181 | MrBayesPrint (" linear scale). \n"); |
---|
11182 | MrBayesPrint (" \n"); |
---|
11183 | MrBayesPrint (" You can set the parameter to a fixed value, or specify that \n"); |
---|
11184 | MrBayesPrint (" it is drawn from an exponential or uniform distribution: \n"); |
---|
11185 | MrBayesPrint (" \n"); |
---|
11186 | MrBayesPrint (" prset tk02varpr = fixed(<number>) \n"); |
---|
11187 | MrBayesPrint (" prset tk02varpr = exponential(<number>) \n"); |
---|
11188 | MrBayesPrint (" prset tk02varpr = uniform(<number>,<number>) \n"); |
---|
11189 | MrBayesPrint (" \n"); |
---|
11190 | MrBayesPrint (" For backward compatibility, 'bmvarpr' is allowed as a synonym\n"); |
---|
11191 | MrBayesPrint (" of 'tko2varpr'. \n"); |
---|
11192 | MrBayesPrint (" Igrvarpr -- This parameter allows you to specify a prior on the variance \n"); |
---|
11193 | MrBayesPrint (" of the gamma distribution from which the branch lengths are \n"); |
---|
11194 | MrBayesPrint (" drawn in the independent branch rate (IGR) relaxed clock \n"); |
---|
11195 | MrBayesPrint (" model. Specifically, the parameter specifies the rate at \n"); |
---|
11196 | MrBayesPrint (" which the variance increases with respect to the base rate of\n"); |
---|
11197 | MrBayesPrint (" the clock. If you have a branch of a length corresponding to \n"); |
---|
11198 | MrBayesPrint (" 0.4 expected changes per site according to the base rate of \n"); |
---|
11199 | MrBayesPrint (" the clock, and the igrvar parameter has a value of 2.0, then \n"); |
---|
11200 | MrBayesPrint (" the effective branch length will be drawn from a distribution\n"); |
---|
11201 | MrBayesPrint (" with a variance of 0.4*2.0. \n"); |
---|
11202 | MrBayesPrint (" \n"); |
---|
11203 | MrBayesPrint (" You can set the parameter to a fixed value, or specify that \n"); |
---|
11204 | MrBayesPrint (" it is drawn from an exponential or uniform distribution: \n"); |
---|
11205 | MrBayesPrint (" \n"); |
---|
11206 | MrBayesPrint (" prset igrvarpr = fixed(<number>) \n"); |
---|
11207 | MrBayesPrint (" prset igrvarpr = exponential(<number>) \n"); |
---|
11208 | MrBayesPrint (" prset igrvarpr = uniform(<number>,<number>) \n"); |
---|
11209 | MrBayesPrint (" \n"); |
---|
11210 | MrBayesPrint (" For backward compatibility, 'ibrvarpr' is allowed as a syn- \n"); |
---|
11211 | MrBayesPrint (" onym of 'igrvarpr'. \n"); |
---|
11212 | MrBayesPrint (" Ratepr -- This parameter allows you to specify the site specific rates \n"); |
---|
11213 | MrBayesPrint (" model or any other model that allows different partitions to \n"); |
---|
11214 | MrBayesPrint (" evolve at different rates. First, you must have defined a \n"); |
---|
11215 | MrBayesPrint (" partition of the characters. For example, you may define a \n"); |
---|
11216 | MrBayesPrint (" partition that divides the characters by codon position, if \n"); |
---|
11217 | MrBayesPrint (" you have DNA data. You can also divide your data using a \n"); |
---|
11218 | MrBayesPrint (" partition that separates different genes from each other. \n"); |
---|
11219 | MrBayesPrint (" The next step is to make the desired partition the active one\n"); |
---|
11220 | MrBayesPrint (" using the set command. For example, if your partition is \n"); |
---|
11221 | MrBayesPrint (" called \"by_codon\", then you make that the active partition \n"); |
---|
11222 | MrBayesPrint (" using \"set partition=by_codon\". Now that you have defined \n"); |
---|
11223 | MrBayesPrint (" and activated a partition, you can specify the rate multi- \n"); |
---|
11224 | MrBayesPrint (" pliers for the various partitions. The options are: \n"); |
---|
11225 | MrBayesPrint (" \n"); |
---|
11226 | MrBayesPrint (" prset ratepr = fixed \n"); |
---|
11227 | MrBayesPrint (" prset ratepr = variable \n"); |
---|
11228 | MrBayesPrint (" prset ratepr = dirichlet(<number>,<number>,...,<number>) \n"); |
---|
11229 | MrBayesPrint (" \n"); |
---|
11230 | MrBayesPrint (" If you specify \"fixed\", then the rate multiplier for \n"); |
---|
11231 | MrBayesPrint (" that partition is set to 1 (i.e., the rate is fixed to \n"); |
---|
11232 | MrBayesPrint (" the average rate across partitions). On the other hand, \n"); |
---|
11233 | MrBayesPrint (" if you specify \"variable\", then the rate is allowed to \n"); |
---|
11234 | MrBayesPrint (" vary across partitions subject to the constraint that the \n"); |
---|
11235 | MrBayesPrint (" average rate of substitution across the partitions is 1. \n"); |
---|
11236 | MrBayesPrint (" You must specify a variable rate prior for at least two \n"); |
---|
11237 | MrBayesPrint (" partitions, otherwise the option is not activated when \n"); |
---|
11238 | MrBayesPrint (" calculating likelihoods. The variable option automatically \n"); |
---|
11239 | MrBayesPrint (" associates the partition rates with a dirichlet(1,...,1) \n"); |
---|
11240 | MrBayesPrint (" prior. The dirichlet option is an alternative way of setting \n"); |
---|
11241 | MrBayesPrint (" a partition rate to be variable, and also gives accurate \n"); |
---|
11242 | MrBayesPrint (" control of the shape of the prior. The parameters of the \n"); |
---|
11243 | MrBayesPrint (" Dirichlet are listed in the order of the partitions that the \n"); |
---|
11244 | MrBayesPrint (" ratepr is applied to. For instance, \"prset applyto=(1,3,4) \n"); |
---|
11245 | MrBayesPrint (" ratepr = dirichlet(10,40,15)\" would set the Dirichlet para- \n"); |
---|
11246 | MrBayesPrint (" meter 10 to partition 1, 40 to partition 3, and 15 to parti- \n"); |
---|
11247 | MrBayesPrint (" tion 4. The Dirichlet distribution is applied to the weighted\n"); |
---|
11248 | MrBayesPrint (" rates; that is, it weights the partition rates according to \n"); |
---|
11249 | MrBayesPrint (" the number of included characters in each partition. \n"); |
---|
11250 | MrBayesPrint (" \n"); |
---|
11251 | if (numCurrentDivisions == 0) |
---|
11252 | tempInt = 1; |
---|
11253 | else |
---|
11254 | tempInt = numCurrentDivisions; |
---|
11255 | for (i=0; i<tempInt; i++) |
---|
11256 | { |
---|
11257 | if (numCurrentDivisions == 0) |
---|
11258 | { |
---|
11259 | MrBayesPrint (" Default model settings: \n"); |
---|
11260 | mp = &defaultModel; |
---|
11261 | } |
---|
11262 | else |
---|
11263 | { |
---|
11264 | MrBayesPrint (" Model settings for partition %d: \n", i+1); |
---|
11265 | mp = &modelParams[i]; |
---|
11266 | } |
---|
11267 | MrBayesPrint (" \n"); |
---|
11268 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
11269 | MrBayesPrint (" ------------------------------------------------------------------ \n"); |
---|
11270 | |
---|
11271 | MrBayesPrint (" Tratiopr Beta/Fixed %s", mp->tRatioPr); |
---|
11272 | if (!strcmp(mp->tRatioPr, "Beta")) |
---|
11273 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->tRatioDir[0], mp->tRatioDir[1]); |
---|
11274 | else |
---|
11275 | MrBayesPrint ("(%1.1lf)\n", mp->tRatioFix); |
---|
11276 | |
---|
11277 | MrBayesPrint (" Revmatpr Dirichlet/Fixed %s", mp->revMatPr); |
---|
11278 | if (!strcmp(mp->revMatPr, "Dirichlet")) |
---|
11279 | MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->revMatDir[0], |
---|
11280 | mp->revMatDir[1], mp->revMatDir[2], mp->revMatDir[3], |
---|
11281 | mp->revMatDir[4], mp->revMatDir[5]); |
---|
11282 | else |
---|
11283 | MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->revMatFix[0], |
---|
11284 | mp->revMatFix[1], mp->revMatFix[2], mp->revMatFix[3], |
---|
11285 | mp->revMatFix[4], mp->revMatFix[5]); |
---|
11286 | |
---|
11287 | MrBayesPrint (" Aamodelpr Fixed/Mixed %s", mp->aaModelPr); |
---|
11288 | if (!strcmp(mp->aaModelPr, "Fixed")) |
---|
11289 | MrBayesPrint ("(%s)\n", mp->aaModel); |
---|
11290 | else |
---|
11291 | MrBayesPrint ("\n"); |
---|
11292 | |
---|
11293 | MrBayesPrint (" Aarevmatpr Dirichlet/Fixed %s", mp->aaRevMatPr); |
---|
11294 | if (!strcmp(mp->revMatPr, "Dirichlet")) |
---|
11295 | { |
---|
11296 | for (j=1; j<190; j++) |
---|
11297 | if (AreDoublesEqual (mp->aaRevMatDir[0], mp->aaRevMatDir[j], 0.00001) == NO) |
---|
11298 | break; |
---|
11299 | if (j==190) |
---|
11300 | MrBayesPrint ("(%1.1lf,%1.1lf,...)\n", mp->revMatDir[0], mp->revMatDir[0]); |
---|
11301 | else |
---|
11302 | MrBayesPrint (" (use 'Showmodel' to see values set by user)\n"); |
---|
11303 | } |
---|
11304 | else |
---|
11305 | { |
---|
11306 | for (j=1; j<190; j++) |
---|
11307 | if (AreDoublesEqual (mp->aaRevMatFix[0], mp->aaRevMatFix[j], 0.00001) == NO) |
---|
11308 | break; |
---|
11309 | if (j==190) |
---|
11310 | MrBayesPrint ("(%1.1lf,%1.1lf,...)\n", mp->revMatFix[0], mp->revMatFix[0]); |
---|
11311 | else |
---|
11312 | MrBayesPrint (" (use 'Showmodel' to see values set by user)\n"); |
---|
11313 | } |
---|
11314 | |
---|
11315 | MrBayesPrint (" Omegapr Dirichlet/Fixed %s", mp->omegaPr); |
---|
11316 | if (!strcmp(mp->omegaPr, "Dirichlet")) |
---|
11317 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->omegaDir[0], mp->omegaDir[1]); |
---|
11318 | else |
---|
11319 | MrBayesPrint ("(%1.1lf)\n", mp->omegaFix); |
---|
11320 | |
---|
11321 | MrBayesPrint (" Ny98omega1pr Beta/Fixed %s", mp->ny98omega1pr); |
---|
11322 | if (!strcmp(mp->ny98omega1pr, "Beta")) |
---|
11323 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->ny98omega1Beta[0], mp->ny98omega1Beta[1]); |
---|
11324 | else if (!strcmp(mp->ny98omega1pr, "Fixed")) |
---|
11325 | MrBayesPrint ("(%1.1lf)\n", mp->ny98omega1Fixed); |
---|
11326 | |
---|
11327 | MrBayesPrint (" Ny98omega3pr Uniform/Exponential/Fixed %s", mp->ny98omega3pr); |
---|
11328 | if (!strcmp(mp->ny98omega3pr, "Uniform")) |
---|
11329 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->ny98omega3Uni[0], mp->ny98omega3Uni[1]); |
---|
11330 | else if (!strcmp(mp->ny98omega3pr, "Exponential")) |
---|
11331 | MrBayesPrint ("(%1.1lf)\n", mp->ny98omega3Exp); |
---|
11332 | else |
---|
11333 | MrBayesPrint ("(%1.1lf)\n", mp->ny98omega3Fixed); |
---|
11334 | |
---|
11335 | MrBayesPrint (" M3omegapr Exponential/Fixed %s", mp->m3omegapr); |
---|
11336 | if (!strcmp(mp->m3omegapr, "Exponential")) |
---|
11337 | MrBayesPrint ("\n"); |
---|
11338 | else if (!strcmp(mp->m3omegapr, "Fixed")) |
---|
11339 | MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->m3omegaFixed[0], mp->m3omegaFixed[1], mp->m3omegaFixed[2]); |
---|
11340 | |
---|
11341 | MrBayesPrint (" Codoncatfreqs Dirichlet/Fixed %s", mp->codonCatFreqPr); |
---|
11342 | if (!strcmp(mp->codonCatFreqPr, "Dirichlet")) |
---|
11343 | MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->codonCatDir[0], mp->codonCatDir[1], mp->codonCatDir[2]); |
---|
11344 | else |
---|
11345 | MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->codonCatFreqFix[0], mp->codonCatFreqFix[1], mp->codonCatFreqFix[2]); |
---|
11346 | |
---|
11347 | MrBayesPrint (" Statefreqpr Dirichlet/Fixed %s", mp->stateFreqPr); |
---|
11348 | if (!strcmp(mp->stateFreqPr, "Dirichlet")) |
---|
11349 | { |
---|
11350 | if (mp->dataType == DNA || mp->dataType == RNA) |
---|
11351 | { |
---|
11352 | if (!strcmp(mp->nucModel, "4by4")) |
---|
11353 | MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->stateFreqsDir[0], mp->stateFreqsDir[1], |
---|
11354 | mp->stateFreqsDir[2], mp->stateFreqsDir[3]); |
---|
11355 | else |
---|
11356 | MrBayesPrint ("\n"); |
---|
11357 | } |
---|
11358 | else if (mp->dataType == RESTRICTION) |
---|
11359 | { |
---|
11360 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->stateFreqsDir[0], mp->stateFreqsDir[1]); |
---|
11361 | } |
---|
11362 | else |
---|
11363 | MrBayesPrint ("\n"); |
---|
11364 | } |
---|
11365 | else if (!strcmp(mp->stateFreqPr, "Fixed")) |
---|
11366 | { |
---|
11367 | if (mp->dataType == DNA || mp->dataType == RNA) |
---|
11368 | { |
---|
11369 | if (!strcmp(mp->nucModel, "4by4")) |
---|
11370 | MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->stateFreqsFix[0], mp->stateFreqsFix[1], |
---|
11371 | mp->stateFreqsFix[2], mp->stateFreqsFix[3]); |
---|
11372 | else |
---|
11373 | MrBayesPrint ("\n"); |
---|
11374 | } |
---|
11375 | else if (mp->dataType == RESTRICTION) |
---|
11376 | { |
---|
11377 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->stateFreqsFix[0], mp->stateFreqsFix[1]); |
---|
11378 | } |
---|
11379 | else |
---|
11380 | MrBayesPrint ("\n"); |
---|
11381 | } |
---|
11382 | |
---|
11383 | MrBayesPrint (" Shapepr Uniform/Exponential/Fixed %s", mp->shapePr); |
---|
11384 | if (!strcmp(mp->shapePr, "Uniform")) |
---|
11385 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->shapeUni[0], mp->shapeUni[1]); |
---|
11386 | else if (!strcmp(mp->shapePr, "Exponential")) |
---|
11387 | MrBayesPrint ("(%1.1lf)\n", mp->shapeExp); |
---|
11388 | else |
---|
11389 | MrBayesPrint ("(%1.1lf)\n", mp->shapeFix); |
---|
11390 | |
---|
11391 | MrBayesPrint (" Ratecorrpr Uniform/Fixed %s", mp->adGammaCorPr); |
---|
11392 | if (!strcmp(mp->adGammaCorPr, "Uniform")) |
---|
11393 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->corrUni[0], mp->corrUni[1]); |
---|
11394 | else |
---|
11395 | MrBayesPrint ("(%1.1lf)\n", mp->corrFix); |
---|
11396 | |
---|
11397 | MrBayesPrint (" Pinvarpr Uniform/Fixed %s", mp->pInvarPr); |
---|
11398 | if (!strcmp(mp->pInvarPr, "Uniform")) |
---|
11399 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->pInvarUni[0], mp->pInvarUni[1]); |
---|
11400 | else |
---|
11401 | MrBayesPrint ("(%1.1lf)\n", mp->pInvarFix); |
---|
11402 | |
---|
11403 | MrBayesPrint (" Covswitchpr Uniform/Exponential/Fixed %s", mp->covSwitchPr); |
---|
11404 | if (!strcmp(mp->covSwitchPr, "Uniform")) |
---|
11405 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->covswitchUni[0], mp->covswitchUni[1]); |
---|
11406 | else if (!strcmp(mp->covSwitchPr, "Exponential")) |
---|
11407 | MrBayesPrint ("(%1.1lf)\n", mp->covswitchExp); |
---|
11408 | else |
---|
11409 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->covswitchFix[0], mp->covswitchFix[1]); |
---|
11410 | |
---|
11411 | MrBayesPrint (" Symdirihyperpr Uniform/Exponential/Fixed %s", mp->symPiPr); |
---|
11412 | if (!strcmp(mp->symPiPr, "Uniform")) |
---|
11413 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->symBetaUni[0], mp->symBetaUni[1]); |
---|
11414 | else if (!strcmp(mp->covSwitchPr, "Exponential")) |
---|
11415 | MrBayesPrint ("(%1.1lf)\n", mp->symBetaExp); |
---|
11416 | else |
---|
11417 | { |
---|
11418 | if (mp->symBetaFix < 0) |
---|
11419 | MrBayesPrint ("(Infinity)\n"); |
---|
11420 | else |
---|
11421 | MrBayesPrint ("(%1.1lf)\n", mp->symBetaFix); |
---|
11422 | } |
---|
11423 | |
---|
11424 | MrBayesPrint (" Topologypr Uniform/Constraints/Fixed %s", mp->topologyPr); |
---|
11425 | if (!strcmp(mp->topologyPr, "Constraints")) |
---|
11426 | { |
---|
11427 | MrBayesPrint ("("); |
---|
11428 | for (j=0; j<numDefinedConstraints; j++) |
---|
11429 | { |
---|
11430 | if (mp->activeConstraints[j] == YES) |
---|
11431 | { |
---|
11432 | MrBayesPrint ("%d", j+1); |
---|
11433 | break; |
---|
11434 | } |
---|
11435 | } |
---|
11436 | for (j++; j<numDefinedConstraints; j++) |
---|
11437 | { |
---|
11438 | if (mp->activeConstraints[j] == YES) |
---|
11439 | { |
---|
11440 | MrBayesPrint (",%d", j+1); |
---|
11441 | } |
---|
11442 | } |
---|
11443 | MrBayesPrint (")\n"); |
---|
11444 | } |
---|
11445 | else if (!strcmp(mp->topologyPr, "Fixed")) |
---|
11446 | MrBayesPrint("(%s)\n", userTree[mp->topologyFix]->name); |
---|
11447 | else |
---|
11448 | MrBayesPrint ("\n"); |
---|
11449 | |
---|
11450 | MrBayesPrint (" Brlenspr Unconstrained/Clock/Fixed %s", mp->brlensPr); |
---|
11451 | if (!strcmp(mp->brlensPr, "Unconstrained")) |
---|
11452 | { |
---|
11453 | if (!strcmp(mp->unconstrainedPr, "Uniform")) |
---|
11454 | MrBayesPrint (":Uni(%1.1lf,%1.1lf)\n", mp->brlensUni[0], mp->brlensUni[1]); |
---|
11455 | else |
---|
11456 | MrBayesPrint (":Exp(%1.1lf)\n", mp->brlensExp); |
---|
11457 | } |
---|
11458 | else if (!strcmp(mp->brlensPr, "Clock")) |
---|
11459 | { |
---|
11460 | if (!strcmp(mp->clockPr,"Fixed")) |
---|
11461 | MrBayesPrint (":%s(%s)\n", mp->clockPr, userTree[mp->brlensFix]->name); |
---|
11462 | else |
---|
11463 | MrBayesPrint (":%s\n", mp->clockPr); |
---|
11464 | } |
---|
11465 | else if (!strcmp(mp->brlensPr, "Fixed")) |
---|
11466 | MrBayesPrint("(%s)\n", userTree[mp->brlensFix]->name); |
---|
11467 | |
---|
11468 | MrBayesPrint (" Treeagepr Exponential/Gamma/Fixed %s", mp->treeAgePr); |
---|
11469 | if (!strcmp(mp->treeAgePr, "Gamma")) |
---|
11470 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->treeAgeGamma[0], mp->treeAgeGamma[1]); |
---|
11471 | else if (!strcmp(mp->treeAgePr, "Fixed")) |
---|
11472 | MrBayesPrint ("(%1.1lf)\n", mp->treeAgeFix); |
---|
11473 | else /* if (!strcmp(mp->speciationPr, "Exponential")) */ |
---|
11474 | MrBayesPrint ("(%1.1lf)\n", mp->treeAgeExp); |
---|
11475 | |
---|
11476 | MrBayesPrint (" Speciationpr Uniform/Exponential/Fixed %s", mp->speciationPr); |
---|
11477 | if (!strcmp(mp->speciationPr, "Uniform")) |
---|
11478 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->speciationUni[0], mp->speciationUni[1]); |
---|
11479 | else if (!strcmp(mp->speciationPr, "Exponential")) |
---|
11480 | MrBayesPrint ("(%1.1lf)\n", mp->speciationExp); |
---|
11481 | else |
---|
11482 | MrBayesPrint ("(%1.1lf)\n", mp->speciationFix); |
---|
11483 | |
---|
11484 | MrBayesPrint (" Extinctionpr Beta/Fixed %s", mp->extinctionPr); |
---|
11485 | if (!strcmp(mp->extinctionPr, "Beta")) |
---|
11486 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->extinctionBeta[0], mp->extinctionBeta[1]); |
---|
11487 | else |
---|
11488 | MrBayesPrint ("(%1.1lf)\n", mp->extinctionFix); |
---|
11489 | MrBayesPrint (" SampleStrat Random/Diversity/Cluster %s\n", mp->sampleStrat); |
---|
11490 | MrBayesPrint (" Sampleprob <number> %1.2lf\n", mp->sampleProb); |
---|
11491 | |
---|
11492 | MrBayesPrint (" Popsizepr Lognormal/Gamma/Uniform/ %s", mp->popSizePr); |
---|
11493 | if (!strcmp(mp->popSizePr, "Uniform")) |
---|
11494 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeUni[0], mp->popSizeUni[1]); |
---|
11495 | else if (!strcmp(mp->popSizePr, "Lognormal")) |
---|
11496 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeLognormal[0], mp->popSizeLognormal[1]); |
---|
11497 | else if (!strcmp(mp->popSizePr, "Normal")) |
---|
11498 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeNormal[0], mp->popSizeNormal[1]); |
---|
11499 | else if (!strcmp(mp->popSizePr, "Gamma")) |
---|
11500 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeGamma[0], mp->popSizeGamma[1]); |
---|
11501 | else |
---|
11502 | MrBayesPrint ("(%1.1lf)\n", mp->popSizeFix); |
---|
11503 | MrBayesPrint (" Normal/Fixed \n"); |
---|
11504 | |
---|
11505 | MrBayesPrint (" Popvarpr Equal/Variable %s\n", mp->popVarPr); |
---|
11506 | |
---|
11507 | /* |
---|
11508 | MrBayesPrint (" Growthpr Uniform/Exponential/ \n"); |
---|
11509 | MrBayesPrint (" Fixed/Normal %s", mp->growthPr); |
---|
11510 | if (!strcmp(mp->growthPr, "Uniform")) |
---|
11511 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->growthUni[0], mp->growthUni[1]); |
---|
11512 | else if (!strcmp(mp->growthPr, "Exponential")) |
---|
11513 | MrBayesPrint ("(%1.1lf)\n", mp->growthExp); |
---|
11514 | else if (!strcmp(mp->growthPr, "Normal")) |
---|
11515 | MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->growthNorm[0], mp->growthNorm[1]); |
---|
11516 | else |
---|
11517 | MrBayesPrint ("(%1.1lf)\n", mp->growthFix); |
---|
11518 | */ |
---|
11519 | |
---|
11520 | MrBayesPrint (" Nodeagepr Unconstrained/Calibrated %s\n", mp->nodeAgePr); |
---|
11521 | |
---|
11522 | MrBayesPrint (" Clockratepr Fixed/Normal/Lognormal/\n%s", spacer); |
---|
11523 | MrBayesPrint (" Exponential/Gamma %s", mp->clockRatePr); |
---|
11524 | if (!strcmp(mp->clockRatePr, "Fixed")) |
---|
11525 | MrBayesPrint ("(%1.2lf)\n", mp->clockRateFix); |
---|
11526 | else if (!strcmp(mp->clockRatePr,"Exponential")) |
---|
11527 | MrBayesPrint ("(%1.2lf)\n", mp->clockRateExp); |
---|
11528 | else if (!strcmp(mp->clockRatePr,"Normal")) |
---|
11529 | MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateNormal[0], mp->clockRateNormal[1]); |
---|
11530 | else if (!strcmp(mp->clockRatePr,"Lognormal")) |
---|
11531 | MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateLognormal[0], mp->clockRateLognormal[1]); |
---|
11532 | else |
---|
11533 | { |
---|
11534 | assert (!strcmp(mp->clockRatePr,"Gamma")); |
---|
11535 | MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateGamma[0], mp->clockRateGamma[1]); |
---|
11536 | } |
---|
11537 | |
---|
11538 | MrBayesPrint (" Clockvarpr Strict/Cpp/TK02/Igr %s\n", mp->clockVarPr); |
---|
11539 | |
---|
11540 | MrBayesPrint (" Cppratepr Fixed/Exponential %s", mp->cppRatePr); |
---|
11541 | if (!strcmp(mp->cppRatePr, "Fixed")) |
---|
11542 | MrBayesPrint ("(%1.2lf)\n", mp->cppRateFix); |
---|
11543 | else /* if (!strcmp(mp->cppRatePr,"Exponential")) */ |
---|
11544 | MrBayesPrint ("(%1.2lf)\n", mp->cppRateExp); |
---|
11545 | |
---|
11546 | MrBayesPrint (" Cppmultdevpr Fixed %s", mp->cppMultDevPr); |
---|
11547 | MrBayesPrint ("(%1.2lf)\n", mp->cppMultDevFix); |
---|
11548 | |
---|
11549 | MrBayesPrint (" TK02varpr Fixed/Exponential/Uniform %s", mp->tk02varPr); |
---|
11550 | if (!strcmp(mp->tk02varPr, "Fixed")) |
---|
11551 | MrBayesPrint ("(%1.2lf)\n", mp->tk02varFix); |
---|
11552 | else if (!strcmp(mp->tk02varPr,"Exponential")) |
---|
11553 | MrBayesPrint ("(%1.2lf)\n", mp->tk02varExp); |
---|
11554 | else |
---|
11555 | { |
---|
11556 | assert (!strcmp(mp->tk02varPr,"Uniform")); |
---|
11557 | MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->tk02varUni[0], mp->tk02varUni[1]); |
---|
11558 | } |
---|
11559 | |
---|
11560 | MrBayesPrint (" Igrvarpr Fixed/Exponential/Uniform %s", mp->igrvarPr); |
---|
11561 | if (!strcmp(mp->igrvarPr, "Fixed")) |
---|
11562 | MrBayesPrint ("(%1.2lf)\n", mp->igrvarFix); |
---|
11563 | else if (!strcmp(mp->igrvarPr,"Exponential")) |
---|
11564 | MrBayesPrint ("(%1.2lf)\n", mp->igrvarExp); |
---|
11565 | else |
---|
11566 | { |
---|
11567 | assert (!strcmp(mp->igrvarPr,"Uniform")); |
---|
11568 | MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->igrvarUni[0], mp->igrvarUni[1]); |
---|
11569 | } |
---|
11570 | |
---|
11571 | |
---|
11572 | MrBayesPrint (" Ratepr Fixed/Variable=Dirichlet %s", mp->ratePr); |
---|
11573 | if (!strcmp(mp->ratePr, "Dirichlet")) |
---|
11574 | MrBayesPrint ("(...,%1.1lf,...)\n", mp->ratePrDir); |
---|
11575 | else |
---|
11576 | MrBayesPrint ("\n"); |
---|
11577 | |
---|
11578 | MrBayesPrint (" ------------------------------------------------------------------ \n"); |
---|
11579 | MrBayesPrint (" \n"); |
---|
11580 | } |
---|
11581 | } |
---|
11582 | else if (!strcmp(helpTkn, "Ctype")) |
---|
11583 | { |
---|
11584 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11585 | MrBayesPrint (" Ctype \n"); |
---|
11586 | MrBayesPrint (" \n"); |
---|
11587 | MrBayesPrint (" This command sets the character ordering for standard-type data. The \n"); |
---|
11588 | MrBayesPrint (" correct usage is: \n"); |
---|
11589 | MrBayesPrint (" \n"); |
---|
11590 | MrBayesPrint (" ctype <ordering>:<characters> \n"); |
---|
11591 | MrBayesPrint (" \n"); |
---|
11592 | MrBayesPrint (" The available options for the <ordering> specifier are: \n"); |
---|
11593 | MrBayesPrint (" \n"); |
---|
11594 | MrBayesPrint (" unordered -- Movement directly from one state to another is \n"); |
---|
11595 | MrBayesPrint (" allowed in an instant of time. \n"); |
---|
11596 | MrBayesPrint (" ordered -- Movement is only allowed between adjacent characters. \n"); |
---|
11597 | MrBayesPrint (" For example, perhaps only between 0 <-> 1 and 1 <-> 2 \n"); |
---|
11598 | MrBayesPrint (" for a three state character ordered as 0 - 1 - 2. \n"); |
---|
11599 | MrBayesPrint (" irreversible -- Rates of change for losses are 0. \n"); |
---|
11600 | MrBayesPrint (" \n"); |
---|
11601 | MrBayesPrint (" The characters to which the ordering is applied is specified in manner \n"); |
---|
11602 | MrBayesPrint (" that is identical to commands such as \"include\" or \"exclude\". For \n"); |
---|
11603 | MrBayesPrint (" example, \n"); |
---|
11604 | MrBayesPrint (" \n"); |
---|
11605 | MrBayesPrint (" ctype ordered: 10 23 45 \n"); |
---|
11606 | MrBayesPrint (" \n"); |
---|
11607 | MrBayesPrint (" defines charactes 10, 23, and 45 to be of type ordered. Similarly, \n"); |
---|
11608 | MrBayesPrint (" \n"); |
---|
11609 | MrBayesPrint (" ctype irreversible: 54 - 67 71-92 \n"); |
---|
11610 | MrBayesPrint (" \n"); |
---|
11611 | MrBayesPrint (" defines characters 54 to 67 and characters 71 to 92 to be of type \n"); |
---|
11612 | MrBayesPrint (" irreversible. You can use the \".\" to denote the last character, and \n"); |
---|
11613 | MrBayesPrint (" \"all\" to denote all of the characters. Finally, you can use the \n"); |
---|
11614 | MrBayesPrint (" specifier \"\\\" to apply the ordering to every n-th character or \n"); |
---|
11615 | MrBayesPrint (" you can use predefined charsets to specify the character. \n"); |
---|
11616 | MrBayesPrint (" \n"); |
---|
11617 | MrBayesPrint (" Only one ordering can be used on any specific application of ctype. \n"); |
---|
11618 | MrBayesPrint (" If you want to apply different orderings to different characters, then \n"); |
---|
11619 | MrBayesPrint (" you need to use ctype multiple times. For example, \n"); |
---|
11620 | MrBayesPrint (" \n"); |
---|
11621 | MrBayesPrint (" ctype ordered: 1-50 \n"); |
---|
11622 | MrBayesPrint (" ctype irreversible: 51-100 \n"); |
---|
11623 | MrBayesPrint (" \n"); |
---|
11624 | MrBayesPrint (" sets characters 1 to 50 to be ordered and characters 51 to 100 to be \n"); |
---|
11625 | MrBayesPrint (" irreversible. \n"); |
---|
11626 | MrBayesPrint (" \n"); |
---|
11627 | MrBayesPrint (" The ctype command is only sensible with morphological (here called \n"); |
---|
11628 | MrBayesPrint (" \"standard\") characters. The program ignores attempts to apply char- \n"); |
---|
11629 | MrBayesPrint (" acter orderings to other types of characters, such as DNA characters. \n"); |
---|
11630 | |
---|
11631 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11632 | } |
---|
11633 | else if (!strcmp(helpTkn, "Propset")) |
---|
11634 | { |
---|
11635 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11636 | MrBayesPrint (" Propset \n"); |
---|
11637 | MrBayesPrint (" \n"); |
---|
11638 | MrBayesPrint (" This command allows the user to change the details of the MCMC samplers \n"); |
---|
11639 | MrBayesPrint (" (moves) that update the state of the chain. The useage is: \n"); |
---|
11640 | MrBayesPrint (" \n"); |
---|
11641 | MrBayesPrint (" propset <move_name>$<tuning-parameter>=<value> \n"); |
---|
11642 | MrBayesPrint (" \n"); |
---|
11643 | MrBayesPrint (" Assume we have a topology parameter called 'Tau{all}', which is sampled by \n"); |
---|
11644 | MrBayesPrint (" the move 'ExtTBR(Tau{all})' (note that the parameter name is included in the \n"); |
---|
11645 | MrBayesPrint (" move name). This move has three tuning parameters: (1) 'prob', the relative \n"); |
---|
11646 | MrBayesPrint (" proposal probability (a weight defining its probability relative to other \n"); |
---|
11647 | MrBayesPrint (" moves); (2) 'p_ext', the extension probability; and (3) 'lambda', the tuning \n"); |
---|
11648 | MrBayesPrint (" parameter of the branch length multiplier. A list of the tuning parameters is \n"); |
---|
11649 | MrBayesPrint (" available by using 'Showmoves' (see below). To change the relative proposal \n"); |
---|
11650 | MrBayesPrint (" probability to 20 and the extension probability to 0.7, use: \n"); |
---|
11651 | MrBayesPrint (" \n"); |
---|
11652 | MrBayesPrint (" propset etbr(tau{all})$prob=20 etbr(tau{all})$p_ext=0.7 \n"); |
---|
11653 | MrBayesPrint (" \n"); |
---|
11654 | MrBayesPrint (" This change would apply to all chains in all runs. It is also possible to set \n"); |
---|
11655 | MrBayesPrint (" the tuning parameters of individual runs and chains using the format: \n"); |
---|
11656 | MrBayesPrint (" \n"); |
---|
11657 | MrBayesPrint (" propset <move_name>$<tuning-parameter>(<run>,<chain>)=<value> \n"); |
---|
11658 | MrBayesPrint (" \n"); |
---|
11659 | MrBayesPrint (" where <run> and <chain> are the index numbers of the run and chain for which \n"); |
---|
11660 | MrBayesPrint (" you want to change the value. If you leave out the index of the run, the \n"); |
---|
11661 | MrBayesPrint (" change will apply to all runs; if you leave out the index of the chain, the \n"); |
---|
11662 | MrBayesPrint (" change will similarly apply to all chains. To switch off the exttbr(tau{all}) \n"); |
---|
11663 | MrBayesPrint (" move in chain 2 of all runs, use: \n"); |
---|
11664 | MrBayesPrint (" \n"); |
---|
11665 | MrBayesPrint (" propset etbr(tau{all})$prob(,2)=0 \n"); |
---|
11666 | MrBayesPrint (" \n"); |
---|
11667 | MrBayesPrint (" It is important to note that all moves are not available until the model has \n"); |
---|
11668 | MrBayesPrint (" been completely defined. Any change to the model will cause all proposal \n"); |
---|
11669 | MrBayesPrint (" tuning parameters to return to their default values. To see a list of all the \n"); |
---|
11670 | MrBayesPrint (" moves that are currently switched on for the model, use 'showmoves'. You can \n"); |
---|
11671 | MrBayesPrint (" also see other available moves by using 'showmoves allavailable=yes'. A list \n"); |
---|
11672 | MrBayesPrint (" of the moves for each parameter in the model is available by using the command\n"); |
---|
11673 | MrBayesPrint (" 'Showparams'. If you change proposal probabilities, make sure that all \n"); |
---|
11674 | MrBayesPrint (" parameters that are not fixed in your model have at least one move switched \n"); |
---|
11675 | MrBayesPrint (" on. \n"); |
---|
11676 | MrBayesPrint (" \n"); |
---|
11677 | MrBayesPrint (" One word of warning: You should be extremely careful when modifying any \n"); |
---|
11678 | MrBayesPrint (" of the chain parameters using 'propset'. It is quite possible to completely \n"); |
---|
11679 | MrBayesPrint (" wreck any hope of achieving convergence by inappropriately setting the \n"); |
---|
11680 | MrBayesPrint (" tuning parameters. In general, you want to set move tuning parameters such \n"); |
---|
11681 | MrBayesPrint (" that the acceptance rate of the move is intermediate (we suggest targeting \n"); |
---|
11682 | MrBayesPrint (" the range 10%% to 70%% acceptance, if possible). If the acceptance rate is \n"); |
---|
11683 | MrBayesPrint (" outside of this range, the MCMC chain will probably not sample that parameter \n"); |
---|
11684 | MrBayesPrint (" very efficiently. The acceptance rates for all moves in the cold chain(s) are \n"); |
---|
11685 | MrBayesPrint (" summarized at the end of each run in the screen output. The acceptance rates \n"); |
---|
11686 | MrBayesPrint (" (potentially for all chains, cold and heated) are also printed to the .mcmc \n"); |
---|
11687 | MrBayesPrint (" file if Mcmc convergence diagnostics are turned on (using 'Mcmc' or 'Mcmcp'). \n"); |
---|
11688 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11689 | } |
---|
11690 | else if (!strcmp(helpTkn, "Log")) |
---|
11691 | { |
---|
11692 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11693 | MrBayesPrint (" Log \n"); |
---|
11694 | MrBayesPrint (" \n"); |
---|
11695 | MrBayesPrint (" This command allows output to the screen to also be output to a file. \n"); |
---|
11696 | MrBayesPrint (" The useage is: \n"); |
---|
11697 | MrBayesPrint (" \n"); |
---|
11698 | MrBayesPrint (" log start/stop filename=<name> append/replace \n"); |
---|
11699 | MrBayesPrint (" \n"); |
---|
11700 | MrBayesPrint (" The options are: \n"); |
---|
11701 | MrBayesPrint (" \n"); |
---|
11702 | MrBayesPrint (" Start/Stop -- Starts or stops logging of output to file. \n"); |
---|
11703 | MrBayesPrint (" Append/Replace -- Either append to or replace existing file. \n"); |
---|
11704 | MrBayesPrint (" Filename -- Name of log file (currently, the name of the log \n"); |
---|
11705 | MrBayesPrint (" file is \"%s\").\n", logFileName); |
---|
11706 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11707 | } |
---|
11708 | else if (!strcmp(helpTkn, "Translate")) |
---|
11709 | { |
---|
11710 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11711 | MrBayesPrint (" Translate \n"); |
---|
11712 | MrBayesPrint (" \n"); |
---|
11713 | MrBayesPrint (" This command is used by MrBayes to specify the mapping between taxon names \n"); |
---|
11714 | MrBayesPrint (" and taxon numbers in a Nexus tree file. For instance, \n"); |
---|
11715 | MrBayesPrint (" \n"); |
---|
11716 | MrBayesPrint (" translate \n"); |
---|
11717 | MrBayesPrint (" 1 Homo, \n"); |
---|
11718 | MrBayesPrint (" 2 Pan, \n"); |
---|
11719 | MrBayesPrint (" 3 Gorilla, \n"); |
---|
11720 | MrBayesPrint (" 4 Hylobates; \n"); |
---|
11721 | MrBayesPrint (" \n"); |
---|
11722 | MrBayesPrint (" establishes that the taxon labeled 1 in the trees that follow is Homo, the \n"); |
---|
11723 | MrBayesPrint (" taxon labeled 2 is Pan, etc. \n"); |
---|
11724 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11725 | } |
---|
11726 | else if (!strcmp(helpTkn, "Usertree")) |
---|
11727 | { |
---|
11728 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11729 | MrBayesPrint (" Usertree \n"); |
---|
11730 | MrBayesPrint (" \n"); |
---|
11731 | MrBayesPrint (" This command allows you to specify a user tree. The user tree can then be \n"); |
---|
11732 | MrBayesPrint (" used as a starting tree for a MCMC analysis. The format for the command is \n"); |
---|
11733 | MrBayesPrint (" \n"); |
---|
11734 | MrBayesPrint (" usertree = <tree in Newick format> \n"); |
---|
11735 | MrBayesPrint (" \n"); |
---|
11736 | MrBayesPrint (" For example, \n"); |
---|
11737 | MrBayesPrint (" \n"); |
---|
11738 | MrBayesPrint (" usertree = (A,B,(C,D)) \n"); |
---|
11739 | MrBayesPrint (" \n"); |
---|
11740 | MrBayesPrint (" specifies an unrooted tree of four species. Note that the program re- \n"); |
---|
11741 | MrBayesPrint (" quires that trees are binary (i.e., strictly bifurcating). Hence, there \n"); |
---|
11742 | MrBayesPrint (" can be only one three-way split, as shown in the example. If the tree \n"); |
---|
11743 | MrBayesPrint (" is not binary, the program will return an error. \n"); |
---|
11744 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11745 | } |
---|
11746 | else if (!strcmp(helpTkn, "Mcmc")) |
---|
11747 | { |
---|
11748 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11749 | MrBayesPrint (" Mcmc \n"); |
---|
11750 | MrBayesPrint (" \n"); |
---|
11751 | MrBayesPrint (" This command starts the Markov chain Monte Carlo (MCMC) analysis. The \n"); |
---|
11752 | MrBayesPrint (" posterior probability of phylogenetic trees (and other parameters of the \n"); |
---|
11753 | MrBayesPrint (" substitution model) cannot be determined analytically. Instead, MCMC is \n"); |
---|
11754 | MrBayesPrint (" used to approximate the posterior probabilities of trees by drawing \n"); |
---|
11755 | MrBayesPrint (" (dependent) samples from the posterior distribution. This program can \n"); |
---|
11756 | MrBayesPrint (" implement a variant of MCMC called \"Metropolis-coupled Markov chain Monte \n"); |
---|
11757 | MrBayesPrint (" Carlo\", or MCMCMC for short. Basically, \"Nchains\" are run, with \n"); |
---|
11758 | MrBayesPrint (" Nchains - 1 of them heated. The chains are labelled 1, 2, ..., Nchains. \n"); |
---|
11759 | MrBayesPrint (" The heat that is applied to the i-th chain is B = 1 / (1 + temp X i). B \n"); |
---|
11760 | MrBayesPrint (" is the power to which the posterior probability is raised. When B = 0, all \n"); |
---|
11761 | MrBayesPrint (" trees have equal probability and the chain freely visits trees. B = 1 is \n"); |
---|
11762 | MrBayesPrint (" the \"cold\" chain (or the distribution of interest). MCMCMC can mix \n"); |
---|
11763 | MrBayesPrint (" better than ordinary MCMC; after all of the chains have gone through \n"); |
---|
11764 | MrBayesPrint (" one cycle, two chains are chosen at random and an attempt is made to \n"); |
---|
11765 | MrBayesPrint (" swap the states (with the probability of a swap being determined by the \n"); |
---|
11766 | MrBayesPrint (" Metropolis et al. equation). This allows the chain to potentially jump \n"); |
---|
11767 | MrBayesPrint (" a valley in a single bound. The correct usage is \n"); |
---|
11768 | MrBayesPrint (" \n"); |
---|
11769 | MrBayesPrint (" mcmc <parameter> = <value> ... <parameter> = <value> \n"); |
---|
11770 | MrBayesPrint (" \n"); |
---|
11771 | MrBayesPrint (" For example, \n"); |
---|
11772 | MrBayesPrint (" \n"); |
---|
11773 | MrBayesPrint (" mcmc ngen=100000 nchains=4 temp=0.5 \n"); |
---|
11774 | MrBayesPrint (" \n"); |
---|
11775 | MrBayesPrint (" performs a MCMCMC analysis with four chains with the temperature set to \n"); |
---|
11776 | MrBayesPrint (" 0.5. The chains would be run for 100,000 cycles. \n"); |
---|
11777 | MrBayesPrint (" \n"); |
---|
11778 | MrBayesPrint (" Options: \n"); |
---|
11779 | MrBayesPrint (" \n"); |
---|
11780 | MrBayesPrint (" Ngen -- This option sets the number of cycles for the MCMC alg- \n"); |
---|
11781 | MrBayesPrint (" orithm. This should be a big number as you want the chain \n"); |
---|
11782 | MrBayesPrint (" to first reach stationarity, and then remain there for \n"); |
---|
11783 | MrBayesPrint (" enough time to take lots of samples. \n"); |
---|
11784 | MrBayesPrint (" Nruns -- How many independent analyses are started simultaneously. \n"); |
---|
11785 | MrBayesPrint (" Nchains -- How many chains are run for each analysis for the MCMCMC \n"); |
---|
11786 | MrBayesPrint (" variant. The default is 4: 1 cold chain and 3 heated chains. \n"); |
---|
11787 | MrBayesPrint (" If Nchains is set to 1, MrBayes will use regular MCMC sam- \n"); |
---|
11788 | MrBayesPrint (" pling, without heating. \n"); |
---|
11789 | MrBayesPrint (" Temp -- The temperature parameter for heating the chains. The higher \n"); |
---|
11790 | MrBayesPrint (" the temperature, the more likely the heated chains are to \n"); |
---|
11791 | MrBayesPrint (" move between isolated peaks in the posterior distribution. \n"); |
---|
11792 | MrBayesPrint (" However, excessive heating may lead to very low acceptance \n"); |
---|
11793 | MrBayesPrint (" rates for swaps between different chains. Before changing the \n"); |
---|
11794 | MrBayesPrint (" default setting, however, note that the acceptance rates of \n"); |
---|
11795 | MrBayesPrint (" swaps tend to fluctuate during the burn-in phase of the run. \n"); |
---|
11796 | MrBayesPrint (" Reweight -- Here, you specify three numbers, that respectively represent \n"); |
---|
11797 | MrBayesPrint (" the percentage of characters to decrease in weight, the \n"); |
---|
11798 | MrBayesPrint (" percentage of characters to increase in weight, and the \n"); |
---|
11799 | MrBayesPrint (" increment. An increase/decrease in weight is acheived by \n"); |
---|
11800 | MrBayesPrint (" replicating/removing a character in the matrix. This is \n"); |
---|
11801 | MrBayesPrint (" only done to non-cold chains. The format for this parameter \n"); |
---|
11802 | MrBayesPrint (" is \"reweight=(<number>,<number>)\" or \"reweight=(<number>, \n"); |
---|
11803 | MrBayesPrint (" <number>,<number>)\". \n"); |
---|
11804 | MrBayesPrint (" Swapfreq -- This specifies how often swaps of states between chains are \n"); |
---|
11805 | MrBayesPrint (" attempted. You must be running at least two chains for this \n"); |
---|
11806 | MrBayesPrint (" option to be relevant. The default is Swapfreq=1, resulting \n"); |
---|
11807 | MrBayesPrint (" in Nswaps (see below) swaps being tried each generation of \n"); |
---|
11808 | MrBayesPrint (" the run. If Swapfreq is set to 10, then Nswaps swaps will be \n"); |
---|
11809 | MrBayesPrint (" tried every tenth generation of the run. \n"); |
---|
11810 | MrBayesPrint (" Nswaps -- The number of swaps tried for each swapping generation of the \n"); |
---|
11811 | MrBayesPrint (" chain (see also Swapfreq). \n"); |
---|
11812 | MrBayesPrint (" Samplefreq -- This specifies how often the Markov chain is sampled. You \n"); |
---|
11813 | MrBayesPrint (" can sample the chain every cycle, but this results in very \n"); |
---|
11814 | MrBayesPrint (" large output files. Thinning the chain is a way of making \n"); |
---|
11815 | MrBayesPrint (" these files smaller and making the samples more independent. \n"); |
---|
11816 | MrBayesPrint (" Printfreq -- This specifies how often information about the chain is \n"); |
---|
11817 | MrBayesPrint (" printed to the screen. \n"); |
---|
11818 | MrBayesPrint (" Printall -- If set to NO, only cold chains in a MCMC analysis are printed \n"); |
---|
11819 | MrBayesPrint (" to screen. If set to YES, both cold and heated chains will be \n"); |
---|
11820 | MrBayesPrint (" output. This setting only affects the printing to screen, it \n"); |
---|
11821 | MrBayesPrint (" does not change the way values are written to file. \n"); |
---|
11822 | MrBayesPrint (" Printmax -- The maximum number of chains to print to screen. \n"); |
---|
11823 | MrBayesPrint (" Mcmcdiagn -- Determines whether acceptance ratios of moves and swaps will \n"); |
---|
11824 | MrBayesPrint (" be printed to file. The file will be named similarly to the \n"); |
---|
11825 | MrBayesPrint (" '.p' and '.t' files, but will have the ending '.mcmc'. If \n"); |
---|
11826 | MrBayesPrint (" more than one independent analysis is run simultaneously (see \n"); |
---|
11827 | MrBayesPrint (" Nruns below), convergence diagnostics for tree topology will \n"); |
---|
11828 | MrBayesPrint (" also be printed to this file. The convergence diagnostic used \n"); |
---|
11829 | MrBayesPrint (" is the average standard deviation in partition frequency \n"); |
---|
11830 | MrBayesPrint (" values across independent analyses. The Burnin setting (see \n"); |
---|
11831 | MrBayesPrint (" below) determines how many samples will be discarded as burnin\n"); |
---|
11832 | MrBayesPrint (" before calculating the partition frequencies. The Minpartfreq \n"); |
---|
11833 | MrBayesPrint (" setting (see below) determines the minimum partition frequency\n"); |
---|
11834 | MrBayesPrint (" required for a partition to be included in the calculation. As\n"); |
---|
11835 | MrBayesPrint (" the independent analyses approach stationarity (converge), the\n"); |
---|
11836 | MrBayesPrint (" value of the diagnostic is expected to approach zero. \n"); |
---|
11837 | MrBayesPrint (" Diagnfreq -- The number of generations between the calculation of MCMC \n"); |
---|
11838 | MrBayesPrint (" diagnostics (see Mcmcdiagn above). \n"); |
---|
11839 | MrBayesPrint (" Diagnstat -- The statistic to use for run-time convergence diagnostics. \n"); |
---|
11840 | MrBayesPrint (" Choices are 'Avgstddev' for average standard deviation of \n"); |
---|
11841 | MrBayesPrint (" split frequencies and 'Maxstddev' for maximum standard devia- \n"); |
---|
11842 | MrBayesPrint (" tion of split frequencies. \n"); |
---|
11843 | MrBayesPrint (" Savetrees -- If you are using a relative burnin for run-time convergence \n"); |
---|
11844 | MrBayesPrint (" diagnostics, tree samples need to be deleted from split \n"); |
---|
11845 | MrBayesPrint (" frequency counters as the cut-off point for the burnin moves \n"); |
---|
11846 | MrBayesPrint (" during the run. If 'Savetrees' is set to 'No', tree samples \n"); |
---|
11847 | MrBayesPrint (" to be discarded are read back in from file. If 'Savetrees' is \n"); |
---|
11848 | MrBayesPrint (" set to 'Yes', the tree samples to be removed will be stored \n"); |
---|
11849 | MrBayesPrint (" in the internal memory instead. This can use up a lot of \n"); |
---|
11850 | MrBayesPrint (" memory in large analyses. \n"); |
---|
11851 | MrBayesPrint (" Minpartfreq -- The minimum frequency required for a partition to be included \n"); |
---|
11852 | MrBayesPrint (" in the calculation of the topology convergence diagnostic. The\n"); |
---|
11853 | MrBayesPrint (" partition is included if the minimum frequency is reached in \n"); |
---|
11854 | MrBayesPrint (" at least one of the independent tree samples that are com- \n"); |
---|
11855 | MrBayesPrint (" pared. \n"); |
---|
11856 | MrBayesPrint (" Allchains -- If this option is set to YES, acceptance ratios for moves are \n"); |
---|
11857 | MrBayesPrint (" recorded for all chains, cold or heated. By default, only the \n"); |
---|
11858 | MrBayesPrint (" acceptance ratios for the cold chain are recorded. \n"); |
---|
11859 | MrBayesPrint (" Allcomps -- If this option is set to YES, topological convergence diag- \n"); |
---|
11860 | MrBayesPrint (" nostics are calculated over all pairwise comparisons of runs. \n"); |
---|
11861 | MrBayesPrint (" If it is set to NO, only the overall value is reported. \n"); |
---|
11862 | MrBayesPrint (" Relburnin -- If this option is set to YES, then a proportion of the sampled\n"); |
---|
11863 | MrBayesPrint (" values will be discarded as burnin when calculating the con- \n"); |
---|
11864 | MrBayesPrint (" vergence diagnostic. The proportion to be discarded is set \n"); |
---|
11865 | MrBayesPrint (" with Burninfrac (see below). When the Relburnin option is set \n"); |
---|
11866 | MrBayesPrint (" to NO, then a specific number of samples will be discarded \n"); |
---|
11867 | MrBayesPrint (" instead. This number is set by Burnin (see below). \n"); |
---|
11868 | MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n"); |
---|
11869 | MrBayesPrint (" be discarded when convergence diagnostics are calculated. \n"); |
---|
11870 | MrBayesPrint (" The value of this option is only relevant when Relburnin is \n"); |
---|
11871 | MrBayesPrint (" set to NO. \n"); |
---|
11872 | MrBayesPrint (" BurninFrac -- Determines the fraction of samples that will be discarded \n"); |
---|
11873 | MrBayesPrint (" when convergence diagnostics are calculated. The value of \n"); |
---|
11874 | MrBayesPrint (" this option is only relevant when Relburnin is set to YES. \n"); |
---|
11875 | MrBayesPrint (" Example: A value for this option of 0.25 means that 25%% of \n"); |
---|
11876 | MrBayesPrint (" the samples will be discarded. \n"); |
---|
11877 | MrBayesPrint (" Stoprule -- If this option is set to NO, then the chain is run the number \n"); |
---|
11878 | MrBayesPrint (" of generations determined by Ngen. If it is set to YES, and \n"); |
---|
11879 | MrBayesPrint (" topological convergence diagnostics are calculated (Mcmcdiagn \n"); |
---|
11880 | MrBayesPrint (" is set to YES), then the chain will be stopped before the pre-\n"); |
---|
11881 | MrBayesPrint (" determined number of generations if the convergence diagnostic\n"); |
---|
11882 | MrBayesPrint (" falls below the stop value. \n"); |
---|
11883 | MrBayesPrint (" Stopval -- The critical value for the topological convergence diagnostic.\n"); |
---|
11884 | MrBayesPrint (" Only used when Stoprule and Mcmcdiagn are set to yes, and \n"); |
---|
11885 | MrBayesPrint (" more than one analysis is run simultaneously (Nruns > 1). \n"); |
---|
11886 | MrBayesPrint (" Checkpoint -- If this parameter is set to 'Yes', all the current parameter \n"); |
---|
11887 | MrBayesPrint (" values of all chains will be printed to a check-pointing file \n"); |
---|
11888 | MrBayesPrint (" every 'Checkfreq' generation of the analysis. The file will be\n"); |
---|
11889 | MrBayesPrint (" named <Filename>.ckp and allows you to restart the analysis \n"); |
---|
11890 | MrBayesPrint (" from the last check point. This can be handy if you are \n"); |
---|
11891 | MrBayesPrint (" running a long analysis and want to extend it, or if there is \n"); |
---|
11892 | MrBayesPrint (" a risk that a long analysis will be inadvertently interupted \n"); |
---|
11893 | MrBayesPrint (" by hardware failure or other factors that are out of your \n"); |
---|
11894 | MrBayesPrint (" control. \n"); |
---|
11895 | MrBayesPrint (" Checkfreq -- The number of generations between check-pointing. See the \n"); |
---|
11896 | MrBayesPrint (" 'Checkpoint' parameter above for more information. \n"); |
---|
11897 | MrBayesPrint (" Filename -- The name of the files that will be generated. Two files \n"); |
---|
11898 | MrBayesPrint (" are generated: \"<Filename>.t\" and \"<Filename>.p\". \n"); |
---|
11899 | MrBayesPrint (" The .t file contains the trees whereas the .p file con- \n"); |
---|
11900 | MrBayesPrint (" tains the sampled values of the parameters. \n"); |
---|
11901 | MrBayesPrint (" Startparams -- The starting values for the model parameters are set to \n"); |
---|
11902 | MrBayesPrint (" arbitrary or random values when the parameters are created. \n"); |
---|
11903 | MrBayesPrint (" These starting values can be altered using the 'Startvals' \n"); |
---|
11904 | MrBayesPrint (" command. The 'Startparams=reset' option allows you to reset \n"); |
---|
11905 | MrBayesPrint (" the starting values to the default at the start of the ana- \n"); |
---|
11906 | MrBayesPrint (" lysis, overriding any previous user-defined starting values. \n"); |
---|
11907 | MrBayesPrint (" Under the default option, 'current', the chains will use the \n"); |
---|
11908 | MrBayesPrint (" current starting values. \n"); |
---|
11909 | MrBayesPrint (" Starttree -- The starting tree(s) for the chain can either be randomly \n"); |
---|
11910 | MrBayesPrint (" selected or user-defined. It might be a good idea to \n"); |
---|
11911 | MrBayesPrint (" start from randomly chosen trees; convergence seems \n"); |
---|
11912 | MrBayesPrint (" likely if independently run chains, each of which \n"); |
---|
11913 | MrBayesPrint (" started from different random trees, converge to the same \n"); |
---|
11914 | MrBayesPrint (" answer. If you want the chain to start from user-defined \n"); |
---|
11915 | MrBayesPrint (" trees instead, you first need to read in your tree(s) from a \n"); |
---|
11916 | MrBayesPrint (" Nexus file with a 'trees' block, and then you need to set the \n"); |
---|
11917 | MrBayesPrint (" starting tree(s) using the 'Startvals' command. Finally, you \n"); |
---|
11918 | MrBayesPrint (" need to make sure that 'Starttree' is set to 'current'. If \n"); |
---|
11919 | MrBayesPrint (" you do not set the starting tree(s), the chains will start \n"); |
---|
11920 | MrBayesPrint (" with random trees. Setting 'Starttree' to 'random' causes \n"); |
---|
11921 | MrBayesPrint (" new starting trees to be drawn randomly at the start of the \n"); |
---|
11922 | MrBayesPrint (" run, overwriting any previous user-defined starting trees. \n"); |
---|
11923 | MrBayesPrint (" Nperts -- This is the number of random perturbations to apply to the \n"); |
---|
11924 | MrBayesPrint (" user starting tree. This allows you to have something \n"); |
---|
11925 | MrBayesPrint (" between completely random and user-defined trees start \n"); |
---|
11926 | MrBayesPrint (" the chain. \n"); |
---|
11927 | MrBayesPrint (" Savebrlens -- This specifies whether branch length information is \n"); |
---|
11928 | MrBayesPrint (" saved on the trees. \n"); |
---|
11929 | MrBayesPrint (" Data -- When Data is set to NO, the chain is run without data. This \n"); |
---|
11930 | MrBayesPrint (" should be used only for examining induced priors. DO NOT SET \n"); |
---|
11931 | MrBayesPrint (" 'DATA' TO 'NO' UNLESS YOU KNOW WHAT YOU ARE DOING! \n"); |
---|
11932 | MrBayesPrint (" Ordertaxa -- Determines whether taxa should be ordered before trees are \n"); |
---|
11933 | MrBayesPrint (" printed to file. If set to 'Yes', terminals in the sampled \n"); |
---|
11934 | MrBayesPrint (" trees will be reordered to match the order of the taxa in the \n"); |
---|
11935 | MrBayesPrint (" data matrix as closely as possible. By default, trees will be \n"); |
---|
11936 | MrBayesPrint (" printed without reordering of taxa. \n"); |
---|
11937 | MrBayesPrint (" Append -- Set this to 'Yes' to append the results of the current run to \n"); |
---|
11938 | MrBayesPrint (" a previous run. MrBayes will first read in the results of the \n"); |
---|
11939 | MrBayesPrint (" previous run (number of generations and sampled splits) and \n"); |
---|
11940 | MrBayesPrint (" will then continue that run where you left it off. Make sure \n"); |
---|
11941 | MrBayesPrint (" that the output file names used in the previous run are the \n"); |
---|
11942 | MrBayesPrint (" same as those in the current run. \n"); |
---|
11943 | MrBayesPrint (" Autotune -- Set this to 'Yes' to autotune the proposals that change \n"); |
---|
11944 | MrBayesPrint (" substitution model parameters. When set to 'No', the tuning \n"); |
---|
11945 | MrBayesPrint (" parameters are fixed to their starting values. Note that the \n"); |
---|
11946 | MrBayesPrint (" autotuning occurs independently for each chain. The target \n"); |
---|
11947 | MrBayesPrint (" acceptance rate for each move can be changed using the \n"); |
---|
11948 | MrBayesPrint (" 'Propset' command. \n"); |
---|
11949 | MrBayesPrint (" Tunefreq -- When a proposal has been tried 'Tunefreq' times, its tuning \n"); |
---|
11950 | MrBayesPrint (" parameter is adjusted to reach the target acceptance rate \n"); |
---|
11951 | MrBayesPrint (" if 'Autotune' is set to 'Yes'. \n"); |
---|
11952 | MrBayesPrint (" \n"); |
---|
11953 | PrintSettings ("Mcmc", NULL); |
---|
11954 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11955 | } |
---|
11956 | else if (!strcmp(helpTkn, "Mcmcp")) |
---|
11957 | { |
---|
11958 | PrintYesNo (chainParams.saveBrlens, yesNoStr); |
---|
11959 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11960 | MrBayesPrint (" Mcmcp \n"); |
---|
11961 | MrBayesPrint (" \n"); |
---|
11962 | MrBayesPrint (" This command sets the parameters of the Markov chain Monte Carlo (MCMC) \n"); |
---|
11963 | MrBayesPrint (" analysis without actually starting the chain. This command is identical \n"); |
---|
11964 | MrBayesPrint (" in all respects to Mcmc, except that the analysis will not start after \n"); |
---|
11965 | MrBayesPrint (" this command is issued. For more details on the options, check the help \n"); |
---|
11966 | MrBayesPrint (" menu for Mcmc.\n"); |
---|
11967 | MrBayesPrint (" \n"); |
---|
11968 | PrintSettings ("Mcmc", NULL); |
---|
11969 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11970 | } |
---|
11971 | else if (!strcmp(helpTkn, "Ss")) |
---|
11972 | { |
---|
11973 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
11974 | MrBayesPrint (" Ss \n"); |
---|
11975 | MrBayesPrint (" \n"); |
---|
11976 | MrBayesPrint (" This command is used to start stepping-stone sampling, which is an efficient \n"); |
---|
11977 | MrBayesPrint (" and accurate method for estimating the marginal likelihood of the currently \n"); |
---|
11978 | MrBayesPrint (" specified model. It is considerably more accurate than the harmonic mean of \n"); |
---|
11979 | MrBayesPrint (" the likelihoods from a standard MCMC run on the model (calculated by the \n"); |
---|
11980 | MrBayesPrint (" 'Sump' command) but it requires a separate MCMC-like run. To be more specific,\n"); |
---|
11981 | MrBayesPrint (" stepping-stone sampling uses importance sampling to estimate each ratio in a \n"); |
---|
11982 | MrBayesPrint (" series of discrete steps bridging the posterior and prior distributions. \n"); |
---|
11983 | MrBayesPrint (" The importance distributions that are used are called power posterior distri- \n"); |
---|
11984 | MrBayesPrint (" butions, and are defined as prior*(likelihood^beta). By varying beta from 1 to\n"); |
---|
11985 | MrBayesPrint (" 0, we get a series of distributions that connect the posterior (beta = 1) to \n"); |
---|
11986 | MrBayesPrint (" the prior (beta = 0). \n"); |
---|
11987 | MrBayesPrint (" \n"); |
---|
11988 | MrBayesPrint (" The power posterior distributions are sampled using MCMC. First, we start a \n"); |
---|
11989 | MrBayesPrint (" standard MCMC chain on the posterior distribution, and let it run until we \n"); |
---|
11990 | MrBayesPrint (" have reached the criterion specified by the 'Burninss' option. After this, we \n"); |
---|
11991 | MrBayesPrint (" step through the power posterior distributions until we reach the prior dis- \n"); |
---|
11992 | MrBayesPrint (" tribution. In each of the 'Nsteps' steps, we sample from a new power poster- \n"); |
---|
11993 | MrBayesPrint (" ior distribution with a distinct beta value. The beta values correspond to \n"); |
---|
11994 | MrBayesPrint (" 'Nsteps' evenly spaced quantiles in a Beta distribution with the parameters \n"); |
---|
11995 | MrBayesPrint (" 'Alpha' and 1.0. For the first sampling step, the beta value is equal to the \n"); |
---|
11996 | MrBayesPrint (" last quantile, i.e., it is close to 1.0. For each successive step, the beta \n"); |
---|
11997 | MrBayesPrint (" value takes on the value of the next quantile, in decreasing order, until it \n"); |
---|
11998 | MrBayesPrint (" reaches the value of 0.0. If you change value of 'FromPrior' from default 'No'\n"); |
---|
11999 | MrBayesPrint (" to 'Yes' then the direction of power posterior change during SS analizes is \n"); |
---|
12000 | MrBayesPrint (" opposite to the one described above, i.e. we start from sampling prior and \n"); |
---|
12001 | MrBayesPrint (" finish close to posterior. \n"); |
---|
12002 | MrBayesPrint (" \n"); |
---|
12003 | MrBayesPrint (" The 'Ss' procedure uses the same machinery as the standard 'Mcmc' algorithm, \n"); |
---|
12004 | MrBayesPrint (" and shares most of its parameters with the 'Mcmc' and 'Mcmcp' commands. All \n"); |
---|
12005 | MrBayesPrint (" 'Mcmc' parameters, except those related to burnin, have the same meaning and \n"); |
---|
12006 | MrBayesPrint (" usage in the 'Ss' command as they have in the 'Mcmc' command. The 'Mcmc' \n"); |
---|
12007 | MrBayesPrint (" burnin parameters are used to set up burnin within each step. The 'Ss' command\n"); |
---|
12008 | MrBayesPrint (" also uses its own burnin parameter, 'Burninss' (see below for details). The \n"); |
---|
12009 | MrBayesPrint (" 'Ss' command also has its own parameters for specifying the number of steps \n"); |
---|
12010 | MrBayesPrint (" and the shape of the Beta distribution from which the beta values are computed\n"); |
---|
12011 | MrBayesPrint (" (see below). \n"); |
---|
12012 | MrBayesPrint (" \n"); |
---|
12013 | MrBayesPrint (" Note that the 'Ngen' parameter of 'Mcmc' is used to set the maximum number of \n"); |
---|
12014 | MrBayesPrint (" generations processed, including both the burnin and the following steps in \n"); |
---|
12015 | MrBayesPrint (" the stepping-stone sampling phase. For instance, assume that 'Burninss' is set\n"); |
---|
12016 | MrBayesPrint (" to '-1', 'Nsteps' to '49', 'Ngen' to '1000000' and 'Samplefreq' to '1000'. \n"); |
---|
12017 | MrBayesPrint (" We will then get 1,000 samples in total (1,000,000 / 1,000). These will fall \n"); |
---|
12018 | MrBayesPrint (" into 50 bins, one of which represents the burnin and is discarded. Each step \n"); |
---|
12019 | MrBayesPrint (" in the algorithm will thus be represented by 20 samples. \n"); |
---|
12020 | MrBayesPrint (" \n"); |
---|
12021 | MrBayesPrint (" More information on 'Mcmc' parameters is available in the help for the 'Mcmc' \n"); |
---|
12022 | MrBayesPrint (" and 'Mcmcp' commands. Only the exclusive 'Ss' parameters are listed below. \n"); |
---|
12023 | MrBayesPrint (" These can only be set up using the 'Ss' command, while the parameters shared \n"); |
---|
12024 | MrBayesPrint (" with 'Mcmc' and 'Mcmcp' can also be set up using those commands. \n"); |
---|
12025 | MrBayesPrint (" \n"); |
---|
12026 | MrBayesPrint (" The correct usage is \n"); |
---|
12027 | MrBayesPrint (" \n"); |
---|
12028 | MrBayesPrint (" ss <parameter>=<value> ... <parameter>=<value> \n"); |
---|
12029 | MrBayesPrint (" \n"); |
---|
12030 | MrBayesPrint (" Note that a command: \n"); |
---|
12031 | MrBayesPrint (" \n"); |
---|
12032 | MrBayesPrint (" ss <setting parameters shared with mcmc> <setting exclusive ss parameters> \n"); |
---|
12033 | MrBayesPrint (" \n"); |
---|
12034 | MrBayesPrint (" would be equivalent to executing two commands: \n"); |
---|
12035 | MrBayesPrint (" \n"); |
---|
12036 | MrBayesPrint (" mcmcp <setting parameters shared with mcmc>; \n"); |
---|
12037 | MrBayesPrint (" ss <setting exclusive ss parameters>; \n"); |
---|
12038 | MrBayesPrint (" \n"); |
---|
12039 | MrBayesPrint (" For more information on the stepping-stone algorithm, see: \n"); |
---|
12040 | MrBayesPrint (" \n"); |
---|
12041 | MrBayesPrint (" Xie, W., P. O. Lewis, Y. Fan, L. Kuo, and M.-H. Chen. 2011. Improving marginal\n"); |
---|
12042 | MrBayesPrint (" likelihood estimation for Bayesian phylogenetic model selection. Systematic\n"); |
---|
12043 | MrBayesPrint (" Biology 60:150-160. \n"); |
---|
12044 | MrBayesPrint (" \n"); |
---|
12045 | MrBayesPrint (" Available options: \n"); |
---|
12046 | MrBayesPrint (" (NB: Only exclusive ss parameters listed here. For additional parameters, see \n"); |
---|
12047 | MrBayesPrint (" help on 'mcmc' or 'mcmcp'. \n"); |
---|
12048 | MrBayesPrint (" \n"); |
---|
12049 | MrBayesPrint (" Alpha -- The beta values used in the stepping-stone sampling procedure \n"); |
---|
12050 | MrBayesPrint (" correspond to evenly spaced quantiles from a Beta('Alpha',1.0)\n"); |
---|
12051 | MrBayesPrint (" distribution. The parameter 'Alpha' determines the skewness of\n"); |
---|
12052 | MrBayesPrint (" the beta values. If 'Alpha' is set to '1.0', the beta values \n"); |
---|
12053 | MrBayesPrint (" would be spaced uniformly on the interval (0.0,1.0). However, \n"); |
---|
12054 | MrBayesPrint (" better results are obtained if the beta values are skewed. \n"); |
---|
12055 | MrBayesPrint (" Empirically, it was observed that 'Alpha' values in the range \n"); |
---|
12056 | MrBayesPrint (" of 0.3 to 0.5 produce the most accurate results. \n"); |
---|
12057 | MrBayesPrint (" Burninss -- Fixed number of samples discarded before sampling of the first\n"); |
---|
12058 | MrBayesPrint (" step starts. 'Burninss' can be specified using either a pos- \n"); |
---|
12059 | MrBayesPrint (" itive or a negative number. If the number is positive, it is \n"); |
---|
12060 | MrBayesPrint (" interpreted as the number of samples to discard as burnin. If \n"); |
---|
12061 | MrBayesPrint (" the number is negative, its absolute value is interpreted as \n"); |
---|
12062 | MrBayesPrint (" the length of the burnin in terms of the length of each of the\n"); |
---|
12063 | MrBayesPrint (" following steps in the stepping-stone algorithm. For instance,\n"); |
---|
12064 | MrBayesPrint (" a value of '-1' means that the length of the burnin is the \n"); |
---|
12065 | MrBayesPrint (" same as the length of each of the subsequent steps. \n"); |
---|
12066 | MrBayesPrint (" Nsteps -- Number of steps in the stepping-stone algorithm. Typically, a \n"); |
---|
12067 | MrBayesPrint (" number above 30 is sufficient for accurate results. \n"); |
---|
12068 | MrBayesPrint (" FromPrior -- If it is set to 'Yes', it indicates that in the first step we \n"); |
---|
12069 | MrBayesPrint (" sample from the prior, with each consequtive step we sample \n"); |
---|
12070 | MrBayesPrint (" closer to the posterior. 'No' indicates the opposite direction\n"); |
---|
12071 | MrBayesPrint (" of power posterior change, i.e. in the first step we sample \n"); |
---|
12072 | MrBayesPrint (" close to the posterior, and with each consequtive step we \n"); |
---|
12073 | MrBayesPrint (" sample closer to the prior. \n"); |
---|
12074 | MrBayesPrint (" \n"); |
---|
12075 | MrBayesPrint (" Current settings: \n"); |
---|
12076 | MrBayesPrint (" \n"); |
---|
12077 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
12078 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
12079 | MrBayesPrint (" Alpha <number> %1.2lf\n", chainParams.alphaSS); |
---|
12080 | MrBayesPrint (" BurninSS <number> %d\n", chainParams.burninSS); |
---|
12081 | MrBayesPrint (" Nsteps <number> %d\n", chainParams.numStepsSS); |
---|
12082 | MrBayesPrint (" FromPrior Yes/No %s \n", chainParams.startFromPriorSS == YES ? "Yes" : "No"); |
---|
12083 | MrBayesPrint (" \n"); |
---|
12084 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12085 | } |
---|
12086 | else if (!strcmp(helpTkn, "Ssp")) |
---|
12087 | { |
---|
12088 | PrintYesNo (chainParams.saveBrlens, yesNoStr); |
---|
12089 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12090 | MrBayesPrint (" Ssp \n"); |
---|
12091 | MrBayesPrint (" \n"); |
---|
12092 | MrBayesPrint (" This command sets the parameters of the stepping-stone sampling \n"); |
---|
12093 | MrBayesPrint (" analysis without actually starting the chain. This command is identical \n"); |
---|
12094 | MrBayesPrint (" in all respects to Ss, except that the analysis will not start after \n"); |
---|
12095 | MrBayesPrint (" this command is issued. For more details on the options, check the help \n"); |
---|
12096 | MrBayesPrint (" menu for Ss.\n"); |
---|
12097 | MrBayesPrint (" \n"); |
---|
12098 | MrBayesPrint (" Current settings: \n"); |
---|
12099 | MrBayesPrint (" \n"); |
---|
12100 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
12101 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
12102 | MrBayesPrint (" Alpha <number> %1.2lf\n", chainParams.alphaSS); |
---|
12103 | MrBayesPrint (" BurninSS <number> %d\n", chainParams.burninSS); |
---|
12104 | MrBayesPrint (" Nsteps <number> %d\n", chainParams.numStepsSS); |
---|
12105 | MrBayesPrint (" FromPrior Yes/No %s \n", chainParams.startFromPriorSS == YES ? "Yes" : "No"); |
---|
12106 | MrBayesPrint (" \n"); |
---|
12107 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12108 | } |
---|
12109 | else if (!strcmp(helpTkn, "Set")) |
---|
12110 | { |
---|
12111 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12112 | MrBayesPrint (" Set \n"); |
---|
12113 | MrBayesPrint (" \n"); |
---|
12114 | MrBayesPrint (" This command is used to set some general features of the model or program \n"); |
---|
12115 | MrBayesPrint (" behavior. The correct usage is \n"); |
---|
12116 | MrBayesPrint (" \n"); |
---|
12117 | MrBayesPrint (" set <parameter>=<value> ... <parameter>=<value> \n"); |
---|
12118 | MrBayesPrint (" \n"); |
---|
12119 | MrBayesPrint (" Available options: \n"); |
---|
12120 | MrBayesPrint (" \n"); |
---|
12121 | MrBayesPrint (" Seed -- Sets the seed number for the random number generator. The \n"); |
---|
12122 | MrBayesPrint (" random number seed is initialized haphazardly at the beg- \n"); |
---|
12123 | MrBayesPrint (" inning of each MrBayes session. This option allows you to \n"); |
---|
12124 | MrBayesPrint (" set the seed to some specific value, thereby allowing you \n"); |
---|
12125 | MrBayesPrint (" to exactly repeat an analysis. If the analysis uses swapping \n"); |
---|
12126 | MrBayesPrint (" between cold and heated chains, you must also set the swap \n"); |
---|
12127 | MrBayesPrint (" seed (see below) to exactly repeat the analysis. \n"); |
---|
12128 | MrBayesPrint (" Swapseed -- Sets the seed used for generating the swapping sequence \n"); |
---|
12129 | MrBayesPrint (" when Metropolis-coupled heated chains are used. This seed \n"); |
---|
12130 | MrBayesPrint (" is initialized haphazardly at the beginning of each MrBayes \n"); |
---|
12131 | MrBayesPrint (" session. This option allows you to set the seed to some \n"); |
---|
12132 | MrBayesPrint (" specific value, thereby allowing you to exactly repeat a \n"); |
---|
12133 | MrBayesPrint (" swap sequence. See also the 'Seed' option. \n"); |
---|
12134 | MrBayesPrint (" Dir -- The working directory. Specifies the absolute or relative path\n"); |
---|
12135 | MrBayesPrint (" to the working directory. If left empty, the working directory\n"); |
---|
12136 | MrBayesPrint (" is the current directory. \n"); |
---|
12137 | MrBayesPrint (" Partition -- Set this option to a valid partition id, either the number or \n"); |
---|
12138 | MrBayesPrint (" name of a defined partition, to enforce a specific partition- \n"); |
---|
12139 | MrBayesPrint (" ing of the data. When a data matrix is read in, a partition \n"); |
---|
12140 | MrBayesPrint (" called \"Default\" is automatically created. It divides the \n"); |
---|
12141 | MrBayesPrint (" data into one part for each data type. If you only have one \n"); |
---|
12142 | MrBayesPrint (" data type, DNA for instance, the default partition will not \n"); |
---|
12143 | MrBayesPrint (" divide up the data at all. The default partition is always \n"); |
---|
12144 | MrBayesPrint (" the first partition, so 'set partition=1' is the same as \n"); |
---|
12145 | MrBayesPrint (" 'set partition=default'. \n"); |
---|
12146 | MrBayesPrint (" Speciespartition -- Set this option to a valid speciespartition id, either the\n"); |
---|
12147 | MrBayesPrint (" number or name of a defined speciespartition, to enforce a \n"); |
---|
12148 | MrBayesPrint (" specific partitioning of taxa to species. When a data matrix \n"); |
---|
12149 | MrBayesPrint (" is read in, a speciespartition called \"Default\" is auto- \n"); |
---|
12150 | MrBayesPrint (" matically created. It assigns one taxon for each species. The \n"); |
---|
12151 | MrBayesPrint (" default speciespartition is always the first speciespartition,\n"); |
---|
12152 | MrBayesPrint (" so 'set speciespartition=1' is the same as \n"); |
---|
12153 | MrBayesPrint (" 'set speciespartition=default'. \n"); |
---|
12154 | MrBayesPrint (" Autoclose -- If autoclose is set to 'yes', then the program will not prompt\n"); |
---|
12155 | MrBayesPrint (" you during the course of executing a file. This is particular-\n"); |
---|
12156 | MrBayesPrint (" ly useful when you run MrBayes in batch mode. \n"); |
---|
12157 | MrBayesPrint (" Nowarnings -- If nowarnings is set to yes, then the program will not prompt \n"); |
---|
12158 | MrBayesPrint (" you when overwriting or appending an ouput file that is al- \n"); |
---|
12159 | MrBayesPrint (" ready present. If 'nowarnings=no' (the default setting), then \n"); |
---|
12160 | MrBayesPrint (" the program propts the user before overwriting output files. \n"); |
---|
12161 | MrBayesPrint (" Autoreplace -- When nowarnings is set to yes, then MrBayes will by default \n"); |
---|
12162 | MrBayesPrint (" overwrite output files that already exists. This may cause \n"); |
---|
12163 | MrBayesPrint (" irrecoverable loss of previous results if you have not removed\n"); |
---|
12164 | MrBayesPrint (" or renamed the files from previous runs. To override this be- \n"); |
---|
12165 | MrBayesPrint (" havior, set autooverwrite to no, in which case new output will\n"); |
---|
12166 | MrBayesPrint (" be appended to existing files instead. \n"); |
---|
12167 | MrBayesPrint (" Quitonerror -- If quitonerror is set to yes, then the program will quit when \n"); |
---|
12168 | MrBayesPrint (" an error is encountered, after printing an error message. If \n"); |
---|
12169 | MrBayesPrint (" quitonerror is set to no (the default setting), then the \n"); |
---|
12170 | MrBayesPrint (" program will wait for additional commands from the command \n"); |
---|
12171 | MrBayesPrint (" line after the error message is printed. \n"); |
---|
12172 | MrBayesPrint (" Scientific -- Set this option to 'Yes' to write sampled values to file in \n"); |
---|
12173 | MrBayesPrint (" scientific format and to 'No' to write them in fixed format. \n"); |
---|
12174 | MrBayesPrint (" Fixed format is easier for humans to read but you risk losing \n"); |
---|
12175 | MrBayesPrint (" precision for small numbers. For instance, sampled values that\n"); |
---|
12176 | MrBayesPrint (" are less than 1E-6 will print to file as '0.000000' if fixed \n"); |
---|
12177 | MrBayesPrint (" format is used and 'precision' is set to 6. \n"); |
---|
12178 | MrBayesPrint (" Precision -- Precision allows you to set the number of decimals to be prin-\n"); |
---|
12179 | MrBayesPrint (" ted when sampled values are written to file. Precision must be\n"); |
---|
12180 | MrBayesPrint (" in the range 3 to 15. \n"); |
---|
12181 | #if defined (BEAGLE_ENABLED) |
---|
12182 | MrBayesPrint (" Usebeagle -- Set this option to 'Yes' to attempt to use the BEAGLE library \n"); |
---|
12183 | MrBayesPrint (" to compute the phylogenetic likelihood on a variety of high- \n"); |
---|
12184 | MrBayesPrint (" performance hardware including multicore CPUs and GPUs. Some \n"); |
---|
12185 | MrBayesPrint (" models in MrBayes are not yet supported by BEAGLE. \n"); |
---|
12186 | MrBayesPrint (" Beagledevice -- Set this option to 'GPU' or 'CPU' to select processor. \n"); |
---|
12187 | MrBayesPrint (" Beagleprecision -- Selection 'Single' or 'Double' precision computation. \n"); |
---|
12188 | MrBayesPrint (" Beaglescaling -- 'Always' rescales partial likelihoods at each evaluation. \n"); |
---|
12189 | MrBayesPrint (" 'Dynamic' rescales less frequently and should run faster. \n"); |
---|
12190 | MrBayesPrint (" Beaglesse -- Use SSE instructions on Intel CPU processors. \n"); |
---|
12191 | MrBayesPrint (" Beagleopenmp -- Use OpenMP to parallelize across multi-core CPU processors. \n"); |
---|
12192 | #endif |
---|
12193 | #if defined (THREADS_ENABLED) |
---|
12194 | MrBayesPrint (" Beaglethreads -- Set this option to 'Yes' to employ multiple threads to drive \n"); |
---|
12195 | MrBayesPrint (" multiple BEAGLE resource simultaneously. This is highly \n"); |
---|
12196 | MrBayesPrint (" recommended for more than one GPU, and for sufficiently large\n"); |
---|
12197 | MrBayesPrint (" data partitions, multi-core CPUs should also demonstrate \n"); |
---|
12198 | MrBayesPrint (" speed-ups. \n"); |
---|
12199 | #endif |
---|
12200 | MrBayesPrint (" \n"); |
---|
12201 | MrBayesPrint (" Current settings: \n"); |
---|
12202 | MrBayesPrint (" \n"); |
---|
12203 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
12204 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
12205 | MrBayesPrint (" Seed <number> %ld \n", globalSeed); |
---|
12206 | MrBayesPrint (" Swapseed <number> %ld \n", swapSeed); |
---|
12207 | MrBayesPrint (" Dir <name> \"%s\"\n", workingDir); |
---|
12208 | if (defMatrix == YES) |
---|
12209 | MrBayesPrint (" Partition <name> %s\n", partitionNames[partitionNum]); |
---|
12210 | else |
---|
12211 | MrBayesPrint (" Partition <name> \"\"\n"); |
---|
12212 | if (defTaxa == YES) |
---|
12213 | MrBayesPrint (" Speciespartition <name> %s\n", speciespartitionNames[speciespartitionNum]); |
---|
12214 | else |
---|
12215 | MrBayesPrint (" Speciespartition <name> \"\"\n"); |
---|
12216 | MrBayesPrint (" Autoclose Yes/No %s \n", autoClose == YES ? "Yes" : "No"); |
---|
12217 | MrBayesPrint (" Nowarnings Yes/No %s \n", noWarn == YES ? "Yes" : "No"); |
---|
12218 | MrBayesPrint (" Autoreplace Yes/No %s \n", autoOverwrite == YES ? "Yes" : "No"); |
---|
12219 | MrBayesPrint (" Quitonerror Yes/No %s \n", quitOnError == YES ? "Yes" : "No"); |
---|
12220 | MrBayesPrint (" Sientific Yes/No %s \n", scientific == YES ? "Yes" : "No"); |
---|
12221 | MrBayesPrint (" Precision <number> %d \n", precision); |
---|
12222 | #if defined (BEAGLE_ENABLED) |
---|
12223 | MrBayesPrint (" Usebeagle Yes/No %s \n", tryToUseBEAGLE == YES ? "Yes" : "No"); |
---|
12224 | MrBayesPrint (" Beagledevice CPU/GPU %s \n", beagleFlags & BEAGLE_FLAG_PROCESSOR_GPU ? "GPU" : "CPU"); |
---|
12225 | MrBayesPrint (" Beagleprecision Single/Double %s \n", beagleFlags & BEAGLE_FLAG_PRECISION_SINGLE ? "Single" : "Double"); |
---|
12226 | MrBayesPrint (" Beaglescaling Always/Dynamic %s \n", beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS ? "Always" : "Dynamic"); |
---|
12227 | MrBayesPrint (" Beaglesse Yes/No %s \n", beagleFlags & BEAGLE_FLAG_VECTOR_SSE ? "Yes" : "No"); |
---|
12228 | MrBayesPrint (" Beagleopenmp Yes/No %s \n", beagleFlags & BEAGLE_FLAG_THREADING_OPENMP ? "Yes" : "No"); |
---|
12229 | #endif |
---|
12230 | #if defined (THREADS_ENABLED) |
---|
12231 | MrBayesPrint (" Beaglethreads Yes/No %s \n", tryToUseThreads == YES ? "Yes" : "No"); |
---|
12232 | #endif |
---|
12233 | MrBayesPrint (" \n"); |
---|
12234 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12235 | } |
---|
12236 | else if (!strcmp(helpTkn, "Charset")) |
---|
12237 | { |
---|
12238 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12239 | MrBayesPrint (" Charset \n"); |
---|
12240 | MrBayesPrint (" \n"); |
---|
12241 | MrBayesPrint (" This command defines a character set. The format for the charset command \n"); |
---|
12242 | MrBayesPrint (" is \n"); |
---|
12243 | MrBayesPrint (" \n"); |
---|
12244 | MrBayesPrint (" charset <name> = <character numbers> \n"); |
---|
12245 | MrBayesPrint (" \n"); |
---|
12246 | MrBayesPrint (" For example, \"charset first_pos = 1-720\\3\" defines a character set \n"); |
---|
12247 | MrBayesPrint (" called \"first_pos\" that includes every third site from 1 to 720. \n"); |
---|
12248 | MrBayesPrint (" The character set name cannot have any spaces in it. The slash (\\) \n"); |
---|
12249 | MrBayesPrint (" is a nifty way of telling the program to assign every third (or \n"); |
---|
12250 | MrBayesPrint (" second, or fifth, or whatever) character to the character set. \n"); |
---|
12251 | MrBayesPrint (" This option is best used not from the command line, but rather as a \n"); |
---|
12252 | MrBayesPrint (" line in the mrbayes block of a file. Note that you can use \".\" to \n"); |
---|
12253 | MrBayesPrint (" stand in for the last character (e.g., charset 1-.\\3). \n"); |
---|
12254 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12255 | } |
---|
12256 | else if (!strcmp(helpTkn, "Outgroup")) |
---|
12257 | { |
---|
12258 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12259 | MrBayesPrint (" Outgroup \n"); |
---|
12260 | MrBayesPrint (" \n"); |
---|
12261 | MrBayesPrint (" This command assigns a taxon to the outgroup. The correct usage is: \n"); |
---|
12262 | MrBayesPrint (" \n"); |
---|
12263 | MrBayesPrint (" outgroup <number>/<taxon name> \n"); |
---|
12264 | MrBayesPrint (" \n"); |
---|
12265 | MrBayesPrint (" For example, \"outgroup 3\" assigns the third taxon in the matrix to be \n"); |
---|
12266 | MrBayesPrint (" the outgroup. Similarly, \"outgroup Homo_sapiens\" assings the taxon \n"); |
---|
12267 | MrBayesPrint (" \"Homo_sapiens\" to be the outgroup (assuming that there is a taxon named \n"); |
---|
12268 | MrBayesPrint (" \"Homo_sapiens\" in the matrix). Only a single taxon can be assigned to \n"); |
---|
12269 | MrBayesPrint (" be the outgroup. \n"); |
---|
12270 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12271 | } |
---|
12272 | else if (!strcmp(helpTkn, "Showusertrees")) |
---|
12273 | { |
---|
12274 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12275 | MrBayesPrint (" Showusertrees \n"); |
---|
12276 | MrBayesPrint (" \n"); |
---|
12277 | MrBayesPrint (" This command shows the currently defined user trees. The correct usage \n"); |
---|
12278 | MrBayesPrint (" is \"showusertrees\". \n"); |
---|
12279 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12280 | } |
---|
12281 | else if (!strcmp(helpTkn, "Showmcmctrees")) |
---|
12282 | { |
---|
12283 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12284 | MrBayesPrint (" Showmcmctrees \n"); |
---|
12285 | MrBayesPrint (" \n"); |
---|
12286 | MrBayesPrint (" This command shows the current trees used by the Markov chains. \n"); |
---|
12287 | MrBayesPrint (" is \"showmcmctrees\". \n"); |
---|
12288 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12289 | } |
---|
12290 | else if (!strcmp(helpTkn, "Deroot")) |
---|
12291 | { |
---|
12292 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12293 | MrBayesPrint (" Deroot \n"); |
---|
12294 | MrBayesPrint (" \n"); |
---|
12295 | MrBayesPrint (" This command deroots the user tree. If the tree is already unrooted, a \n"); |
---|
12296 | MrBayesPrint (" warning is issued. The correct usage is \"deroot\". \n"); |
---|
12297 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12298 | } |
---|
12299 | else if (!strcmp(helpTkn, "Root")) |
---|
12300 | { |
---|
12301 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12302 | MrBayesPrint (" Root \n"); |
---|
12303 | MrBayesPrint (" \n"); |
---|
12304 | MrBayesPrint (" This command roots the tree. If the tree is already rooted, a warning \n"); |
---|
12305 | MrBayesPrint (" is issued. The tree is rooted at the midpoint between the outgroup species \n"); |
---|
12306 | MrBayesPrint (" and the ingroup species. The correct usage is \"root\". \n"); |
---|
12307 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12308 | } |
---|
12309 | else if (!strcmp(helpTkn, "Taxset")) |
---|
12310 | { |
---|
12311 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12312 | MrBayesPrint (" Taxset \n"); |
---|
12313 | MrBayesPrint (" \n"); |
---|
12314 | MrBayesPrint (" This command defines a taxon set. The format for the taxset command \n"); |
---|
12315 | MrBayesPrint (" is \n"); |
---|
12316 | MrBayesPrint (" \n"); |
---|
12317 | MrBayesPrint (" taxset <name> = <taxon names or numbers> \n"); |
---|
12318 | MrBayesPrint (" \n"); |
---|
12319 | MrBayesPrint (" For example, \"taxset apes = Homo Pan Gorilla Orang gibbon\" defines a \n"); |
---|
12320 | MrBayesPrint (" taxon set called \"apes\" that includes five taxa (namely, apes). \n"); |
---|
12321 | MrBayesPrint (" You can assign up to 30 taxon sets. This option is best used \n"); |
---|
12322 | MrBayesPrint (" not from the command line but rather as a line in the mrbayes block \n"); |
---|
12323 | MrBayesPrint (" of a file. \n"); |
---|
12324 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12325 | } |
---|
12326 | else if (!strcmp(helpTkn, "Taxlabels")) |
---|
12327 | { |
---|
12328 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12329 | MrBayesPrint (" Taxlabels \n"); |
---|
12330 | MrBayesPrint (" \n"); |
---|
12331 | MrBayesPrint (" This command defines taxon labels. It could be used within taxa block. \n"); |
---|
12332 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12333 | } |
---|
12334 | else if (!strcmp(helpTkn, "Charstat")) |
---|
12335 | { |
---|
12336 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12337 | MrBayesPrint (" Charstat \n"); |
---|
12338 | MrBayesPrint (" \n"); |
---|
12339 | MrBayesPrint (" This command shows the status of all the characters. The correct usage \n"); |
---|
12340 | MrBayesPrint (" is \n"); |
---|
12341 | MrBayesPrint (" \n"); |
---|
12342 | MrBayesPrint (" charstat \n"); |
---|
12343 | MrBayesPrint (" \n"); |
---|
12344 | MrBayesPrint (" After typing \"charstat\", the character number, whether it is excluded \n"); |
---|
12345 | MrBayesPrint (" or included, and the partition identity are shown. The output is paused \n"); |
---|
12346 | MrBayesPrint (" every 100 characters. This pause can be turned off by setting autoclose \n"); |
---|
12347 | MrBayesPrint (" to \"yes\" (set autoclose=yes). \n"); |
---|
12348 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12349 | } |
---|
12350 | else if (!strcmp(helpTkn, "Taxastat")) |
---|
12351 | { |
---|
12352 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12353 | MrBayesPrint (" Taxastat \n"); |
---|
12354 | MrBayesPrint (" \n"); |
---|
12355 | MrBayesPrint (" This command shows the status of all the taxa. The correct usage is \n"); |
---|
12356 | MrBayesPrint (" \n"); |
---|
12357 | MrBayesPrint (" taxastat \n"); |
---|
12358 | MrBayesPrint (" \n"); |
---|
12359 | MrBayesPrint (" After typing \"taxastat\", the taxon number, name, and whether it is \n"); |
---|
12360 | MrBayesPrint (" excluded or included are shown. \n"); |
---|
12361 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12362 | } |
---|
12363 | else if (!strcmp(helpTkn, "Partition")) |
---|
12364 | { |
---|
12365 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12366 | MrBayesPrint (" Partition \n"); |
---|
12367 | MrBayesPrint (" \n"); |
---|
12368 | MrBayesPrint (" This command allows you to specify a character partition. The format for \n"); |
---|
12369 | MrBayesPrint (" this command is \n"); |
---|
12370 | MrBayesPrint (" \n"); |
---|
12371 | MrBayesPrint (" partition <name> = <num parts>:<chars in first>, ...,<chars in last> \n"); |
---|
12372 | MrBayesPrint (" \n"); |
---|
12373 | MrBayesPrint (" For example, \"partition by_codon = 3:1st_pos,2nd_pos,3rd_pos\" specifies \n"); |
---|
12374 | MrBayesPrint (" a partition called \"by_codon\" which consists of three parts (first, \n"); |
---|
12375 | MrBayesPrint (" second, and third codon positions). Here, we are assuming that the sites \n"); |
---|
12376 | MrBayesPrint (" in each partition were defined using the charset command. You can specify \n"); |
---|
12377 | MrBayesPrint (" a partition without using charset as follows: \n"); |
---|
12378 | MrBayesPrint (" \n"); |
---|
12379 | MrBayesPrint (" partition by_codon = 3:1 4 6 9 12,2 5 7 10 13,3 6 8 11 14 \n"); |
---|
12380 | MrBayesPrint (" \n"); |
---|
12381 | MrBayesPrint (" However, we recommend that you use the charsets to define a set of char- \n"); |
---|
12382 | MrBayesPrint (" acters and then use these predefined sets when defining the partition. \n"); |
---|
12383 | MrBayesPrint (" Also, it makes more sense to define a partition as a line in the mrbayes \n"); |
---|
12384 | MrBayesPrint (" block than to issue the command from the command line (then again, you \n"); |
---|
12385 | MrBayesPrint (" may be a masochist, and want to do extra work). \n"); |
---|
12386 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12387 | } |
---|
12388 | else if (!strcmp(helpTkn, "Exclude")) |
---|
12389 | { |
---|
12390 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12391 | MrBayesPrint (" Exclude \n"); |
---|
12392 | MrBayesPrint (" \n"); |
---|
12393 | MrBayesPrint (" This command excludes characters from the analysis. The correct usage is \n"); |
---|
12394 | MrBayesPrint (" \n"); |
---|
12395 | MrBayesPrint (" exclude <number> <number> <number> \n"); |
---|
12396 | MrBayesPrint (" \n"); |
---|
12397 | MrBayesPrint (" or \n"); |
---|
12398 | MrBayesPrint (" \n"); |
---|
12399 | MrBayesPrint (" exclude <number> - <number> \n"); |
---|
12400 | MrBayesPrint (" \n"); |
---|
12401 | MrBayesPrint (" or \n"); |
---|
12402 | MrBayesPrint (" \n"); |
---|
12403 | MrBayesPrint (" exclude <charset> \n"); |
---|
12404 | MrBayesPrint (" \n"); |
---|
12405 | MrBayesPrint (" or some combination thereof. Moreover, you can use the specifier \"\\\" to \n"); |
---|
12406 | MrBayesPrint (" exclude every nth character. For example, the following \n"); |
---|
12407 | MrBayesPrint (" \n"); |
---|
12408 | MrBayesPrint (" exclude 1-100\\3 \n"); |
---|
12409 | MrBayesPrint (" \n"); |
---|
12410 | MrBayesPrint (" would exclude every third character. As a specific example, \n"); |
---|
12411 | MrBayesPrint (" \n"); |
---|
12412 | MrBayesPrint (" exclude 2 3 10-14 22 \n"); |
---|
12413 | MrBayesPrint (" \n"); |
---|
12414 | MrBayesPrint (" excludes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also, \n"); |
---|
12415 | MrBayesPrint (" \n"); |
---|
12416 | MrBayesPrint (" exclude all \n"); |
---|
12417 | MrBayesPrint (" \n"); |
---|
12418 | MrBayesPrint (" excludes all of the characters from the analysis. Excluding all characters \n"); |
---|
12419 | MrBayesPrint (" does not leave you much information for inferring phylogeny. \n"); |
---|
12420 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12421 | } |
---|
12422 | else if (!strcmp(helpTkn, "Include")) |
---|
12423 | { |
---|
12424 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12425 | MrBayesPrint (" Include \n"); |
---|
12426 | MrBayesPrint (" \n"); |
---|
12427 | MrBayesPrint (" This command includes characters that were previously excluded from the \n"); |
---|
12428 | MrBayesPrint (" analysis. The correct usage is \n"); |
---|
12429 | MrBayesPrint (" \n"); |
---|
12430 | MrBayesPrint (" include <number> <number> <number> \n"); |
---|
12431 | MrBayesPrint (" \n"); |
---|
12432 | MrBayesPrint (" or \n"); |
---|
12433 | MrBayesPrint (" \n"); |
---|
12434 | MrBayesPrint (" include <number> - <number> \n"); |
---|
12435 | MrBayesPrint (" \n"); |
---|
12436 | MrBayesPrint (" or \n"); |
---|
12437 | MrBayesPrint (" \n"); |
---|
12438 | MrBayesPrint (" include <charset> \n"); |
---|
12439 | MrBayesPrint (" \n"); |
---|
12440 | MrBayesPrint (" or some combination thereof. Moreover, you can use the specifier \"\\\" to \n"); |
---|
12441 | MrBayesPrint (" include every nth character. For example, the following \n"); |
---|
12442 | MrBayesPrint (" \n"); |
---|
12443 | MrBayesPrint (" include 1-100\\3 \n"); |
---|
12444 | MrBayesPrint (" \n"); |
---|
12445 | MrBayesPrint (" would include every third character. As a specific example, \n"); |
---|
12446 | MrBayesPrint (" \n"); |
---|
12447 | MrBayesPrint (" include 2 3 10-14 22 \n"); |
---|
12448 | MrBayesPrint (" \n"); |
---|
12449 | MrBayesPrint (" includes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also, \n"); |
---|
12450 | MrBayesPrint (" \n"); |
---|
12451 | MrBayesPrint (" include all \n"); |
---|
12452 | MrBayesPrint (" \n"); |
---|
12453 | MrBayesPrint (" includes all of the characters in the analysis. Including all of the \n"); |
---|
12454 | MrBayesPrint (" characters (even if many of them are bad) is a very total-evidence-like \n"); |
---|
12455 | MrBayesPrint (" thing to do. Doing this will make a certain group of people very happy. \n"); |
---|
12456 | MrBayesPrint (" On the other hand, simply using this program would make those same people \n"); |
---|
12457 | MrBayesPrint (" unhappy. \n"); |
---|
12458 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12459 | } |
---|
12460 | else if (!strcmp(helpTkn, "Delete")) |
---|
12461 | { |
---|
12462 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12463 | MrBayesPrint (" Delete \n"); |
---|
12464 | MrBayesPrint (" \n"); |
---|
12465 | MrBayesPrint (" This command deletes taxa from the analysis. The correct usage is: \n"); |
---|
12466 | MrBayesPrint (" \n"); |
---|
12467 | MrBayesPrint (" delete <name and/or number and/or taxset> ... \n"); |
---|
12468 | MrBayesPrint (" \n"); |
---|
12469 | MrBayesPrint (" A list of the taxon names or taxon numbers (labelled 1 to ntax in the order \n"); |
---|
12470 | MrBayesPrint (" in the matrix) or taxset(s) can be used. For example, the following: \n"); |
---|
12471 | MrBayesPrint (" \n"); |
---|
12472 | MrBayesPrint (" delete 1 2 Homo_sapiens \n"); |
---|
12473 | MrBayesPrint (" \n"); |
---|
12474 | MrBayesPrint (" deletes taxa 1, 2, and the taxon labelled Homo_sapiens from the analysis. \n"); |
---|
12475 | MrBayesPrint (" You can also use \"all\" to delete all of the taxa. For example, \n"); |
---|
12476 | MrBayesPrint (" \n"); |
---|
12477 | MrBayesPrint (" delete all \n"); |
---|
12478 | MrBayesPrint (" \n"); |
---|
12479 | MrBayesPrint (" deletes all of the taxa from the analysis. Of course, a phylogenetic anal- \n"); |
---|
12480 | MrBayesPrint (" ysis that does not include any taxa is fairly uninteresting. \n"); |
---|
12481 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12482 | } |
---|
12483 | else if (!strcmp(helpTkn, "Restore")) |
---|
12484 | { |
---|
12485 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12486 | MrBayesPrint (" Restore \n"); |
---|
12487 | MrBayesPrint (" \n"); |
---|
12488 | MrBayesPrint (" This command restores taxa to the analysis. The correct usage is: \n"); |
---|
12489 | MrBayesPrint (" \n"); |
---|
12490 | MrBayesPrint (" restore <name and/or number and/or taxset> ... \n"); |
---|
12491 | MrBayesPrint (" \n"); |
---|
12492 | MrBayesPrint (" A list of the taxon names or taxon numbers (labelled 1 to ntax in the order \n"); |
---|
12493 | MrBayesPrint (" in the matrix) or taxset(s) can be used. For example, the following: \n"); |
---|
12494 | MrBayesPrint (" \n"); |
---|
12495 | MrBayesPrint (" restore 1 2 Homo_sapiens \n"); |
---|
12496 | MrBayesPrint (" \n"); |
---|
12497 | MrBayesPrint (" restores taxa 1, 2, and the taxon labelled Homo_sapiens to the analysis. \n"); |
---|
12498 | MrBayesPrint (" You can also use \"all\" to restore all of the taxa. For example, \n"); |
---|
12499 | MrBayesPrint (" \n"); |
---|
12500 | MrBayesPrint (" restore all \n"); |
---|
12501 | MrBayesPrint (" \n"); |
---|
12502 | MrBayesPrint (" restores all of the taxa to the analysis. \n"); |
---|
12503 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12504 | } |
---|
12505 | else if (!strcmp(helpTkn, "Quit")) |
---|
12506 | { |
---|
12507 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12508 | MrBayesPrint (" Quit \n"); |
---|
12509 | MrBayesPrint (" \n"); |
---|
12510 | MrBayesPrint (" This command quits the program. The correct usage is: \n"); |
---|
12511 | MrBayesPrint (" \n"); |
---|
12512 | MrBayesPrint (" quit \n"); |
---|
12513 | MrBayesPrint (" \n"); |
---|
12514 | MrBayesPrint (" It is a very easy command to use properly. \n"); |
---|
12515 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12516 | } |
---|
12517 | else if (!strcmp(helpTkn, "Disclaimer")) |
---|
12518 | { |
---|
12519 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12520 | MrBayesPrint (" Disclaimer \n"); |
---|
12521 | MrBayesPrint (" \n"); |
---|
12522 | MrBayesPrint (" This command shows the disclaimer for the program. In short, the disclaimer \n"); |
---|
12523 | MrBayesPrint (" states that the authors are not responsible for any silly things you may do \n"); |
---|
12524 | MrBayesPrint (" to your computer or any unforseen but possibly nasty things the computer \n"); |
---|
12525 | MrBayesPrint (" program may inadvertently do to you. \n"); |
---|
12526 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12527 | } |
---|
12528 | else if (!strcmp(helpTkn, "Unlink")) |
---|
12529 | { |
---|
12530 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12531 | MrBayesPrint (" Unlink \n"); |
---|
12532 | MrBayesPrint (" \n"); |
---|
12533 | MrBayesPrint (" This command unlinks model parameters across partitions of the data. The \n"); |
---|
12534 | MrBayesPrint (" correct usage is: \n"); |
---|
12535 | MrBayesPrint (" \n"); |
---|
12536 | MrBayesPrint (" unlink <parameter name> = (<all> or <partition list>) \n"); |
---|
12537 | MrBayesPrint (" \n"); |
---|
12538 | MrBayesPrint (" A little background is necessary to understand this command. Upon exe- \n"); |
---|
12539 | MrBayesPrint (" cution of a file, a default partition is set up. This partition refer- \n"); |
---|
12540 | MrBayesPrint (" enced either by its name (\"default\") or number (0). If your data are \n"); |
---|
12541 | MrBayesPrint (" all of one type, then this default partition does not actually divide up \n"); |
---|
12542 | MrBayesPrint (" your characters. However, if your datatype is mixed, then the default \n"); |
---|
12543 | MrBayesPrint (" partition contains as many divisions as there are datatypes in your \n"); |
---|
12544 | MrBayesPrint (" character matrix. Of course, you can also define other partitions, and \n"); |
---|
12545 | MrBayesPrint (" switch among them using the set command (\"set partition=<name/number>\"). \n"); |
---|
12546 | MrBayesPrint (" Importantly, you can also assign model parameters to individual part- \n"); |
---|
12547 | MrBayesPrint (" itions or to groups of them using the \"applyto\" option in lset and \n"); |
---|
12548 | MrBayesPrint (" prset. When the program attempts to perform an analysis, the model is \n"); |
---|
12549 | MrBayesPrint (" set for individual partitions. If the same parameter applies to differ- \n"); |
---|
12550 | MrBayesPrint (" partitions and if that parameter has the same prior, then the program \n"); |
---|
12551 | MrBayesPrint (" will link the parameters: that is, it will use a single value for the \n"); |
---|
12552 | MrBayesPrint (" parameter. The program's default, then, is to strive for parsimony. \n"); |
---|
12553 | MrBayesPrint (" However, there are lots of cases where you may want unlink a parameter \n"); |
---|
12554 | MrBayesPrint (" across partitions. For example, you may want a different transition/ \n"); |
---|
12555 | MrBayesPrint (" transversion rate ratio to apply to different partitions. This command \n"); |
---|
12556 | MrBayesPrint (" allows you to unlink the parameters, or to make them different across \n"); |
---|
12557 | MrBayesPrint (" partitions. The converse of this command is \"link\", which links to- \n"); |
---|
12558 | MrBayesPrint (" gether parameters that were previously told to be different. The list \n"); |
---|
12559 | MrBayesPrint (" of parameters that can be unlinked includes: \n"); |
---|
12560 | MrBayesPrint (" \n"); |
---|
12561 | MrBayesPrint (" Tratio -- Transition/transversion rate ratio \n"); |
---|
12562 | MrBayesPrint (" Revmat -- Substitution rates of GTR model \n"); |
---|
12563 | MrBayesPrint (" Omega -- Nonsynonymous/synonymous rate ratio \n"); |
---|
12564 | MrBayesPrint (" Statefreq -- Character state frequencies \n"); |
---|
12565 | MrBayesPrint (" Shape -- Gamma shape parameter \n"); |
---|
12566 | MrBayesPrint (" Pinvar -- Proportion of invariable sites \n"); |
---|
12567 | MrBayesPrint (" Correlation -- Correlation parameter of autodiscrete gamma \n"); |
---|
12568 | MrBayesPrint (" Switchrates -- Switching rates for covarion model \n"); |
---|
12569 | MrBayesPrint (" Brlens -- Branch lengths of tree \n"); |
---|
12570 | MrBayesPrint (" Topology -- Topology of tree \n"); |
---|
12571 | MrBayesPrint (" Speciationrates -- Speciation rates for birth-death process \n"); |
---|
12572 | MrBayesPrint (" Ratemultiplier -- Rate multiplier for partitions \n"); |
---|
12573 | MrBayesPrint (" Extinctionrates -- Extinction rates for birth-death process \n"); |
---|
12574 | MrBayesPrint (" Theta -- Parameter for coalescence process \n"); |
---|
12575 | MrBayesPrint (" Growthrate -- Growth rate of coalescence process \n"); |
---|
12576 | MrBayesPrint (" Aamodel -- Aminoacid rate matrix \n"); |
---|
12577 | MrBayesPrint (" Cpprate -- Rate of Compound Poisson Process (CPP) \n"); |
---|
12578 | MrBayesPrint (" Cppmultdev -- Standard dev. of CPP rate multipliers (log scale) \n"); |
---|
12579 | MrBayesPrint (" Cppevents -- CPP events \n"); |
---|
12580 | MrBayesPrint (" TK02var -- Variance increase in TK02 relaxed clock model \n"); |
---|
12581 | MrBayesPrint (" TK02branchrates -- Branch rates of TK02 relaxed clock model \n"); |
---|
12582 | MrBayesPrint (" Igrvar -- Variance increase in IGR relaxed clock model \n"); |
---|
12583 | MrBayesPrint (" Igrbranchlens -- Branch lengths of IGR relaxed clock model \n"); |
---|
12584 | MrBayesPrint (" \n"); |
---|
12585 | MrBayesPrint (" For example, \n"); |
---|
12586 | MrBayesPrint (" \n"); |
---|
12587 | MrBayesPrint (" unlink shape=(all) \n"); |
---|
12588 | MrBayesPrint (" \n"); |
---|
12589 | MrBayesPrint (" unlinks the gamma shape parameter across all partitions of the data. \n"); |
---|
12590 | MrBayesPrint (" You can use \"showmodel\" to see the current linking status of the \n"); |
---|
12591 | MrBayesPrint (" characters. \n"); |
---|
12592 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12593 | } |
---|
12594 | else if (!strcmp(helpTkn, "Link")) |
---|
12595 | { |
---|
12596 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12597 | MrBayesPrint (" Link \n"); |
---|
12598 | MrBayesPrint (" \n"); |
---|
12599 | MrBayesPrint (" This command links model parameters across partitions of the data. The \n"); |
---|
12600 | MrBayesPrint (" correct usage is: \n"); |
---|
12601 | MrBayesPrint (" \n"); |
---|
12602 | MrBayesPrint (" link <parameter name> = (<all> or <partition list>) \n"); |
---|
12603 | MrBayesPrint (" \n"); |
---|
12604 | MrBayesPrint (" The list of parameters that can be linked includes: \n"); |
---|
12605 | MrBayesPrint (" \n"); |
---|
12606 | MrBayesPrint (" Tratio -- Transition/transversion rate ratio \n"); |
---|
12607 | MrBayesPrint (" Revmat -- Substitution rates of GTR model \n"); |
---|
12608 | MrBayesPrint (" Omega -- Nonsynonymous/synonymous rate ratio \n"); |
---|
12609 | MrBayesPrint (" Statefreq -- Character state frequencies \n"); |
---|
12610 | MrBayesPrint (" Shape -- Gamma shape parameter \n"); |
---|
12611 | MrBayesPrint (" Pinvar -- Proportion of invariable sites \n"); |
---|
12612 | MrBayesPrint (" Correlation -- Correlation parameter of autodiscrete gamma \n"); |
---|
12613 | MrBayesPrint (" Switchrates -- Switching rates for covarion model \n"); |
---|
12614 | MrBayesPrint (" Brlens -- Branch lengths of tree \n"); |
---|
12615 | MrBayesPrint (" Topology -- Topology of tree \n"); |
---|
12616 | MrBayesPrint (" Speciationrates -- Speciation rates for birth-death process \n"); |
---|
12617 | MrBayesPrint (" Extinctionrates -- Extinction rates for birth-death process \n"); |
---|
12618 | MrBayesPrint (" Theta -- Parameter for coalescence process \n"); |
---|
12619 | MrBayesPrint (" Growthrate -- Growth rate of coalescence process \n"); |
---|
12620 | MrBayesPrint (" Aamodel -- Aminoacid rate matrix \n"); |
---|
12621 | MrBayesPrint (" Cpprate -- Rate of Compound Poisson Process (CPP) \n"); |
---|
12622 | MrBayesPrint (" Cppmultdev -- Standard dev. of CPP rate multipliers (log scale) \n"); |
---|
12623 | MrBayesPrint (" Cppevents -- CPP events \n"); |
---|
12624 | MrBayesPrint (" TK02var -- Variance increase in TK02 relaxed clock model \n"); |
---|
12625 | MrBayesPrint (" TK02branchrates -- Branch rates of TK02 relaxed clock model \n"); |
---|
12626 | MrBayesPrint (" Igrvar -- Variance increase in IGR relaxed clock model \n"); |
---|
12627 | MrBayesPrint (" Igrbrlens -- Branch lengths of IGR relaxed clock model \n"); |
---|
12628 | MrBayesPrint (" \n"); |
---|
12629 | MrBayesPrint (" For example, \n"); |
---|
12630 | MrBayesPrint (" \n"); |
---|
12631 | MrBayesPrint (" link shape=(all) \n"); |
---|
12632 | MrBayesPrint (" \n"); |
---|
12633 | MrBayesPrint (" links the gamma shape parameter across all partitions of the data. \n"); |
---|
12634 | MrBayesPrint (" You can use \"showmodel\" to see the current linking status of the \n"); |
---|
12635 | MrBayesPrint (" characters. For more information on this command, see the help menu \n"); |
---|
12636 | MrBayesPrint (" for link's converse, unlink (\"help unlink\"); \n"); |
---|
12637 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12638 | } |
---|
12639 | else if (!strcmp(helpTkn, "Help")) |
---|
12640 | { |
---|
12641 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12642 | MrBayesPrint (" Help \n"); |
---|
12643 | MrBayesPrint (" \n"); |
---|
12644 | MrBayesPrint (" This command provides useful information on the use of this program. The \n"); |
---|
12645 | MrBayesPrint (" correct usage is \n"); |
---|
12646 | MrBayesPrint (" \n"); |
---|
12647 | MrBayesPrint (" help \n"); |
---|
12648 | MrBayesPrint (" \n"); |
---|
12649 | MrBayesPrint (" which gives a list of all available commands with a brief description of \n"); |
---|
12650 | MrBayesPrint (" each or \n"); |
---|
12651 | MrBayesPrint (" \n"); |
---|
12652 | MrBayesPrint (" help <command> \n"); |
---|
12653 | MrBayesPrint (" \n"); |
---|
12654 | MrBayesPrint (" which gives detailed information on the use of <command>. \n"); |
---|
12655 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12656 | } |
---|
12657 | else if (!strcmp(helpTkn, "Sump")) |
---|
12658 | { |
---|
12659 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12660 | MrBayesPrint (" Sump \n"); |
---|
12661 | MrBayesPrint (" \n"); |
---|
12662 | MrBayesPrint (" During an MCMC analysis, MrBayes prints the sampled parameter values to one or\n"); |
---|
12663 | MrBayesPrint (" more tab-delimited text files, one for each independent run in your analysis. \n"); |
---|
12664 | MrBayesPrint (" The command 'Sump' summarizes the information in this parameter file or these \n"); |
---|
12665 | MrBayesPrint (" parameter files. By default, the root of the parameter file name(s) is assumed\n"); |
---|
12666 | MrBayesPrint (" to be the name of the last matrix-containing nexus file. MrBayes also remem- \n"); |
---|
12667 | MrBayesPrint (" bers the number of independent runs in the last analysis that you set up, re- \n"); |
---|
12668 | MrBayesPrint (" gardless of whether you actually ran it. For instance, if there were two in- \n"); |
---|
12669 | MrBayesPrint (" dependent runs, which is the initial setting when you read in a new matrix, \n"); |
---|
12670 | MrBayesPrint (" MrBayes will assume that there are two parameter files with the endings \n"); |
---|
12671 | MrBayesPrint (" '.run1.p' and '.run2.p'. You can change the root of the file names and the \n"); |
---|
12672 | MrBayesPrint (" number of runs using the 'Filename' and 'Nruns' settings. \n"); |
---|
12673 | MrBayesPrint (" \n"); |
---|
12674 | MrBayesPrint (" When you invoke the 'Sump' command, three items are output: (1) a generation \n"); |
---|
12675 | MrBayesPrint (" plot of the likelihood values; (2) estimates of the marginal likelihood of \n"); |
---|
12676 | MrBayesPrint (" the model; and (3) a table with the mean, variance, and 95 percent credible \n"); |
---|
12677 | MrBayesPrint (" interval for the sampled parameters. All three items are output to screen. \n"); |
---|
12678 | MrBayesPrint (" The table of marginal likelihoods is also printed to a file with the ending \n"); |
---|
12679 | MrBayesPrint (" '.lstat' and the parameter table to a file with the ending '.pstat'. For some \n"); |
---|
12680 | MrBayesPrint (" model parameters, there may also be a '.mstat' file. \n"); |
---|
12681 | MrBayesPrint (" \n"); |
---|
12682 | MrBayesPrint (" When running 'Sump' you typically want to discard a specified number or \n"); |
---|
12683 | MrBayesPrint (" fraction of samples from the beginning of the chain as the burn in. This is \n"); |
---|
12684 | MrBayesPrint (" done using the same mechanism used by the 'mcmc' command. That is, if you \n"); |
---|
12685 | MrBayesPrint (" run an mcmc analysis with a relative burn in of 25 %% of samples for con- \n"); |
---|
12686 | MrBayesPrint (" vergence diagnostics, then the same burn in will be used for a subsequent \n"); |
---|
12687 | MrBayesPrint (" sump command, unless a different burn in is specified. That is, issuing \n"); |
---|
12688 | MrBayesPrint (" \n"); |
---|
12689 | MrBayesPrint (" sump \n"); |
---|
12690 | MrBayesPrint (" \n"); |
---|
12691 | MrBayesPrint (" immediately after 'mcmc', will result in using the same burn in settings as \n"); |
---|
12692 | MrBayesPrint (" for the 'mcmc' command. All burnin settings are reset to default values every \n"); |
---|
12693 | MrBayesPrint (" time a new matrix is read in, namely relative burnin ('relburnin=yes') with \n"); |
---|
12694 | MrBayesPrint (" 25 %% of samples discarded ('burninfrac = 0.25'). \n"); |
---|
12695 | MrBayesPrint (" \n"); |
---|
12696 | MrBayesPrint (" Options: \n"); |
---|
12697 | MrBayesPrint (" \n"); |
---|
12698 | MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n"); |
---|
12699 | MrBayesPrint (" samples will be discarded as burnin when calculating summary \n"); |
---|
12700 | MrBayesPrint (" statistics. The proportion to be discarded is set with \n"); |
---|
12701 | MrBayesPrint (" 'Burninfrac' (see below). When the 'Relburnin' option is set \n"); |
---|
12702 | MrBayesPrint (" to 'No', then a specific number of samples is discarded \n"); |
---|
12703 | MrBayesPrint (" instead. This number is set by 'Burnin' (see below). Note that\n"); |
---|
12704 | MrBayesPrint (" the burnin setting is shared across the 'sumt', 'sump', and \n"); |
---|
12705 | MrBayesPrint (" 'mcmc' commands. \n"); |
---|
12706 | MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n"); |
---|
12707 | MrBayesPrint (" be discarded when summary statistics are calculated. The \n"); |
---|
12708 | MrBayesPrint (" value of this option is only applicable when 'Relburnin' is \n"); |
---|
12709 | MrBayesPrint (" set to 'No'. \n"); |
---|
12710 | MrBayesPrint (" Burninfrac -- Determines the fraction of samples that will be discarded when\n"); |
---|
12711 | MrBayesPrint (" summary statistics are calculated. The setting only takes \n"); |
---|
12712 | MrBayesPrint (" effect if 'Relburnin' is set to 'Yes'. \n"); |
---|
12713 | MrBayesPrint (" Nruns -- Determines how many '.p' files from independent analyses that \n"); |
---|
12714 | MrBayesPrint (" will be summarized. If Nruns > 1 then the names of the files \n"); |
---|
12715 | MrBayesPrint (" are derived from 'Filename' by adding '.run1.p', '.run2.p', \n"); |
---|
12716 | MrBayesPrint (" etc. If Nruns=1, then the single file name is obtained by \n"); |
---|
12717 | MrBayesPrint (" adding '.p' to 'Filename'. \n"); |
---|
12718 | MrBayesPrint (" Filename -- The name of the file to be summarized. This is the base of the\n"); |
---|
12719 | MrBayesPrint (" file name to which endings are added according to the current \n"); |
---|
12720 | MrBayesPrint (" setting of the 'Nruns' parameter. If 'Nruns' is 1, then only \n"); |
---|
12721 | MrBayesPrint (" '.p' is added to the file name. Otherwise, the endings will \n"); |
---|
12722 | MrBayesPrint (" be '.run1.p', '.run2.p', etc. \n"); |
---|
12723 | MrBayesPrint (" Outputname -- Base name of the file(s) to which 'Sump' results will be \n"); |
---|
12724 | MrBayesPrint (" printed. \n"); |
---|
12725 | MrBayesPrint (" Hpd -- Determines whether credibility intervals will be given as the \n"); |
---|
12726 | MrBayesPrint (" region of Highest Posterior Density ('Yes') or as the interval\n"); |
---|
12727 | MrBayesPrint (" containing the median 95 %% of sampled values ('No'). \n"); |
---|
12728 | MrBayesPrint (" Minprob -- Determines the minimum probability of submodels to be included\n"); |
---|
12729 | MrBayesPrint (" in summary statistics. Only applicable to models that explore \n"); |
---|
12730 | MrBayesPrint (" submodel spaces, like 'nst=mixed' and 'aamodelpr=mixed'. \n"); |
---|
12731 | MrBayesPrint (" \n"); |
---|
12732 | MrBayesPrint (" Current settings: \n"); |
---|
12733 | MrBayesPrint (" \n"); |
---|
12734 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
12735 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
12736 | MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No"); |
---|
12737 | MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn); |
---|
12738 | MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction); |
---|
12739 | MrBayesPrint (" Nruns <number> %d \n", sumpParams.numRuns); |
---|
12740 | if (sumpParams.numRuns == 1) |
---|
12741 | MrBayesPrint (" Filename <name> %s<.p>\n", sumpParams.sumpFileName); |
---|
12742 | else |
---|
12743 | MrBayesPrint (" Filename <name> %s<.run<i>.p>\n", sumpParams.sumpFileName); |
---|
12744 | MrBayesPrint (" Outputname <name> %s<.pstat etc>\n", sumpParams.sumpOutfile); |
---|
12745 | MrBayesPrint (" Hpd Yes/No %s \n", sumpParams.HPD == YES ? "Yes" : "No"); |
---|
12746 | MrBayesPrint (" Minprob <number> %1.3lf \n", sumpParams.minProb); |
---|
12747 | MrBayesPrint (" \n"); |
---|
12748 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12749 | } |
---|
12750 | else if (!strcmp(helpTkn, "Sumss")) |
---|
12751 | { |
---|
12752 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12753 | MrBayesPrint (" Sumss \n"); |
---|
12754 | MrBayesPrint (" \n"); |
---|
12755 | MrBayesPrint (" This command summarizes results of stepping stone analyses. It is a tool to \n"); |
---|
12756 | MrBayesPrint (" investigate the obtained results, and to help find the proper step burn-in. \n"); |
---|
12757 | MrBayesPrint (" To get more help information on stepping-stone analyses, use 'help ss'. \n"); |
---|
12758 | MrBayesPrint (" \n"); |
---|
12759 | MrBayesPrint (" During stepping-stone analysis, MrBayes collects the sampled likelihoods in \n"); |
---|
12760 | MrBayesPrint (" order to estimate the marginal likelihood at the end. It also prints the sam- \n"); |
---|
12761 | MrBayesPrint (" pled parameter values to one or more tab-delimited text files, one for each \n"); |
---|
12762 | MrBayesPrint (" independent run in your analysis. The command 'Sumss' summarizes likelihood \n"); |
---|
12763 | MrBayesPrint (" values stored in these parameter files and calculates marginal likelihood es- \n"); |
---|
12764 | MrBayesPrint (" timates. The names of the files that are summarized are exactly the same as \n"); |
---|
12765 | MrBayesPrint (" the names of the files used for the 'sump' command. In fact, the 'filename' \n"); |
---|
12766 | MrBayesPrint (" setting is a shared setting for the 'sump' and 'sumss' commands. That is, if \n"); |
---|
12767 | MrBayesPrint (" you change the setting in one of the commands, it would change the setting in \n"); |
---|
12768 | MrBayesPrint (" the other command as well. \n"); |
---|
12769 | MrBayesPrint (" \n"); |
---|
12770 | MrBayesPrint (" When you invoke the 'Sumss' command, three items are output: (1) 'Step contri-\n"); |
---|
12771 | MrBayesPrint (" bution table' - summarizes the contribution of each step to the overall esti- \n"); |
---|
12772 | MrBayesPrint (" mate; (2) 'Step plot' - plot of the likelihood values for the initial burn-in \n"); |
---|
12773 | MrBayesPrint (" phase or a chosen step in the stepping-stone algorithm; (3) 'Joined plot' - \n"); |
---|
12774 | MrBayesPrint (" summarizes sampling across all steps in the algorithm. \n"); |
---|
12775 | MrBayesPrint (" \n"); |
---|
12776 | MrBayesPrint (" Step contribution table \n"); |
---|
12777 | MrBayesPrint (" The printed table is similar to the one output to the .ss file. The main pur- \n"); |
---|
12778 | MrBayesPrint (" pose of the table is to summarize marginal likelihood for different values of \n"); |
---|
12779 | MrBayesPrint (" the step burn-in after the stepping stone analysis has finished. The burn-in \n"); |
---|
12780 | MrBayesPrint (" is controlled by the 'Relburnin', 'Burnin' and 'Burninfrac' settings. \n"); |
---|
12781 | MrBayesPrint (" Note that during stepping-stone analyses, step contributions to marginal \n"); |
---|
12782 | MrBayesPrint (" likelihood are calculated based on all generations excluding burn-in. 'Sumss' \n"); |
---|
12783 | MrBayesPrint (" on the other hand makes estimates based only on the sampled generations. This \n"); |
---|
12784 | MrBayesPrint (" may lead to slight difference in results compared to the one printed to the \n"); |
---|
12785 | MrBayesPrint (" .ss file. \n"); |
---|
12786 | MrBayesPrint (" \n"); |
---|
12787 | MrBayesPrint (" Step plot \n"); |
---|
12788 | MrBayesPrint (" The main objective of the plot is to provide a close look at a given step in \n"); |
---|
12789 | MrBayesPrint (" the analysis. Which step is printed here is defined by the 'Steptoplot' set- \n"); |
---|
12790 | MrBayesPrint (" ting. The plot could be used to inspect if the chosen step burn-in is appro- \n"); |
---|
12791 | MrBayesPrint (" priate for the given step. It could also be used to check if the initial burn-\n"); |
---|
12792 | MrBayesPrint (" in phase has converged. Note that the amount of discarded samples is controled\n"); |
---|
12793 | MrBayesPrint (" by the 'Discardfrac' setting, and not by the ordinary burn-in settings. \n"); |
---|
12794 | MrBayesPrint (" \n"); |
---|
12795 | MrBayesPrint (" Joined plot \n"); |
---|
12796 | MrBayesPrint (" Different steps sample from different power posterior distributions. When we \n"); |
---|
12797 | MrBayesPrint (" switch from one distribution to another, it takes some number of generations \n"); |
---|
12798 | MrBayesPrint (" before the chain settles at the correct stationary distribution. This lag is \n"); |
---|
12799 | MrBayesPrint (" called a 'temperature lag' and if the corresponding samples are not removed, \n"); |
---|
12800 | MrBayesPrint (" it will result in a biased estimate. It is difficult to determine the lag be- \n"); |
---|
12801 | MrBayesPrint (" forehand, but MrBayes allows you to explore different step burn-in settings \n"); |
---|
12802 | MrBayesPrint (" after you have finished the stepping-stone algorithm, without having to rerun \n"); |
---|
12803 | MrBayesPrint (" the whole analysis. The 'Joined plot' helps to facilitate the choice of the \n"); |
---|
12804 | MrBayesPrint (" right step burn-in. The plot summarizes samples across all steps and gives you\n"); |
---|
12805 | MrBayesPrint (" a quick overview of the whole analysis. \n"); |
---|
12806 | MrBayesPrint (" \n"); |
---|
12807 | MrBayesPrint (" Specifically, the following procedure is used to obtain the joined plot. Each \n"); |
---|
12808 | MrBayesPrint (" step has the same number N of samples taken. We number each sample 1 to N \n"); |
---|
12809 | MrBayesPrint (" within steps according to the order in which the samples are taken. The first \n"); |
---|
12810 | MrBayesPrint (" sample in each step is numbered 1, and the last sample is N. For each number i\n"); |
---|
12811 | MrBayesPrint (" in [1,..., N], we sum up log likelihoods for all samples numbered i across all\n"); |
---|
12812 | MrBayesPrint (" steps. The joined plot is a graph of the step number versus the normalized \n"); |
---|
12813 | MrBayesPrint (" sums we get in the procedure describe above. This directly visualizes the tem-\n"); |
---|
12814 | MrBayesPrint (" perature lag and allows you to select the appropriate step burn-in. \n"); |
---|
12815 | MrBayesPrint (" \n"); |
---|
12816 | MrBayesPrint (" Ideally, after you discard the appropriate step burn-in, the graph should \n"); |
---|
12817 | MrBayesPrint (" appear as white noise around the estimated value. If you see an increasing or \n"); |
---|
12818 | MrBayesPrint (" decreasing tendency in the beginning of the graph, you should increase the \n"); |
---|
12819 | MrBayesPrint (" step burn-in. If you see an increasing or decreasing tendency across the whole\n"); |
---|
12820 | MrBayesPrint (" graph, then the initial burn-in phase was not long enough. In this case, you \n"); |
---|
12821 | MrBayesPrint (" need to rerun the analysis with a longer initial burn-in. \n"); |
---|
12822 | MrBayesPrint (" \n"); |
---|
12823 | MrBayesPrint (" To make it easier to observe tendencies in the plotted graph you can choose \n"); |
---|
12824 | MrBayesPrint (" different levels of curve smoothing. If 'Smoothing' is set to k, it means that\n"); |
---|
12825 | MrBayesPrint (" for each step i we take an average over step i and k neighboring samples in \n"); |
---|
12826 | MrBayesPrint (" both directions, i.e., the k-smoothed estimate for step i is an average over \n"); |
---|
12827 | MrBayesPrint (" values for steps [i-k,...,i+k]. \n"); |
---|
12828 | MrBayesPrint (" \n"); |
---|
12829 | MrBayesPrint (" \n"); |
---|
12830 | MrBayesPrint (" Options: \n"); |
---|
12831 | MrBayesPrint (" \n"); |
---|
12832 | MrBayesPrint (" Allruns -- If set to 'Yes', it forces all runs to be printed on the same \n"); |
---|
12833 | MrBayesPrint (" graph when drawing joined and step plots. If set to 'No', each\n"); |
---|
12834 | MrBayesPrint (" run is printed on a separat plot. \n"); |
---|
12835 | MrBayesPrint (" Askmore -- Long analyses may produce huge .p files. Reading in them may \n"); |
---|
12836 | MrBayesPrint (" take several minutes. If you want to investigate different \n"); |
---|
12837 | MrBayesPrint (" aspects of your analyses, it could be very inconvenient to \n"); |
---|
12838 | MrBayesPrint (" wait for several minutes each time you want to get a new sum- \n"); |
---|
12839 | MrBayesPrint (" mary for different settings. If you set 'Askmore' to 'YES', \n"); |
---|
12840 | MrBayesPrint (" sumss will read .p files only once. After responding to the \n"); |
---|
12841 | MrBayesPrint (" original query, it will interactivaly ask you if you wish to \n"); |
---|
12842 | MrBayesPrint (" produce more tables and plots for different settings of \n"); |
---|
12843 | MrBayesPrint (" 'Burnin' or 'Smoothing' (see below). \n"); |
---|
12844 | MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n"); |
---|
12845 | MrBayesPrint (" samples from each step will be discarded as burnin when calcu-\n"); |
---|
12846 | MrBayesPrint (" lsting summary statistics. The proportion to be discarded is \n"); |
---|
12847 | MrBayesPrint (" set with 'Burninfrac' (see below). When the 'Relburnin' option\n"); |
---|
12848 | MrBayesPrint (" is set to 'No', then a specific number of samples is discarded\n"); |
---|
12849 | MrBayesPrint (" instead. This number is set by 'Burnin'. Note that the burnin \n"); |
---|
12850 | MrBayesPrint (" settings --- 'Relburnin', 'Burnin', and 'Burninfrac' --- are \n"); |
---|
12851 | MrBayesPrint (" shared across the 'sumt', 'sump', 'sumss' and 'mcmc' commands.\n"); |
---|
12852 | MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n"); |
---|
12853 | MrBayesPrint (" be discarded from each step when summary statistics are calcu-\n"); |
---|
12854 | MrBayesPrint (" lated. The value of this option is only applicable when \n"); |
---|
12855 | MrBayesPrint (" 'Relburnin' is set to 'No'. \n"); |
---|
12856 | MrBayesPrint (" Burninfrac -- Determines the fraction of samples that will be discarded from\n"); |
---|
12857 | MrBayesPrint (" each step when summary statistics are calculated. The setting \n"); |
---|
12858 | MrBayesPrint (" only takes effect if 'Relburnin' is set to 'Yes'. \n"); |
---|
12859 | MrBayesPrint (" Discardfrac -- Determines the fraction of samples that will be discarded when\n"); |
---|
12860 | MrBayesPrint (" a step plot is printed. It is similar to the 'Burninfrac' set-\n"); |
---|
12861 | MrBayesPrint (" ting, but unlike 'Burninfrac' it is used only for better vis- \n"); |
---|
12862 | MrBayesPrint (" ualization of the step plot. It has no effect on the number of\n"); |
---|
12863 | MrBayesPrint (" samples discarded during marginal likelihood computation. \n"); |
---|
12864 | MrBayesPrint (" Filename -- The name of the file to be summarized. This is the base of the\n"); |
---|
12865 | MrBayesPrint (" file name to which endings are added according to the current \n"); |
---|
12866 | MrBayesPrint (" setting of the 'Nruns' parameter. If 'Nruns' is 1, then only \n"); |
---|
12867 | MrBayesPrint (" '.p' is added to the file name. Otherwise, the endings will \n"); |
---|
12868 | MrBayesPrint (" be '.run1.p', '.run2.p', etc. Note that the 'Filename' setting\n"); |
---|
12869 | MrBayesPrint (" is shared with 'sump' command. \n"); |
---|
12870 | MrBayesPrint (" Nruns -- Determines how many '.p' files from independent analyses that \n"); |
---|
12871 | MrBayesPrint (" will be summarized. If Nruns > 1 then the names of the files \n"); |
---|
12872 | MrBayesPrint (" are derived from 'Filename' by adding '.run1.p', '.run2.p', \n"); |
---|
12873 | MrBayesPrint (" etc. If Nruns=1, then the single file name is obtained by \n"); |
---|
12874 | MrBayesPrint (" adding '.p' to 'Filename'. \n"); |
---|
12875 | MrBayesPrint (" Steptoplot -- Defines which step will be printed in the step plot.If the \n"); |
---|
12876 | MrBayesPrint (" value is set to 0, then the initial sample from the posterior \n"); |
---|
12877 | MrBayesPrint (" will be used. \n"); |
---|
12878 | MrBayesPrint (" Smoothing -- Determines smoothing of the joined plot (see above). A value \n"); |
---|
12879 | MrBayesPrint (" equal to 0 results in no smoothing. \n"); |
---|
12880 | MrBayesPrint (" \n"); |
---|
12881 | MrBayesPrint (" Current settings: \n"); |
---|
12882 | MrBayesPrint (" \n"); |
---|
12883 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
12884 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
12885 | MrBayesPrint (" Allruns Yes/No %s \n", sumssParams.allRuns == YES ? "Yes" : "No"); |
---|
12886 | MrBayesPrint (" Askmore Yes/No %s \n", sumssParams.askForMorePlots == YES ? "Yes" : "No"); |
---|
12887 | MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No"); |
---|
12888 | MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn); |
---|
12889 | MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction); |
---|
12890 | MrBayesPrint (" Discardfrac <number> %1.2lf \n", sumssParams.discardFraction); |
---|
12891 | if (sumpParams.numRuns == 1) |
---|
12892 | MrBayesPrint (" Filename <name> %s<.p>\n", sumpParams.sumpFileName); |
---|
12893 | else |
---|
12894 | MrBayesPrint (" Filename <name> %s<.run<i>.p>\n", sumpParams.sumpFileName); |
---|
12895 | MrBayesPrint (" Nruns <number> %d \n", sumpParams.numRuns); |
---|
12896 | MrBayesPrint (" Steptoplot <number> %d \n", sumssParams.stepToPlot); |
---|
12897 | MrBayesPrint (" Smoothing <number> %d \n", sumssParams.smoothing); |
---|
12898 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12899 | } |
---|
12900 | else if (!strcmp(helpTkn, "Comparetree")) |
---|
12901 | { |
---|
12902 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12903 | MrBayesPrint (" Comparetree \n"); |
---|
12904 | MrBayesPrint (" \n"); |
---|
12905 | MrBayesPrint (" This command compares the trees in two files, called \"filename1\" and \n"); |
---|
12906 | MrBayesPrint (" \"filename2\". It will output a bivariate plot of the split frequencies \n"); |
---|
12907 | MrBayesPrint (" as well as plots of the tree distance as a function of the generation. The \n"); |
---|
12908 | MrBayesPrint (" plots can be used to get a quick indication of whether two runs have con- \n"); |
---|
12909 | MrBayesPrint (" verged onto the same set of trees. The \"Comparetree\" command will also \n"); |
---|
12910 | MrBayesPrint (" produce a \".pairs\" file and a \".dists\" file (these file endings are added \n"); |
---|
12911 | MrBayesPrint (" to the end of the \"Outputname\"). The \".pairs\" file contains the paired \n"); |
---|
12912 | MrBayesPrint (" split frequencies from the two tree samples; the \".dists\" file contains the \n"); |
---|
12913 | MrBayesPrint (" tree distance values. \n"); |
---|
12914 | MrBayesPrint (" \n"); |
---|
12915 | MrBayesPrint (" Note that the \"Sumt\" command provides a different set of convergence diag- \n"); |
---|
12916 | MrBayesPrint (" nostics tools that you may also want to explore. Unlike \"Comparetree\", \"Sumt\"\n"); |
---|
12917 | MrBayesPrint (" can compare more than two tree samples and will calculate consensus trees and \n"); |
---|
12918 | MrBayesPrint (" split frequencies from the pooled samples. \n"); |
---|
12919 | MrBayesPrint (" \n"); |
---|
12920 | MrBayesPrint (" Options: \n"); |
---|
12921 | MrBayesPrint (" \n"); |
---|
12922 | MrBayesPrint (" Relburnin -- If this option is set to 'Yes', then a proportion of the \n"); |
---|
12923 | MrBayesPrint (" samples will be discarded as burnin when calculating summary \n"); |
---|
12924 | MrBayesPrint (" statistics. The proportion to be discarded is set with \n"); |
---|
12925 | MrBayesPrint (" Burninfrac (see below). When the Relburnin option is set to \n"); |
---|
12926 | MrBayesPrint (" 'No', then a specific number of samples is discarded instead.\n"); |
---|
12927 | MrBayesPrint (" This number is set by Burnin (see below). Note that the \n"); |
---|
12928 | MrBayesPrint (" burnin setting is shared with the 'mcmc', 'sumt', 'sump' and \n"); |
---|
12929 | MrBayesPrint (" 'plot' commands. \n"); |
---|
12930 | MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n"); |
---|
12931 | MrBayesPrint (" be discarded when summary statistics are calculated. The \n"); |
---|
12932 | MrBayesPrint (" value of this option is only relevant when Relburnin is set \n"); |
---|
12933 | MrBayesPrint (" to 'No'. \n"); |
---|
12934 | MrBayesPrint (" BurninFrac -- Determines the fraction of samples that will be discarded \n"); |
---|
12935 | MrBayesPrint (" when summary statistics are calculated. The value of this \n"); |
---|
12936 | MrBayesPrint (" option is only relevant when Relburnin is set to 'Yes'. \n"); |
---|
12937 | MrBayesPrint (" Example: A value for this option of 0.25 means that 25%% of \n"); |
---|
12938 | MrBayesPrint (" the samples will be discarded. \n"); |
---|
12939 | MrBayesPrint (" Minpartfreq -- The minimum probability of partitions to include in summary \n"); |
---|
12940 | MrBayesPrint (" statistics. \n"); |
---|
12941 | MrBayesPrint (" Filename1 -- The name of the first tree file to compare. \n"); |
---|
12942 | MrBayesPrint (" Filename2 -- The name of the second tree file to compare. \n"); |
---|
12943 | MrBayesPrint (" Outputname -- Name of the file to which 'comparetree' results will be \n"); |
---|
12944 | MrBayesPrint (" printed. \n"); |
---|
12945 | MrBayesPrint (" \n"); |
---|
12946 | MrBayesPrint (" Current settings: \n"); |
---|
12947 | MrBayesPrint (" \n"); |
---|
12948 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
12949 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
12950 | MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No"); |
---|
12951 | MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn); |
---|
12952 | MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction); |
---|
12953 | MrBayesPrint (" Minpartfreq <number> %1.2lf \n", comptreeParams.minPartFreq); |
---|
12954 | MrBayesPrint (" Filename1 <name> %s \n", comptreeParams.comptFileName1); |
---|
12955 | MrBayesPrint (" Filename2 <name> %s \n", comptreeParams.comptFileName2); |
---|
12956 | MrBayesPrint (" Outputname <name> %s \n", comptreeParams.comptOutfile); |
---|
12957 | MrBayesPrint (" \n"); |
---|
12958 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12959 | } |
---|
12960 | else if (!strcmp(helpTkn, "Sumt")) |
---|
12961 | { |
---|
12962 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
12963 | MrBayesPrint (" Sumt \n"); |
---|
12964 | MrBayesPrint (" \n"); |
---|
12965 | MrBayesPrint (" This command is used to produce summary statistics for trees sampled during \n"); |
---|
12966 | MrBayesPrint (" a Bayesian MCMC analysis. You can either summarize trees from one individual \n"); |
---|
12967 | MrBayesPrint (" analysis, or trees coming from several independent analyses. In either case, \n"); |
---|
12968 | MrBayesPrint (" all the sampled trees are read in and the proportion of the time any single \n"); |
---|
12969 | MrBayesPrint (" taxon bipartition (split) is found is counted. The proportion of the time that\n"); |
---|
12970 | MrBayesPrint (" the bipartition is found is an approximation of the posterior probability of \n"); |
---|
12971 | MrBayesPrint (" the bipartition. (Remember that a taxon bipartition is defined by removing a \n"); |
---|
12972 | MrBayesPrint (" branch on the tree, dividing the tree into those taxa to the left and right \n"); |
---|
12973 | MrBayesPrint (" of the removed branch. This set is called a taxon bipartition.) The branch \n"); |
---|
12974 | MrBayesPrint (" length of the bipartition is also recorded, if branch lengths have been saved \n"); |
---|
12975 | MrBayesPrint (" to file. The result is a list of the taxon bipartitions found, the frequency \n"); |
---|
12976 | MrBayesPrint (" with which they were found, the posterior probability of the bipartition \n"); |
---|
12977 | MrBayesPrint (" and, the mean and variance of the branch lengths or node depths, and various \n"); |
---|
12978 | MrBayesPrint (" other statistics. \n"); |
---|
12979 | MrBayesPrint (" \n"); |
---|
12980 | MrBayesPrint (" The key to the partitions is output to a file with the suffix '.parts'. The \n"); |
---|
12981 | MrBayesPrint (" summary statistics pertaining to bipartition probabilities are output to a \n"); |
---|
12982 | MrBayesPrint (" file with the suffix '.tstat', and the statistics pertaining to branch or node\n"); |
---|
12983 | MrBayesPrint (" parameters are output to a file with the suffix '.vstat'. \n"); |
---|
12984 | MrBayesPrint (" \n"); |
---|
12985 | MrBayesPrint (" A consensus tree is also printed to a file with the suffix '.con.tre' and \n"); |
---|
12986 | MrBayesPrint (" printed to the screen as a cladogram, and as a phylogram if branch lengths \n"); |
---|
12987 | MrBayesPrint (" have been saved. The consensus tree is either a 50 percent majority rule tree \n"); |
---|
12988 | MrBayesPrint (" or a majority rule tree showing all compatible partitions. If branch lengths \n"); |
---|
12989 | MrBayesPrint (" have been recorded during the run, the '.con.tre' file will contain a consen- \n"); |
---|
12990 | MrBayesPrint (" sus tree with branch lengths and interior nodes labelled with support values. \n"); |
---|
12991 | MrBayesPrint (" By default, the consensus tree will also contain other summary information in \n"); |
---|
12992 | MrBayesPrint (" a format understood by the program 'FigTree'. To use a simpler format under- \n"); |
---|
12993 | MrBayesPrint (" stood by other tree-drawing programs, such as 'TreeView', set 'Conformat' to \n"); |
---|
12994 | MrBayesPrint (" 'Simple'. \n"); |
---|
12995 | MrBayesPrint (" \n"); |
---|
12996 | MrBayesPrint (" MrBayes alo produces a file with the ending \".trprobs\" that contains a list \n"); |
---|
12997 | MrBayesPrint (" of all the trees that were found during the MCMC analysis, sorted by their \n"); |
---|
12998 | MrBayesPrint (" probabilities. This list of trees can be used to construct a credible set of \n"); |
---|
12999 | MrBayesPrint (" trees. For example, if you want to construct a 95 percent credible set of \n"); |
---|
13000 | MrBayesPrint (" trees, you include all of those trees whose cumulative probability is less \n"); |
---|
13001 | MrBayesPrint (" than or equal to 0.95. You have the option of displaying the trees to the \n"); |
---|
13002 | MrBayesPrint (" screen using the \"Showtreeprobs\" option. The default is to not display the \n"); |
---|
13003 | MrBayesPrint (" trees to the screen; the number of different trees sampled by the chain can \n"); |
---|
13004 | MrBayesPrint (" be quite large. If you are analyzing a large set of taxa, you may actually \n"); |
---|
13005 | MrBayesPrint (" want to skip the calculation of tree probabilities entirely by setting \n"); |
---|
13006 | MrBayesPrint (" 'Calctreeprobs' to 'No'. \n"); |
---|
13007 | MrBayesPrint (" \n"); |
---|
13008 | MrBayesPrint (" When calculating summary statistics you probably want to skip those trees that\n"); |
---|
13009 | MrBayesPrint (" were sampled in the initial part of the run, the so-called burn-in period. The\n"); |
---|
13010 | MrBayesPrint (" number of skipped samples is controlled by the 'Relburnin', 'Burnin', and \n"); |
---|
13011 | MrBayesPrint (" 'Burninfrac' settings, just as for the 'Mcmc' command. Since version 3.2.0, \n"); |
---|
13012 | MrBayesPrint (" the burn-in settings are shared across the 'Sumt', 'Sump' and 'Mcmc' commands.\n"); |
---|
13013 | MrBayesPrint (" That is, changing the burn-in setting for one command will change the settings\n"); |
---|
13014 | MrBayesPrint (" for subsequent calls to any of the other commands. \n"); |
---|
13015 | MrBayesPrint (" \n"); |
---|
13016 | MrBayesPrint (" If you are summarizing the trees sampled in several independent analyses, \n"); |
---|
13017 | MrBayesPrint (" such as those resulting from setting the 'Nruns' option of the 'Mcmc' command \n"); |
---|
13018 | MrBayesPrint (" to a value larger than 1, MrBayes will also calculate convergence diagnostics \n"); |
---|
13019 | MrBayesPrint (" for the sampled topologies and branch lengths. These values can help you \n"); |
---|
13020 | MrBayesPrint (" determine whether it is likely that your chains have converged. \n"); |
---|
13021 | MrBayesPrint (" \n"); |
---|
13022 | MrBayesPrint (" The 'Sumt' command expands the 'Filename' according to the current values of \n"); |
---|
13023 | MrBayesPrint (" the 'Nruns' and 'Ntrees' options. For instance, if both 'Nruns' and 'Ntrees' \n"); |
---|
13024 | MrBayesPrint (" are set to 1, 'Sumt' will try to open a file named '<Filename>.t'. If 'Nruns' \n"); |
---|
13025 | MrBayesPrint (" is set to 2 and 'Ntrees' to 1, then 'Sumt' will open two files, the first \n"); |
---|
13026 | MrBayesPrint (" named '<Filename>.run1.t' and the second '<Filename>.run2.t', etc. By default,\n"); |
---|
13027 | MrBayesPrint (" the 'Filename' option is set such that 'Sumt' automatically summarizes all the\n"); |
---|
13028 | MrBayesPrint (" results from your immediately preceding 'Mcmc' command. You can also use the \n"); |
---|
13029 | MrBayesPrint (" 'Sumt' command to summarize tree samples in older analyses. If you want to do \n"); |
---|
13030 | MrBayesPrint (" that, remember to first read in a matrix so that MrBayes knows what taxon \n"); |
---|
13031 | MrBayesPrint (" names to expect in the trees. Then set the 'Nruns', 'Ntrees' and 'Filename' \n"); |
---|
13032 | MrBayesPrint (" options appropriately if they differ from the MrBayes defaults. \n"); |
---|
13033 | MrBayesPrint (" \n"); |
---|
13034 | MrBayesPrint (" Options: \n"); |
---|
13035 | MrBayesPrint (" \n"); |
---|
13036 | MrBayesPrint (" Relburnin -- If this option is set to YES, then a proportion of the \n"); |
---|
13037 | MrBayesPrint (" samples will be discarded as burnin when calculating summary \n"); |
---|
13038 | MrBayesPrint (" statistics. The proportion to be discarded is set with \n"); |
---|
13039 | MrBayesPrint (" Burninfrac (see below). When the Relburnin option is set to \n"); |
---|
13040 | MrBayesPrint (" NO, then a specific number of samples is discarded instead. \n"); |
---|
13041 | MrBayesPrint (" This number is set by Burnin (see below). Note that the \n"); |
---|
13042 | MrBayesPrint (" burnin setting is shared across the 'sumt', 'sump', and \n"); |
---|
13043 | MrBayesPrint (" 'mcmc' commands. \n"); |
---|
13044 | MrBayesPrint (" Burnin -- Determines the number of samples (not generations) that will \n"); |
---|
13045 | MrBayesPrint (" be discarded when summary statistics are calculated. The \n"); |
---|
13046 | MrBayesPrint (" value of this option is only relevant when Relburnin is set \n"); |
---|
13047 | MrBayesPrint (" to NO. \n"); |
---|
13048 | MrBayesPrint (" BurninFrac -- Determines the fraction of samples that will be discarded \n"); |
---|
13049 | MrBayesPrint (" when summary statistics are calculated. The value of this \n"); |
---|
13050 | MrBayesPrint (" option is only relevant when Relburnin is set to YES. \n"); |
---|
13051 | MrBayesPrint (" Example: A value for this option of 0.25 means that 25%% of \n"); |
---|
13052 | MrBayesPrint (" the samples will be discarded. \n"); |
---|
13053 | MrBayesPrint (" Nruns -- Determines how many '.t' files from independent analyses that\n"); |
---|
13054 | MrBayesPrint (" will be summarized. If Nruns > 1 then the names of the files \n"); |
---|
13055 | MrBayesPrint (" are derived from 'Filename' by adding '.run1.t', '.run2.t', \n"); |
---|
13056 | MrBayesPrint (" etc. If Nruns=1 and Ntrees=1 (see below), then only '.t' is \n"); |
---|
13057 | MrBayesPrint (" added to 'Filename'. \n"); |
---|
13058 | MrBayesPrint (" Ntrees -- Determines how many trees there are in the sampled model. If \n"); |
---|
13059 | MrBayesPrint (" 'Ntrees' > 1 then the names of the files are derived from \n"); |
---|
13060 | MrBayesPrint (" 'Filename' by adding '.tree1.t', '.tree2.t', etc. If there \n"); |
---|
13061 | MrBayesPrint (" are both multiple trees and multiple runs, the filenames will\n"); |
---|
13062 | MrBayesPrint (" be '<Filename>.tree1.run1.t', '<Filename>.tree1.run2.t', etc.\n"); |
---|
13063 | MrBayesPrint (" Filename -- The name of the file(s) to be summarized. This is the base of\n"); |
---|
13064 | MrBayesPrint (" the file name, to which endings are added according to the \n"); |
---|
13065 | MrBayesPrint (" current settings of the 'Nruns' and 'Ntrees' options. \n"); |
---|
13066 | MrBayesPrint (" Minpartfreq -- The minimum probability of partitions to include in summary \n"); |
---|
13067 | MrBayesPrint (" statistics. \n"); |
---|
13068 | MrBayesPrint (" Contype -- Type of consensus tree. 'Halfcompat' results in a 50%% major-\n"); |
---|
13069 | MrBayesPrint (" ity rule tree, 'Allcompat' adds all compatible groups to such\n"); |
---|
13070 | MrBayesPrint (" a tree. \n"); |
---|
13071 | MrBayesPrint (" Conformat -- Format of consensus tree. The 'Figtree' setting results in a \n"); |
---|
13072 | MrBayesPrint (" consensus tree formatted for the program FigTree, with rich \n"); |
---|
13073 | MrBayesPrint (" summary statistics. The 'Simple' setting results in a simple \n"); |
---|
13074 | MrBayesPrint (" consensus tree written in a format read by a variety of pro- \n"); |
---|
13075 | MrBayesPrint (" grams. \n"); |
---|
13076 | MrBayesPrint (" Outputname -- Base name of the file(s) to which 'sumt' results will be \n"); |
---|
13077 | MrBayesPrint (" printed. The default is the same as 'Filename'. \n"); |
---|
13078 | MrBayesPrint (" Calctreeprobs -- Determines whether tree probabilities should be calculated. \n"); |
---|
13079 | MrBayesPrint (" Showtreeprobs -- Determines whether tree probabilities should be displayed on \n"); |
---|
13080 | MrBayesPrint (" screen. \n"); |
---|
13081 | MrBayesPrint (" Hpd -- Determines whether credibility intervals will be given as the\n"); |
---|
13082 | MrBayesPrint (" region of Highest Posterior Density ('Yes') or as the inter- \n"); |
---|
13083 | MrBayesPrint (" val containing the median 95 %% of sampled values ('No'). \n"); |
---|
13084 | MrBayesPrint (" \n"); |
---|
13085 | MrBayesPrint (" Current settings: \n"); |
---|
13086 | MrBayesPrint (" \n"); |
---|
13087 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
13088 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
13089 | MrBayesPrint (" Relburnin Yes/No %s \n", chainParams.relativeBurnin == YES ? "Yes" : "No"); |
---|
13090 | MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn); |
---|
13091 | MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction); |
---|
13092 | MrBayesPrint (" Nruns <number> %d \n", sumtParams.numRuns); |
---|
13093 | MrBayesPrint (" Ntrees <number> %d \n", sumtParams.numTrees); |
---|
13094 | if (sumtParams.numRuns == 1 && sumtParams.numTrees == 1) |
---|
13095 | MrBayesPrint (" Filename <name> %s<.t>\n", sumtParams.sumtFileName); |
---|
13096 | else if (sumtParams.numRuns == 1 && sumtParams.numTrees > 1) |
---|
13097 | MrBayesPrint (" Filename <name> %s<.tree<i>.t>\n", sumtParams.sumtFileName); |
---|
13098 | else if (sumtParams.numRuns > 1 && sumtParams.numTrees == 1) |
---|
13099 | MrBayesPrint (" Filename <name> %s<.run<i>.t>\n", sumtParams.sumtFileName); |
---|
13100 | else if (sumtParams.numRuns > 1 && sumtParams.numTrees > 1) |
---|
13101 | MrBayesPrint (" Filename <name> %s<.tree<i>.run<i>.t>\n", sumtParams.sumtFileName); |
---|
13102 | MrBayesPrint (" Minpartfreq <number> %1.2lf \n", sumtParams.minPartFreq); |
---|
13103 | MrBayesPrint (" Contype Halfcompat/Allcompat %s\n", sumtParams.sumtConType); |
---|
13104 | MrBayesPrint (" Conformat Figtree/Simple %s \n", sumtParams.consensusFormat == SIMPLE ? "Simple" : "Figtree"); |
---|
13105 | MrBayesPrint (" Outputname <name> %s<.parts etc>\n", sumtParams.sumtOutfile); |
---|
13106 | MrBayesPrint (" Calctreeprobs Yes/No %s \n", sumtParams.calcTreeprobs == YES ? "Yes" : "No"); |
---|
13107 | MrBayesPrint (" Showtreeprobs Yes/No %s \n", sumtParams.showSumtTrees == YES ? "Yes" : "No"); |
---|
13108 | MrBayesPrint (" Hpd Yes/No %s \n", sumtParams.HPD == YES ? "Yes" : "No"); |
---|
13109 | MrBayesPrint (" \n"); |
---|
13110 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13111 | } |
---|
13112 | else if (!strcmp(helpTkn, "Tree")) |
---|
13113 | { |
---|
13114 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13115 | MrBayesPrint (" Tree \n"); |
---|
13116 | MrBayesPrint (" \n"); |
---|
13117 | MrBayesPrint (" This command is used by MrBayes to write trees to a nexus tree file. Trees \n"); |
---|
13118 | MrBayesPrint (" are written in the Newick format. For instance, \n"); |
---|
13119 | MrBayesPrint (" \n"); |
---|
13120 | MrBayesPrint (" tree ((1,2),3,4); \n"); |
---|
13121 | MrBayesPrint (" \n"); |
---|
13122 | MrBayesPrint (" describes an unrooted tree with taxa 1 and 2 being more closely related to \n"); |
---|
13123 | MrBayesPrint (" each other than to taxa 3 and 4. If branch lengths are saved to file, they \n"); |
---|
13124 | MrBayesPrint (" are given after a colon sign immediately following the terminal taxon or the \n"); |
---|
13125 | MrBayesPrint (" interior node they refer to. An example of an unrooted tree with branch \n"); |
---|
13126 | MrBayesPrint (" lengths is: \n"); |
---|
13127 | MrBayesPrint (" \n"); |
---|
13128 | MrBayesPrint (" tree ((1:0.064573,2:0.029042):0.041239,3:0.203988,4:0.187654); \n"); |
---|
13129 | MrBayesPrint (" \n"); |
---|
13130 | MrBayesPrint (" Trees that are rooted (clock trees) are written with a basal dichotomy \n"); |
---|
13131 | MrBayesPrint (" instead of a basal trichotomy. If the tree described above had been rooted \n"); |
---|
13132 | MrBayesPrint (" on the branch leading to taxon 4, it would have been represented as: \n"); |
---|
13133 | MrBayesPrint (" \n"); |
---|
13134 | MrBayesPrint (" tree (((1,2),3),4); \n"); |
---|
13135 | MrBayesPrint (" \n"); |
---|
13136 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13137 | } |
---|
13138 | else if (!strcmp(helpTkn, "Report")) |
---|
13139 | { |
---|
13140 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13141 | MrBayesPrint (" Report \n"); |
---|
13142 | MrBayesPrint (" \n"); |
---|
13143 | MrBayesPrint (" This command allows you to control how the posterior distribution is \n"); |
---|
13144 | MrBayesPrint (" reported. For rate parameters, it allows you to choose among several popular \n"); |
---|
13145 | MrBayesPrint (" parameterizations. The report command also allows you to request printing of \n"); |
---|
13146 | MrBayesPrint (" some model aspects that are usually not reported. For instance, if a node is \n"); |
---|
13147 | MrBayesPrint (" constrained in the analysis, MrBayes can print the probabilities of the \n"); |
---|
13148 | MrBayesPrint (" ancestral states at that node. Similarly, if there is rate variation in the \n"); |
---|
13149 | MrBayesPrint (" model, MrBayes can print the inferred site rates, and if there is omega varia-\n"); |
---|
13150 | MrBayesPrint (" tion, MrBayes can print the inferred omega (positive selection) values for \n"); |
---|
13151 | MrBayesPrint (" each codon. In a complex model with several partitions, each partition is \n"); |
---|
13152 | MrBayesPrint (" controlled separately using the same 'Applyto' mechanism as in the 'Lset' and \n"); |
---|
13153 | MrBayesPrint (" 'Prset' commands. \n"); |
---|
13154 | MrBayesPrint (" \n"); |
---|
13155 | MrBayesPrint (" Options: \n"); |
---|
13156 | MrBayesPrint (" \n"); |
---|
13157 | MrBayesPrint (" Applyto -- This option allows you to apply the report commands to specific \n"); |
---|
13158 | MrBayesPrint (" partitions. This command should be the first in the list of \n"); |
---|
13159 | MrBayesPrint (" commands specified in 'report'. \n"); |
---|
13160 | MrBayesPrint (" For example, \n"); |
---|
13161 | MrBayesPrint (" \n"); |
---|
13162 | MrBayesPrint (" report applyto=(1,2) tratio=ratio \n"); |
---|
13163 | MrBayesPrint (" \n"); |
---|
13164 | MrBayesPrint (" report applyto=(3) tratio=dirichlet \n"); |
---|
13165 | MrBayesPrint (" \n"); |
---|
13166 | MrBayesPrint (" would result in the transition and transversion rates of the \n"); |
---|
13167 | MrBayesPrint (" first and second partitions in the model being reported as a \n"); |
---|
13168 | MrBayesPrint (" ratio and the transition and transversion rates of the third \n"); |
---|
13169 | MrBayesPrint (" partition being reported as proportions of the rate sum (the \n"); |
---|
13170 | MrBayesPrint (" Dirichlet parameterization). \n"); |
---|
13171 | MrBayesPrint (" Tratio -- This specifies the report format for the transition and trans- \n"); |
---|
13172 | MrBayesPrint (" version rates of a nucleotide substituion model with nst=2. \n"); |
---|
13173 | MrBayesPrint (" If 'ratio' is selected, the rates will be reported as a ratio \n"); |
---|
13174 | MrBayesPrint (" (transition rate/transversion rate). If 'dirichlet' is selected, \n"); |
---|
13175 | MrBayesPrint (" the transition and transversion rates will instead be reported \n"); |
---|
13176 | MrBayesPrint (" as proportions of the rate sum. For example, if the transition \n"); |
---|
13177 | MrBayesPrint (" rate is three times the transversion rate and 'ratio' is selec- \n"); |
---|
13178 | MrBayesPrint (" ted, this will reported as a single value, '3.0'. If 'dirichlet' \n"); |
---|
13179 | MrBayesPrint (" is selected instead, the same rates will be reported using two \n"); |
---|
13180 | MrBayesPrint (" values, '0.75 0.25'. The sum of the Dirichlet values is always 1.\n"); |
---|
13181 | MrBayesPrint (" Although the Dirichlet format may be unfamiliar to some users, \n"); |
---|
13182 | MrBayesPrint (" it is more convenient for specifying priors than the ratio \n"); |
---|
13183 | MrBayesPrint (" format. \n"); |
---|
13184 | MrBayesPrint (" Revmat -- This specifies the report format for the substitution rates of \n"); |
---|
13185 | MrBayesPrint (" a GTR substitution model for nucleotide or amino acid data. If \n"); |
---|
13186 | MrBayesPrint (" 'ratio' is selected, the rates will be reported scaled to the \n"); |
---|
13187 | MrBayesPrint (" G-T rate (for nucleotides) or the Y-V rate (for amino acids). If \n"); |
---|
13188 | MrBayesPrint (" 'dirichlet' is specified instead, the rates are reported as pro- \n"); |
---|
13189 | MrBayesPrint (" portions of the rate sum. For instance, assume that the C-T rate \n"); |
---|
13190 | MrBayesPrint (" is twice the A-G rate and four times the transversion rates, \n"); |
---|
13191 | MrBayesPrint (" which are equal. If the report format is set to 'ratio', this \n"); |
---|
13192 | MrBayesPrint (" would be reported as '1.0 2.0 1.0 1.0 4.0 1.0' since the rates \n"); |
---|
13193 | MrBayesPrint (" are reported in the order rAC, rAG, rAT, rCG, rCT, rGT and scaled\n"); |
---|
13194 | MrBayesPrint (" relative to the last rate, the G-T rate. If 'dirichlet' is selec-\n"); |
---|
13195 | MrBayesPrint (" ted instead, the same rates would have been reported as '0.1 0.2 \n"); |
---|
13196 | MrBayesPrint (" 0.1 0.1 0.4 0.1' since the rates are now scaled so that they sum \n"); |
---|
13197 | MrBayesPrint (" to 1.0. The Dirichlet format is the parameterization used for \n"); |
---|
13198 | MrBayesPrint (" formulating priors on the rates. \n"); |
---|
13199 | MrBayesPrint (" Ratemult -- This specifies the report format used for the rate multiplier of \n"); |
---|
13200 | MrBayesPrint (" different model partitions. Three formats are available. If \n"); |
---|
13201 | MrBayesPrint (" 'scaled' is selected, then rates are scaled such that the mean \n"); |
---|
13202 | MrBayesPrint (" rate per site across partitions is 1.0. If 'ratio' is chosen, \n"); |
---|
13203 | MrBayesPrint (" the rates are scaled relative to the rate of the first parti- \n"); |
---|
13204 | MrBayesPrint (" tion. Finally, if 'dirichlet' is chosen, the rates are given as \n"); |
---|
13205 | MrBayesPrint (" proportions of the rate sum. The latter is the format used \n"); |
---|
13206 | MrBayesPrint (" when formulating priors on the rate multiplier. \n"); |
---|
13207 | MrBayesPrint (" Tree -- This specifies the report format used for the tree(s). Two op- \n"); |
---|
13208 | MrBayesPrint (" tions are available. 'Topology' results in only the topology \n"); |
---|
13209 | MrBayesPrint (" being printed to file, whereas 'brlens' causes branch lengths to \n"); |
---|
13210 | MrBayesPrint (" to be printed as well. \n"); |
---|
13211 | MrBayesPrint (" Ancstates -- If this option is set to 'yes', MrBayes will print the pro- \n"); |
---|
13212 | MrBayesPrint (" bability of the ancestral states at all constrained nodes. Typ- \n"); |
---|
13213 | MrBayesPrint (" ically, you are interested in the ancestral states of only a few \n"); |
---|
13214 | MrBayesPrint (" characters and only at one node in the tree. To perform such \n"); |
---|
13215 | MrBayesPrint (" an analysis, first define and enforce a topology constraint \n"); |
---|
13216 | MrBayesPrint (" using 'constraint' and 'prset topologypr = constraints (...)'. \n"); |
---|
13217 | MrBayesPrint (" Then put the character(s) of interest in a separate partition and\n"); |
---|
13218 | MrBayesPrint (" set MrBayes to report the ancestral states for that partition. \n"); |
---|
13219 | MrBayesPrint (" For instance, if the characters of interest are in partition 2, \n"); |
---|
13220 | MrBayesPrint (" use 'report applyto=(2) ancstates=yes' to force MrBayes to print \n"); |
---|
13221 | MrBayesPrint (" the probability of the ancestral states of those characters at \n"); |
---|
13222 | MrBayesPrint (" the constrained node to the '.p' file. \n"); |
---|
13223 | MrBayesPrint (" Siterates -- If this option is set to 'yes' and the relevant model has rate \n"); |
---|
13224 | MrBayesPrint (" variation across sites, then the site rates, weighted over rate \n"); |
---|
13225 | MrBayesPrint (" categories, will be reported to the '.p' file. \n"); |
---|
13226 | MrBayesPrint (" Possel -- If this option is set to 'yes' and the relevant model has omega \n"); |
---|
13227 | MrBayesPrint (" variation across sites, the probability that each model site \n"); |
---|
13228 | MrBayesPrint (" (codon in this case) is positively selected will be written to \n"); |
---|
13229 | MrBayesPrint (" file. \n"); |
---|
13230 | MrBayesPrint (" Siteomega -- If this option is set to 'yes' and the relevant model has omega \n"); |
---|
13231 | MrBayesPrint (" variation across sites, the weighted omega value (over omega \n"); |
---|
13232 | MrBayesPrint (" categories) for each model site will be reported to file. \n"); |
---|
13233 | MrBayesPrint (" \n"); |
---|
13234 | if (numCurrentDivisions == 0) |
---|
13235 | tempInt = 1; |
---|
13236 | else |
---|
13237 | tempInt = numCurrentDivisions; |
---|
13238 | for (i=0; i<tempInt; i++) |
---|
13239 | { |
---|
13240 | if (numCurrentDivisions == 0) |
---|
13241 | { |
---|
13242 | MrBayesPrint (" Default report settings: \n"); |
---|
13243 | mp = &defaultModel; |
---|
13244 | } |
---|
13245 | else |
---|
13246 | { |
---|
13247 | MrBayesPrint (" Current report settings for partition %d: \n", i+1); |
---|
13248 | mp = &modelParams[i]; |
---|
13249 | } |
---|
13250 | MrBayesPrint (" \n"); |
---|
13251 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
13252 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
13253 | MrBayesPrint (" Tratio Ratio/Dirichlet %s \n", mp->tratioFormat); |
---|
13254 | MrBayesPrint (" Revmat Ratio/Dirichlet %s \n", mp->revmatFormat); |
---|
13255 | MrBayesPrint (" Ratemult Scaled/Ratio/Dirichlet %s \n", mp->ratemultFormat); |
---|
13256 | MrBayesPrint (" Tree Brlens/Topology %s \n", mp->treeFormat); |
---|
13257 | MrBayesPrint (" Ancstates Yes/No %s \n", mp->inferAncStates); |
---|
13258 | MrBayesPrint (" Siterates Yes/No %s \n", mp->inferSiteRates); |
---|
13259 | MrBayesPrint (" Possel Yes/No %s \n", mp->inferPosSel); |
---|
13260 | MrBayesPrint (" Siteomega Yes/No %s \n", mp->inferSiteOmegas); |
---|
13261 | MrBayesPrint (" \n"); |
---|
13262 | MrBayesPrint (" ------------------------------------------------------------------ \n"); |
---|
13263 | MrBayesPrint (" \n"); |
---|
13264 | } |
---|
13265 | } |
---|
13266 | else if (!strcmp(helpTkn, "Manual")) |
---|
13267 | { |
---|
13268 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13269 | MrBayesPrint (" Manual \n"); |
---|
13270 | MrBayesPrint (" \n"); |
---|
13271 | MrBayesPrint (" This command allows you to generate a text file containing help information \n"); |
---|
13272 | MrBayesPrint (" on all the available commands. This text file can be used as an up-to-date \n"); |
---|
13273 | MrBayesPrint (" command reference. You can set the name of the text file using the \n"); |
---|
13274 | MrBayesPrint (" \"filename\" option; the default is \"commref_mb<version>.txt\". \n"); |
---|
13275 | MrBayesPrint (" \n"); |
---|
13276 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
13277 | MrBayesPrint (" -------------------------------------------------------- \n"); |
---|
13278 | MrBayesPrint (" Filename <name> %s \n", manFileName); |
---|
13279 | MrBayesPrint (" \n"); |
---|
13280 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13281 | } |
---|
13282 | else if (!strcmp(helpTkn, "Showmoves")) |
---|
13283 | { |
---|
13284 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13285 | MrBayesPrint (" Showmoves \n"); |
---|
13286 | MrBayesPrint (" \n"); |
---|
13287 | MrBayesPrint (" This command shows the MCMC samplers (moves) that are switched on for the \n"); |
---|
13288 | MrBayesPrint (" parameters in the current model. The basic usage is \n"); |
---|
13289 | MrBayesPrint (" \n"); |
---|
13290 | MrBayesPrint (" showmoves \n"); |
---|
13291 | MrBayesPrint (" \n"); |
---|
13292 | MrBayesPrint (" If you want to see all available moves, use \n"); |
---|
13293 | MrBayesPrint (" \n"); |
---|
13294 | MrBayesPrint (" showmoves allavailable=yes \n"); |
---|
13295 | MrBayesPrint (" \n"); |
---|
13296 | MrBayesPrint (" If you want to change any of the tuning parameters for the moves, use the \n"); |
---|
13297 | MrBayesPrint (" 'propset' command. \n"); |
---|
13298 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13299 | } |
---|
13300 | else if (!strcmp(helpTkn, "Showparams")) |
---|
13301 | { |
---|
13302 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13303 | MrBayesPrint (" Showparams \n"); |
---|
13304 | MrBayesPrint (" \n"); |
---|
13305 | MrBayesPrint (" This command shows all of the parameters in the current model. The basic \n"); |
---|
13306 | MrBayesPrint (" usage is \n"); |
---|
13307 | MrBayesPrint (" \n"); |
---|
13308 | MrBayesPrint (" showparams \n"); |
---|
13309 | MrBayesPrint (" \n"); |
---|
13310 | MrBayesPrint (" The parameters are listed together with their priors, the available moves, \n"); |
---|
13311 | MrBayesPrint (" and the current value(s), which will be used as the starting values in the \n"); |
---|
13312 | MrBayesPrint (" next mcmc analysis. \n"); |
---|
13313 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13314 | } |
---|
13315 | else if (!strcmp(helpTkn, "Startvals")) |
---|
13316 | { |
---|
13317 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13318 | MrBayesPrint (" Startvals \n"); |
---|
13319 | MrBayesPrint (" \n"); |
---|
13320 | MrBayesPrint (" Use this command to change the current values for parameters in your model. \n"); |
---|
13321 | MrBayesPrint (" These values will be used as the starting values in the next mcmc analysis. \n"); |
---|
13322 | MrBayesPrint (" The basic format is: \n"); |
---|
13323 | MrBayesPrint (" \n"); |
---|
13324 | MrBayesPrint (" startvals <param>=(<value_1>,<value_2>,...,<value_n>) \n"); |
---|
13325 | MrBayesPrint (" \n"); |
---|
13326 | MrBayesPrint (" for all substitution model parameters. The format is slightly different for \n"); |
---|
13327 | MrBayesPrint (" parameters that are written to a tree file: \n"); |
---|
13328 | MrBayesPrint (" \n"); |
---|
13329 | MrBayesPrint (" startvals <param>=<tree_name> \n"); |
---|
13330 | MrBayesPrint (" \n"); |
---|
13331 | MrBayesPrint (" This version of the command will look for a tree with the specified name \n"); |
---|
13332 | MrBayesPrint (" among the trees read in previously when parsing a tree block. The information \n"); |
---|
13333 | MrBayesPrint (" stored in that tree will be used to set the starting value of the parameter. \n"); |
---|
13334 | MrBayesPrint (" The parameters that are set using this mechanism include topology and branch \n"); |
---|
13335 | MrBayesPrint (" length parameters, as well as relaxed clock branch rates, cpp events and \n"); |
---|
13336 | MrBayesPrint (" cpp branch rate multipliers. \n"); |
---|
13337 | MrBayesPrint (" \n"); |
---|
13338 | MrBayesPrint (" The above versions of the command will set the value for all runs and chains. \n"); |
---|
13339 | MrBayesPrint (" You can also set the value for an individual run and chain by using the format\n"); |
---|
13340 | MrBayesPrint (" \n"); |
---|
13341 | MrBayesPrint (" startvals <param>(<run>,<chain>)=(<value_1>,...) \n"); |
---|
13342 | MrBayesPrint (" \n"); |
---|
13343 | MrBayesPrint (" where <run> is the index of the run and <chain> the index of the chain. If \n"); |
---|
13344 | MrBayesPrint (" the run index is omitted, the values will be changed for all runs. Similarly, \n"); |
---|
13345 | MrBayesPrint (" if the chain index is omitted, all chains will be set to the specified value. \n"); |
---|
13346 | MrBayesPrint (" For example, if we wanted to set the values of the stationary frequency \n"); |
---|
13347 | MrBayesPrint (" parameter pi{1} to (0.1,0.1,0.4,0.4) for all chains in run 1, and to \n"); |
---|
13348 | MrBayesPrint (" (0.3,0.3,0.2,0.2) for chain 3 of run 2, we would use \n"); |
---|
13349 | MrBayesPrint (" \n"); |
---|
13350 | MrBayesPrint (" startvals pi{1}(1,)=(0.1,0.1,0.4,0.4) pi{1}(2,3)=(0.3,0.3,0.2,0.2) \n"); |
---|
13351 | MrBayesPrint (" \n"); |
---|
13352 | MrBayesPrint (" --------------------------------------------------------------------------- \n"); |
---|
13353 | } |
---|
13354 | else |
---|
13355 | { |
---|
13356 | return (ERROR); |
---|
13357 | } |
---|
13358 | |
---|
13359 | return (NO_ERROR); |
---|
13360 | |
---|
13361 | } |
---|
13362 | |
---|
13363 | |
---|
13364 | |
---|
13365 | |
---|
13366 | |
---|
13367 | /* IsAmbig: This function returns YES if character is set as ambiguous |
---|
13368 | either by using parenthetic notation or by ambiguity codes. It returns |
---|
13369 | NO if character is unambiguous, missing or gapped */ |
---|
13370 | int IsAmbig (int charCode, int dType) |
---|
13371 | |
---|
13372 | { |
---|
13373 | |
---|
13374 | if (dType == DNA || dType == RNA || dType == STANDARD |
---|
13375 | || dType == RESTRICTION || dType == PROTEIN) |
---|
13376 | { |
---|
13377 | if (charCode != MISSING && charCode != GAP) |
---|
13378 | if (NBits(charCode) > 1) |
---|
13379 | return (YES); |
---|
13380 | } |
---|
13381 | else if (dType == CONTINUOUS) |
---|
13382 | { |
---|
13383 | /* do nothing, these cannot be partly ambiguous */ |
---|
13384 | |
---|
13385 | } |
---|
13386 | else |
---|
13387 | { |
---|
13388 | MrBayesPrint ("Unknown datatype in \"IsAmbig\"\n", spacer); |
---|
13389 | } |
---|
13390 | |
---|
13391 | return (NO); |
---|
13392 | |
---|
13393 | } |
---|
13394 | |
---|
13395 | |
---|
13396 | |
---|
13397 | |
---|
13398 | |
---|
13399 | int IsArgValid (char *tk, char *validArg) |
---|
13400 | |
---|
13401 | { |
---|
13402 | |
---|
13403 | int i, j, k, tkLen, targetLen, numDiff, numStrMatches; |
---|
13404 | char tempStr[100]; |
---|
13405 | ParmInfoPtr p; |
---|
13406 | |
---|
13407 | p = paramPtr; |
---|
13408 | tkLen = (int) strlen(tk); |
---|
13409 | |
---|
13410 | numStrMatches = i = j = 0; |
---|
13411 | do |
---|
13412 | { |
---|
13413 | if (p->valueList[i] == '|' || p->valueList[i] == '\0') |
---|
13414 | { |
---|
13415 | tempStr[j++] = '\0'; |
---|
13416 | targetLen = (int) strlen(tempStr); |
---|
13417 | if (tkLen <= targetLen) |
---|
13418 | { |
---|
13419 | numDiff = 0; |
---|
13420 | for (k=0; k<tkLen; k++) |
---|
13421 | if (ChangeCase(tk[k]) != ChangeCase(tempStr[k])) |
---|
13422 | numDiff++; |
---|
13423 | if (numDiff == 0) |
---|
13424 | { |
---|
13425 | numStrMatches++; |
---|
13426 | strcpy (validArg, tempStr); |
---|
13427 | } |
---|
13428 | } |
---|
13429 | j = 0; |
---|
13430 | } |
---|
13431 | else |
---|
13432 | tempStr[j++] = p->valueList[i]; |
---|
13433 | i++; |
---|
13434 | } |
---|
13435 | while (p->valueList[i] != '\0'); |
---|
13436 | |
---|
13437 | if (numStrMatches == 0) |
---|
13438 | { |
---|
13439 | MrBayesPrint ("%s No valid match for argument \"%s\"\n", spacer, tk); |
---|
13440 | return (ERROR); |
---|
13441 | } |
---|
13442 | else if (numStrMatches == 1) |
---|
13443 | { |
---|
13444 | return (NO_ERROR); |
---|
13445 | } |
---|
13446 | else |
---|
13447 | { |
---|
13448 | MrBayesPrint ("%s Argument \"%s\" is ambiguous\n", spacer, tk); |
---|
13449 | return (ERROR); |
---|
13450 | } |
---|
13451 | |
---|
13452 | } |
---|
13453 | |
---|
13454 | |
---|
13455 | |
---|
13456 | |
---|
13457 | |
---|
13458 | int IsIn (char ch, char *s) |
---|
13459 | |
---|
13460 | { |
---|
13461 | |
---|
13462 | while (*s) |
---|
13463 | { |
---|
13464 | if (*s++ == ch) |
---|
13465 | return 1; |
---|
13466 | } |
---|
13467 | return 0; |
---|
13468 | |
---|
13469 | } |
---|
13470 | |
---|
13471 | |
---|
13472 | |
---|
13473 | |
---|
13474 | |
---|
13475 | int IsMissing (int charCode, int dType) |
---|
13476 | |
---|
13477 | { |
---|
13478 | |
---|
13479 | if (dType == DNA || dType == RNA) |
---|
13480 | { |
---|
13481 | if (charCode == 15 || charCode == 16) |
---|
13482 | return (YES); |
---|
13483 | } |
---|
13484 | else if (dType == STANDARD || dType == PROTEIN) |
---|
13485 | { |
---|
13486 | if (charCode == MISSING || charCode == GAP) |
---|
13487 | return (YES); |
---|
13488 | } |
---|
13489 | else if (dType == RESTRICTION) |
---|
13490 | { |
---|
13491 | if (charCode == 3 || charCode == 4) |
---|
13492 | return (YES); |
---|
13493 | } |
---|
13494 | else if (dType == CONTINUOUS) |
---|
13495 | { |
---|
13496 | |
---|
13497 | } |
---|
13498 | else |
---|
13499 | { |
---|
13500 | MrBayesPrint ("Unknown datatype in \"IsMissing\"\n", spacer); |
---|
13501 | } |
---|
13502 | return (NO); |
---|
13503 | |
---|
13504 | } |
---|
13505 | |
---|
13506 | |
---|
13507 | |
---|
13508 | |
---|
13509 | |
---|
13510 | int IsSame (char *s1, char *s2) |
---|
13511 | |
---|
13512 | { |
---|
13513 | |
---|
13514 | int i, nDiff, isIdentical, len; |
---|
13515 | |
---|
13516 | isIdentical = YES; |
---|
13517 | if (strlen(s1) != strlen(s2)) |
---|
13518 | isIdentical = NO; /* strings cannot be identical because they are different lengths */ |
---|
13519 | |
---|
13520 | /* now, we go through both strings, one character at a time, to see if |
---|
13521 | any are different */ |
---|
13522 | if (strlen(s1) > strlen(s2)) |
---|
13523 | len = (int) strlen(s2); |
---|
13524 | else |
---|
13525 | len = (int) strlen(s1); |
---|
13526 | i = nDiff = 0; |
---|
13527 | while (i < len) |
---|
13528 | { |
---|
13529 | if (tolower(s1[i]) != tolower(s2[i])) |
---|
13530 | nDiff++; |
---|
13531 | i++; |
---|
13532 | } |
---|
13533 | if (nDiff == 0 && isIdentical == YES) |
---|
13534 | return (SAME); |
---|
13535 | else if (nDiff == 0 && isIdentical == NO) |
---|
13536 | return (CONSISTENT_WITH); |
---|
13537 | else |
---|
13538 | return (DIFFERENT); |
---|
13539 | |
---|
13540 | } |
---|
13541 | |
---|
13542 | |
---|
13543 | |
---|
13544 | |
---|
13545 | |
---|
13546 | int IsWhite (char c) |
---|
13547 | |
---|
13548 | { |
---|
13549 | |
---|
13550 | if (c == ' ' || c == '\t' || c == '\n' || c == '\r') |
---|
13551 | { |
---|
13552 | if (c == '\n' || c == '\r') |
---|
13553 | return 2; |
---|
13554 | return 1; |
---|
13555 | } |
---|
13556 | return 0; |
---|
13557 | |
---|
13558 | } |
---|
13559 | |
---|
13560 | |
---|
13561 | |
---|
13562 | |
---|
13563 | |
---|
13564 | /* NBits: count bits in an int */ |
---|
13565 | int NBits (int x) |
---|
13566 | |
---|
13567 | { |
---|
13568 | |
---|
13569 | int n=0; |
---|
13570 | |
---|
13571 | for (n=0; x != 0; n++) |
---|
13572 | x &= (x-1); |
---|
13573 | |
---|
13574 | return n; |
---|
13575 | |
---|
13576 | } |
---|
13577 | |
---|
13578 | |
---|
13579 | |
---|
13580 | |
---|
13581 | |
---|
13582 | int NucID (char nuc) |
---|
13583 | |
---|
13584 | { |
---|
13585 | |
---|
13586 | char n; |
---|
13587 | |
---|
13588 | if (nuc == 'U' || nuc == 'u') |
---|
13589 | n = 'T'; |
---|
13590 | else |
---|
13591 | n = nuc; |
---|
13592 | |
---|
13593 | if (n == 'A' || n == 'a') |
---|
13594 | { |
---|
13595 | return 1; |
---|
13596 | } |
---|
13597 | else if (n == 'C' || n == 'c') |
---|
13598 | { |
---|
13599 | return 2; |
---|
13600 | } |
---|
13601 | else if (n == 'G' || n == 'g') |
---|
13602 | { |
---|
13603 | return 4; |
---|
13604 | } |
---|
13605 | else if (n == 'T' || n == 't') |
---|
13606 | { |
---|
13607 | return 8; |
---|
13608 | } |
---|
13609 | else if (n == 'R' || n == 'r') |
---|
13610 | { |
---|
13611 | return 5; |
---|
13612 | } |
---|
13613 | else if (n == 'Y' || n == 'y') |
---|
13614 | { |
---|
13615 | return 10; |
---|
13616 | } |
---|
13617 | else if (n == 'M' || n == 'm') |
---|
13618 | { |
---|
13619 | return 3; |
---|
13620 | } |
---|
13621 | else if (n == 'K' || n == 'k') |
---|
13622 | { |
---|
13623 | return 12; |
---|
13624 | } |
---|
13625 | else if (n == 'S' || n == 's') |
---|
13626 | { |
---|
13627 | return 6; |
---|
13628 | } |
---|
13629 | else if (n == 'W' || n == 'w') |
---|
13630 | { |
---|
13631 | return 9; |
---|
13632 | } |
---|
13633 | else if (n == 'H' || n == 'h') |
---|
13634 | { |
---|
13635 | return 11; |
---|
13636 | } |
---|
13637 | else if (n == 'B' || n == 'b') |
---|
13638 | { |
---|
13639 | return 14; |
---|
13640 | } |
---|
13641 | else if (n == 'V' || n == 'v') |
---|
13642 | { |
---|
13643 | return 7; |
---|
13644 | } |
---|
13645 | else if (n == 'D' || n == 'd') |
---|
13646 | { |
---|
13647 | return 13; |
---|
13648 | } |
---|
13649 | else if (n == 'N' || n == 'n') |
---|
13650 | { |
---|
13651 | return 15; |
---|
13652 | } |
---|
13653 | else if (n == gapId) |
---|
13654 | { |
---|
13655 | return GAP; |
---|
13656 | } |
---|
13657 | else if (n == missingId) |
---|
13658 | { |
---|
13659 | return MISSING; |
---|
13660 | } |
---|
13661 | else |
---|
13662 | return -1; |
---|
13663 | |
---|
13664 | } |
---|
13665 | |
---|
13666 | |
---|
13667 | |
---|
13668 | |
---|
13669 | |
---|
13670 | /*-------| ParseCommand |------------------------------------------------ |
---|
13671 | | |
---|
13672 | | This function is used to parse a file. The expected format is: |
---|
13673 | | |
---|
13674 | | command parameter=value parameter=value ... ; |
---|
13675 | | |
---|
13676 | | For example, the following is a valid line for this parser: |
---|
13677 | | |
---|
13678 | | lset nst=2; |
---|
13679 | | |
---|
13680 | | In some cases, however, the format is: |
---|
13681 | | |
---|
13682 | | command stuff more stuff ... ; |
---|
13683 | | |
---|
13684 | | For example, when reading a data file, the matrix command might be: |
---|
13685 | | |
---|
13686 | | matrix |
---|
13687 | | taxon_1 data |
---|
13688 | | taxon_2 data |
---|
13689 | | taxon_3 data |
---|
13690 | | ; |
---|
13691 | | |
---|
13692 | | Like before, the command and all of the stuff for that command are |
---|
13693 | | terminated by a semicolon. |
---|
13694 | | |
---|
13695 | */ |
---|
13696 | int ParseCommand (char *s) |
---|
13697 | |
---|
13698 | { |
---|
13699 | |
---|
13700 | int rc, tokenType, inError, numMatches, skipCmd; |
---|
13701 | char errStr[100]; |
---|
13702 | |
---|
13703 | cmdStr = s; |
---|
13704 | tokenP = &s[0]; |
---|
13705 | |
---|
13706 | # if defined (ECHO_PROCESSED_COMMANDS) |
---|
13707 | MrBayesPrint ("Currently processing command: %s\n", s); |
---|
13708 | # endif |
---|
13709 | |
---|
13710 | inError = skipCmd = NO; |
---|
13711 | do |
---|
13712 | { |
---|
13713 | /* Get the next token. A token is a valid word in a line. Token type is defined in "globals.h". */ |
---|
13714 | if( GetToken (token, &tokenType, &tokenP)) |
---|
13715 | { |
---|
13716 | inError = YES; |
---|
13717 | break; |
---|
13718 | } |
---|
13719 | if (strlen(token) > 0 || tokenType == ALPHA) |
---|
13720 | { |
---|
13721 | # if defined (SHOW_TOKENS) |
---|
13722 | MrBayesPrint ("%s\n", token); |
---|
13723 | # endif |
---|
13724 | if (tokenType == LEFTCOMMENT) |
---|
13725 | { |
---|
13726 | /* If the token is a left comment "[", then we don't want to |
---|
13727 | actually process commands until we find a right comment. */ |
---|
13728 | /* The exception is if readComment is set to YES, in which case |
---|
13729 | we will leave it to the parser functions to decide on whether |
---|
13730 | they want to read the comment or not */ |
---|
13731 | if (readComment == NO || inComment == YES) |
---|
13732 | { |
---|
13733 | inComment = YES; |
---|
13734 | numComments++; |
---|
13735 | } |
---|
13736 | } |
---|
13737 | if (inComment == NO && inForeignBlock == NO) |
---|
13738 | { |
---|
13739 | if (tokenType != SEMICOLON) |
---|
13740 | { |
---|
13741 | /* If the token is not a semicolon, then we will be processing |
---|
13742 | either a command or a parameter. */ |
---|
13743 | if (expecting == Expecting(COMMAND)) |
---|
13744 | { |
---|
13745 | /* We are expecting to find a command (defined above in "commands[]"). Find the |
---|
13746 | correct command and set a pointer to that command. */ |
---|
13747 | commandPtr = NULL; |
---|
13748 | if (FindValidCommand (token, &numMatches) == ERROR) |
---|
13749 | { |
---|
13750 | /* We couldn't find the command or the user did not specify enough letters |
---|
13751 | to unambiguously determine the command. The command pointer (commandPtr) |
---|
13752 | is NULL. */ |
---|
13753 | if (numMatches == 0) |
---|
13754 | MrBayesPrint ("%s Could not find command \"%s\"\n", spacer, token); |
---|
13755 | else |
---|
13756 | MrBayesPrint ("%s Ambiguous command \"%s\"\n", spacer, token); |
---|
13757 | inError = YES; |
---|
13758 | } |
---|
13759 | else |
---|
13760 | { |
---|
13761 | /* We did find a valid command. Set what we are expecting to see next. */ |
---|
13762 | expecting = commandPtr->expect; |
---|
13763 | |
---|
13764 | /* Check to see if we have one of the so-called special cases in which a |
---|
13765 | command is not necessarily followed by a parameter (e.g., matrix). If we |
---|
13766 | do have a special case, then we want to set the parameter pointer (paramPtr) |
---|
13767 | appropriately. In this case, simply go to the first parameter in the parmList. */ |
---|
13768 | if (commandPtr->specialCmd == YES) |
---|
13769 | { |
---|
13770 | isFirstMatrixRead = YES; |
---|
13771 | foundFirst = NO; |
---|
13772 | paramPtr = paramTable + commandPtr->parmList[0]; |
---|
13773 | } |
---|
13774 | if (strcmp(commandPtr->string, "Execute")==0) |
---|
13775 | { |
---|
13776 | /* set the tokenizer to recognize quoted strings */ |
---|
13777 | readWord = YES; |
---|
13778 | } |
---|
13779 | } |
---|
13780 | } |
---|
13781 | else |
---|
13782 | { |
---|
13783 | /* We are expecting to find a parameter or a value for the parameter, not a command. */ |
---|
13784 | if ((expecting & Expecting(PARAMETER)) == Expecting(PARAMETER) && |
---|
13785 | (expecting & Expecting(tokenType)) != Expecting(tokenType)) |
---|
13786 | { |
---|
13787 | /* Specifically, if we are here, we need to go through the parameter list, |
---|
13788 | checking to see if the token is a valid parameter. */ |
---|
13789 | expecting = (expecting & Expecting(PARAMETER)); |
---|
13790 | if (FindValidParam (token, &numMatches) == ERROR) |
---|
13791 | { |
---|
13792 | /* The token is not a valid parameter. */ |
---|
13793 | if (numMatches == 0) |
---|
13794 | MrBayesPrint ("%s Could not find parameter \"%s\"\n", spacer, token); |
---|
13795 | else |
---|
13796 | MrBayesPrint ("%s Ambiguous parameter \"%s\"\n", spacer, token); |
---|
13797 | inError = YES; |
---|
13798 | } |
---|
13799 | else |
---|
13800 | { |
---|
13801 | /* The token is a valid parameter. Call the appropriate function ("DoXxxxParm"). */ |
---|
13802 | if ((paramPtr->fp)(paramPtr->string, token) == ERROR) |
---|
13803 | { |
---|
13804 | if (strcmp("Xxxxxxxxxx", paramPtr->string)) |
---|
13805 | MrBayesPrint ("%s Error when setting parameter \"%s\" (1)\n", spacer, paramPtr->string); |
---|
13806 | inError = YES; |
---|
13807 | } |
---|
13808 | } |
---|
13809 | } |
---|
13810 | else |
---|
13811 | { |
---|
13812 | /* Otherwise, we are expecting a value for the parameter. Call the appropriate function ("DoXxxxParm"). */ |
---|
13813 | if ((expecting & Expecting(tokenType)) != 0) |
---|
13814 | expecting = (expecting & Expecting(tokenType)); |
---|
13815 | if ((Expecting(tokenType) & expecting) == Expecting(tokenType)) |
---|
13816 | { |
---|
13817 | if ((paramPtr->fp)(paramPtr->string, token) == ERROR) |
---|
13818 | { |
---|
13819 | if (strcmp("Xxxxxxxxxx", paramPtr->string)) |
---|
13820 | MrBayesPrint ("%s Error when setting parameter \"%s\" (2)\n", spacer, paramPtr->string); |
---|
13821 | inError = YES; |
---|
13822 | } |
---|
13823 | } |
---|
13824 | else |
---|
13825 | { |
---|
13826 | inError = YES; |
---|
13827 | WhatVariableExp (expecting, errStr); |
---|
13828 | MrBayesPrint ("%s Expecting '%s'\n", spacer, errStr+1); /* there will be an initial space in errStr so print from pos 1 */ |
---|
13829 | if (numOpenExeFiles > 0) |
---|
13830 | MrBayesPrint ("%s Instead found '%s' in command '%s'\n", |
---|
13831 | spacer, token, commandPtr->string); |
---|
13832 | else |
---|
13833 | MrBayesPrint ("%s Instead found '%s' in command '%s' at position %d\n", |
---|
13834 | spacer, token, commandPtr->string, tokenP - cmdStr - strlen(token)+1); |
---|
13835 | } |
---|
13836 | } |
---|
13837 | } |
---|
13838 | } |
---|
13839 | else |
---|
13840 | { |
---|
13841 | /* The token is a semicolon. This means that we are at the end of processing one command. We |
---|
13842 | need to clean things up. We do this by calling the finishing function ("DoXxxx"). */ |
---|
13843 | if ((Expecting(SEMICOLON) & expecting) == Expecting(SEMICOLON)) |
---|
13844 | { |
---|
13845 | if (commandPtr->cmdFxnPtr != NULL) |
---|
13846 | { |
---|
13847 | /* Finish up the command here. */ |
---|
13848 | rc = (commandPtr->cmdFxnPtr) (); |
---|
13849 | if (rc == ERROR || rc == ABORT) |
---|
13850 | { |
---|
13851 | if (rc == ABORT) |
---|
13852 | { |
---|
13853 | MrBayesPrint (" Mcmc run aborted\n"); |
---|
13854 | } |
---|
13855 | else if (rc == SKIP_COMMAND) |
---|
13856 | { |
---|
13857 | MrBayesPrint (" Cancelled execution of command\n"); |
---|
13858 | skipCmd = YES; |
---|
13859 | } |
---|
13860 | else |
---|
13861 | { |
---|
13862 | MrBayesPrint ("%s Error in command \"%s\"\n", spacer, commandPtr->string); |
---|
13863 | inError = YES; |
---|
13864 | } |
---|
13865 | } |
---|
13866 | } |
---|
13867 | /* if the user typed "quit", then we want to bail out of this loop, with a NO_ERROR_QUIT */ |
---|
13868 | if (!strcmp(commandPtr->string, "Quit")) |
---|
13869 | return (NO_ERROR_QUIT); |
---|
13870 | expecting = Expecting(COMMAND); |
---|
13871 | } |
---|
13872 | else |
---|
13873 | { |
---|
13874 | inError = YES; |
---|
13875 | WhatVariableExp (expecting, errStr); |
---|
13876 | MrBayesPrint ("%s Expecting %s\n", spacer, errStr); |
---|
13877 | } |
---|
13878 | } |
---|
13879 | } |
---|
13880 | /* Check to see if a comment is terminated. A comment can either be a right comment "]" or, if we were in a foreign nexus block |
---|
13881 | (e.g., a "paup" block) the terminating comment will be "end". */ |
---|
13882 | if (tokenType == RIGHTCOMMENT) |
---|
13883 | { |
---|
13884 | if (inComment == NO && readComment == NO) |
---|
13885 | { |
---|
13886 | MrBayesPrint ("%s Found \"]\", without having previously found \"[\"\n", spacer); |
---|
13887 | inError = YES; |
---|
13888 | } |
---|
13889 | else if (inComment == NO && readComment == YES) |
---|
13890 | { |
---|
13891 | /* This is OK, we just pass through and rely on the command to handle the RIGHTCOMMENT */ |
---|
13892 | } |
---|
13893 | else |
---|
13894 | { |
---|
13895 | numComments--; |
---|
13896 | if (numComments == 0) |
---|
13897 | inComment = NO; |
---|
13898 | } |
---|
13899 | } |
---|
13900 | if ((IsSame(token, "end") == SAME || IsSame(token, "endblock") == SAME) && inForeignBlock == YES) |
---|
13901 | { |
---|
13902 | strcpy (spacer, ""); |
---|
13903 | inForeignBlock = NO; |
---|
13904 | } |
---|
13905 | } |
---|
13906 | |
---|
13907 | } while ((*token || tokenType == ALPHA) && inError == NO && skipCmd == NO); |
---|
13908 | |
---|
13909 | if (inError == YES) |
---|
13910 | { |
---|
13911 | readComment = NO; /* reset this in case it is set to YES in command and we get an error exit */ |
---|
13912 | return (ERROR); |
---|
13913 | } |
---|
13914 | else |
---|
13915 | return (NO_ERROR); |
---|
13916 | |
---|
13917 | } |
---|
13918 | |
---|
13919 | |
---|
13920 | |
---|
13921 | |
---|
13922 | |
---|
13923 | void PrintSettings (char *command, ModelInfo *mp) |
---|
13924 | |
---|
13925 | { |
---|
13926 | char yesNoStr[20]; |
---|
13927 | |
---|
13928 | if (!strcmp(command,"Mcmc")) |
---|
13929 | { |
---|
13930 | MrBayesPrint (" Parameter Options Current Setting \n"); |
---|
13931 | MrBayesPrint (" ----------------------------------------------------- \n"); |
---|
13932 | MrBayesPrint (" Ngen <number> %d \n", chainParams.numGen); |
---|
13933 | MrBayesPrint (" Nruns <number> %d \n", chainParams.numRuns); |
---|
13934 | MrBayesPrint (" Nchains <number> %d \n", chainParams.numChains); |
---|
13935 | MrBayesPrint (" Temp <number> %lf \n", chainParams.chainTemp); |
---|
13936 | MrBayesPrint (" Reweight <number>,<number> %1.2lf v %1.2lf ^ \n", chainParams.weightScheme[0], chainParams.weightScheme[1]); |
---|
13937 | MrBayesPrint (" Swapfreq <number> %d \n", chainParams.swapFreq); |
---|
13938 | MrBayesPrint (" Nswaps <number> %d \n", chainParams.numSwaps); |
---|
13939 | MrBayesPrint (" Samplefreq <number> %d \n", chainParams.sampleFreq); |
---|
13940 | MrBayesPrint (" Printfreq <number> %d \n", chainParams.printFreq); |
---|
13941 | PrintYesNo (chainParams.printAll, yesNoStr); |
---|
13942 | MrBayesPrint (" Printall Yes/No %s \n", yesNoStr); |
---|
13943 | MrBayesPrint (" Printmax <number> %d \n", chainParams.printMax); |
---|
13944 | PrintYesNo (chainParams.mcmcDiagn, yesNoStr); |
---|
13945 | MrBayesPrint (" Mcmcdiagn Yes/No %s \n", yesNoStr); |
---|
13946 | MrBayesPrint (" Diagnfreq <number> %d \n", chainParams.diagnFreq); |
---|
13947 | if (chainParams.diagnStat == AVGSTDDEV) |
---|
13948 | strcpy (yesNoStr, "Avgstddev"); |
---|
13949 | else |
---|
13950 | strcpy (yesNoStr, "Maxstddev"); |
---|
13951 | MrBayesPrint (" Diagnstat Avgstddev/Maxstddev %s \n", yesNoStr); |
---|
13952 | MrBayesPrint (" Minpartfreq <number> %1.2lf \n", chainParams.minPartFreq); |
---|
13953 | PrintYesNo (chainParams.allChains, yesNoStr); |
---|
13954 | MrBayesPrint (" Allchains Yes/No %s \n", yesNoStr); |
---|
13955 | PrintYesNo (chainParams.allComps, yesNoStr); |
---|
13956 | MrBayesPrint (" Allcomps Yes/No %s \n", yesNoStr); |
---|
13957 | PrintYesNo (chainParams.relativeBurnin, yesNoStr); |
---|
13958 | MrBayesPrint (" Relburnin Yes/No %s \n", yesNoStr); |
---|
13959 | MrBayesPrint (" Burnin <number> %d \n", chainParams.chainBurnIn); |
---|
13960 | MrBayesPrint (" Burninfrac <number> %1.2lf \n", chainParams.burninFraction); |
---|
13961 | PrintYesNo (chainParams.stopRule, yesNoStr); |
---|
13962 | MrBayesPrint (" Stoprule Yes/No %s \n", yesNoStr); |
---|
13963 | MrBayesPrint (" Stopval <number> %1.2lf \n", chainParams.stopVal); |
---|
13964 | PrintYesNo (chainParams.saveTrees, yesNoStr); |
---|
13965 | MrBayesPrint (" Savetrees Yes/No %s \n", yesNoStr); |
---|
13966 | PrintYesNo (chainParams.checkPoint, yesNoStr); |
---|
13967 | MrBayesPrint (" Checkpoint Yes/No %s \n", yesNoStr); |
---|
13968 | MrBayesPrint (" Checkfreq <number> %d \n", chainParams.checkFreq); |
---|
13969 | MrBayesPrint (" Filename <name> %s.<p/t>\n", chainParams.chainFileName); |
---|
13970 | MrBayesPrint (" Startparams Current/Reset %s \n", chainParams.startParams); |
---|
13971 | MrBayesPrint (" Starttree Current/Random/ %s \n", chainParams.startTree); |
---|
13972 | MrBayesPrint (" Parsimony \n"); |
---|
13973 | MrBayesPrint (" Nperts <number> %d \n", chainParams.numStartPerts); |
---|
13974 | PrintYesNo (chainParams.runWithData, yesNoStr); |
---|
13975 | MrBayesPrint (" Data Yes/No %s \n", yesNoStr); |
---|
13976 | MrBayesPrint (" Ordertaxa Yes/No %s \n", chainParams.orderTaxa == YES? "Yes" : "No"); |
---|
13977 | MrBayesPrint (" Append Yes/No %s \n", chainParams.append == YES? "Yes" : "No"); |
---|
13978 | MrBayesPrint (" Autotune Yes/No %s \n", chainParams.autotune == YES? "Yes" : "No"); |
---|
13979 | MrBayesPrint (" Tunefreq <number> %d \n", chainParams.tuneFreq); |
---|
13980 | MrBayesPrint (" \n"); |
---|
13981 | } |
---|
13982 | } |
---|
13983 | |
---|
13984 | |
---|
13985 | |
---|
13986 | |
---|
13987 | void PrintYesNo (int yn, char s[4]) |
---|
13988 | |
---|
13989 | { |
---|
13990 | |
---|
13991 | if (yn == YES) |
---|
13992 | strcpy (s, "Yes"); |
---|
13993 | else |
---|
13994 | strcpy (s, "No"); |
---|
13995 | |
---|
13996 | } |
---|
13997 | |
---|
13998 | |
---|
13999 | |
---|
14000 | |
---|
14001 | |
---|
14002 | int ProtID (char aa) |
---|
14003 | |
---|
14004 | { |
---|
14005 | |
---|
14006 | |
---|
14007 | if (aa == 'A' || aa == 'a') /* Ala */ |
---|
14008 | { |
---|
14009 | return 1; |
---|
14010 | } |
---|
14011 | else if (aa == 'R' || aa == 'r') /* Arg */ |
---|
14012 | { |
---|
14013 | return 2; |
---|
14014 | } |
---|
14015 | else if (aa == 'N' || aa == 'n') /* Asn */ |
---|
14016 | { |
---|
14017 | return 4; |
---|
14018 | } |
---|
14019 | else if (aa == 'D' || aa == 'd') /* Asp */ |
---|
14020 | { |
---|
14021 | return 8; |
---|
14022 | } |
---|
14023 | else if (aa == 'C' || aa == 'c') /* Cys */ |
---|
14024 | { |
---|
14025 | return 16; |
---|
14026 | } |
---|
14027 | else if (aa == 'Q' || aa == 'q') /* Gln */ |
---|
14028 | { |
---|
14029 | return 32; |
---|
14030 | } |
---|
14031 | else if (aa == 'E' || aa == 'e') /* Glu */ |
---|
14032 | { |
---|
14033 | return 64; |
---|
14034 | } |
---|
14035 | else if (aa == 'G' || aa == 'g') /* Gly */ |
---|
14036 | { |
---|
14037 | return 128; |
---|
14038 | } |
---|
14039 | else if (aa == 'H' || aa == 'h') /* His */ |
---|
14040 | { |
---|
14041 | return 256; |
---|
14042 | } |
---|
14043 | else if (aa == 'I' || aa == 'i') /* Ile */ |
---|
14044 | { |
---|
14045 | return 512; |
---|
14046 | } |
---|
14047 | else if (aa == 'L' || aa == 'l') /* Leu */ |
---|
14048 | { |
---|
14049 | return 1024; |
---|
14050 | } |
---|
14051 | else if (aa == 'K' || aa == 'k') /* Lys */ |
---|
14052 | { |
---|
14053 | return 2048; |
---|
14054 | } |
---|
14055 | else if (aa == 'M' || aa == 'm') /* Met */ |
---|
14056 | { |
---|
14057 | return 4096; |
---|
14058 | } |
---|
14059 | else if (aa == 'F' || aa == 'f') /* Phe */ |
---|
14060 | { |
---|
14061 | return 8192; |
---|
14062 | } |
---|
14063 | else if (aa == 'P' || aa == 'p') /* Pro */ |
---|
14064 | { |
---|
14065 | return 16384; |
---|
14066 | } |
---|
14067 | else if (aa == 'S' || aa == 's') /* Ser */ |
---|
14068 | { |
---|
14069 | return 32768; |
---|
14070 | } |
---|
14071 | else if (aa == 'T' || aa == 't') /* Thr */ |
---|
14072 | { |
---|
14073 | return 65536; |
---|
14074 | } |
---|
14075 | else if (aa == 'W' || aa == 'w') /* Trp */ |
---|
14076 | { |
---|
14077 | return 131072; |
---|
14078 | } |
---|
14079 | else if (aa == 'Y' || aa == 'y') /* Tyr */ |
---|
14080 | { |
---|
14081 | return 262144; |
---|
14082 | } |
---|
14083 | else if (aa == 'V' || aa == 'v') /* Val */ |
---|
14084 | { |
---|
14085 | return 524288; |
---|
14086 | } |
---|
14087 | else if (aa == 'X' || aa == 'x') /* Nonidentified */ |
---|
14088 | { |
---|
14089 | return MISSING; |
---|
14090 | } |
---|
14091 | else if (aa == gapId) |
---|
14092 | { |
---|
14093 | return GAP; |
---|
14094 | } |
---|
14095 | else if (aa == missingId) |
---|
14096 | { |
---|
14097 | return MISSING; |
---|
14098 | } |
---|
14099 | else |
---|
14100 | return -1; |
---|
14101 | |
---|
14102 | } |
---|
14103 | |
---|
14104 | |
---|
14105 | |
---|
14106 | |
---|
14107 | |
---|
14108 | int RemoveLastFromString (char *s1) |
---|
14109 | |
---|
14110 | { |
---|
14111 | |
---|
14112 | int i, j, numPrev, numRemoved; |
---|
14113 | |
---|
14114 | /* We remove the last name from the string simply by deleting the last "|". */ |
---|
14115 | |
---|
14116 | i = numPrev = 0; |
---|
14117 | while (s1[i] != '\0') |
---|
14118 | { |
---|
14119 | if (s1[i] == '|') |
---|
14120 | numPrev++; |
---|
14121 | i++; |
---|
14122 | } |
---|
14123 | |
---|
14124 | i = j = numRemoved = 0; |
---|
14125 | while (s1[i] != '\0') |
---|
14126 | { |
---|
14127 | if (s1[i] == '|') |
---|
14128 | j++; |
---|
14129 | if (numPrev == j) |
---|
14130 | { |
---|
14131 | s1[i] = ' '; |
---|
14132 | numRemoved++; |
---|
14133 | break; |
---|
14134 | } |
---|
14135 | i++; |
---|
14136 | } |
---|
14137 | |
---|
14138 | if (numRemoved != 1) |
---|
14139 | { |
---|
14140 | MrBayesPrint ("%s Could not find name to remove\n", spacer); |
---|
14141 | return (ERROR); |
---|
14142 | } |
---|
14143 | |
---|
14144 | return (NO_ERROR); |
---|
14145 | |
---|
14146 | } |
---|
14147 | |
---|
14148 | |
---|
14149 | |
---|
14150 | |
---|
14151 | |
---|
14152 | int MBResID (char nuc) |
---|
14153 | |
---|
14154 | { |
---|
14155 | |
---|
14156 | char n; |
---|
14157 | |
---|
14158 | n = nuc; |
---|
14159 | |
---|
14160 | if (n == '0' || n == 'a' || n == 'A') |
---|
14161 | { |
---|
14162 | return 1; |
---|
14163 | } |
---|
14164 | else if (n == '1' || n == 'b' || n == 'B') |
---|
14165 | { |
---|
14166 | return 2; |
---|
14167 | } |
---|
14168 | else if (n == gapId) |
---|
14169 | { |
---|
14170 | return GAP; |
---|
14171 | } |
---|
14172 | else if (n == missingId) |
---|
14173 | { |
---|
14174 | return MISSING; |
---|
14175 | } |
---|
14176 | else |
---|
14177 | return -1; |
---|
14178 | |
---|
14179 | } |
---|
14180 | |
---|
14181 | |
---|
14182 | |
---|
14183 | |
---|
14184 | |
---|
14185 | /* Reset character flags */ |
---|
14186 | void ResetCharacterFlags (void) |
---|
14187 | { |
---|
14188 | /* reset all characters flags */ |
---|
14189 | numChar = 0; /* number of defined characters */ |
---|
14190 | defChars = NO; /* flag for whether number of characters is known*/ |
---|
14191 | defMatrix = NO; /* flag for whether matrix is successfull read */ |
---|
14192 | matrixHasPoly = NO; /* flag for whether matrix has polymorphisms */ |
---|
14193 | isInAmbig = NO; /* flag for whether the parser is within () */ |
---|
14194 | isInPoly = NO; /* flag for whether the parser is within {} */ |
---|
14195 | defPartition = NO; /* flag for whether character partition is read */ |
---|
14196 | defPairs = NO; /* flag indicating whether pairs have been defnd */ |
---|
14197 | numDefinedPartitions = 0; /* number of defined partitions */ |
---|
14198 | partitionNum = 0; /* partition number currently enforced */ |
---|
14199 | numCurrentDivisions = 0; /* number of partitions of data */ |
---|
14200 | numCharSets = 0; /* holds number of character sets */ |
---|
14201 | numDivisions = 1; /* holds number of partitions */ |
---|
14202 | isMixed = NO; /* are data mixed ? */ |
---|
14203 | dataType = NONE; /* holds datatype */ |
---|
14204 | matchId = '\0'; /* no default for match character */ |
---|
14205 | gapId = '\0'; /* no default for gap character */ |
---|
14206 | missingId = '\0'; /* no default for missing characters */ |
---|
14207 | } |
---|
14208 | |
---|
14209 | |
---|
14210 | |
---|
14211 | |
---|
14212 | |
---|
14213 | /* Reset taxa flags */ |
---|
14214 | void ResetTaxaFlags (void) |
---|
14215 | { |
---|
14216 | numTaxa = 0; /* number of taxa */ |
---|
14217 | numNamedTaxa = 0; /* number of named taxa */ |
---|
14218 | defTaxa = NO; /* flag for whether number of taxa is known */ |
---|
14219 | isTaxsetDef = NO; /* is a taxlabels set defined */ |
---|
14220 | numDefinedConstraints = 0; /* holds number of defined constraints */ |
---|
14221 | definedConstraint = NULL; |
---|
14222 | definedConstraintTwo = NULL; |
---|
14223 | definedConstraintPruned = NULL; |
---|
14224 | definedConstraintTwoPruned = NULL; |
---|
14225 | constraintNames = NULL; |
---|
14226 | nodeCalibration = NULL; |
---|
14227 | tempActiveConstraints = NULL; /* holds temp info on active constraints */ |
---|
14228 | outGroupNum = 0; /* default outgroup */ |
---|
14229 | numTaxaSets = 0; /* holds number of taxa sets */ |
---|
14230 | } |
---|
14231 | |
---|
14232 | |
---|
14233 | |
---|
14234 | |
---|
14235 | |
---|
14236 | /* SetPartition: Set model partition */ |
---|
14237 | int SetPartition (int part) |
---|
14238 | |
---|
14239 | { |
---|
14240 | int i, j; |
---|
14241 | |
---|
14242 | /* Free space for modelParams and modelSettings */ |
---|
14243 | if (memAllocs[ALLOC_MODEL] == YES) |
---|
14244 | { |
---|
14245 | for (i=0; i<numCurrentDivisions; i++) |
---|
14246 | free (modelParams[i].activeConstraints); |
---|
14247 | free (modelParams); |
---|
14248 | free (modelSettings); |
---|
14249 | modelParams = NULL; |
---|
14250 | modelSettings = NULL; |
---|
14251 | memAllocs[ALLOC_MODEL] = NO; |
---|
14252 | } |
---|
14253 | |
---|
14254 | /* Set model partition */ |
---|
14255 | partitionNum = part; |
---|
14256 | numCurrentDivisions = 0; |
---|
14257 | |
---|
14258 | /* Set numCurrentDivisions to maximum division a character belongs to in partition part */ |
---|
14259 | for (i=0; i<numChar; i++) |
---|
14260 | { |
---|
14261 | j = partitionId[i][part]; |
---|
14262 | if (j > numCurrentDivisions) |
---|
14263 | numCurrentDivisions = j; |
---|
14264 | } |
---|
14265 | |
---|
14266 | /* Allocate space for partition models */ |
---|
14267 | modelParams = (Model *) SafeCalloc (numCurrentDivisions, sizeof (Model)); |
---|
14268 | modelSettings = (ModelInfo *) SafeCalloc (numCurrentDivisions, sizeof (ModelInfo)); |
---|
14269 | if (!modelParams || !modelSettings) |
---|
14270 | { |
---|
14271 | MrBayesPrint ("%s Could not allocate modelParams or modelSettings\n", spacer); |
---|
14272 | if (modelParams) |
---|
14273 | free (modelParams); |
---|
14274 | if (modelSettings) |
---|
14275 | free (modelSettings); |
---|
14276 | return (ERROR); |
---|
14277 | } |
---|
14278 | memAllocs[ALLOC_MODEL] = YES; |
---|
14279 | |
---|
14280 | numVars = (int *) SafeRealloc ((void *) numVars, (size_t)(3 * numCurrentDivisions * sizeof(int))); |
---|
14281 | tempLinkUnlinkVec = numVars + numCurrentDivisions; |
---|
14282 | activeParts = numVars + 2*numCurrentDivisions; |
---|
14283 | |
---|
14284 | tempNum = (MrBFlt *) SafeRealloc ((void *) tempNum, (size_t)(6 * sizeof(MrBFlt))); |
---|
14285 | |
---|
14286 | activeParams[0] = (int *) SafeRealloc ((void *) (activeParams[0]), (size_t)(NUM_LINKED * numCurrentDivisions * sizeof(int))); |
---|
14287 | for (i=1; i<NUM_LINKED; i++) |
---|
14288 | activeParams[i] = activeParams[0] + i*numCurrentDivisions; |
---|
14289 | |
---|
14290 | linkTable[0] = (int *) SafeRealloc ((void *) (linkTable[0]), (size_t)(3 * NUM_LINKED * numCurrentDivisions * sizeof(int))); |
---|
14291 | tempLinkUnlink[0] = linkTable[0] + NUM_LINKED*numCurrentDivisions; |
---|
14292 | for (i=1; i<NUM_LINKED; i++) |
---|
14293 | { |
---|
14294 | linkTable[i] = linkTable[0] + i*numCurrentDivisions; |
---|
14295 | tempLinkUnlink[i] = tempLinkUnlink[0] + i*numCurrentDivisions; |
---|
14296 | } |
---|
14297 | |
---|
14298 | return (NO_ERROR); |
---|
14299 | } |
---|
14300 | |
---|
14301 | |
---|
14302 | |
---|
14303 | |
---|
14304 | |
---|
14305 | /* SetSpeciespartition: Set speciespartition */ |
---|
14306 | int SetSpeciespartition (int part) |
---|
14307 | |
---|
14308 | { |
---|
14309 | int i, j; |
---|
14310 | |
---|
14311 | /* Set model partition */ |
---|
14312 | speciespartitionNum = part; |
---|
14313 | numSpecies = 0; |
---|
14314 | |
---|
14315 | /* Set numSpecies to maximum species a taxon belongs to in partition part */ |
---|
14316 | for (i=0; i<numTaxa; i++) |
---|
14317 | { |
---|
14318 | j = speciespartitionId[i][part]; |
---|
14319 | if (j > numSpecies) |
---|
14320 | numSpecies = j; |
---|
14321 | } |
---|
14322 | |
---|
14323 | return (NO_ERROR); |
---|
14324 | } |
---|
14325 | |
---|
14326 | |
---|
14327 | |
---|
14328 | |
---|
14329 | |
---|
14330 | int SetTaxaFromTranslateTable (void) |
---|
14331 | { |
---|
14332 | int i; |
---|
14333 | |
---|
14334 | if (numTaxa != 0) |
---|
14335 | return ERROR; |
---|
14336 | |
---|
14337 | for (i=0; i<numTranslates; i++) |
---|
14338 | { |
---|
14339 | if ( strlen(transFrom[i])>99 ) |
---|
14340 | { |
---|
14341 | MrBayesPrint ("%s Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, transFrom[i]); |
---|
14342 | return (ERROR); |
---|
14343 | } |
---|
14344 | AddString(&taxaNames, numTaxa, transFrom[i]); |
---|
14345 | numTaxa++; |
---|
14346 | } |
---|
14347 | |
---|
14348 | return NO_ERROR; |
---|
14349 | } |
---|
14350 | |
---|
14351 | |
---|
14352 | |
---|
14353 | |
---|
14354 | |
---|
14355 | void SetUpParms (void) |
---|
14356 | |
---|
14357 | { |
---|
14358 | |
---|
14359 | ParmInfoPtr p = paramTable; |
---|
14360 | |
---|
14361 | PARAM ( 0, "NEXUS", DoNexusParm, "NEXUS|\0"); |
---|
14362 | PARAM ( 1, "Data", DoBeginParm, "\0"); |
---|
14363 | PARAM ( 2, "Mrbayes", DoBeginParm, "\0"); |
---|
14364 | PARAM ( 3, "Trees", DoBeginParm, "\0"); |
---|
14365 | PARAM ( 4, "Ntax", DoDimensionsParm, "\0"); |
---|
14366 | PARAM ( 5, "Nchar", DoDimensionsParm, "\0"); |
---|
14367 | PARAM ( 6, "Interleave", DoFormatParm, "Yes|No|\0"); |
---|
14368 | PARAM ( 7, "Datatype", DoFormatParm, "Dna|Rna|Protein|Restriction|Standard|Continuous|Mixed|\0"); |
---|
14369 | PARAM ( 8, "Gap", DoFormatParm, "\0"); |
---|
14370 | PARAM ( 9, "Missing", DoFormatParm, "\0"); |
---|
14371 | PARAM ( 10, "Matchchar", DoFormatParm, "\0"); |
---|
14372 | PARAM ( 11, "MatrixInfo", DoMatrixParm, "\0"); |
---|
14373 | PARAM ( 12, "Filename", DoExecuteParm, "\0"); |
---|
14374 | PARAM ( 13, "Autoclose", DoSetParm, "Yes|No|\0"); |
---|
14375 | PARAM ( 14, "Partition", DoSetParm, "\0"); |
---|
14376 | PARAM ( 15, "Xxxxxxxxxx", DoCharsetParm, "\0"); |
---|
14377 | PARAM ( 16, "Xxxxxxxxxx", DoPartitionParm, "\0"); |
---|
14378 | PARAM ( 17, "Seed", DoMcmcParm, "\0"); |
---|
14379 | PARAM ( 18, "Ngen", DoMcmcParm, "\0"); |
---|
14380 | PARAM ( 19, "Samplefreq", DoMcmcParm, "\0"); |
---|
14381 | PARAM ( 20, "Printfreq", DoMcmcParm, "\0"); |
---|
14382 | PARAM ( 21, "Nchains", DoMcmcParm, "\0"); |
---|
14383 | PARAM ( 22, "Temp", DoMcmcParm, "\0"); |
---|
14384 | PARAM ( 23, "Filename", DoMcmcParm, "\0"); |
---|
14385 | PARAM ( 24, "Burnin", DoMcmcParm, "\0"); |
---|
14386 | PARAM ( 25, "Starttree", DoMcmcParm, "Random|Current|User|Parsimony|NJ|\0"); |
---|
14387 | PARAM ( 26, "Nperts", DoMcmcParm, "\0"); |
---|
14388 | PARAM ( 27, "Savebrlens", DoMcmcParm, "Yes|No|\0"); |
---|
14389 | PARAM ( 28, "Nucmodel", DoLsetParm, "4by4|Doublet|Codon|Protein|\0"); |
---|
14390 | PARAM ( 29, "Nst", DoLsetParm, "1|2|6|Mixed|\0"); |
---|
14391 | PARAM ( 30, "Aamodel", DoLsetParm, "Poisson|Equalin|Jones|Dayhoff|Mtrev|Mtmam|Wag|Rtrev|Cprev|Vt|Blosum|Blossum|\0"); |
---|
14392 | PARAM ( 31, "Parsmodel", DoLsetParm, "Yes|No|\0"); |
---|
14393 | PARAM ( 32, "Omegavar", DoLsetParm, "Equal|Ny98|M3|M10|\0"); |
---|
14394 | PARAM ( 33, "Code", DoLsetParm, "Universal|Vertmt|Mycoplasma|Yeast|Ciliates|Metmt|\0"); |
---|
14395 | PARAM ( 34, "Coding", DoLsetParm, "All|Variable|Noabsencesites|Nopresencesites|Informative|\0"); |
---|
14396 | PARAM ( 35, "Seqerror", DoPrsetParm, "\0"); |
---|
14397 | PARAM ( 36, "Tratiopr", DoPrsetParm, "Beta|Fixed|\0"); |
---|
14398 | PARAM ( 37, "Revmatpr", DoPrsetParm, "Dirichlet|Fixed|\0"); |
---|
14399 | PARAM ( 38, "Omegapr", DoPrsetParm, "Uniform|Exponential|Fixed|\0"); |
---|
14400 | PARAM ( 39, "Statefreqpr", DoPrsetParm, "Dirichlet|Fixed|\0"); |
---|
14401 | PARAM ( 40, "Ngammacat", DoLsetParm, "\0"); |
---|
14402 | PARAM ( 41, "Shapepr", DoPrsetParm, "Uniform|Exponential|Fixed|\0"); |
---|
14403 | PARAM ( 42, "Ratecorrpr", DoPrsetParm, "Uniform|Fixed|\0"); |
---|
14404 | PARAM ( 43, "Pinvarpr", DoPrsetParm, "Uniform|Fixed|\0"); |
---|
14405 | PARAM ( 44, "Covswitchpr", DoPrsetParm, "Uniform|Exponential|Fixed|\0"); |
---|
14406 | PARAM ( 45, "Xxxxxxxxxx", DoExcludeParm, "\0"); |
---|
14407 | PARAM ( 46, "Xxxxxxxxxx", DoIncludeParm, "\0"); |
---|
14408 | PARAM ( 47, "Xxxxxxxxxx", DoDeleteParm, "\0"); |
---|
14409 | PARAM ( 48, "Xxxxxxxxxx", DoRestoreParm, "\0"); |
---|
14410 | PARAM ( 49, "Xxxxxxxxxx", DoTaxasetParm, "\0"); |
---|
14411 | PARAM ( 50, "Xxxxxxxxxx", DoHelpParm, "\0"); |
---|
14412 | PARAM ( 51, "Applyto", DoLsetParm, "\0"); |
---|
14413 | PARAM ( 52, "Rates", DoLsetParm, "Equal|Gamma|Propinv|Invgamma|Adgamma|\0"); |
---|
14414 | PARAM ( 53, "Covarion", DoLsetParm, "Yes|No|\0"); |
---|
14415 | PARAM ( 54, "Applyto", DoPrsetParm, "\0"); |
---|
14416 | PARAM ( 55, "Tratio", DoLinkParm, "\0"); |
---|
14417 | PARAM ( 56, "Revmat", DoLinkParm, "\0"); |
---|
14418 | PARAM ( 57, "Omega", DoLinkParm, "\0"); |
---|
14419 | PARAM ( 58, "Statefreq", DoLinkParm, "\0"); |
---|
14420 | PARAM ( 59, "Shape", DoLinkParm, "\0"); |
---|
14421 | PARAM ( 60, "Pinvar", DoLinkParm, "\0"); |
---|
14422 | PARAM ( 61, "Correlation", DoLinkParm, "\0"); |
---|
14423 | PARAM ( 62, "Ratemultiplier", DoLinkParm, "\0"); |
---|
14424 | PARAM ( 63, "Switchrates", DoLinkParm, "\0"); |
---|
14425 | PARAM ( 64, "Symdirihyperpr", DoPrsetParm, "Uniform|Exponential|Fixed|\0"); |
---|
14426 | PARAM ( 65, "Xxxxxxxxxx", DoCtypeParm, "\0"); |
---|
14427 | PARAM ( 66, "Xxxxxxxxxx", DoConstraintParm, "\0"); |
---|
14428 | PARAM ( 67, "Topologypr", DoPrsetParm, "Uniform|Constraints|Fixed|Speciestree|\0"); |
---|
14429 | PARAM ( 68, "Brlenspr", DoPrsetParm, "Unconstrained|Clock|Relaxedclock|Fixed|\0"); |
---|
14430 | PARAM ( 69, "Speciationpr", DoPrsetParm, "Uniform|Exponential|Fixed|\0"); |
---|
14431 | PARAM ( 70, "Extinctionpr", DoPrsetParm, "Beta|Fixed|\0"); |
---|
14432 | PARAM ( 71, "Popsizepr", DoPrsetParm, "Lognormal|Uniform|Gamma|Normal|Fixed|\0"); |
---|
14433 | PARAM ( 72, "Topology", DoLinkParm, "\0"); |
---|
14434 | PARAM ( 73, "Brlens", DoLinkParm, "\0"); |
---|
14435 | PARAM ( 74, "Speciationrate", DoLinkParm, "\0"); |
---|
14436 | PARAM ( 75, "Extinctionrate", DoLinkParm, "\0"); |
---|
14437 | PARAM ( 76, "Theta", DoLinkParm, "\0"); |
---|
14438 | PARAM ( 77, "Ratepr", DoPrsetParm, "Variable|Dirichlet|Fixed|\0"); |
---|
14439 | PARAM ( 78, "Xxxxxxxxxx", DoOutgroupParm, "\0"); |
---|
14440 | PARAM ( 79, "Xxxxxxxxxx", DoTreeParm, "\0"); |
---|
14441 | PARAM ( 80, "Filename", DoSumtParm, "\0"); |
---|
14442 | PARAM ( 81, "Burnin", DoSumtParm, "\0"); |
---|
14443 | PARAM ( 82, "Contype", DoSumtParm, "Halfcompat|Allcompat|\0"); |
---|
14444 | PARAM ( 83, "Xxxxxxxxxx", DoTranslateParm, "\0"); |
---|
14445 | PARAM ( 84, "Swapfreq", DoMcmcParm, "\0"); |
---|
14446 | PARAM ( 85, "Start", DoLogParm, "\0"); |
---|
14447 | PARAM ( 86, "Stop", DoLogParm, "\0"); |
---|
14448 | PARAM ( 87, "Filename", DoLogParm, "\0"); |
---|
14449 | PARAM ( 88, "Append", DoLogParm, "\0"); |
---|
14450 | PARAM ( 89, "Replace", DoLogParm, "\0"); |
---|
14451 | PARAM ( 90, "Nbetacat", DoLsetParm, "\0"); |
---|
14452 | PARAM ( 91, "Augment", DoLsetParm, "Yes|No|\0"); |
---|
14453 | PARAM ( 92, "Xxxxxxxxxx", DoPairsParm, "\0"); |
---|
14454 | PARAM ( 93, "Xxxxxxxxxx", DoBreaksParm, "\0"); |
---|
14455 | PARAM ( 94, "Nowarnings", DoSetParm, "Yes|No|\0"); |
---|
14456 | PARAM ( 95, "Showtreeprobs", DoSumtParm, "Yes|No|\0"); |
---|
14457 | PARAM ( 96, "Filename", DoSumpParm, "\0"); |
---|
14458 | PARAM ( 97, "Burnin", DoSumpParm, "\0"); |
---|
14459 | PARAM ( 98, "Reweight", DoMcmcParm, "\0"); |
---|
14460 | PARAM ( 99, "Noop", DoMcmcParm, "\0"); |
---|
14461 | PARAM (100, "Ny98omega1pr", DoPrsetParm, "Beta|Fixed|\0"); |
---|
14462 | PARAM (101, "Ny98omega3pr", DoPrsetParm, "Uniform|Exponential|Fixed|\0"); |
---|
14463 | PARAM (102, "Codoncatfreqs", DoPrsetParm, "Dirichlet|Fixed|\0"); |
---|
14464 | PARAM (103, "Sampleprob", DoPrsetParm, "\0"); |
---|
14465 | PARAM (104, "Aamodelpr", DoPrsetParm, "Fixed|Mixed|\0"); |
---|
14466 | PARAM (105, "Aamodel", DoLinkParm, "\0"); |
---|
14467 | PARAM (106, "Filename", DoPlotParm, "\0"); |
---|
14468 | PARAM (107, "Parameter", DoPlotParm, "\0"); |
---|
14469 | PARAM (108, "Match", DoPlotParm, "Perfect|Consistentwith|All|\0"); |
---|
14470 | PARAM (109, "Burnin", DoPlotParm, "\0"); |
---|
14471 | PARAM (110, "Brownscalepr", DoPrsetParm, "Uniform|Gamma|Gammamean|Fixed|\0"); |
---|
14472 | PARAM (111, "Browncorrpr", DoPrsetParm, "Uniform|Fixed|\0"); |
---|
14473 | PARAM (112, "Pbf", DoMcmcParm, "Yes|No|\0"); |
---|
14474 | PARAM (113, "Pbfinitburnin", DoMcmcParm, "\0"); |
---|
14475 | PARAM (114, "Pbfsamplefreq", DoMcmcParm, "\0"); |
---|
14476 | PARAM (115, "Pbfsampletime", DoMcmcParm, "\0"); |
---|
14477 | PARAM (116, "Pbfsampleburnin",DoMcmcParm, "\0"); |
---|
14478 | PARAM (117, "Growthpr", DoPrsetParm, "Uniform|Exponential|Fixed|Normal|\0"); |
---|
14479 | PARAM (118, "Growthrate", DoLinkParm, "\0"); |
---|
14480 | PARAM (119, "Xxxxxxxxxx", DoCalibrateParm, "Uniform|Offsetexponential|Fixed|Unconstrained|\0"); |
---|
14481 | PARAM (120, "Calwaitpr", DoPrsetParm, "Exponential|Fixed|\0"); /* not used but leave it in to not destroy mapping to commands */ |
---|
14482 | PARAM (121, "M3omegapr", DoPrsetParm, "Exponential|Fixed|\0"); |
---|
14483 | PARAM (122, "Applyto", DoReportParm, "\0"); |
---|
14484 | PARAM (123, "Tratio", DoReportParm, "Dirichlet|Ratio|\0"); |
---|
14485 | PARAM (124, "Revmat", DoReportParm, "Dirichlet|Ratio|\0"); |
---|
14486 | PARAM (125, "Ratemult", DoReportParm, "Dirichlet|Scaled|Ratio|\0"); |
---|
14487 | PARAM (126, "Filename", DoManualParm, "\0"); |
---|
14488 | PARAM (127, "Filename1", DoCompareTreeParm, "\0"); |
---|
14489 | PARAM (128, "Filename2", DoCompareTreeParm, "\0"); |
---|
14490 | PARAM (129, "Outputname", DoCompareTreeParm, "\0"); |
---|
14491 | PARAM (130, "Burnin", DoCompareTreeParm, "\0"); |
---|
14492 | PARAM (131, "Ploidy", DoLsetParm, "Haploid|Diploid|Zlinked|\0"); |
---|
14493 | PARAM (132, "Swapadjacent", DoMcmcParm, "Yes|No|\0"); |
---|
14494 | PARAM (133, "Treeagepr", DoPrsetParm, "Gamma|Exponential|Fixed|\0"); |
---|
14495 | PARAM (134, "Ancstates", DoReportParm, "Yes|No|\0"); |
---|
14496 | PARAM (135, "Siterates", DoReportParm, "Yes|No|\0"); |
---|
14497 | PARAM (136, "Possel", DoReportParm, "Yes|No|\0"); |
---|
14498 | PARAM (137, "Plot", DoSumpParm, "Yes|No|\0"); |
---|
14499 | PARAM (138, "Table", DoSumpParm, "Yes|No|\0"); |
---|
14500 | PARAM (139, "Minprob", DoSumpParm, "\0"); |
---|
14501 | PARAM (140, "Printtofile", DoSumpParm, "Yes|No|\0"); |
---|
14502 | PARAM (141, "Outputname", DoSumpParm, "\0"); |
---|
14503 | PARAM (142, "Redirect", DoMcmcParm, "Yes|No|\0"); |
---|
14504 | PARAM (143, "Swapseed", DoMcmcParm, "\0"); |
---|
14505 | PARAM (144, "Runidseed", DoMcmcParm, "\0"); |
---|
14506 | PARAM (145, "Quitonerror", DoSetParm, "Yes|No|\0"); |
---|
14507 | PARAM (146, "Printbrlens", DoSumtParm, "Yes|No|\0"); |
---|
14508 | PARAM (147, "Brlensgeq", DoSumtParm, "\0"); |
---|
14509 | PARAM (148, "Minpartfreq", DoMcmcParm, "\0"); |
---|
14510 | PARAM (149, "Allchains", DoMcmcParm, "Yes|No|\0"); |
---|
14511 | PARAM (150, "Mcmcdiagn", DoMcmcParm, "Yes|No|\0"); |
---|
14512 | PARAM (151, "Diagnfreq", DoMcmcParm, "\0"); |
---|
14513 | PARAM (152, "Nruns", DoMcmcParm, "\0"); |
---|
14514 | PARAM (153, "Stoprule", DoMcmcParm, "Yes|No|\0"); |
---|
14515 | PARAM (154, "Stopval", DoMcmcParm, "\0"); |
---|
14516 | PARAM (155, "Relburnin", DoMcmcParm, "Yes|No|\0"); |
---|
14517 | PARAM (156, "Burninfrac", DoMcmcParm, "\0"); |
---|
14518 | PARAM (157, "Allcomps", DoMcmcParm, "Yes|No|\0"); |
---|
14519 | PARAM (158, "Printall", DoMcmcParm, "Yes|No|\0"); |
---|
14520 | PARAM (159, "Printmax", DoMcmcParm, "\0"); |
---|
14521 | PARAM (160, "Data", DoMcmcParm, "Yes|No|\0"); |
---|
14522 | PARAM (161, "Nruns", DoSumpParm, "\0"); |
---|
14523 | PARAM (162, "Allruns", DoSumpParm, "Yes|No|\0"); |
---|
14524 | PARAM (163, "Nruns", DoSumtParm, "\0"); |
---|
14525 | PARAM (164, "Ntrees", DoSumtParm, "\0"); |
---|
14526 | PARAM (165, "Calctreeprobs", DoSumtParm, "Yes|No|\0"); |
---|
14527 | PARAM (166, "Ordertaxa", DoMcmcParm, "Yes|No|\0"); |
---|
14528 | PARAM (167, "Ordertaxa", DoSumtParm, "Yes|No|\0"); |
---|
14529 | PARAM (168, "Aarevmatpr", DoPrsetParm, "Dirichlet|Fixed|\0"); |
---|
14530 | PARAM (169, "Nswaps", DoMcmcParm, "\0"); |
---|
14531 | PARAM (170, "Autoreplace", DoSetParm, "Yes|No|\0"); |
---|
14532 | PARAM (171, "Npthreads", DoSetParm, "\0"); |
---|
14533 | PARAM (172, "Cppratepr", DoPrsetParm, "Fixed|Exponential|\0"); |
---|
14534 | PARAM (173, "Cppmultdevpr", DoPrsetParm, "Fixed|\0"); |
---|
14535 | PARAM (174, "TK02varpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0"); |
---|
14536 | PARAM (175, "Pfile", DoSumtParm, "\0"); |
---|
14537 | PARAM (176, "Pfile", DoSumtParm, "\0"); |
---|
14538 | PARAM (177, "Autocomplete", DoSumtParm, "Yes|No|\0"); |
---|
14539 | PARAM (178, "Autocomplete", DoSumpParm, "Yes|No|\0"); |
---|
14540 | PARAM (179, "Userlevel", DoSetParm, "Standard|Developer|\0"); |
---|
14541 | PARAM (180, "Allavailable", DoShowmovesParm, "Yes|No|\0"); |
---|
14542 | PARAM (181, "Seed", DoSetParm, "\0"); |
---|
14543 | PARAM (182, "Swapseed", DoSetParm, "\0"); |
---|
14544 | PARAM (183, "Clockratepr", DoPrsetParm, "Fixed|Normal|Lognormal|Exponential|Gamma|\0"); |
---|
14545 | PARAM (184, "Nodeagepr", DoPrsetParm, "Unconstrained|Calibrated|\0"); |
---|
14546 | PARAM (185, "Clockvarpr", DoPrsetParm, "Strict|Cpp|TK02|Igr|Bm|Ibr|\0"); |
---|
14547 | PARAM (186, "Xxxxxxxxxx", DoPropsetParm, "\0"); |
---|
14548 | PARAM (187, "Xxxxxxxxxx", DoStartvalsParm, "\0"); |
---|
14549 | PARAM (188, "Usegibbs", DoLsetParm, "Yes|No|\0"); |
---|
14550 | PARAM (189, "Gibbsfreq", DoLsetParm, "\0"); |
---|
14551 | PARAM (190, "Checkpoint", DoMcmcParm, "Yes|No|\0"); |
---|
14552 | PARAM (191, "Checkfreq", DoMcmcParm, "\0"); |
---|
14553 | PARAM (192, "Tree", DoReportParm, "Topology|Brlens|\0"); |
---|
14554 | PARAM (193, "Cpprate", DoLinkParm, "\0"); |
---|
14555 | PARAM (194, "Cppmultdev", DoLinkParm, "\0"); |
---|
14556 | PARAM (195, "Cppevents", DoLinkParm, "\0"); |
---|
14557 | PARAM (196, "TK02var", DoLinkParm, "\0"); |
---|
14558 | PARAM (197, "TK02branchrates",DoLinkParm, "\0"); |
---|
14559 | PARAM (198, "Savetrees", DoMcmcParm, "Yes|No|\0"); |
---|
14560 | PARAM (199, "Diagnstat", DoMcmcParm, "Avgstddev|Maxstddev|\0"); |
---|
14561 | PARAM (200, "Startparams", DoMcmcParm, "Reset|Current|\0"); |
---|
14562 | PARAM (201, "Characters", DoBeginParm, "\0"); |
---|
14563 | PARAM (202, "Startingtrees", DoMcmcParm, "\0"); |
---|
14564 | PARAM (203, "Xxxxxxxxxx", DoUserTreeParm, "\0"); |
---|
14565 | PARAM (204, "Outputname", DoSumtParm, "\0"); |
---|
14566 | PARAM (205, "Table", DoSumtParm, "Yes|No|\0"); |
---|
14567 | PARAM (206, "Summary", DoSumtParm, "Yes|No|\0"); |
---|
14568 | PARAM (207, "Consensus", DoSumtParm, "Yes|No|\0"); |
---|
14569 | PARAM (208, "Minpartfreq", DoSumtParm, "\0"); |
---|
14570 | PARAM (209, "Relburnin", DoSumtParm, "Yes|No|\0"); |
---|
14571 | PARAM (210, "Burninfrac", DoSumtParm, "\0"); |
---|
14572 | PARAM (211, "Relburnin", DoSumpParm, "Yes|No|\0"); |
---|
14573 | PARAM (212, "Burninfrac", DoSumpParm, "\0"); |
---|
14574 | PARAM (213, "Append", DoMcmcParm, "Yes|No|\0"); |
---|
14575 | PARAM (214, "Autotune", DoMcmcParm, "Yes|No|\0"); |
---|
14576 | PARAM (215, "Tunefreq", DoMcmcParm, "\0"); |
---|
14577 | PARAM (216, "Scientific", DoSetParm, "Yes|No|\0"); |
---|
14578 | PARAM (217, "Siteomega", DoReportParm, "Yes|No|\0"); |
---|
14579 | PARAM (218, "Igrvarpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0"); |
---|
14580 | PARAM (219, "Symbols", DoFormatParm, "\0"); |
---|
14581 | PARAM (220, "Equate", DoFormatParm, "\0"); |
---|
14582 | PARAM (221, "Relburnin", DoCompareTreeParm, "Yes|No|\0"); |
---|
14583 | PARAM (222, "Burninfrac", DoCompareTreeParm, "\0"); |
---|
14584 | PARAM (223, "Minpartfreq", DoCompareTreeParm, "\0"); |
---|
14585 | PARAM (224, "Relburnin", DoPlotParm, "Yes|No|\0"); |
---|
14586 | PARAM (225, "Burninfrac", DoPlotParm, "\0"); |
---|
14587 | PARAM (226, "Taxa", DoBeginParm, "\0"); |
---|
14588 | PARAM (227, "Xxxxxxxxxx", DoBeginParm, "\0"); |
---|
14589 | PARAM (228, "Xxxxxxxxxx", DoTaxlabelsParm, "\0"); |
---|
14590 | PARAM (229, "Dir", DoSetParm, "\0"); |
---|
14591 | PARAM (230, "Conformat", DoSumtParm, "Figtree|Simple|\0"); |
---|
14592 | PARAM (231, "Hpd", DoSumpParm, "Yes|No|\0"); |
---|
14593 | PARAM (232, "Hpd", DoSumtParm, "Yes|No|\0"); |
---|
14594 | PARAM (233, "Usebeagle", DoSetParm, "Yes|No|\0"); |
---|
14595 | PARAM (234, "Beagledevice", DoSetParm, "Cpu|Gpu|\0"); |
---|
14596 | PARAM (235, "Beagleprecision",DoSetParm, "Single|Double|\0"); |
---|
14597 | PARAM (236, "Beaglesse", DoSetParm, "Yes|No|\0"); |
---|
14598 | PARAM (237, "Beagleopenmp", DoSetParm, "Yes|No|\0"); |
---|
14599 | PARAM (238, "Beaglethreads", DoSetParm, "Yes|No|\0"); |
---|
14600 | PARAM (239, "Beaglescaling", DoSetParm, "Always|Dynamic|\0"); |
---|
14601 | PARAM (240, "Beaglefreq", DoSetParm, "\0"); |
---|
14602 | PARAM (241, "Popvarpr", DoPrsetParm, "Equal|Variable|\0"); |
---|
14603 | PARAM (242, "Igrvar", DoLinkParm, "\0"); |
---|
14604 | PARAM (243, "Igrbranchlens", DoLinkParm, "\0"); |
---|
14605 | PARAM (244, "Xxxxxxxxxx", DoSpeciespartitionParm, "\0"); |
---|
14606 | PARAM (245, "Speciespartition",DoSetParm, "\0"); |
---|
14607 | PARAM (246, "Revratepr", DoPrsetParm, "Symdir|\0"); |
---|
14608 | PARAM (247, "Samplestrat", DoPrsetParm, "Random|Diversity|Cluster|\0"); |
---|
14609 | PARAM (248, "Burninss", DoSsParm, "\0"); |
---|
14610 | PARAM (249, "Nsteps", DoSsParm, "\0"); |
---|
14611 | PARAM (250, "Alpha", DoSsParm, "\0"); |
---|
14612 | PARAM (251, "Bmvarpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0"); |
---|
14613 | PARAM (252, "Bmvar", DoLinkParm, "\0"); |
---|
14614 | PARAM (253, "Bmbranchrates", DoLinkParm, "\0"); |
---|
14615 | PARAM (254, "Ibrvarpr", DoPrsetParm, "Fixed|Exponential|Uniform|\0"); |
---|
14616 | PARAM (255, "Ibrvar", DoLinkParm, "\0"); |
---|
14617 | PARAM (256, "Ibrbranchlens", DoLinkParm, "\0"); |
---|
14618 | PARAM (257, "FromPrior", DoSsParm, "Yes|No|\0"); |
---|
14619 | PARAM (258, "Filename", DoSumSsParm, "\0"); |
---|
14620 | PARAM (259, "Burnin", DoSumSsParm, "\0"); |
---|
14621 | PARAM (260, "Nruns", DoSumSsParm, "\0"); |
---|
14622 | PARAM (261, "Allruns", DoSumSsParm, "Yes|No|\0"); |
---|
14623 | PARAM (262, "Askmore", DoSumSsParm, "Yes|No|\0"); |
---|
14624 | PARAM (263, "Relburnin", DoSumSsParm, "Yes|No|\0"); |
---|
14625 | PARAM (264, "Burninfrac", DoSumSsParm, "\0"); |
---|
14626 | PARAM (265, "Discardfrac", DoSumSsParm, "\0"); |
---|
14627 | PARAM (266, "Smoothing", DoSumSsParm, "\0"); |
---|
14628 | PARAM (267, "Steptoplot", DoSumSsParm, "\0"); |
---|
14629 | PARAM (268, "Precision", DoSetParm, "\0"); |
---|
14630 | |
---|
14631 | |
---|
14632 | /* NOTE: If a change is made to the parameter table, make certain you |
---|
14633 | change the number of elements (now 269) in paramTable[] at the top of this file. */ |
---|
14634 | |
---|
14635 | } |
---|
14636 | |
---|
14637 | |
---|
14638 | |
---|
14639 | |
---|
14640 | |
---|
14641 | void ShowNodes (TreeNode *p, int indent, int isThisTreeRooted) |
---|
14642 | |
---|
14643 | { |
---|
14644 | |
---|
14645 | if (p != NULL) |
---|
14646 | { |
---|
14647 | printf (" "); |
---|
14648 | if (p->left == NULL && p->right == NULL && p->anc != NULL) |
---|
14649 | { |
---|
14650 | printf("%*cN %d (l=%d r=%d a=%d) %1.15lf (%s) scalerNode=%d isDated=%d ", |
---|
14651 | indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->length, p->label, p->scalerNode, p->isDated); |
---|
14652 | } |
---|
14653 | else if (p->left != NULL && p->right == NULL && p->anc == NULL) |
---|
14654 | { |
---|
14655 | if (isThisTreeRooted == NO) |
---|
14656 | { |
---|
14657 | if (p->label[0] == '\0' || p->label[0] == '\n' || p->label[0] == ' ') |
---|
14658 | printf("%*cN %d (l=%d r=%d a=%d) (---) scalerNode=%d ", |
---|
14659 | indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode); |
---|
14660 | else |
---|
14661 | printf("%*cN %d (l=%d r=%d a=%d) (%s) scalerNode=%d ", |
---|
14662 | indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->label, p->scalerNode); |
---|
14663 | } |
---|
14664 | else |
---|
14665 | { |
---|
14666 | printf("%*cN %d (l=%d r=%d a=%d) X.XXXXXX scalerNode=%d ", |
---|
14667 | indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode); |
---|
14668 | } |
---|
14669 | } |
---|
14670 | else |
---|
14671 | { |
---|
14672 | if (p->anc != NULL) |
---|
14673 | { |
---|
14674 | if (p->anc->anc == NULL && isThisTreeRooted == YES) |
---|
14675 | printf("%*cN %d (l=%d r=%d a=%d) X.XXXXXX scalerNode=%d ", |
---|
14676 | indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode); |
---|
14677 | else |
---|
14678 | printf("%*cN %d (l=%d r=%d a=%d) %1.15lf scalerNode=%d ", |
---|
14679 | indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->length, p->scalerNode); |
---|
14680 | } |
---|
14681 | } |
---|
14682 | if (isThisTreeRooted == YES) |
---|
14683 | printf ("depth=%1.15lf\n", p->nodeDepth); |
---|
14684 | else |
---|
14685 | printf ("\n"); |
---|
14686 | ShowNodes (p->left, indent + 2, isThisTreeRooted); |
---|
14687 | ShowNodes (p->right, indent + 2, isThisTreeRooted); |
---|
14688 | } |
---|
14689 | |
---|
14690 | } |
---|
14691 | |
---|
14692 | |
---|
14693 | |
---|
14694 | |
---|
14695 | |
---|
14696 | int StandID (char nuc) |
---|
14697 | |
---|
14698 | { |
---|
14699 | |
---|
14700 | char n; |
---|
14701 | |
---|
14702 | /* Note that if you change how many states are recognized, you need |
---|
14703 | to look at IsMissing */ |
---|
14704 | n = nuc; |
---|
14705 | |
---|
14706 | if (n == '0') |
---|
14707 | { |
---|
14708 | return 1; |
---|
14709 | } |
---|
14710 | else if (n == '1') |
---|
14711 | { |
---|
14712 | return 2; |
---|
14713 | } |
---|
14714 | else if (n == '2') |
---|
14715 | { |
---|
14716 | return 4; |
---|
14717 | } |
---|
14718 | else if (n == '3') |
---|
14719 | { |
---|
14720 | return 8; |
---|
14721 | } |
---|
14722 | else if (n == '4') |
---|
14723 | { |
---|
14724 | return 16; |
---|
14725 | } |
---|
14726 | else if (n == '5') |
---|
14727 | { |
---|
14728 | return 32; |
---|
14729 | } |
---|
14730 | else if (n == '6') |
---|
14731 | { |
---|
14732 | return 64; |
---|
14733 | } |
---|
14734 | else if (n == '7') |
---|
14735 | { |
---|
14736 | return 128; |
---|
14737 | } |
---|
14738 | else if (n == '8') |
---|
14739 | { |
---|
14740 | return 256; |
---|
14741 | } |
---|
14742 | else if (n == '9') |
---|
14743 | { |
---|
14744 | return 512; |
---|
14745 | } |
---|
14746 | else if (n == missingId) |
---|
14747 | { |
---|
14748 | return MISSING; |
---|
14749 | } |
---|
14750 | else if (n == gapId) |
---|
14751 | { |
---|
14752 | return GAP; |
---|
14753 | } |
---|
14754 | else |
---|
14755 | return -1; |
---|
14756 | |
---|
14757 | } |
---|
14758 | |
---|
14759 | |
---|
14760 | |
---|
14761 | |
---|
14762 | |
---|
14763 | void State_CODON (char *state, int code, int division) |
---|
14764 | { |
---|
14765 | state[0] = StateCode_NUC4(modelParams[division].codonNucs[code][0]); |
---|
14766 | state[1] = StateCode_NUC4(modelParams[division].codonNucs[code][1]); |
---|
14767 | state[2] = StateCode_NUC4(modelParams[division].codonNucs[code][2]); |
---|
14768 | state[3] = '\0'; |
---|
14769 | } |
---|
14770 | |
---|
14771 | |
---|
14772 | |
---|
14773 | |
---|
14774 | |
---|
14775 | void State_DOUBLET (char *state, int code) |
---|
14776 | { |
---|
14777 | state[0] = code/4 + 'A'; |
---|
14778 | state[1] = code%4 + 'A'; |
---|
14779 | state[2] = '\0'; |
---|
14780 | } |
---|
14781 | |
---|
14782 | |
---|
14783 | |
---|
14784 | |
---|
14785 | |
---|
14786 | int StateCode_AA (int n) |
---|
14787 | |
---|
14788 | { |
---|
14789 | if (n == 0) |
---|
14790 | return 'A'; /* Ala */ |
---|
14791 | else if (n == 1) |
---|
14792 | return 'R'; /* Arg */ |
---|
14793 | else if (n == 2) |
---|
14794 | return 'N'; /* Asn */ |
---|
14795 | else if (n == 3) |
---|
14796 | return 'D'; /* Asp */ |
---|
14797 | else if (n == 4) |
---|
14798 | return 'C'; /* Cys */ |
---|
14799 | else if (n == 5) |
---|
14800 | return 'Q'; /* Gln */ |
---|
14801 | else if (n == 6) |
---|
14802 | return 'E'; /* Glu */ |
---|
14803 | else if (n == 7) |
---|
14804 | return 'G'; /* Gly */ |
---|
14805 | else if (n == 8) |
---|
14806 | return 'H'; /* His */ |
---|
14807 | else if (n == 9) |
---|
14808 | return 'I'; /* Ile */ |
---|
14809 | else if (n == 10) |
---|
14810 | return 'L'; /* Leu */ |
---|
14811 | else if (n == 11) |
---|
14812 | return 'K'; /* Lys */ |
---|
14813 | else if (n == 12) |
---|
14814 | return 'M'; /* Met */ |
---|
14815 | else if (n == 13) |
---|
14816 | return 'F'; /* Phe */ |
---|
14817 | else if (n == 14) |
---|
14818 | return 'P'; /* Pro */ |
---|
14819 | else if (n == 15) |
---|
14820 | return 'S'; /* Ser */ |
---|
14821 | else if (n == 16) |
---|
14822 | return 'T'; /* Thr */ |
---|
14823 | else if (n == 17) |
---|
14824 | return 'W'; /* Trp */ |
---|
14825 | else if (n == 18) |
---|
14826 | return 'Y'; /* Tyr */ |
---|
14827 | else if (n == 19) |
---|
14828 | return 'V'; /* Val */ |
---|
14829 | else |
---|
14830 | return '?'; |
---|
14831 | } |
---|
14832 | |
---|
14833 | |
---|
14834 | |
---|
14835 | int StateCode_NUC4 (int n) |
---|
14836 | |
---|
14837 | { |
---|
14838 | if (n == 0) |
---|
14839 | return 'A'; |
---|
14840 | else if (n == 1) |
---|
14841 | return 'C'; |
---|
14842 | else if (n == 2) |
---|
14843 | return 'G'; |
---|
14844 | else if (n == 3) |
---|
14845 | return 'T'; |
---|
14846 | else return '?'; |
---|
14847 | } |
---|
14848 | |
---|
14849 | |
---|
14850 | |
---|
14851 | |
---|
14852 | int StateCode_Std (int n) |
---|
14853 | |
---|
14854 | { |
---|
14855 | if (n <= 9 && n >= 0) |
---|
14856 | return '0' + n; |
---|
14857 | else return '?'; |
---|
14858 | } |
---|
14859 | |
---|
14860 | |
---|
14861 | |
---|
14862 | |
---|
14863 | void WhatVariableExp (SafeLong exp, char *st) |
---|
14864 | |
---|
14865 | { |
---|
14866 | |
---|
14867 | int n; |
---|
14868 | |
---|
14869 | strcpy (st, ""); |
---|
14870 | n = 0; |
---|
14871 | if (exp == 0) |
---|
14872 | strcat(st, " nothing"); |
---|
14873 | else |
---|
14874 | { |
---|
14875 | if ((exp & Expecting(COMMAND)) == Expecting(COMMAND)) |
---|
14876 | { |
---|
14877 | strcat(st, " command"); |
---|
14878 | n++; |
---|
14879 | } |
---|
14880 | if ((exp & Expecting(PARAMETER)) == Expecting(PARAMETER)) |
---|
14881 | { |
---|
14882 | if (n > 0) |
---|
14883 | strcat(st, " or"); |
---|
14884 | strcat(st, " parameter"); |
---|
14885 | n++; |
---|
14886 | } |
---|
14887 | if ((exp & Expecting(EQUALSIGN)) == Expecting(EQUALSIGN)) |
---|
14888 | { |
---|
14889 | if (n > 0) |
---|
14890 | strcat(st, " or"); |
---|
14891 | strcat(st, " ="); |
---|
14892 | n++; |
---|
14893 | } |
---|
14894 | if ((exp & Expecting(COLON)) == Expecting(COLON)) |
---|
14895 | { |
---|
14896 | if (n > 0) |
---|
14897 | strcat(st, " or"); |
---|
14898 | strcat(st, " :"); |
---|
14899 | n++; |
---|
14900 | } |
---|
14901 | if ((exp & Expecting(SEMICOLON)) == Expecting(SEMICOLON)) |
---|
14902 | { |
---|
14903 | if (n > 0) |
---|
14904 | strcat(st, " or"); |
---|
14905 | strcat(st, " ;"); |
---|
14906 | n++; |
---|
14907 | } |
---|
14908 | if ((exp & Expecting(COMMA)) == Expecting(COMMA)) |
---|
14909 | { |
---|
14910 | if (n > 0) |
---|
14911 | strcat(st, " or"); |
---|
14912 | strcat(st, " ,"); |
---|
14913 | n++; |
---|
14914 | } |
---|
14915 | if ((exp & Expecting(POUNDSIGN)) == Expecting(POUNDSIGN)) |
---|
14916 | { |
---|
14917 | if (n > 0) |
---|
14918 | strcat(st, " or"); |
---|
14919 | strcat(st, " #"); |
---|
14920 | n++; |
---|
14921 | } |
---|
14922 | if ((exp & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) |
---|
14923 | { |
---|
14924 | if (n > 0) |
---|
14925 | strcat(st, " or"); |
---|
14926 | strcat(st, " ?"); |
---|
14927 | n++; |
---|
14928 | } |
---|
14929 | if ((exp & Expecting(DASH)) == Expecting(DASH)) |
---|
14930 | { |
---|
14931 | if (n > 0) |
---|
14932 | strcat(st, " or"); |
---|
14933 | strcat(st, " -"); |
---|
14934 | n++; |
---|
14935 | } |
---|
14936 | if ((exp & Expecting(LEFTPAR)) == Expecting(LEFTPAR)) |
---|
14937 | { |
---|
14938 | if (n > 0) |
---|
14939 | strcat(st, " or"); |
---|
14940 | strcat(st, " ("); |
---|
14941 | n++; |
---|
14942 | } |
---|
14943 | if ((exp & Expecting(RIGHTPAR)) == Expecting(RIGHTPAR)) |
---|
14944 | { |
---|
14945 | if (n > 0) |
---|
14946 | strcat(st, " or"); |
---|
14947 | strcat(st, " )"); |
---|
14948 | n++; |
---|
14949 | } |
---|
14950 | if ((exp & Expecting(LEFTCOMMENT)) == Expecting(LEFTCOMMENT)) |
---|
14951 | { |
---|
14952 | if (n > 0) |
---|
14953 | strcat(st, " or"); |
---|
14954 | strcat(st, " ["); |
---|
14955 | n++; |
---|
14956 | } |
---|
14957 | if ((exp & Expecting(RIGHTCOMMENT)) == Expecting(RIGHTCOMMENT)) |
---|
14958 | { |
---|
14959 | if (n > 0) |
---|
14960 | strcat(st, " or"); |
---|
14961 | strcat(st, " ]"); |
---|
14962 | n++; |
---|
14963 | } |
---|
14964 | if ((exp & Expecting(ALPHA)) == Expecting(ALPHA)) |
---|
14965 | { |
---|
14966 | if (n > 0) |
---|
14967 | strcat(st, " or"); |
---|
14968 | strcat(st, " <name>"); |
---|
14969 | n++; |
---|
14970 | } |
---|
14971 | if ((exp & Expecting(NUMBER)) == Expecting(NUMBER)) |
---|
14972 | { |
---|
14973 | if (n > 0) |
---|
14974 | strcat(st, " or"); |
---|
14975 | strcat(st, " <number>"); |
---|
14976 | n++; |
---|
14977 | } |
---|
14978 | if ((exp & Expecting(RETURNSYMBOL)) == Expecting(RETURNSYMBOL)) |
---|
14979 | { |
---|
14980 | if (n > 0) |
---|
14981 | strcat(st, " or"); |
---|
14982 | strcat(st, " return"); |
---|
14983 | n++; |
---|
14984 | } |
---|
14985 | if ((exp & Expecting(ASTERISK)) == Expecting(ASTERISK)) |
---|
14986 | { |
---|
14987 | if (n > 0) |
---|
14988 | strcat(st, " or"); |
---|
14989 | strcat(st, " *"); |
---|
14990 | n++; |
---|
14991 | } |
---|
14992 | if ((exp & Expecting(BACKSLASH)) == Expecting(BACKSLASH)) |
---|
14993 | { |
---|
14994 | if (n > 0) |
---|
14995 | strcat(st, " or"); |
---|
14996 | strcat(st, " /"); |
---|
14997 | n++; |
---|
14998 | } |
---|
14999 | if ((exp & Expecting(BACKSLASH)) == Expecting(BACKSLASH)) |
---|
15000 | { |
---|
15001 | if (n > 0) |
---|
15002 | strcat(st, " or"); |
---|
15003 | strcat(st, " \\"); |
---|
15004 | n++; |
---|
15005 | } |
---|
15006 | if ((exp & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) |
---|
15007 | { |
---|
15008 | if (n > 0) |
---|
15009 | strcat(st, " or"); |
---|
15010 | strcat(st, " !"); |
---|
15011 | n++; |
---|
15012 | } |
---|
15013 | if ((exp & Expecting(PERCENT)) == Expecting(PERCENT)) |
---|
15014 | { |
---|
15015 | if (n > 0) |
---|
15016 | strcat(st, " or"); |
---|
15017 | strcat(st, " %"); |
---|
15018 | n++; |
---|
15019 | } |
---|
15020 | if ((exp & Expecting(LEFTCURL)) == Expecting(LEFTCURL)) |
---|
15021 | { |
---|
15022 | if (n > 0) |
---|
15023 | strcat(st, " or"); |
---|
15024 | strcat(st, " {"); |
---|
15025 | n++; |
---|
15026 | } |
---|
15027 | if ((exp & Expecting(RIGHTCURL)) == Expecting(RIGHTCURL)) |
---|
15028 | { |
---|
15029 | if (n > 0) |
---|
15030 | strcat(st, " or"); |
---|
15031 | strcat(st, " }"); |
---|
15032 | n++; |
---|
15033 | } |
---|
15034 | if ((exp & Expecting(WEIRD)) == Expecting(WEIRD)) |
---|
15035 | { |
---|
15036 | if (n > 0) |
---|
15037 | strcat(st, " or"); |
---|
15038 | strcat(st, " <whatever>"); |
---|
15039 | n++; |
---|
15040 | } |
---|
15041 | if ((exp & Expecting(UNKNOWN_TOKEN_TYPE)) == Expecting(UNKNOWN_TOKEN_TYPE)) |
---|
15042 | { |
---|
15043 | if (n > 0) |
---|
15044 | strcat(st, " or"); |
---|
15045 | strcat(st, " no clue"); |
---|
15046 | n++; |
---|
15047 | } |
---|
15048 | } |
---|
15049 | |
---|
15050 | } |
---|
15051 | |
---|
15052 | |
---|
15053 | |
---|
15054 | |
---|
15055 | |
---|
15056 | char WhichAA (int x) |
---|
15057 | |
---|
15058 | { |
---|
15059 | |
---|
15060 | if (x == 1) |
---|
15061 | return ('A'); |
---|
15062 | else if (x == 2) |
---|
15063 | return ('R'); |
---|
15064 | else if (x == 4) |
---|
15065 | return ('N'); |
---|
15066 | else if (x == 8) |
---|
15067 | return ('D'); |
---|
15068 | else if (x == 16) |
---|
15069 | return ('C'); |
---|
15070 | else if (x == 32) |
---|
15071 | return ('Q'); |
---|
15072 | else if (x == 64) |
---|
15073 | return ('E'); |
---|
15074 | else if (x == 128) |
---|
15075 | return ('G'); |
---|
15076 | else if (x == 256) |
---|
15077 | return ('H'); |
---|
15078 | else if (x == 512) |
---|
15079 | return ('I'); |
---|
15080 | else if (x == 1024) |
---|
15081 | return ('L'); |
---|
15082 | else if (x == 2048) |
---|
15083 | return ('K'); |
---|
15084 | else if (x == 4096) |
---|
15085 | return ('M'); |
---|
15086 | else if (x == 8192) |
---|
15087 | return ('F'); |
---|
15088 | else if (x == 16384) |
---|
15089 | return ('P'); |
---|
15090 | else if (x == 32768) |
---|
15091 | return ('S'); |
---|
15092 | else if (x == 65536) |
---|
15093 | return ('T'); |
---|
15094 | else if (x == 131072) |
---|
15095 | return ('W'); |
---|
15096 | else if (x == 262144) |
---|
15097 | return ('Y'); |
---|
15098 | else if (x == 524288) |
---|
15099 | return ('V'); |
---|
15100 | else if (x > 0 && x < 524288) |
---|
15101 | return ('*'); |
---|
15102 | else if (x == MISSING) |
---|
15103 | return ('?'); |
---|
15104 | else if (x == GAP) |
---|
15105 | return ('-'); |
---|
15106 | else |
---|
15107 | return (' '); |
---|
15108 | |
---|
15109 | } |
---|
15110 | |
---|
15111 | |
---|
15112 | |
---|
15113 | |
---|
15114 | |
---|
15115 | MrBFlt WhichCont (int x) |
---|
15116 | |
---|
15117 | { |
---|
15118 | |
---|
15119 | return ((MrBFlt)(x / 1000.0)); |
---|
15120 | |
---|
15121 | } |
---|
15122 | |
---|
15123 | |
---|
15124 | |
---|
15125 | |
---|
15126 | |
---|
15127 | char WhichNuc (int x) |
---|
15128 | |
---|
15129 | { |
---|
15130 | |
---|
15131 | if (x == 1) |
---|
15132 | return ('A'); |
---|
15133 | else if (x == 2) |
---|
15134 | return ('C'); |
---|
15135 | else if (x == 3) |
---|
15136 | return ('M'); |
---|
15137 | else if (x == 4) |
---|
15138 | return ('G'); |
---|
15139 | else if (x == 5) |
---|
15140 | return ('R'); |
---|
15141 | else if (x == 6) |
---|
15142 | return ('S'); |
---|
15143 | else if (x == 7) |
---|
15144 | return ('V'); |
---|
15145 | else if (x == 8) |
---|
15146 | return ('T'); |
---|
15147 | else if (x == 9) |
---|
15148 | return ('W'); |
---|
15149 | else if (x == 10) |
---|
15150 | return ('Y'); |
---|
15151 | else if (x == 11) |
---|
15152 | return ('H'); |
---|
15153 | else if (x == 12) |
---|
15154 | return ('K'); |
---|
15155 | else if (x == 13) |
---|
15156 | return ('D'); |
---|
15157 | else if (x == 14) |
---|
15158 | return ('B'); |
---|
15159 | else if (x == 15) |
---|
15160 | return ('N'); |
---|
15161 | else if (x == MISSING) |
---|
15162 | return ('?'); |
---|
15163 | else if (x == GAP) |
---|
15164 | return ('-'); |
---|
15165 | else |
---|
15166 | return (' '); |
---|
15167 | |
---|
15168 | } |
---|
15169 | |
---|
15170 | |
---|
15171 | |
---|
15172 | |
---|
15173 | |
---|
15174 | char WhichRes (int x) |
---|
15175 | |
---|
15176 | { |
---|
15177 | |
---|
15178 | if (x == 1) |
---|
15179 | return ('0'); |
---|
15180 | else if (x == 2) |
---|
15181 | return ('1'); |
---|
15182 | else if (x == 3) |
---|
15183 | return ('*'); |
---|
15184 | else if (x == MISSING) |
---|
15185 | return ('N'); |
---|
15186 | else if (x == GAP) |
---|
15187 | return ('-'); |
---|
15188 | else |
---|
15189 | return (' '); |
---|
15190 | |
---|
15191 | } |
---|
15192 | |
---|
15193 | |
---|
15194 | |
---|
15195 | |
---|
15196 | |
---|
15197 | char WhichStand (int x) |
---|
15198 | |
---|
15199 | { |
---|
15200 | |
---|
15201 | if (x == 1) |
---|
15202 | return ('0'); |
---|
15203 | else if (x == 2) |
---|
15204 | return ('1'); |
---|
15205 | else if (x == 4) |
---|
15206 | return ('2'); |
---|
15207 | else if (x == 8) |
---|
15208 | return ('3'); |
---|
15209 | else if (x == 16) |
---|
15210 | return ('4'); |
---|
15211 | else if (x == 32) |
---|
15212 | return ('5'); |
---|
15213 | else if (x == 64) |
---|
15214 | return ('6'); |
---|
15215 | else if (x == 128) |
---|
15216 | return ('7'); |
---|
15217 | else if (x == 256) |
---|
15218 | return ('8'); |
---|
15219 | else if (x == 512) |
---|
15220 | return ('9'); |
---|
15221 | else if (x > 0 && x < 512) |
---|
15222 | return ('*'); |
---|
15223 | else if (x == MISSING) |
---|
15224 | return ('N'); |
---|
15225 | else if (x == GAP) |
---|
15226 | return ('-'); |
---|
15227 | else |
---|
15228 | return (' '); |
---|
15229 | |
---|
15230 | } |
---|
15231 | |
---|
15232 | |
---|