Exemplo n.º 1
0
int allkeysdefined(const GtStr *indexname,const char *suffix,
                   const GtArray *riktab,Verboseinfo *verboseinfo,
                   GtError *err)
{
  unsigned long i;
  Readintkeys *rikptr;

  gt_error_check(err);
  for (i=0; i<gt_array_size(riktab); i++)
  {
    rikptr = (Readintkeys *) gt_array_get(riktab,i);
    if (rikptr->found)
    {
      if (rikptr->ptrdefined)
      {
        if (rikptr->smallvalueptr != NULL)
        {
          showverbose(verboseinfo,"%s=%u",
                      rikptr->keystring,
                      (unsigned int) *(rikptr->smallvalueptr));
        } else
        {
          if (rikptr->bigvalueptr != NULL)
          {
            showverbose(verboseinfo,"%s=" Formatuint64_t,
                        rikptr->keystring,
                        PRINTuint64_tcast(*(rikptr->bigvalueptr)));
          } else
          {
            gt_assert(false);
          }
        }
      } else
      {
        showverbose(verboseinfo,"%s=0",rikptr->keystring);
      }
      if (rikptr->readflag != NULL)
      {
        *(rikptr->readflag) = true;
      }
    } else
    {
      if (rikptr->readflag == NULL)
      {
        gt_error_set(err,"file %s%s: missing line beginning with \"%s=\"",
                           gt_str_get(indexname),
                           suffix,
                           rikptr->keystring);
        return -1;
      }
      *(rikptr->readflag) = false;
    }
  }
  return 0;
}
Exemplo n.º 2
0
void gt_copysortsuffixes(const GtBucketspec2 *bucketspec2,
                         Seqpos *suftab,
                         Verboseinfo *verboseinfo)
{
  Seqpos hardwork = 0, **targetptr;
  unsigned int idx, idxsource, source, second;

#ifdef WITHSUFFIXES
  {
    const Seqpos *ptr;
    for (ptr = suftab; ptr < suftab + bucketspec2->partwidth; ptr++)
    {
      showsequenceatstartpos(stdout,
                             ISDIRREVERSE(readmode) ? false : true,
                             ISDIRCOMPLEMENT(readmode) ? true : false,
                             encseq,
                             *ptr);
    }
  }
#endif
  targetptr = gt_malloc(sizeof(*targetptr) * bucketspec2->numofchars);
  for (idxsource = 0; idxsource<bucketspec2->numofchars; idxsource++)
  {
    source = bucketspec2->order[idxsource];
    for (second = 0; second < bucketspec2->numofchars; second++)
    {
      if (!bucketspec2->subbuckettab[source][second].sorted && source != second)
      {
        gt_assert(bucketspec2->subbuckettab[source][second].hardworktodo);
        showverbose(verboseinfo,"hard work for %u %u",source,second);
        hardwork += getendidx(bucketspec2,source,second) -
                    getstartidx(bucketspec2,source,second);
        bucketspec2->subbuckettab[source][second].sorted = true;
      } else
      {
        gt_assert(!bucketspec2->subbuckettab[source][second].hardworktodo);
      }
    }
    if (getstartidx(bucketspec2,source,0) <
        getstartidx(bucketspec2,source,source))
    {
      for (idx = 0; idx < bucketspec2->numofchars; idx++)
      {
        targetptr[idx] = suftab + getstartidx(bucketspec2,idx,source);
      }
      forwardderive(bucketspec2,
                    targetptr,
                    source,
                    suftab + getstartidx(bucketspec2,source,0));
    }
    if (getendidx(bucketspec2,source,source) <
        getendidx(bucketspec2,source,bucketspec2->numofchars))
    {
      for (idx = 0; idx < bucketspec2->numofchars; idx++)
      {
        targetptr[idx] = suftab + getendidx(bucketspec2,idx,source) - 1;
      }
      backwardderive(bucketspec2,
                     targetptr,
                     source,
                     suftab +
                     getendidx(bucketspec2,source,bucketspec2->numofchars) - 1);
    }
    for (idx = 0; idx < bucketspec2->numofchars; idx++)
    {
      bucketspec2->subbuckettab[idx][source].sorted = true;
    }
    bucketspec2->superbuckettab[source].sorted = true;
  }
  gt_free(targetptr);
  showverbose(verboseinfo,"hardwork = " FormatSeqpos " (%.2f)",
            PRINTSeqposcast(hardwork),
            (double) hardwork/getencseqtotallength(bucketspec2->encseq));
}