# fn() findRepeats
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/`N`s 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 = getAbsolutePath("/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;
    }

Demo: demos/dox/index/find_repeats.cpp

    # 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

## Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## See Also

- Repeat
- unknownValue

#### Dox Sources

    /*!
     * @fn findRepeats
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Search for repeats in a text.
     *
     * @signature void findRepeats(repeatString, text, minRepeatLength[,
     *            maxPeriod]);
     *
     * @param[out] repeatString A @link String @endlink of @link Repeat @endlink
     *                          objects.
     * @param[in] text The text to search repeats in. Types: @link ContainerConcept
     *                 @endlink
     * @param[in] minRepeatLength The minimum length each reported repeat must have.
     * @param[in] maxPeriod Optionally, the maximal period that reported repeats can
     *                      have. Default: 1
     *
     * Subsequences of undefined values/<tt>N</tt>s will always be reported.
     *
     * @section Examples
     *
     * The following demonstrates finding repeats of period 3.
     *
     * @include demos/dox/index/find_repeats.cpp
     *
     * @code{.console}
     * # 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
     * @endcode
     *
     *
     * @see AlphabetWithUnknownValueConcept#unknownValue
     * @see Repeat
     */