Exemplo n.º 1
0
void gt_tyrindex_check(GT_UNUSED const Tyrindex *tyrindex)
{
#ifndef NDEBUG
  GtUchar *mercodeptr;
  const GtUchar *result;
  GtUword position;
  GT_UNUSED GtUword previousposition = 0;

  gt_assert(tyrindex->merbytes > 0);
  for (mercodeptr = tyrindex->mertable;
       mercodeptr <= tyrindex->lastmer;
       mercodeptr += tyrindex->merbytes)
  {
    result = gt_tyrindex_binmersearch(tyrindex,0,mercodeptr,
                                   tyrindex->mertable,
                                   tyrindex->lastmer);
    gt_assert(result != NULL);
    if ((result - tyrindex->mertable) % tyrindex->merbytes != 0)
    {
      fprintf(stderr,"result is not multiple of "GT_WU"\n",tyrindex->merbytes);
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
    position = (GtUword) (result-tyrindex->mertable)/
                               tyrindex->merbytes;
    if (position > 0 && previousposition + 1 != position)
    {
      fprintf(stderr,"position "GT_WU" is not increasing\n",position);
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
    previousposition = position;
  }
#endif
}
Exemplo n.º 2
0
/*@null@*/ const GtUchar *gt_searchsinglemer(const GtUchar *qptr,
                                        const Tyrindex *tyrindex,
                                        const Tyrsearchinfo *tyrsearchinfo,
                                        const Tyrbckinfo *tyrbckinfo)
{
  const GtUchar *result;

  gt_encseq_plainseq2bytecode(tyrsearchinfo->bytecode,qptr,
                                       tyrsearchinfo->mersize);
  if (tyrbckinfo == NULL)
  {
    result = gt_tyrindex_binmersearch(tyrindex,0,tyrsearchinfo->bytecode,
                                   tyrsearchinfo->mertable,
                                   tyrsearchinfo->lastmer);
  } else
  {
    result = gt_searchinbuckets(tyrindex,tyrbckinfo,tyrsearchinfo->bytecode);
  }
  return result;
}