fn() findRepeatsSearch for repeats in a text.
Search for repeats in a text.
Defined in | <seqan/index.h> |
---|---|
Signature |
void findRepeats(repeatString, text, minRepeatLength[, maxPeriod]);
|
Parameters
repeatString
|
A String of Repeat objects. |
---|---|
text
|
The text to search repeats in. Types: ContainerConcept |
minRepeatLength
|
The minimum length each reported repeat must have. |
maxPeriod
|
Optionally, the maximal period that reported repeats can have. Default: 1 |
Detailed Description
Subsequences of undefined values/Ns will always be reported.
Examples
The following demonstrates finding repeats of period 3.
#include <fstream> #include <seqan/basic.h> #include <seqan/index.h> #include <seqan/seq_io.h> using namespace seqan; int main() { // Get path to file to search for repeats in. std::string path = (std::string)SEQAN_PATH_TO_ROOT() + "/demos/index/ref.fa"; // Load first sequence from file. CharString id; Dna5String seq; SeqFileIn file(path.c_str()); readRecord(id, seq, file); // Find repeats and print them. String<Repeat<unsigned, unsigned> > repeats; findRepeats(repeats, seq, 3); std::cerr << "# of repeats: " << length(repeats) << "\n"; for (unsigned i = 0; i < length(repeats); ++i) std::cerr << "i == " << i << ", beginPosition = " << repeats[i].beginPosition << ", endPosition = " << repeats[i].endPosition << ", period = " << repeats[i].period << "\n"; return 0; }
# of repeats: 15 i == 0, beginPosition = 3, endPosition = 7, period = 1 i == 1, beginPosition = 46, endPosition = 53, period = 1 i == 2, beginPosition = 101, endPosition = 105, period = 1 i == 3, beginPosition = 105, endPosition = 109, period = 1 i == 4, beginPosition = 164, endPosition = 169, period = 1 i == 5, beginPosition = 291, endPosition = 297, period = 1 i == 6, beginPosition = 319, endPosition = 327, period = 1 i == 7, beginPosition = 400, endPosition = 404, period = 1 i == 8, beginPosition = 442, endPosition = 446, period = 1 i == 9, beginPosition = 468, endPosition = 473, period = 1 i == 10, beginPosition = 476, endPosition = 480, period = 1 i == 11, beginPosition = 507, endPosition = 513, period = 1 i == 12, beginPosition = 561, endPosition = 566, period = 1 i == 13, beginPosition = 623, endPosition = 627, period = 1 i == 14, beginPosition = 655, endPosition = 659, period = 1