# Spec SwiftPattern
Pattern for SWIFT search, must be used together with SwiftFinder.

Extends | Pattern
All Extended | Pattern
All Subcl's | SwiftLocalPattern, SwiftSemiGlobalPattern
Defined in | <seqan/index.h>
Signature | `template <typename TIndex, typename TSpec> class Pattern<TIndex, Swift<TSpec> >;`

## Template Parameters

`TSpec` | Specifies the type of Swift filter.
`TIndex` | A q-gram index of needle(s). Types: IndexQGram

## Interface Function Overview

- `TPosition beginPosition(pattern);`
  Returns the begin position of the local match in the pattern.
- `TPosition endPosition(pattern);`
  Returns the end position of the local match in the pattern.
- `TSize getMaxDeviationOfOrder(pattern);`
  Returns the maximal out-of-order distance of adjacent hits.
- `TPair positionRange(pattern);`
  Returns a pair of the begin and end position in the haystack or needle for the last hit found.
- `TPair positionRangeNoClip(pattern)`
  Returns a pair of the begin and end position in or beyond the haystack or needle for the last hit found.
- `void setMinThreshold(pattern, seqNo, thresh);`
  Set minimal threshold (t) for a given needle.

### Interface Functions Inherited From Pattern

- `getBeginScore`
- `host`
- `needle`
- `position`
- `scoringScheme`
- `setNeedle`
- `setScoringScheme`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From Pattern

- `Container`
- `Difference`
- `Host`
- `Needle`
- `PexMultiFinder`
- `Position`
- `ScoringScheme`
- `Size`
- `Value`

## Member Variable Overview

- `SwiftParameters SwiftPattern::parameters`
  The SWIFT parameters to use for configuration.

## Detailed Description

The Pattern must be a IndexQGram over multiple patterns. The allowed error rate must be given when find or windowFindBegin is called.

Provides a fast filter alogrithm that guarantees to find all regions overlapping with potential ε-matches. An ε-match is a matching region of minimal length and an error rate of at most ε.

## See Also

- SwiftFinder

## Interface Functions Detail

### `TPosition beginPosition(pattern);`

Returns the begin position of the local match in the pattern.

#### Parameters

`pattern` | The SwiftPattern to query.

#### Returns

`TPosition` | The SA value of the pattern text.

#### Data Races

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

### `TPosition endPosition(pattern);`

Returns the end position of the local match in the pattern.

#### Parameters

`pattern` | The SwiftPattern to query.

#### Returns

`TPosition` | The SA value of the pattern text.

#### Data Races

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

### `TSize getMaxDeviationOfOrder(pattern);`

Returns the maximal out-of-order distance of adjacent hits.

#### Parameters

`pattern` | A SwiftPattern.

#### Returns

`TSize` | Returns the maximal distance two adjacent hits can have which are not in increasing order. `TSize` is the size type of the underlying index.

#### Data Races

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

### `TPair positionRange(pattern);`

Returns a pair of the begin and end position in the haystack or needle for the last hit found.

#### Parameters

`pattern` | A Pattern object.

#### Returns

`TPair` | A Pair of the begin and end position in the haystack or needle for the last hit found. The return type is `Pair<typename SAValue<THost&g;::Type>` if `THost` is the type of haystack or needle.

#### Data Races

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

#### See Also

- positionRangeNoClip

### `TPair positionRangeNoClip(pattern)`

Returns a pair of the begin and end position in or beyond the haystack or needle for the last hit found.

#### Parameters

`pattern` | SwiftPattern object to query.

#### Returns

`TPair` | A pair of the begin and end position in the haystack or needle for the last hit found. These positions could be negative or beyond the end of `finder` or `pattern` when using filter algorithms. The return type is `Pair<typename SAValue<THost>::Type>` if `THost` is the type of haystack or needle.

#### Data Races

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

#### See Also

- positionRange
- positionRangeNoClip

### `void setMinThreshold(pattern, seqNo, thresh);`

Set minimal threshold (t) for a given needle.

#### Parameters

`pattern` | The SwiftPattern to modify.
`seqNo` | The number to set the threshold for.
`tresh` | The threshold to use.

This function can be used to make the filter allow less errors for a given needle.

#### Data Races

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

