Exemplo n.º 1
0
unsigned long distanceofshortstringsbytearray(unsigned long *eqsvector,
                                              unsigned int alphasize,
                                              const GtUchar *useq,
                                              unsigned long ulen,
                                              const GtUchar *vseq,
                                              unsigned long vlen)
{
  DECLARELOCALVARS;
  const GtUchar *vptr;

  initeqsvector(eqsvector,(unsigned long) alphasize,useq,ulen);
  for (vptr = vseq; vptr < vseq + vlen; vptr++)
  {
    COMPUTENEWDIST(*vptr);
  }
  return distval;
}
Exemplo n.º 2
0
static void pms_initdfsconstinfo(Limdfsconstinfo *mti,
                                 unsigned int alphasize,
                                 ...)
                                 /* Variable argument list is as follows:
                                    unsigned int alphasize
                                    const GtUchar *pattern,
                                    unsigned long patternlength
                                 */
{
  va_list ap;
  const GtUchar *pattern;

  va_start(ap,alphasize);
  pattern = va_arg(ap, const GtUchar *);
  mti->patternlength = va_arg(ap, unsigned long);
  va_end(ap);
  initeqsvector(mti->eqsvector,(unsigned long) alphasize,
                pattern,mti->patternlength);
}
Exemplo n.º 3
0
unsigned long distanceofshortstringsencseq(unsigned long *eqsvector,
                                           unsigned int alphasize,
                                           const GtUchar *useq,
                                           unsigned long ulen,
                                           const Encodedsequence *encseq,
                                           Seqpos vstartpos,
                                           Seqpos vlen)
{
  DECLARELOCALVARS;
  GtUchar cc;
  Seqpos pos;

  initeqsvector(eqsvector,(unsigned long) alphasize,useq,ulen);
  for (pos = vstartpos; pos < vstartpos + vlen; pos++)
  {
    cc = getencodedchar(encseq,pos,Forwardmode);
    COMPUTENEWDIST(cc);
  }
  return distval;
}
Exemplo n.º 4
0
Definedunsignedlong forwardprefixmatch(const Encodedsequence *encseq,
                                       unsigned int alphasize,
                                       Seqpos startpos,
                                       bool nowildcards,
                                       unsigned long *eqsvector,
                                       const GtUchar *useq,
                                       unsigned long ulen,
                                       unsigned long maxdistance)
{
  DECLARELOCALVARS;
  Seqpos pos, totallength = getencseqtotallength(encseq);
  GtUchar cc;
  Definedunsignedlong result;

  initeqsvector(eqsvector,(unsigned long) alphasize,useq,ulen);
  gt_assert(maxdistance > 0);
  for (pos = startpos; /* Nothing */; pos++)
  {
    gt_assert(pos - startpos <= (Seqpos) (ulen + maxdistance));
    cc = getencodedchar(encseq,pos,Forwardmode);
    if (nowildcards && cc == (GtUchar) WILDCARD)
    {
      result.defined = false;
      result.valueunsignedlong = 0;
      return result;
    }
    COMPUTENEWDIST(cc);
    if (distval <= maxdistance || pos == totallength-1)
    {
      break;
    }
  }
  result.defined = true;
  result.valueunsignedlong = (unsigned long) (pos - startpos + 1);
  return result;
}