Пример #1
0
static void gt_seqorder_sort(GtSuffixsortspace *suffixsortspace,
                             const GtEncseq *encseq)
{
    Sfxstrategy sfxstrategy;

    defaultsfxstrategy(&sfxstrategy, false);
    gt_suffixsortspace_init_seqstartpos(suffixsortspace,encseq);
    gt_sortallsuffixesfromstart(suffixsortspace,
                                gt_encseq_num_of_sequences(encseq), encseq, GT_READMODE_FORWARD, NULL, 0,
                                &sfxstrategy, NULL, NULL, NULL);
}
Пример #2
0
static void gt_seqorder_sort(GtSuffixsortspace *suffixsortspace,
    GtEncseq *encseq)
{
  unsigned long i;
  Sfxstrategy sfxstrategy;

  defaultsfxstrategy(&sfxstrategy, false);
  for (i = 0; i < gt_encseq_num_of_sequences(encseq); i++)
    gt_suffixsortspace_setdirect(suffixsortspace, i,
        gt_encseq_seqstartpos(encseq, i));
  gt_sortallsuffixesfromstart(suffixsortspace,
      gt_encseq_num_of_sequences(encseq), encseq, GT_READMODE_FORWARD, NULL, 0,
      &sfxstrategy, NULL, NULL, NULL);
}
Пример #3
0
static int gt_constructsarrandrunmmsearch(
                 const GtEncseq *dbencseq,
                 GtReadmode readmode,
                 unsigned int prefixlength,
                 unsigned int numofparts,
                 GtUword maximumspace,
                 const GtUchar *query,
                 GtUword querylen,
                 unsigned int minlength,
                 GtProcessquerymatch processquerymatch,
                 void *processquerymatchinfo,
                 GtTimer *sfxprogress,
                 bool withprogressbar,
                 GtLogger *logger,
                 GtError *err)
{
  bool haserr = false;
  Sfxiterator *sfi;
  Sfxstrategy sfxstrategy;

  defaultsfxstrategy(&sfxstrategy,
                     gt_encseq_bitwise_cmp_ok(dbencseq) ? false : true);
  sfxstrategy.outsuftabonfile = false;
  sfi = gt_Sfxiterator_new(dbencseq,
                           readmode,
                           prefixlength,
                           numofparts,
                           maximumspace,
                           &sfxstrategy, /* sfxstrategy */
                           sfxprogress,
                           withprogressbar,
                           logger, /* logger */
                           err);
  if (sfi == NULL)
  {
    haserr = true;
  } else
  {
    const GtSuffixsortspace *suffixsortspace;
    GtUword numberofsuffixes;
    GtQuerymatch *querymatchspaceptr = gt_querymatch_new();
    GtQueryrepresentation queryrep;

    queryrep.sequence = query;
    queryrep.encseq = NULL;
    queryrep.readmode = GT_READMODE_FORWARD;
    queryrep.startpos = 0;
    queryrep.seqlen = querylen;
    while (true)
    {
      suffixsortspace = gt_Sfxiterator_next(&numberofsuffixes,NULL,sfi);
      if (suffixsortspace == NULL)
      {
        break;
      }
      gt_querysubstringmatch(false,
                             dbencseq,
                             (const ESASuffixptr *)
                             gt_suffixsortspace_ulong_get(suffixsortspace),
                             readmode,
                             numberofsuffixes,
                             0,
                             &queryrep,
                             (GtUword) minlength,
                             processquerymatch,
                             processquerymatchinfo,
                             querymatchspaceptr);
    }
    gt_querymatch_delete(querymatchspaceptr);
  }
  if (gt_Sfxiterator_delete(sfi,err) != 0)
  {
    haserr = true;
  }
  return haserr ? -1 : 0;
}
Пример #4
0
static int constructsarrandrunmaxpairs(
                 Substringmatchinfo *ssi,
                 GtReadmode readmode,
                 unsigned int prefixlength,
                 unsigned int numofparts,
                 GtUword maximumspace,
                 GtTimer *sfxprogress,
                 bool withprogressbar,
                 GT_UNUSED GtLogger *logger,
                 GtError *err)
{
  const GtSuffixsortspace *suffixsortspace;
  GtUword numberofsuffixes;
  bool haserr = false;
  Sfxiterator *sfi;
  bool specialsuffixes = false;

  Sfxstrategy sfxstrategy;

  defaultsfxstrategy(&sfxstrategy,
                     gt_encseq_bitwise_cmp_ok(ssi->encseq) ? false : true);
  sfi = gt_Sfxiterator_new(ssi->encseq,
                           readmode,
                           prefixlength,
                           numofparts,
                           maximumspace,
                           &sfxstrategy,
                           sfxprogress,
                           withprogressbar,
                           NULL, /* logger */
                           err);
  if (sfi == NULL)
  {
    haserr = true;
  } else
  {
    Sequentialsuffixarrayreader *ssar = NULL;
    bool firstpage = true;

    ssar = gt_newSequentialsuffixarrayreaderfromRAM(ssi->encseq,
                                                    readmode);
    while (true)
    {
      suffixsortspace = gt_Sfxiterator_next(&numberofsuffixes,&specialsuffixes,
                                            sfi);
      if (suffixsortspace == NULL || specialsuffixes)
      {
        break;
      }
      gt_updateSequentialsuffixarrayreaderfromRAM(
               ssar,
               (const ESASuffixptr *)
               gt_suffixsortspace_ulong_get(suffixsortspace),
               firstpage,
               numberofsuffixes);
      firstpage = false;
      if (gt_enumeratemaxpairs(ssar,
                               ssi->encseq,
                               readmode,
                               ssi->minlength,
                               ssi->processmaxpairs,
                               ssi->processmaxpairsinfo,
                               err) != 0)
      {
        haserr = true;
      }
    }
    if (ssar != NULL)
    {
      gt_freeSequentialsuffixarrayreader(&ssar);
    }
  }
  if (gt_Sfxiterator_delete(sfi,err) != 0)
  {
    haserr = true;
  }
  return haserr ? -1 : 0;
}