// Count the number of occurrences of string w, including the reverse complement using a BWTInterval cache size_t BWTAlgorithms::countSequenceOccurrencesWithCache(const std::string& w, const BWT* pBWT, const BWTIntervalCache* pIntervalCache) { BWTInterval fwd_interval = findIntervalWithCache(pBWT, pIntervalCache, w); BWTInterval rc_interval = findIntervalWithCache(pBWT, pIntervalCache, reverseComplement(w)); size_t count = 0; if(fwd_interval.isValid()) count += fwd_interval.size(); if(rc_interval.isValid()) count += rc_interval.size(); return count; }
// Delegate the findInterval call based on what indices are loaded BWTInterval BWTAlgorithms::findInterval(const BWTIndexSet& indices, const std::string& w) { if(indices.pCache != NULL) return findIntervalWithCache(indices.pBWT, indices.pCache, w); else return findInterval(indices.pBWT, w); }
size_t BWTAlgorithms::countSequenceOccurrencesSingleStrand(const std::string& w, const BWTIndexSet& indices) { assert(indices.pBWT != NULL); assert(indices.pCache != NULL); BWTInterval interval = findIntervalWithCache(indices.pBWT, indices.pCache, w); return interval.isValid() ? interval.size() : 0; }