MCPcopy Create free account
hub / github.com/arq5x/bedtools2 / countPattern

Function countPattern

src/utils/sequenceUtilities/sequenceUtils.cpp:214–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213
214int countPattern(const string &seq, const string &pattern, bool ignoreCase)
215{
216 string s = seq;
217 string p = pattern;
218 // standardize the seq and the pattern
219 // if case should be ignored
220 if (ignoreCase) {
221 toUpperCase(s);
222 toUpperCase(p);
223 }
224 int patternLength = p.size();
225 int patternCount = 0;
226 for(unsigned int i = 0; i < s.length(); i++) {
227 if (s.substr(i,patternLength) == p) {
228 patternCount++;
229 }
230 }
231 return patternCount;
232}
233
234

Callers 1

ReportDnaProfileMethod · 0.85

Calls 4

toUpperCaseFunction · 0.85
lengthMethod · 0.80
substrMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected