# Class SeedSet
Handles a set of seeds with local chaining on adding seeds.

Implements | ContainerConcept
All Impl'd | AssignableConcept, ContainerConcept, DestructibleConcept
Defined in | <seqan/seeds.h>
Signature | `template <typename TSeed[, typename TSpec]> class SeedSet;`

## Template Parameters

`TSeed` | Type of the Seed objects stored in the seed set.
`TSpec` | Optional tag for seed set specialization. Defaults to `Unordered`.

## Member Function Overview

### Member Functions Inherited From AssignableConcept

- `operator=`

## Interface Function Overview

- `bool addSeed(seedSet, seed, distance, bandwidth, score, seqH, seqV, tag);, bool addSeed(seedSet, seed, distance, score, SimpleChain);, bool addSeed(seedSet, seed, distance, Merge);, bool addSeed(seedSet, seed, Single);`
  Adds a seed to an existing SeedSet using different algorithms for local chaining.
- `void clear(seedSet);`
  Clear the SeedSet.
- `TSeedScore minScore(seedSet);`
  Returns the threshold to distinguish between high-scoring and low-scoring seeds.
- `void setMinScore(seedSet, scoreValue);`
  Sets the threshold at which seeds are considered high-scoring.

### Interface Functions Inherited From AssignableConcept

- `assign`
- `set`
- `move`

### Interface Functions Inherited From ContainerConcept

- `begin`
- `end`
- `length`
- `empty`
- `swap`
- `writeValue`
- `write`
- `getObjectId`
- `moveValue`
- `append`
- `appendValue`
- `shrinkToFit`
- `directionIterator`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From ContainerConcept

- `DefaultGetIteratorSpec`
- `DefaultIteratorSpec`
- `Difference`
- `DirectionIterator`
- `GetValue`
- `Iterator`
- `Position`
- `Reference`
- `Size`
- `Value`

## Detailed Description

Note:

At the moment only `Unordered SeedSets` are supported.

## Interface Functions Detail

### `bool addSeed(seedSet, seed, distance, bandwidth, score, seqH, seqV, tag); bool addSeed(seedSet, seed, distance, score, SimpleChain); bool addSeed(seedSet, seed, distance, Merge); bool addSeed(seedSet, seed, Single);`

Adds a seed to an existing SeedSet using different algorithms for local chaining.

#### Parameters

`seedSet` | The SeedSet to add the seed to.
`seed` | The seed to be added.
`distance` | The maximal distance between the end point of the upper left and the begin point of the lower right Seed allowed for local chaining. NB: only Chaos, SimpleChain and Merge require the distance information.
`bandwidth` | The window size to search for a chainable Seed. Note, only `Chaos` requires the bandwidth information.
`score` | The scoring scheme.Note, only Chaos and SimpleChain require the score. Type: SimpleScore.
`seqH` | Database sequence (horizontal). Only required for Chaos Chaining. Types: ContainerConcept.
`seqV` | Query sequence (vertical). Only required for Chaos Chaining. Types: ContainerConcept.
`tag` | Select the algorithm that is used to add the new seed. Note that not every algorithm can be used with each type of Seed. See special signatures above. The seed is copied and then added.

#### Returns

`bool` | `true` if successful. Adding can fail if no appropriate seed is there for chaining or merging. Adding using `Single` ever fails.

