GtUword gt_bwtrangesplitallwithoutspecial(Mbtab *mbtab, GtUword *rangeOccs, const FMindex *fmindex, GtUword lbound, GtUword ubound) { const BWTSeq *bwtseq = (const BWTSeq *) fmindex; AlphabetRangeSize idx, rangesize = MRAEncGetRangeSize(EISGetAlphabet(bwtseq->seqIdx),0); gt_assert(sizeof (AlphabetRangeSize) <= sizeof (GtUword)); BWTSeqPosPairRangeOcc(bwtseq, 0, lbound, ubound,rangeOccs); for (idx = 0; idx < rangesize; idx++) { if (rangeOccs[idx] < rangeOccs[rangesize+idx]) { mbtab[idx].lowerbound = bwtseq->count[idx] + rangeOccs[idx]; mbtab[idx].upperbound = bwtseq->count[idx] + rangeOccs[rangesize+idx]; } else { mbtab[idx].lowerbound = mbtab[idx].upperbound = 0; } } return (GtUword) rangesize; }
static MRAEnc * BWTSASSNewMRAEnc(const SASeqSrc *src) { const BWTSASeqSrc *bwtSASeqSrc; gt_assert(src); bwtSASeqSrc = constSASS2BWTSASS(src); return MRAEncCopy(EISGetAlphabet(BWTSeqGetEncIdxSeq(bwtSASeqSrc->bwtSeq))); }
extern Seqpos BWTSeqGetRankSort(const BWTSeq *bwtSeq, Seqpos pos, AlphabetRangeID range, struct extBitsRetrieval *extBits) { BitOffset locVarBits; AlphabetRangeSize rSize; gt_assert(bwtSeq->rangeSort[range] == SORTMODE_RANK); EISRetrieveExtraBits(bwtSeq->seqIdx, pos, EBRF_RETRIEVE_CWBITS | EBRF_RETRIEVE_VARBITS, extBits, bwtSeq->hint); locVarBits = locateVarBits(bwtSeq, extBits); rSize = MRAEncGetRangeSize(EISGetAlphabet(bwtSeq->seqIdx), range); { Seqpos ranks[rSize * 2]; Seqpos BWTRankTotal = 0; AlphabetRangeSize i; EISPosPairRangeRank(bwtSeq->seqIdx, range, extBits->start, pos, ranks, bwtSeq->hint); for (i = 0; i < rSize; ++i) BWTRankTotal += ranks[i + rSize] - ranks[i]; return gt_bsGetSeqpos(extBits->varPart, extBits->varOffset + locVarBits + bwtSeq->bitsPerOrigRank * BWTRankTotal, bwtSeq->bitsPerOrigRank); } }
void gt_bwtrangesplitwithoutspecial(GtArrayBoundswithchar *bwci, GtUword *rangeOccs, const FMindex *fmindex, GtUword lbound, GtUword ubound) { const BWTSeq *bwtseq = (const BWTSeq *) fmindex; AlphabetRangeSize idx, rangesize; rangesize = MRAEncGetRangeSize(EISGetAlphabet(bwtseq->seqIdx),0); bwci->nextfreeBoundswithchar = 0; BWTSeqPosPairRangeOcc(bwtseq, 0, lbound, ubound,rangeOccs); for (idx = 0; idx < rangesize; idx++) { if (rangeOccs[idx] < rangeOccs[rangesize+idx]) { bwci->spaceBoundswithchar[bwci->nextfreeBoundswithchar].inchar = idx; bwci->spaceBoundswithchar[bwci->nextfreeBoundswithchar].lbound = bwtseq->count[idx] + rangeOccs[idx]; bwci->spaceBoundswithchar[bwci->nextfreeBoundswithchar++].rbound = bwtseq->count[idx] + rangeOccs[rangesize+idx]; } } }