コード例 #1
0
ファイル: contml.c プロジェクト: Chrisss50/ViralToolBox
void getoptions()
{ /* interactively set options */
  long inseed0, loopcount;
  Char ch;
  boolean done;

  fprintf(outfile, "\nContinuous character Maximum Likelihood");
  fprintf(outfile, " method version %s\n\n",VERSION);
  putchar('\n');
  global = false;
  jumble = false;
  njumble = 1;
  lengths = false;
  outgrno = 1;
  outgropt = false;
  all = false;
  contchars = false;
  trout = true;
  usertree = false;
  printdata = false;
  progress = true;
  treeprint = true;
  loopcount = 0;
  do {
    cleerhome();
    printf("\nContinuous character Maximum Likelihood");
    printf(" method version %s\n\n",VERSION);
    printf("Settings for this run:\n");
    printf("  U                       Search for best tree?  %s\n",
           (usertree ? "No, use user trees in input" : "Yes"));
    if (usertree) {
      printf("  L                Use lengths from user trees?%s\n",
             (lengths ? "  Yes" : "  No"));
    }
    printf("  C  Gene frequencies or continuous characters?  %s\n",
           (contchars ? "Continuous characters" : "Gene frequencies"));
    if (!contchars)
      printf("  A   Input file has all alleles at each locus?  %s\n",
             (all ? "Yes" : "No, one allele missing at each"));
    printf("  O                              Outgroup root?  %s %ld\n",
           (outgropt ? "Yes, at species number" :
                       "No, use as outgroup species"),outgrno);
    if (!usertree) {
      printf("  G                      Global rearrangements?  %s\n",
             (global ? "Yes" : "No"));
      printf("  J           Randomize input order of species?");
      if (jumble)
        printf("  Yes (seed=%8ld,%3ld times)\n", inseed0, njumble);
      else
        printf("  No. Use input order\n");
    }
    printf("  M                 Analyze multiple data sets?");
    if (mulsets)
      printf("  Yes, %2ld sets\n", datasets);
    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             Write out trees onto tree file?  %s\n",
           (trout ? "Yes" : "No"));
    printf("\n  Y to accept these or type the letter for one to change\n");
#ifdef WIN32
    phyFillScreenColor();
#endif
    fflush(stdout);
    scanf("%c%*[^\n]", &ch);
    getchar();
    uppercase(&ch);
    done = (ch == 'Y');
    if (!done) {
      if (((!usertree) && (strchr("JOUGACM12340", ch) != NULL))
          || (usertree && ((strchr("LOUACM12340", ch) != NULL)))){
        switch (ch) {

        case 'A':
          if (!contchars)
            all = !all;
          break;

        case 'C':
          contchars = !contchars;
          break;

        case 'G':
          global = !global;
          break;

        case 'J':
          jumble = !jumble;
          if (jumble)
            initjumble(&inseed, &inseed0, seed, &njumble);
          else njumble = 1;
          break;

         case 'L':
           lengths = !lengths;
           break;

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

        case 'U':
          usertree = !usertree;
          break;

        case 'M':
          mulsets = !mulsets;
          if (mulsets)
            initdatasets(&datasets);
          break;

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

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

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

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

        case '4':
          trout = !trout;
          break;
        }
      } else
        printf("Not a possible option!\n");
    }
    countup(&loopcount, 100);
  } while (!done);
}  /* getoptions */
コード例 #2
0
ファイル: fitch.c プロジェクト: OS2World/APP-SCIENCE-LVB
void getoptions()
{
  /* interactively set options */
  long inseed0=0;
  Char ch;
  boolean done=false;

  putchar('\n');
  minev = false;
  global = false;
  jumble = false;
  njumble = 1;
  lengths = false;
  lower = false;
  negallowed = false;
  outgrno = 1;
  outgropt = false;
  power = 2.0;
  replicates = false;
  trout = true;
  upper = false;
  usertree = false;
  printdata = false;
  progress = true;
  treeprint = true;
  do {
    cleerhome();
    printf("\nFitch-Margoliash method version %s\n\n",VERSION);
    printf("Settings for this run:\n");
    printf("  D      Method (F-M, Minimum Evolution)?  %s\n",
	     (minev ? "Minimum Evolution" : "Fitch-Margoliash"));
    printf("  U                 Search for best tree?  %s\n",
	   (usertree ? "No, use user trees in input file" : "Yes"));
    if (usertree) {
      printf("  N          Use lengths from user trees?  %s\n",
	     (lengths ? "Yes" : "No"));
    }
    printf("  P                                Power?%9.5f\n",power);
    printf("  -      Negative branch lengths allowed?  %s\n",
	   negallowed ? "Yes" : "No");
    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("  L         Lower-triangular data matrix?");
    if (lower)
      printf("  Yes\n");
    else
      printf("  No\n");
    printf("  R         Upper-triangular data matrix?");
    if (upper)
      printf("  Yes\n");
    else
      printf("  No\n");
    printf("  S                        Subreplicates?");
    if (replicates)
      printf("  Yes\n");
    else
      printf("  No\n");
    if (!usertree) {
      printf("  G                Global rearrangements?");
      if (global)
        printf("  Yes\n");
      else
        printf("  No\n");
      printf("  J     Randomize input order of species?");
      if (jumble)
        printf("  Yes (seed =%8ld,%3ld times)\n", inseed0, njumble);
      else
        printf("  No. Use input order\n");
    }
    printf("  M           Analyze multiple data sets?");
    if (mulsets)
      printf("  Yes, %2ld sets\n", datasets);
    else
      printf("  No\n");
    printf("  0   Terminal type (IBM PC, ANSI, none)?");
    if (ibmpc)
      printf("  IBM PC\n");
    if (ansi)
      printf("  ANSI\n");
    if (!(ibmpc || ansi))
      printf("  (none)\n");
    printf("  1    Print out the data at start of run");
    if (printdata)
      printf("  Yes\n");
    else
      printf("  No\n");
    printf("  2  Print indications of progress of run");
    if (progress)
      printf("  Yes\n");
    else
      printf("  No\n");
    printf("  3                        Print out tree");
    if (treeprint)
      printf("  Yes\n");
    else
      printf("  No\n");
    printf("  4       Write out trees onto tree file?");
    if (trout)
      printf("  Yes\n");
    else
      printf("  No\n");
    printf(
   "\n  Y to accept these or type the letter for one to change\n");
#ifdef WIN32
    phyFillScreenColor();
#endif
    scanf("%c%*[^\n]", &ch);
    getchar();
    uppercase(&ch);
    done = (ch == 'Y');
   if (!done) {
      if (strchr("DJOUNPG-LRSM01234",ch) != NULL) {
        switch (ch) {

        case 'D':
          minev = !minev;
          if (minev && (!negallowed))
            negallowed = true;
          break;

        case '-':
          negallowed = !negallowed;
          break;

        case 'G':
          global = !global;
          break;

        case 'J':
          jumble = !jumble;
          if (jumble)
	    initjumble(&inseed, &inseed0, seed, &njumble);
          else njumble = 1;
          break;

        case 'L':
          lower = !lower;
          break;

 	case 'N':
 	  lengths = !lengths;
 	  break;

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

        case 'P':
          initpower(&power);
          break;

        case 'R':
          upper = !upper;
          break;

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

        case 'U':
          usertree = !usertree;
          break;

        case 'M':
          mulsets = !mulsets;
          if (mulsets)
	    initdatasets(&datasets);
          break;

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

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

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

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

        case '4':
          trout = !trout;
          break;
        }
      } else
        printf("Not a possible option!\n");
    }
  } while (!done);
}  /* getoptions */
コード例 #3
0
ファイル: penny.c プロジェクト: uw-loci/ome-server
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 */
コード例 #4
0
ファイル: neighbor.c プロジェクト: OS2World/APP-SCIENCE-LVB
void getoptions()
{
  /* interactively set options */
  long i;
  long inseed0 = 0;
  Char ch;

  fprintf(outfile, "\nNeighbor-Joining/UPGMA method version %s\n\n",VERSION);
  putchar('\n');
  jumble = false;
  lower = false;
  outgrno = 1;
  outgropt = false;
  replicates = false;
  trout = true;
  upper = false;
  printdata = false;
  progress = true;
  treeprint = true;
  njoin = true;
  for(;;) {
    printf(ansi ? "\033[2J\033[H" : "\n");
    printf("\nNeighbor-Joining/UPGMA method version %s\n\n",VERSION);
    printf("Settings for this run:\n");
    printf("  N       Neighbor-joining or UPGMA tree?  %s\n",
           (njoin ? "Neighbor-joining" : "UPGMA"));
    if (njoin) {
      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("  L         Lower-triangular data matrix?  %s\n",
           (lower ? "Yes" : "No"));
    printf("  R         Upper-triangular data matrix?  %s\n",
           (upper ? "Yes" : "No"));
    printf("  S                        Subreplicates?  %s\n",
           (replicates ? "Yes" : "No"));
    printf("  J     Randomize input order of species?");
    if (jumble)
      printf("  Yes (random number seed =%8ld)\n", inseed0);
    else
      printf("  No. Use input order\n");
    printf("  M           Analyze multiple data sets?");
    if (mulsets)
      printf("  Yes, %2ld sets\n", datasets);
    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       Write out trees onto tree file?  %s\n",
           (trout ? "Yes" : "No"));
    printf("\n\n  Y to accept these or type the letter for one to change\n");
#ifdef WIN32
    phyFillScreenColor();
#endif
    scanf("%c%*[^\n]", &ch);
    getchar();
    if (ch == '\n')
      ch = ' ';
    uppercase(&ch);
    if  (ch == 'Y')
      break;
    if (strchr("NJOULRSM01234",ch) != NULL){
      switch (ch) {
	
      case 'J':
	jumble = !jumble;
 	if (jumble) {
 	  do {
 	    printf("Random number seed (must be odd)?\n");
#ifdef WIN32
            phyFillScreenColor();
#endif
 	    scanf("%ld%*[^\n]", &inseed);
 	    getchar();
 	  } while (!(inseed & 1));
 	  inseed0 = inseed;
 	  for (i = 0; i <= 5; i++)
 	    seed[i] = 0;
 	  i = 0;
 	  do {
 	    seed[i] = inseed & 63;
 	    inseed /= 64;
 	    i++;
 	  } while (inseed != 0);
 	}
	break;
	
      case 'L':
	lower = !lower;
	break;
	
      case 'O':
	outgropt = !outgropt;
	if (outgropt)
	  initoutgroup(&outgrno, spp);
        else
          outgrno = 1;
	break;
	
      case 'R':
	upper = !upper;
	break;
	
      case 'S':
	replicates = !replicates;
	break;
	
      case 'N':
	njoin = !njoin;
	break;
	
      case 'M':
	mulsets = !mulsets;
	if (mulsets)
	  initdatasets(&datasets);
	break;
	
      case '0':
	initterminal(&ibmpc, &ansi);
	break;
	
      case '1':
	printdata = !printdata;
	break;
	
      case '2':
	progress = !progress;
	break;
	
      case '3':
	treeprint = !treeprint;
	break;
	
      case '4':
	trout = !trout;
	break;
      }
    } else
      printf("Not a possible option!\n");
  }
}  /* getoptions */
コード例 #5
0
ファイル: restdist.c プロジェクト: OS2World/APP-SCIENCE-LVB
void getoptions()
{
  /* interactively set options */
  Char ch;

  putchar('\n');
  sitelength = 6.0;
  neili = false;
  gama = false;
  cvi = 0.0;
  weights = false;
  lower = false;
  printdata = false;
  progress = true;
  restsites = true;
  interleaved = true;
  ttratio = 2.0;
  for (;;) {
    printf("%s", (ansi ? ("\033[2J\033[H") : "\n"));
    printf("\nRestriction site or fragment distances, ");
    printf("version %s\n\n",VERSION);
    printf("Settings for this run:\n");
    printf("  R           Restriction sites or fragments?  %s\n",
           (restsites ? "Sites" : "Fragments"));
    if (!restsites)
      printf("  N        Original or modified Nei/Li model?  %s\n",
             (neili ? "Original" : "Modified"));
    if (restsites || !neili) {
      printf("  G  Gamma distribution of rates among sites?");
      if (!gama)
        printf("  No\n");
      else
        printf("  Yes\n");
      printf("  T            Transition/transversion ratio?  %f\n", ttratio);
    }
    printf("  S                              Site length? %4.1f\n",sitelength);
    printf("  L                  Form of distance matrix?  %s\n",
           (lower ? "Lower-triangular" : "Square"));
    printf("  M               Analyze multiple data sets?");
    if (mulsets)
      printf("  Yes, %2ld sets\n", datasets);
    else
      printf("  No\n");
    printf("  I              Input sequences interleaved?  %s\n",
           (interleaved ? "Yes" : "No, sequential"));
    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("\n  Y to accept these or type the letter for one to change\n");
#ifdef WIN32
    phyFillScreenColor();
#endif
    scanf("%c%*[^\n]", &ch);
    getchar();
    if (ch == '\n')
      ch = ' ';
    uppercase(&ch);
    if (ch == 'Y')
      break;
    if (strchr("RDNGTSLMI012",ch) != NULL){
      switch (ch) {
        
      case 'R':
        restsites = !restsites;
        break;
        
      case 'G':
        if (restsites || !neili)
          gama = !gama;
        break;

      case 'N':
        if (!restsites)
          neili = !neili;
        break;

      case 'T':
        if (restsites || !neili)
          initratio(&ttratio);
        break;

      case 'S':
        do {
          printf("New Sitelength?\n");
#ifdef WIN32
          phyFillScreenColor();
#endif
          scanf("%lf%*[^\n]", &sitelength);
          getchar();
          if (sitelength < 1.0)
            printf("BAD RESTRICTION SITE LENGTH: %f\n", sitelength); 
        } while (sitelength < 1.0);
        break;
        
      case 'L':
        lower = !lower;
        break;

      case 'M':
        mulsets = !mulsets;
        if (mulsets)
          initdatasets(&datasets);
        break;
        
      case 'I':
        interleaved = !interleaved;
        break;
        
      case '0':
        initterminal(&ibmpc, &ansi);
        break;
        
      case '1':
        printdata = !printdata;
        break;
        
      case '2':
        progress = !progress;
        break;
        
      }
    } else
      printf("Not a possible option!\n");
  }
  if (gama) {
    do {
      printf(
"\nCoefficient of variation of substitution rate among sites (must be positive)?\n");
#ifdef WIN32
      phyFillScreenColor();
#endif
      scanf("%lf%*[^\n]", &cvi);
      getchar();
    } while (cvi <= 0.0);
    cvi = 1.0 / (cvi * cvi);
    printf("\n");
  }
  xi = (ttratio - 0.5)/(ttratio + 0.5);
  xv = 1.0 - xi;
  fracchange = xi*0.5 + xv*0.75;
}  /* getoptions */