Пример #1
0
void getoptions()
{
    /* interactively set options */
    long loopcount, loopcount2;
    Char ch, ch2;

    fprintf(outfile, "\nPenny algorithm, version %s\n",VERSION);
    fprintf(outfile, " branch-and-bound to find all");
    fprintf(outfile, " most parsimonious trees\n\n");
    howoften = often;
    howmanny = many;
    outgrno = 1;
    outgropt = false;
    simple = true;
    thresh = false;
    threshold = spp;
    trout = true;
    weights = false;
    justwts = false;
    ancvar = false;
    allsokal = false;
    allwagner = true;
    mixture = false;
    printdata = false;
    progress = true;
    treeprint = true;
    stepbox = false;
    ancseq = false;
    loopcount = 0;
    for(;;) {
        cleerhome();
        printf("\nPenny algorithm, version %s\n",VERSION);
        printf(" branch-and-bound to find all most parsimonious trees\n\n");
        printf("Settings for this run:\n");
        printf("  X                     Use Mixed method?  %s\n",
               mixture ? "Yes" : "No");
        printf("  P                     Parsimony method?  %s\n",
               (allwagner && !mixture)  ? "Wagner"       :
               (!(allwagner || mixture)) ? "Camin-Sokal"  : "(methods in mixture)");
        printf("  F        How often to report, in trees:%5ld\n",howoften);
        printf("  H        How many groups of%5ld trees:%6ld\n",howoften,howmanny);
        printf("  O                        Outgroup root?");
        if (outgropt)
            printf("  Yes, at species number%3ld\n", outgrno);
        else
            printf("  No, use as outgroup species%3ld\n", outgrno);
        printf("  S           Branch and bound is simple?  %s\n",
               simple ? "Yes" : "No. reconsiders order of species");
        printf("  T              Use Threshold parsimony?");
        if (thresh)
            printf("  Yes, count steps up to%4.1f per char.\n", threshold);
        else
            printf("  No, use ordinary parsimony\n");
        printf("  A   Use ancestral states in input file?  %s\n",
               ancvar ? "Yes" : "No");
        printf("  W                       Sites weighted?  %s\n",
               (weights ? "Yes" : "No"));
        printf("  M           Analyze multiple data sets?");
        if (mulsets)
            printf("  Yes, %2ld %s\n", msets,
                   (justwts ? "sets of weights" : "data sets"));
        else
            printf("  No\n");
        printf("  0   Terminal type (IBM PC, ANSI, none)?  %s\n",
               ibmpc ? "IBM PC" : ansi  ? "ANSI" : "(none)");
        printf("  1    Print out the data at start of run  %s\n",
               printdata ? "Yes" : "No");
        printf("  2  Print indications of progress of run  %s\n",
               progress ? "Yes" : "No");
        printf("  3                        Print out tree  %s\n",
               treeprint ? "Yes" : "No");
        printf("  4     Print out steps in each character  %s\n",
               stepbox ? "Yes" : "No");
        printf("  5     Print states at all nodes of tree  %s\n",
               ancseq ? "Yes" : "No");
        printf("  6       Write out trees onto tree file?  %s\n",
               trout ? "Yes" : "No");
        if(weights && justwts) {
            printf(
                "WARNING:  W option and Multiple Weights options are both on.  ");
            printf(
                "The W menu option is unnecessary and has no additional effect. \n");
        }
        printf("\nAre these settings correct?");
        printf(" (type Y or the letter for one to change)\n");
#ifdef WIN32
        phyFillScreenColor();
#endif
        scanf("%c%*[^\n]", &ch);
        getchar();
        uppercase(&ch);
        if (ch == 'Y')
            break;
        if (strchr("WHFSOMPATX1234560",ch) != NULL) {
            switch (ch) {

            case 'X':
                mixture = !mixture;
                break;

            case 'P':
                allwagner = !allwagner;
                break;

            case 'A':
                ancvar = !ancvar;
                break;

            case 'H':
                inithowmany(&howmanny, howoften);
                break;

            case 'F':
                inithowoften(&howoften);
                break;

            case 'S':
                simple = !simple;
                break;

            case 'O':
                outgropt = !outgropt;
                if (outgropt)
                    initoutgroup(&outgrno, spp);
                else outgrno = 1;
                break;

            case 'T':
                thresh = !thresh;
                if (thresh)
                    initthreshold(&threshold);
                break;

            case 'W':
                weights = !weights;
                break;

            case 'M':
                mulsets = !mulsets;
                if (mulsets) {
                    printf("Multiple data sets or multiple weights?");
                    loopcount2 = 0;
                    do {
                        printf(" (type D or W)\n");
#ifdef WIN32
                        phyFillScreenColor();
#endif
                        scanf("%c%*[^\n]", &ch2);
                        getchar();
                        if (ch2 == '\n')
                            ch2 = ' ';
                        uppercase(&ch2);
                        countup(&loopcount2, 10);
                    } while ((ch2 != 'W') && (ch2 != 'D'));
                    justwts = (ch2 == 'W');
                    if (justwts)
                        justweights(&msets);
                    else
                        initdatasets(&msets);
                }
                break;

            case '0':
                initterminal(&ibmpc, &ansi);
                break;

            case '1':
                printdata = !printdata;
                break;

            case '2':
                progress = !progress;
                break;

            case '3':
                treeprint = !treeprint;
                break;

            case '4':
                stepbox = !stepbox;
                break;

            case '5':
                ancseq = !ancseq;
                break;

            case '6':
                trout = !trout;
                break;
            }
        } else
            printf("Not a possible option!\n");
        countup(&loopcount, 100);
    }
    allsokal = (!allwagner && !mixture);
}  /* getoptions */
Пример #2
0
void getoptions()
{
  /* interactively set options */
  long loopcount;
  Char ch;
  boolean done, gotopt;
  char input[100];

  how = arb;
  usertree = false;
  goteof = false;
  thresh = false;
  threshold = spp;
  weights = false;
  ancvar = false;
  factors = false;
  dollo = true;
  loopcount = 0;
  do {
    cleerhome();
    printf("\nInteractive Dollo or polymorphism parsimony,");
    printf(" version %s\n\n",VERSION);
    printf("Settings for this run:\n");
    printf("  P                        Parsimony method?");
    printf("  %s\n",(dollo ? "Dollo" : "Polymorphism"));
    printf("  A                    Use ancestral states?  %s\n",
           ancvar ? "Yes" : "No");
    printf("  F                 Use factors information?  %s\n",
           factors ? "Yes" : "No");
    printf("  W                          Sites weighted?  %s\n",
           (weights ? "Yes" : "No"));
    printf("  T                 Use Threshold parsimony?");
    if (thresh)
      printf("  Yes, count steps up to%4.1f\n", threshold);
    else
      printf("  No, use ordinary parsimony\n");
    printf("  A      Use ancestral states in input file?");
    printf("  %s\n",(ancvar ? "Yes" : "No"));
    printf("  U Initial tree (arbitrary, user, specify)?");
    printf("  %s\n",(how == arb) ? "Arbitrary" :
                    (how == use) ? "User tree from tree file" :
                                   "Tree you specify");
    printf("  0      Graphics type (IBM PC, ANSI, none)?  %s\n",
           ibmpc ? "IBM PC" : ansi  ? "ANSI"   : "(none)");
    printf("  L               Number of lines on screen?%4ld\n",screenlines);
    printf("  S                Width of terminal screen?%4ld\n",screenwidth);
    printf(
      "\n\nAre these settings correct? (type Y or the letter for one to change)\n");
#ifdef WIN32
    phyFillScreenColor();
#endif
    getstryng(input);
    ch = input[0];
    uppercase(&ch);
    done = (ch == 'Y');
    gotopt = (strchr("SFTPULA0W",ch) != NULL) ? true : false;
    if (gotopt) {
      switch (ch) {

      case 'A':
        ancvar = !ancvar;
        break;

      case 'F':
        factors = !factors;
        break;

      case 'W':
        weights = !weights;
        break;
        
      case 'P':
        dollo = !dollo;
        break;

      case 'T':
        thresh = !thresh;
        if (thresh)
          initthreshold(&threshold);
        break;

      case 'U':
        if (how == arb)
          how = use;
        else if (how == use)
            how = spec;
          else
            how = arb;
        break;

      case '0':
        initterminal(&ibmpc, &ansi);
        break;

      case 'L':
        initnumlines(&screenlines);
        break;

      case 'S':
        screenwidth = readlong("Width of terminal screen (in characters)?\n");
      }
    }
    else  
      printf("Not a possible option!\n");
    countup(&loopcount, 100);
  } while (!done);
  if (scrollinc < screenwidth / 2.0)
    hscroll = scrollinc;
  else
    hscroll = screenwidth / 2;
  if (scrollinc < screenlines / 2.0)
    vscroll = scrollinc;
  else
    vscroll = screenlines / 2;
}  /* getoptions */