Exemple #1
0
void inputoptions()
{
  /* read options information */
  long i;

  if (!firstset && !justwts) {
    samenumsp(&sites, ith);
    reallocsites();
  }
  for (i = 0; i < sites; i++) {
    category[i] = 1;
    oldweight[i] = 1;
  }
  if (justwts || weights)
    inputweights(sites, oldweight, &weights);
  if (printdata)
    putc('\n', outfile);
  if (jukes && printdata)
    fprintf(outfile, "  Jukes-Cantor Distance\n");
  if (kimura && printdata)
    fprintf(outfile, "  Kimura 2-parameter Distance\n");
  if (f84 && printdata)
    fprintf(outfile, "  F84 Distance\n");
  if (similarity)
    fprintf(outfile, "  \n  Table of similarity between sequences\n");
  if (firstset && printdata && (kimura || f84))
    fprintf(outfile, "\nTransition/transversion ratio = %10.6f\n", ttratio);
  if (ctgry && categs > 1) {
    inputcategs(0, sites, category, categs, "DnaDist");
    if (printdata)
      printcategs(outfile, sites, category, "Site categories");
  } else if (printdata && (categs > 1)) {
    fprintf(outfile, "\nSite category   Rate of change\n\n");
    for (i = 1; i <= categs; i++)
      fprintf(outfile, "%12ld%13.3f\n", i, rate[i - 1]);
    putc('\n', outfile);
    printcategories();
  }
  if ((jukes || kimura || logdet) && freqsfrom) {
    printf(" WARNING: CANNOT USE EMPIRICAL BASE FREQUENCIES");
    printf(" WITH JUKES-CANTOR, KIMURA, JIN/NEI OR LOGDET DISTANCES\n");
    exxit(-1);
  }
  if (jukes)
    ttratio = 0.5000001;
  if (weights && printdata)
    printweights(outfile, 0, sites, oldweight, "Sites");
}  /* inputoptions */
Exemple #2
0
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 */
Exemple #3
0
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 */
Exemple #4
0
void inputoptions()
{
  /* input the information on the options */
  long weightsum, maxfactsize, i, j, k, l, m;

  if (data == genefreqs) {
    k = 0;
    l = 0;
    for (i = 0; i < (loci); i++) {
      m = alleles[i];
      k++;
      for (j = 1; j <= m; j++) {
        l++;
        factorr[l - 1] = k;
      }
    }
  } else {
    for (i = 1; i <= (sites); i++)
      factorr[i - 1] = i;
  }

  for (i = 0; i < (sites); i++)
    oldweight[i] = 1;
  if (weights)
    inputweightsstr2(phyloweights->Str[0],0, sites, &weightsum, oldweight, &weights, "seqboot");
  if (factors && printdata) {
    for(i = 0; i < sites; i++)
      factor[i] = (char)('0' + (factorr[i]%10));
    printfactors(outfile, sites, factor, " (least significant digit)");
  }
  if (weights && printdata)
    printweights(outfile, 0, sites, oldweight, "Sites");
  for (i = 0; i < (loci); i++)
    how_many[i] = 0;
  for (i = 0; i < (loci); i++)
    where[i] = 0;
  for (i = 1; i <= (sites); i++) {
    how_many[factorr[i - 1] - 1]++;
    if (where[factorr[i - 1] - 1] == 0)
      where[factorr[i - 1] - 1] = i;
  }
  groups = factorr[sites - 1];
  newgroups = 0;
  newsites = 0;
  maxfactsize = 0;
  for(i = 0 ; i < loci ; i++){
    if(how_many[i] > maxfactsize){
      maxfactsize = how_many[i];
    }
  }
  maxnewsites = groups * maxfactsize;
  allocnew();
  for (i = 0; i < (groups); i++) {
    if (oldweight[where[i] - 1] > 0) {
      newgroups++;
      newsites += how_many[i];
      newwhere[newgroups - 1] = where[i];
      newhowmany[newgroups - 1] = how_many[i];
    }
  }
}  /* inputoptions */
Exemple #5
0
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 */