Esempio n. 1
0
void makedists()
{
  /* compute distance matrix */
  long i, j;
  double v;

  if (progress)
    printf("Distances calculated for species\n");
  for (i = 0; i < spp; i++)
    d[i][i] = 0.0;
  for (i = 1; i < spp; i++) {
    if (progress) {
      printf("    ");
      for (j = 0; j < nmlngth; j++)
        putchar(nayme[i - 1][j]);
      printf("   ");
    }
    for (j = i + 1; j <= spp; j++) {
      makev(i, j, &v);
      d[i - 1][j - 1] = v;
      d[j - 1][i - 1] = v;
      if (progress)
        putchar('.');
    }
    if (progress)
      putchar('\n');
  }
  if (progress) {
    printf("    ");
    for (j = 0; j < nmlngth; j++)
      putchar(nayme[spp - 1][j]);
    putchar('\n');
  }
}  /* makedists */
Esempio n. 2
0
vector sptk_window(vector data, WINDOW_SETTINGS * settings)
{
   int fleng = settings->leng,
       outl = -1,
       normflg = NORMFLG,
       i,j;
   Window wintype = settings->window_type;
   double *x;
   vector res;

   if (outl < 0)
      outl = fleng;

   res = makev(data.x);
   x = dgetmem(fleng > outl ? fleng : outl);

   for(i=0;i<data.x;i+=fleng){
      for(j=0;j<fleng;j++) x[j] = data.v[j+i];
      window(wintype, x, fleng, normflg);
      for(j=0;j<fleng;j++) res.v[j+i] = x[j];
   }

   return res;
}
Esempio n. 3
0
void makedists()
{
  /* compute distance matrix */
  long i, j;
  double v;

  inittable();
  for (i = 0; i < endsite; i++)
    weightrat[i] = weight[i] * rate[category[alias[i] - 1] - 1];
  if (progress) {
    printf("Distances calculated for species\n");
#ifdef WIN32
    phyFillScreenColor();
#endif
  }
  for (i = 0; i < spp; i++)
    if (similarity)
      d[i][i] = 1.0;
    else
      d[i][i] = 0.0;
  baddists = false;
  
  float cur_prog = 0;
  int total = (spp*spp / 2) + 1;
  float step = (1.0f / total) * 100.0f;

  for (i = 1; i < spp; i++) {
    if (progress) {
      printf("    ");
      for (j = 0; j < nmlngth; j++)
        putchar(nayme[i - 1][j]);
      printf("   ");
    }
    for (j = i + 1; j <= spp; j++) {
      makev(i, j, &v);
      v = fabs(v);     
      if ( baddists == true ) {
        v = -1;
        baddists = false;
      }
      d[i - 1][j - 1] = v;
      d[j - 1][i - 1] = v;
      
      U2::TaskStateInfo* ts = U2::getTaskInfo();
      if (ts->cancelFlag != 0) {
          ugene_exit("Task canceled!");
      } else if(!U2::isBootstr()){
          cur_prog += step;
          ts->progress = int (cur_prog);   
      }
      
      if (progress) {
        putchar('.');
        fflush(stdout);
      }
    }
    if (progress) {
      putchar('\n');
#ifdef WIN32
      phyFillScreenColor();
#endif
    }
  }
  if (progress) {
    printf("    ");
    for (j = 0; j < nmlngth; j++)
      putchar(nayme[spp - 1][j]);
    putchar('\n');
  }
}  /* makedists */