예제 #1
0
static void checkmergertrie2(Mergertrierep *trierep,
                             Mergertrienode *node,
                             Mergertrienode *father,
                             Bitsequence *leafused,
                             unsigned int *numberofbitsset)
{
  Mergertrienode *current, *previous;

  if (MTRIE_ISLEAF(node))
  {
    GtUword start = node->suffixinfo.startpos;
#ifndef NDEBUG
    if (ISIBITSET(leafused,start))
    {
      fprintf(stderr,"leaf "GT_WU" already found\n",start);
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
#endif
    SETIBIT(leafused,start);
    (*numberofbitsset)++;
  } else
  {
    gt_assert(node->depth == 0 || node->firstchild->rightsibling != NULL);
    if (father != NULL)
    {
      gt_assert(!MTRIE_ISLEAF(father));
#ifndef NDEBUG
      if (father->depth >= node->depth)
      {
        fprintf(stderr,"father.depth = "GT_WU" >= "GT_WU" = node.depth\n",
                       father->depth,
                       node->depth);
        exit(GT_EXIT_PROGRAMMING_ERROR);
      }
#endif
    }
    previous = NULL;
    for (current = node->firstchild; current != NULL;
        current = current->rightsibling)
    {
#ifndef NDEBUG
      if (previous != NULL)
      {
        if (mtrie_comparecharacters(
              getfirstedgechar(trierep,previous,node->depth),
              previous->suffixinfo.idx,
              getfirstedgechar(trierep,current,node->depth),
              current->suffixinfo.idx) >= 0)
        {
          fprintf(stderr,"nodes not correctly ordered\n");
          exit(GT_EXIT_PROGRAMMING_ERROR);
        }
      }
#endif
      checkmergertrie2(trierep,current,node,leafused,numberofbitsset);
      previous = current;
    }
  }
}
예제 #2
0
void checkandresetstorematch(GT_UNUSED uint64_t queryunit,
                             Storematchinfo *storeonline,
                             Storematchinfo *storeoffline)
{
  unsigned long seqnum, countmatchseq = 0,
    numofdbsequences = getencseqnumofdbsequences(storeonline->encseq);

  for (seqnum = 0; seqnum < numofdbsequences; seqnum++)
  {
#ifndef NDEBUG
    if (ISIBITSET(storeonline->hasmatch,seqnum) &&
        !ISIBITSET(storeoffline->hasmatch,seqnum))
    {
      fprintf(stderr,"query " Formatuint64_t " refseq %lu: "
                     "online has match but offline not\n",
                     PRINTuint64_tcast(queryunit),seqnum);
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
    if (!ISIBITSET(storeonline->hasmatch,seqnum) &&
        ISIBITSET(storeoffline->hasmatch,seqnum))
    {
      fprintf(stderr,"query " Formatuint64_t " refseq %lu: "
                     "offline has match but online not\n",
                     PRINTuint64_tcast(queryunit),seqnum);
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
#endif
    if (ISIBITSET(storeonline->hasmatch,seqnum))
    {
      countmatchseq++;
    }
  }
  CLEARBITTAB(storeonline->hasmatch,numofdbsequences);
  CLEARBITTAB(storeoffline->hasmatch,numofdbsequences);
  printf("matching sequences: %lu\n",countmatchseq);
}
예제 #3
0
static void storematch(void *info,const GtMatch *match)
{
  Storematchinfo *storematch = (Storematchinfo *) info;
  unsigned long seqnum;

  if (match->dbabsolute)
  {
    seqnum = getencseqfrompos2seqnum(storematch->encseq,match->dbstartpos);
  } else
  {
    seqnum = match->dbseqnum;
  }
  if (!ISIBITSET(storematch->hasmatch,seqnum))
  {
    SETIBIT(storematch->hasmatch,seqnum);
  }
}
예제 #4
0
static void showitvdistribution(const GtArrayuint64_t *dist,
                                const Bitsequence *outputvector)
{
  unsigned long idx;

  gt_assert(outputvector != NULL && dist->nextfreeuint64_t > 0);
  for (idx=0; idx < dist->nextfreeuint64_t; idx++)
  {
    if (ISIBITSET(outputvector,idx) && dist->spaceuint64_t[idx] > 0)
    {
      /*@ignore@*/
      printf("%lu " Formatuint64_t "\n",
              idx,
              PRINTuint64_tcast(dist->spaceuint64_t[idx]));
      /*@end@*/
    }
  }
}
예제 #5
0
static void showitvsumdistributionoftwo(Summode mode,
                                        const GtArrayuint64_t *dist1,
                                        const GtArrayuint64_t *dist2,
                                        const Bitsequence *outputvector)
{
  unsigned long idx;
  uint64_t sumoftwo, tmp;

  gt_assert(outputvector != NULL && dist1->nextfreeuint64_t > 0
                              && dist2->nextfreeuint64_t > 0);
  for (idx=0; /* Nothing */; idx++)
  {
    if (ISIBITSET(outputvector,idx))
    {
      if (idx < dist1->nextfreeuint64_t)
      {
        if (idx < dist2->nextfreeuint64_t)
        {
          sumoftwo = dist1->spaceuint64_t[idx] + dist2->spaceuint64_t[idx];
        } else
        {
          sumoftwo = dist1->spaceuint64_t[idx];
        }
      } else
      {
        if (idx < dist2->nextfreeuint64_t)
        {
          sumoftwo = dist2->spaceuint64_t[idx];
        } else
        {
          break;
        }
      }
      if (sumoftwo > 0)
      {
        if (mode == Onlyshowsum)
        {
          /*@ignore@*/
          printf("%lu " Formatuint64_t "\n",
                  idx,
                  PRINTuint64_tcast(sumoftwo));
          /*@end@*/
        } else
        {
          if (mode == Showfirst)
          {
            tmp = (idx < dist1->nextfreeuint64_t)
                     ? dist1->spaceuint64_t[idx]
                     : 0;
          } else
          {
            tmp = (idx < dist2->nextfreeuint64_t)
                     ? dist2->spaceuint64_t[idx]
                     : 0;
          }
          if (tmp > 0)
          {
            /*@ignore@*/
            printf("%lu " Formatuint64_t " %.3f\n",
                  idx,
                  PRINTuint64_tcast(tmp),
                  (double) tmp/(double) sumoftwo);
            /*@end@*/
          }
        }
      }
    }
  }
}