/* * MrBayes 2.0 * * John P. Huelsenbeck * Department of Biology * University of Rochester * Rochester, NY 14627 * * johnh@brahms.biology.rochester.edu * * Fredrik Ronquist * Dept. Systematic Zoology * Evolutionary Biology Centre * Uppsala University * Norbyv. 18D, SE-752 36 Uppsala, Sweden * * fredrik.ronquist@ebc.uu.se * */ #include #include #include #include #include #include "jph.h" #include "tree.h" #include "command.h" #define VERSION_NUMBER 2.01 static void CommandLine (void); static void InitializeMrBayes (void); static void PrintHeader (void); int nTaxa, nChar, *origDataMatrix, isNtaxaInitialized, isNcharInitialized, isMatrixAllocated, dataType, *excludedSites, *sitePartitions, *charType, *charNStates, *calibrations, *constraints, nConstraints, nCalibrations, *excludedTaxa, nGen, sampleFreq, printFreq, numChains, isUserTreeDefined, isTreeRooted, enforceConstraints, enforceCalibrations, inferAncStates, nRateCats, isPartitionDefined, nPartitions, outgroupNum, saveBrlens, burnIn, consensusType, paramBurn, autoclose, nPerturbations, userBrlensDef, aaModelType, saveAncFiles, enforceCodonModel, aaCode, inferPoseSel, lagNumber, inferRates, useCovarion, mcmcBurn, cycleFreq, calcPseudoBf, useParsCriterion; long int randomSeed; char *taxonLabels, subModel[20], baseFreqModel[20], ratesModel[20], clockModel[20], tRatioModel[20], revRatesModel[20], nonRevRatesModel[20], partitionName[50], shapeModel[20], siteRatesModel[20],constraintLabels[32][100], calibrationLabels[32][100], outFile[100], qmatprModel[20], basefreqprModel[20], brlenprModel[20], shapeprModel[20], siterateprModel[20], startingTreeModel[20], defPartitionName[50], sumTreeFile[100], sumParmFile[100], codonModelType[20], omegaRatioModel[20], omegaprModel[20], lagModel[20], lagprModel[20], covarionModelType[20], codingType[20], stateFreqPrModel[20]; double revRates[6], nonRevRates[12], shape, tRatio, siteRates[50], calibrationTimes[32][2], chainTemp, qmatprExp, qmatprUni[2], basefreqprDir, brlenprExp, brlenprUni[2], shapeprExp, shapeprUni[2], siterateprExp, siterateprUni[2], seqErrorProb, speciationRate, extinctionRate, samplingFraction, omegaRatio, omegaprUni[2], omegaprExp, lagprUni[2], lagprExp, qMatWinProp, piAlphaProp, rateWinProp, tuningProp, clockTuneProp, timeTuneProp, mTuneProp, extendPProp, wormTuneProp, bdWinProp, omegaWinProp, rhoWinProp, omegaAlphaProp, invSlideProp, switchWinProp, alphaWinProp, nodeTimeTuneProp, reconLimProp, tbrExtendPProp, tbrTuneProp, blTuneProp, statefreqprDir, moveRates[100]; TreeNode *userTree, *userTreeRoot; int main (void) { InitializeMrBayes (); PrintHeader (); SetUpCommandHierarchy (); CommandLine (); return (0); } void CommandLine (void) { int i; char cmdStr[STRING_LENGTH]; for (;;) { printf ("MrBayes > "); fflush (stdin); fgets (cmdStr, STRING_LENGTH - 2, stdin); i = 0; while (cmdStr[i] != '\0' && cmdStr[i] != '\n') i++; cmdStr[i++] = ';'; cmdStr[i] = '\0'; printf ("\n"); if (cmdStr[0] != ';') { ParseCommand (cmdStr); printf ("\n"); } } } void InitializeMrBayes (void) { int i; time_t curTime; outgroupNum = 0; strcpy (subModel, "1"); strcpy (baseFreqModel, "equal"); strcpy (ratesModel, "equal"); strcpy (clockModel, "unconstrained"); strcpy (tRatioModel, "estimate"); strcpy (revRatesModel, "estimate"); strcpy (nonRevRatesModel, "estimate"); strcpy (shapeModel, "estimate"); strcpy (partitionName, "none defined"); strcpy (siteRatesModel, "estimate"); strcpy (startingTreeModel, "random"); strcpy (qmatprModel, "uniform"); strcpy (basefreqprModel, "dirichlet"); strcpy (brlenprModel, "uniform"); strcpy (shapeprModel, "uniform"); strcpy (siterateprModel, "uniform"); strcpy (codingType, "all"); strcpy (stateFreqPrModel, "fixed"); qmatprUni[0] = 0.0000001; qmatprUni[1] = 100.0; basefreqprDir = 4.0; statefreqprDir = 4.0; brlenprUni[0] = 0.0000001; brlenprUni[1] = 10.0; shapeprUni[0] = 0.0000001; shapeprUni[1] = 10.0; siterateprUni[0] = 0.0000001; siterateprUni[1] = 10.0; isUserTreeDefined = NO; nGen = 1000000; sampleFreq = 100; printFreq = 100; numChains = 4; chainTemp = 0.2; strcpy (outFile, "mbout"); curTime = time(NULL); randomSeed = (long int)curTime; if (randomSeed < 0) randomSeed = -randomSeed; nConstraints = 0; nCalibrations = 0; enforceConstraints = NO; enforceCalibrations = NO; inferAncStates = NO; shape = 0.5; nRateCats = 4; tRatio = 1.0; for (i=0; i<6; i++) revRates[i] = 1.0; for (i=0; i<12; i++) nonRevRates[i] = 1.0; isPartitionDefined = NO; nPartitions = 0; for (i=0; i<50; i++) siteRates[i] = 1.0; saveBrlens = NO; seqErrorProb = 0.0; speciationRate = 1.0; extinctionRate = 0.01; samplingFraction = 1.0; burnIn = 0; consensusType = ALL_COMPAT; strcpy (sumTreeFile, outFile); strcat (sumTreeFile, ".t"); paramBurn = 0; strcpy (sumParmFile, outFile); strcat (sumParmFile, ".p.bp"); autoclose = NO; nPerturbations = 0; userBrlensDef = NO; dataType = -1; aaModelType = POISSON; omegaRatio = 1.0; saveAncFiles = NO; enforceCodonModel = NO; strcpy (covarionModelType, "ts98"); strcpy (codonModelType, "equal"); strcpy (omegaRatioModel, "estimate"); strcpy (omegaprModel, "uniform"); omegaprUni[0] = 0.0; omegaprUni[1] = 50.0; omegaprExp = 1.0; inferPoseSel = NO; lagNumber = 1; strcpy (lagModel, "user defined"); strcpy (lagprModel, "fixed"); lagprUni[0] = 0.0; lagprUni[1] = 20.0; lagprExp = 1.0; inferRates = NO; useCovarion = NO; mcmcBurn = 0; cycleFreq = 1000; calcPseudoBf = NO; useParsCriterion = NO; qMatWinProp = 2.0; piAlphaProp = 500.0; rateWinProp = 1.0; tuningProp = 2.0 * log(1.1); clockTuneProp = 2.0 * log(1.1); timeTuneProp = 2.0 * log(1.1); mTuneProp = 0.5 * log(1.1); extendPProp = 0.8; wormTuneProp = 2.0 * log(1.1); bdWinProp = 1.0; omegaWinProp = 1.0; rhoWinProp = 0.2; omegaAlphaProp = 50.0; invSlideProp = 0.1; switchWinProp = 1.0; alphaWinProp = 0.1; nodeTimeTuneProp = 2.0 * log(1.1); reconLimProp = 5.0; tbrExtendPProp = 0.8; tbrTuneProp = 2.0 * log(1.1); blTuneProp = 10.0 * 2.0 * log(1.1); moveRates[ 0] = 1.0; /* CHANGE_QMAT */ moveRates[ 1] = 1.0; /* CHANGE_BASEFREQS */ moveRates[ 2] = 1.0; /* CHANGE_GAMMA_SHAPE */ moveRates[ 3] = 1.0; /* CHANGE_SITE_RATES */ moveRates[ 4] = 40.0; /* CHANGE_UNROOT_LOCAL */ moveRates[ 5] = 25.0; /* CHANGE_CLOCK_LOCAL */ moveRates[ 6] = 25.0; /* CHANGE_CLOCK_TIME_LOCAL */ moveRates[ 7] = 10.0; /* CHANGE_TREE_HEIGHT */ moveRates[ 8] = 2.0; /* CHANGE_WORM */ moveRates[ 9] = 10.0; /* CHANGE_NODE_TIME */ moveRates[10] = 1.0; /* CHANGE_BD_PARAMS */ moveRates[11] = 1.0; /* CHANGE_OMEGA */ moveRates[12] = 1.0; /* CHANGE_OMEGA_PROBS */ moveRates[13] = 1.0; /* CHANGE_AUTO_CORR */ moveRates[14] = 1.0; /* CHANGE_LAG */ moveRates[15] = 0.0; /* CHANGE_TREE_SPR */ moveRates[16] = 1.0; /* CHANGE_INV_P */ moveRates[17] = 1.0; /* CHANGE_SWITCH_RATE */ moveRates[18] = 0.0; /* CHANGE_UNROOT_TBR */ moveRates[19] = 1.0; /* CHANGE_GCSWITCH */ moveRates[20] = 0.0; /* CHANGE_TREE_FTBR */ moveRates[21] = 0.0; /* CHANGE_BRLEN */ moveRates[22] = 0.0; /* CHANGE_ERASER */ moveRates[23] = 0.0; /* CHANGE_TREE_SPR2 */ moveRates[24] = 0.0; /* CHANGE_TREE_TBR2 */ moveRates[25] = 1.0; /* CHANGE_BETA_SHAPE */ } void PrintHeader (void) { printf ("\n\n"); printf (" MrBayes %1.2lf\n\n", VERSION_NUMBER); printf (" (Bayesian Analysis of Phylogeny)\n\n"); printf (" by\n\n"); printf (" John P. Huelsenbeck (1) and Fredrik Ronquist (2)\n\n"); printf (" (1) Department of Biology\n"); printf (" University of Rochester\n"); printf (" johnh@brahms.biology.rochester.edu\n\n"); printf (" (2) Department of Systematic Zoology\n"); printf (" Evolutionary Biology Centre\n"); printf (" Uppsala University\n"); printf (" fredrik.ronquist@ebc.uu.se\n\n"); printf (" Type \"help\" or \"help \" for information\n"); printf (" on the commands that are available.\n\n\n"); }