void inputoptions(void) { /* input the information on the options */ long i; if(justwts){ if(firstset){ if (ancvar) { inputancestorsstr(phyloanc->Str[0], anczero0, ancone0); } } for (i = 0; i < (chars); i++) weight[i] = 1; inputweightsstr(phyloweights->Str[0], chars, weight, &weights); } else { if (!firstset) { samenumspstate(phylostates[ith-1], &chars, ith); reallocchars(); } for (i = 0; i < (chars); i++) weight[i] = 1; if (ancvar) inputancestorsstr(phyloanc->Str[0], anczero0, ancone0); if (weights) inputweightsstr(phyloweights->Str[ith-1], chars, weight, &weights); } if ((weights || justwts) && printdata) printweights(outfile, 0, chars, weight, "Characters"); for (i = 0; i < (chars); i++) { if (!ancvar) { anczero[i] = true; ancone[i] = false; } else { anczero[i] = anczero0[i]; ancone[i] = ancone0[i]; } } if (ancvar && printdata) printancestors(outfile, anczero, ancone); questions = false; for (i = 0; i < (chars); i++) { questions = (questions || (ancone[i] && anczero[i])); threshwt[i] = threshold * weight[i]; } } /* inputoptions */
void inputoptions() { /* input the information on the options */ long i; scan_eoln(infile); for (i = 0; i < (chars); i++) weight[i] = 1; if (ancvar) inputancestors(anczero0, ancone0); if (factors) inputfactors(chars, factor, &factors); if (weights) inputweights(chars, weight, &weights); putchar('\n'); if (weights) printweights(stdout, 0, chars, weight, "Characters"); if (factors) printfactors(stdout, chars, factor, ""); for (i = 0; i < (chars); i++) { if (!ancvar) { anczero[i] = true; ancone[i] = false; } else { anczero[i] = anczero0[i]; ancone[i] = ancone0[i]; } } if (ancvar) printancestors(stdout, anczero, ancone); if (!thresh) threshold = spp; questions = false; for (i = 0; i < (chars); i++) { questions = (questions || (ancone[i] && anczero[i])); threshwt[i] = threshold * weight[i]; } } /* inputoptions */
int main(int argc, Char *argv[]) { /* Penny's branch-and-bound method */ /* Reads in the number of species, number of characters, options and data. Then finds all most parsimonious trees */ #ifdef MAC argc = 1; /* macsetup("Penny",""); */ argv[0] = "Penny"; #endif init(argc,argv); openfile(&infile,INFILE,"input file", "r",argv[0],infilename); openfile(&outfile,OUTFILE,"output file", "w",argv[0],outfilename); ibmpc = IBMCRT; ansi = ANSICRT; mulsets = false; msets = 1; firstset = true; garbage = NULL; bits = 8*sizeof(long) - 1; doinit(); if (weights || justwts) openfile(&weightfile,WEIGHTFILE,"weights file","r",argv[0],weightfilename); if (trout) openfile(&outtree,OUTTREE,"output tree file", "w",argv[0],outtreename); if(ancvar) openfile(&ancfile,ANCFILE,"ancestors file", "r",argv[0],ancfilename); if(mixture) openfile(&mixfile,MIXFILE,"mixture file", "r",argv[0],mixfilename); for (ith = 1; ith <= msets; ith++) { if(firstset) { if (allsokal && !mixture) fprintf(outfile, "Camin-Sokal parsimony method\n\n"); if (allwagner && !mixture) fprintf(outfile, "Wagner parsimony method\n\n"); } doinput(); if (msets > 1 && !justwts) { fprintf(outfile, "Data set # %ld:\n\n",ith); if (progress) printf("\nData set # %ld:\n",ith); } if (justwts) { if(firstset && mixture && printdata) printmixture(outfile, wagner); fprintf(outfile, "Weights set # %ld:\n\n", ith); if (progress) printf("\nWeights set # %ld:\n\n", ith); } else if (mixture && printdata) printmixture(outfile, wagner); if (printdata) { if (weights || justwts) printweights(outfile, 0, chars, weight, "Characters"); if (ancvar) printancestors(outfile, anczero, ancone); } if (ith == 1) firstset = false; maketree(); } FClose(infile); FClose(outfile); FClose(outtree); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif #ifdef WIN32 phyRestoreConsoleAttributes(); #endif return 0; } /* Penny's branch-and-bound method */