#### Examples

        #include <iostream>
    #include <seqan/seeds.h>

    using namespace seqan;

    int main()
    {
        typedef Seed<Simple> TSeed;
        typedef SeedSet<TSeed> TSeedSet;
        typedef Iterator<TSeedSet>::Type TIterator;

        DnaString seqH = "ggatACGTccTTCGAtACccTGGTg";
        DnaString seqV = "ttccgACGTgTTCGAgACtgaGGTca";

        TSeed seed0(4, 5, 4);
        TSeed seed1(10, 10, 5);
        TSeed seed2(14, 14, 4);
        TSeed seed3(21, 21, 3);

        TSeedSet seedSet;

        addSeed(seedSet, seed0, Single());
        addSeed(seedSet, seed1, Single());
        addSeed(seedSet, seed2, Single());
        addSeed(seedSet, seed3, Single());

        std::cout << "Single Method:" << std::endl;
        for (TIterator it = begin(seedSet, Standard()); it != end(seedSet, Standard()); ++it)
            std::cout << "Seed: " << *it << std::endl;
        std::cout << std::endl;

        clear(seedSet);
        if (!addSeed(seedSet, seed0, 2, Merge()))
            addSeed(seedSet, seed0, Single());
        if (!addSeed(seedSet, seed1, 2, Merge()))
            addSeed(seedSet, seed1, Single());
        if (!addSeed(seedSet, seed2, 2, Merge()))
            addSeed(seedSet, seed2, Single());
        if (!addSeed(seedSet, seed3, 2, Merge()))
            addSeed(seedSet, seed3, Single());

        std::cout << "Merge Method:" << std::endl;
        for (TIterator it = begin(seedSet, Standard()); it != end(seedSet, Standard()); ++it)
            std::cout << "Seed: " << *it << std::endl;
        std::cout << std::endl;

        clear(seedSet);
        Score<int, Simple> scoreScheme(2, -1, -2);
        if (!addSeed(seedSet, seed0, 2, 1, scoreScheme, seqH, seqV, Chaos()))
            addSeed(seedSet, seed0, Single());
        if (!addSeed(seedSet, seed1, 2, 1, scoreScheme, seqH, seqV, Chaos()))
            addSeed(seedSet, seed1, Single());
        if (!addSeed(seedSet, seed2, 2, 1, scoreScheme, seqH, seqV, Chaos()))
            addSeed(seedSet, seed2, Single());
        if (!addSeed(seedSet, seed3, 2, 1, scoreScheme, seqH, seqV, Chaos()))
            addSeed(seedSet, seed3, Single());

        std::cout << "Chaos Method:" << std::endl;
        for (TIterator it = begin(seedSet, Standard()); it != end(seedSet, Standard()); ++it)
            std::cout << "Seed: " << *it << std::endl;
        std::cout << std::endl;

    }

Demo: demos/dox/seeds/seeds_add_seed.cpp

The output is as follows:

    Single Method:
    Seed: Seed<Simple, TConfig>(4, 5, 8, 9, lower diag = -1, upper diag = -1)
    Seed: Seed<Simple, TConfig>(10, 10, 15, 15, lower diag = 0, upper diag = 0)
    Seed: Seed<Simple, TConfig>(14, 14, 18, 18, lower diag = 0, upper diag = 0)
    Seed: Seed<Simple, TConfig>(21, 21, 24, 24, lower diag = 0, upper diag = 0)

    Merge Method:
    Seed: Seed<Simple, TConfig>(4, 5, 8, 9, lower diag = -1, upper diag = -1)
    Seed: Seed<Simple, TConfig>(10, 10, 18, 18, lower diag = 0, upper diag = 0)
    Seed: Seed<Simple, TConfig>(21, 21, 24, 24, lower diag = 0, upper diag = 0)

    Chaos Method:
    Seed: Seed<Simple, TConfig>(4, 5, 15, 15, lower diag = -1, upper diag = 0)
    Seed: Seed<Simple, TConfig>(14, 14, 18, 18, lower diag = 0, upper diag = 0)
    Seed: Seed<Simple, TConfig>(21, 21, 24, 24, lower diag = 0, upper diag = 0)

#### Data Races

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

### `void clear(seedSet);`

Clear the SeedSet.

#### Parameters

`seedSet` | The SeedSet to clear.

#### Data Races

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

### `TSeedScore minScore(seedSet);`

Returns the threshold to distinguish between high-scoring and low-scoring seeds.

#### Parameters

`seedSet` | The SeedSet for which the threshold is set. If the score of a seed is higher than the given threshold, then it is virtually put into a container storing the high-scoring seeds which can be iterated separately.

#### Returns

`TSeedScore` | The score threshold. TSeedScore is the SeedScore of the contained seeds.

#### Data Races

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

#### See Also

- setMinScore

### `void setMinScore(seedSet, scoreValue);`

Sets the threshold at which seeds are considered high-scoring.

#### Parameters

`seedSet` | The SeedSet for which the threshold is to be set.
`scoreValue` | The new threshold to set. If the score of a seed is higher than the given threshold, then it is virtually put into a container storing the high-scoring seeds which can be iterated separately (IntegerConcept).

#### Data Races

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

#### See Also

- minScore

