示例#1
0
void inputoptions()
{
    /* input the information on the options */
    long weightsum, maxfactsize, i, j, k, l, m;

    for (i = 1; i <= (sites); i++)
        factorr[i - 1] = i;
    for (i = 0; i < (sites); i++)
        oldweight[i] = 1;
    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 */
示例#2
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 */