## Member Variables Detail

### `SwiftParameters SwiftPattern::parameters`

The SWIFT parameters to use for configuration.

#### Dox Sources

    /*!
     * @class SwiftPattern
     *
     * @extends Pattern
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Pattern for SWIFT search, must be used together with @link SwiftFinder
     *        @endlink.
     *
     * @signature template <typename TIndex, typename TSpec> class Pattern<TIndex,
     *            Swift<TSpec> >;
     *
     * @tparam TSpec Specifies the type of Swift filter.
     * @tparam TIndex A q-gram index of needle(s). Types: @link IndexQGram @endlink
     *
     * The @link Pattern @endlink must be a @link IndexQGram @endlink over multiple
     * patterns. The allowed error rate must be given when @link Finder#find
     * @endlink or @link SwiftFinder#windowFindBegin @endlink is called.
     *
     * Provides a fast filter alogrithm that guarantees to find all regions
     * overlapping with potential &epsilon;-matches. An &epsilon;-match is a
     * matching region of minimal length and an error rate of at most &epsilon;.
     *
     * @see SwiftFinder
     *
     * @var SwiftParameters SwiftPattern::parameters;
     *
     * @brief The SWIFT parameters to use for configuration.
     *
     * @fn SwiftPattern#setMinThreshold
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Set minimal threshold (<i>t</i>) for a given needle.
     *
     * @signature void setMinThreshold(pattern, seqNo, thresh);
     *
     * @param[in,out] pattern The SwiftPattern to modify.
     * @param[in] seqNo The number to set the threshold for.
     * @param[in] tresh The threshold to use.
     *
     * This function can be used to make the filter allow less errors for a given
     * needle.
     *
     * @fn SwiftPattern#beginPosition
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns the begin position of the local match in the pattern.
     *
     * @signature TPosition beginPosition(pattern);
     *
     * @param[in] pattern The SwiftPattern to query.
     *
     * @return TPosition The @link TextConcept#SAValue SA value @endlink of the
     *                   pattern text.
     *
     * @fn SwiftPattern#endPosition
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns the end position of the local match in the pattern.
     *
     * @signature TPosition endPosition(pattern);
     *
     * @param[in] pattern The SwiftPattern to query.
     *
     * @return TPosition The @link TextConcept#SAValue SA value @endlink of the
     *                   pattern text.
     *
     * @fn SwiftPattern#positionRangeNoClip
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns a pair of the begin and end position in or beyond the haystack
     *        or needle for the last hit found.
     *
     * @signature TPair positionRangeNoClip(pattern)
     *
     * @param[in] pattern SwiftPattern object to query.
     *
     * @return TPair A pair of the begin and end position in the haystack or needle
     *               for the last hit found. These positions could be negative or
     *               beyond the end of <tt>finder</tt> or <tt>pattern</tt> when
     *               using filter algorithms. The return type is
     *               <tt>Pair&lt;typename SAValue&lt;THost&gt;::Type&gt;</tt> if
     *               <tt>THost</tt> is the type of haystack or needle.
     *
     * @see SwiftPattern#positionRange
     * @see SwiftFinder#positionRangeNoClip
     *
     * @fn SwiftPattern#positionRange
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns a pair of the begin and end position in the haystack or needle
     *        for the last hit found.
     *
     * @signature TPair positionRange(pattern);
     *
     * @param[in] pattern A @link Pattern @endlink object.
     *
     * @return TPair A @link Pair @endlink of the begin and end position in the
     *               haystack or needle for the last hit found. The return type is
     *               <tt>Pair&lt;typename SAValue&ltTHost&g;::Type&gt;</tt> if
     *               <tt>THost</tt> is the type of haystack or needle.
     *
     * @see SwiftPattern#positionRangeNoClip
     *
     * @fn SwiftPattern#getMaxDeviationOfOrder
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns the maximal out-of-order distance of adjacent hits.
     *
     * @signature TSize getMaxDeviationOfOrder(pattern);
     *
     * @param[in] pattern A SwiftPattern.
     *
     * @return TSize Returns the maximal distance two adjacent hits can have which
     *               are not in increasing order. <tt>TSize</tt> is the size type of
     *               the underlying index.
     */