#### Dox Sources

    /*!
     * @class SeedSet
     *
     * @implements ContainerConcept
     *
     * @headerfile <seqan/seeds.h>
     *
     * @brief Handles a set of seeds with local chaining on adding seeds.
     *
     * @note At the moment only <tt>Unordered SeedSets</tt> are supported.
     *
     * @signature template <typename TSeed[, typename TSpec]> class SeedSet;
     *
     * @tparam TSeed Type of the @link Seed @endlink objects stored in the seed set.
     * @tparam TSpec Optional tag for seed set specialization. Defaults to
     *               <tt>Unordered</tt>.
     *
     * @fn SeedSet#addSeed
     *
     * @headerfile <seqan/seeds.h>
     *
     * @brief Adds a seed to an existing @link SeedSet @endlink using different
     *        algorithms for local chaining.
     *
     * @signature bool addSeed(seedSet, seed, distance, bandwidth, score, seqH,
     *            seqV, tag);
     * @signature bool addSeed(seedSet, seed, distance, score, SimpleChain);
     * @signature bool addSeed(seedSet, seed, distance, Merge);
     * @signature bool addSeed(seedSet, seed, Single);
     *
     * @param[in,out] seedSet The SeedSet to add the seed to.
     * @param[in] seed The seed to be added.
     * @param[in] distance The maximal distance between the end point of the upper
     *                     left and the begin point of the lower right @link Seed
     *                     @endlink allowed for local chaining. NB: only Chaos,
     *                     SimpleChain and Merge require the distance information.
     * @param[in] bandwidth The window size to search for a chainable @link Seed
     *                      @endlink. Note, only <tt>Chaos</tt> requires the
     *                      bandwidth information.
     * @param[in] score The scoring scheme.Note, only Chaos and SimpleChain require
     *                  the score. Type: @link SimpleScore @endlink.
     * @param[in] seqH Database sequence (horizontal). Only required for Chaos
     *                 Chaining. Types: ContainerConcept.
     * @param[in] seqV Query sequence (vertical). Only required for Chaos Chaining.
     *                 Types: ContainerConcept.
     * @param[in] tag Select the algorithm that is used to add the new seed. Note
     *                that not every algorithm can be used with each type of @link
     *                Seed @endlink. See special signatures above. The seed is
     *                copied and then added.
     *
     * @return bool <tt>true</tt> if successful. Adding can fail if no appropriate
     *              seed is there for chaining or merging. Adding using
     *              <tt>Single</tt> ever fails.
     *
     * @section Examples
     *
     * @include demos/dox/seeds/seeds_add_seed.cpp
     *
     * The output is as follows:
     *
     * @code{.console}
     * Single Method:
     * Seed: Seed<Simple, TConfig>(4, 5, 8, 9, lower diag = -1, upper diag = -1)
     * Seed: Seed<Simple, TConfig>(10, 10, 15, 15, lower diag = 0, upper diag = 0)
     * Seed: Seed<Simple, TConfig>(14, 14, 18, 18, lower diag = 0, upper diag = 0)
     * Seed: Seed<Simple, TConfig>(21, 21, 24, 24, lower diag = 0, upper diag = 0)
     *
     *
     * Merge Method:
     * Seed: Seed<Simple, TConfig>(4, 5, 8, 9, lower diag = -1, upper diag = -1)
     * Seed: Seed<Simple, TConfig>(10, 10, 18, 18, lower diag = 0, upper diag = 0)
     * Seed: Seed<Simple, TConfig>(21, 21, 24, 24, lower diag = 0, upper diag = 0)
     *
     *
     * Chaos Method:
     * Seed: Seed<Simple, TConfig>(4, 5, 15, 15, lower diag = -1, upper diag = 0)
     * Seed: Seed<Simple, TConfig>(14, 14, 18, 18, lower diag = 0, upper diag = 0)
     * Seed: Seed<Simple, TConfig>(21, 21, 24, 24, lower diag = 0, upper diag = 0)
     * @endcode
     *
     *
     * @fn SeedSet#minScore
     *
     * @headerfile <seqan/seeds.h>
     *
     * @brief Returns the threshold to distinguish between high-scoring and low-
     *        scoring seeds.
     *
     * @signature TSeedScore minScore(seedSet);
     *
     * @param[in] seedSet The SeedSet for which the threshold is set. If the score
     *                    of a seed is higher than the given threshold, then it is
     *                    virtually put into a container storing the high-scoring
     *                    seeds which can be iterated separately.
     *
     * @return TSeedScore The score threshold. TSeedScore is the @link
     *                    Seed#SeedScore @endlink of the contained seeds.
     *
     * @see SeedSet#setMinScore
     *
     * @fn SeedSet#setMinScore
     *
     * @headerfile <seqan/seeds.h>
     *
     * @brief Sets the threshold at which seeds are considered high-scoring.
     *
     * @signature void setMinScore(seedSet, scoreValue);
     *
     * @param[in,out] seedSet The SeedSet for which the threshold is to be set.
     * @param[in] scoreValue The new threshold to set. If the score of a seed is
     *                       higher than the given threshold, then it is virtually
     *                       put into a container storing the high-scoring seeds
     *                       which can be iterated separately (@link IntegerConcept
     *                       @endlink).
     *
     * @see SeedSet#minScore
     *
     * @fn SeedSet#clear
     *
     * @headerfile <seqan/sequence.h>
     *
     * @brief Clear the SeedSet.
     *
     * @signature void clear(seedSet);
     *
     * @param[in,out] seedSet The SeedSet to clear.
     */