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; }
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; }