# Spec FMIndex
An index based on the Burrows-Wheeler transform.

Extends | Index
Implements | StringTrieConcept
All Extended | Index
All Impl'd | StringTrieConcept
Defined in | <seqan/index.h>
Signature | `template <typename TText[, typename TSpec[, typename TConfig]]> class Index<TText, FMIndex<TSpec, TConfig> >;`

## Template Parameters

`TText` | The text type. Types: String, StringSet
`TSpec` | FM index specialisation, defaults to `void`.
`TConfig` | A config object which determines the data types of the different fibres, defaults to `FMIndexConfig<TSpec>`.

## Member Function Overview

- `Index::Index();, Index::Index(text);`
  Constructor

## Interface Function Overview

- `TIterator begin(index, tag);`
  Returns an iterator pointing to the root node of the virtual prefix trie of the reversed text of the index.
- `TFibre indexLF(index);`
  A shortcut for `getFibre(index, FibreLF())`.
- `TSAValue toSuffixPosition(index, pos, offset);`
  This function computes the position of a specified position in the compressed suffix array (additionally containing entries for the sentinels). The returned position corresponds to the suffix array of the original text without sentinels.

### Interface Functions Inherited From Index

- `clear`
- `countSequences`
- `getFibre`
- `indexCreate`
- `indexRawText`
- `indexRequire`
- `indexSupplied`
- `indexText`
- `length`
- `open`
- `rawtextAt`
- `save`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From Index

- `DefaultIndexCreator`
- `DefaultIndexSpec`
- `DefaultIndexStringSpec`
- `GetVSTreeIteratorTraits`
- `Size`

## Detailed Description

### Structure

The FM index consists of various Fibre of which the most important ones are the compressed suffix array and the LF table, which provides all necessary information for the LF mapping.

## Member Functions Detail

### `Index::Index(); Index::Index(text);`

Constructor

#### Parameters

`text` | The text to be indexed.

#### Data Races

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

## Interface Functions Detail

### `TIterator begin(index, tag);`

Returns an iterator pointing to the root node of the virtual prefix trie of the reversed text of the index.

#### Parameters

`index` | The index to be traversed.
`tag` | The specialisation of the iterator to be returned by the function. Types: VSTree Iterator

#### Returns

`TIterator` | Returns an iterator pointing to the root node of the virtual prefix trie of the reversed text of the the index. Types: `The result of Iterator<Index<TText, TIndexSpec>, TSpec>::Type`

#### Data Races

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

### `TFibre indexLF(index);`

A shortcut for `getFibre(index, FibreLF())`.

#### Parameters

`index` | The FM index.

#### Returns

`TFibre` | A reference to the FibreLF.

#### Data Races

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

### `TSAValue toSuffixPosition(index, pos, offset);`

This function computes the position of a specified position in the compressed suffix array (additionally containing entries for the sentinels). The returned position corresponds to the suffix array of the original text without sentinels.

#### Parameters

`index` | The FM index.
`pos` | The position in the suffix array of the FM index (with sentinels). Types: UnsignedIntegerConcept
`offset` | The number of sequences in the original text. Types: UnsignedIntegerConcept

#### Returns

`TSAValue` | The function function computes the position of a specified position in the compressed suffix array (additionally containing entries for the sentinels). The returned position corresponds to the suffix array of the original text without sentinels. The return type is SAValue<Index<TText, FMIndex<TSpec, TConfig> > >::Type

#### Data Races

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

#### Dox Sources

    /*!
     * @class FMIndex
     *
     * @implements StringTrieConcept
     *
     * @extends Index
     *
     * @headerfile <seqan/index.h>
     *
     * @brief An index based on the Burrows-Wheeler transform.
     *
     * @signature template <typename TText[, typename TSpec[, typename TConfig]]>
     *            class Index<TText, FMIndex<TSpec, TConfig> >;
     *
     * @tparam TText The text type. Types: @link String @endlink, @link StringSet
     *               @endlink
     * @tparam TSpec FM index specialisation, defaults to <tt>void</tt>.
     * @tparam TConfig A config object which determines the data types of the
     *                 different fibres, defaults to
     *                 <tt>FMIndexConfig&lt;TSpec&gt;</tt>.
     *
     * @section Structure
     *
     * The FM index consists of various @link Fibre @endlink of which the most
     * important ones are the compressed suffix array and the LF table, which
     * provides all necessary information for the LF mapping.
     *
     * @fn FMIndex::Index
     *
     * @brief Constructor
     *
     * @signature Index::Index();
     * @signature Index::Index(text);
     *
     * @param[in] text The text to be indexed.
     *
     * @fn FMIndex#indexLF
     *
     * @headerfile <seqan/index.h>
     *
     * @brief A shortcut for <tt>getFibre(index, FibreLF())</tt>.
     *
     * @signature TFibre indexLF(index);
     *
     * @param[in] index The FM index.
     *
     * @return TFibre A reference to the @link FMIndexFibres#FibreLF @endlink.
     *
     * @fn FMIndex#toSuffixPosition
     *
     * @headerfile <seqan/index.h>
     *
     * @brief This function computes the position of a specified position in the
     *        compressed suffix array (additionally containing entries for the
     *        sentinels). The returned position corresponds to the suffix array of
     *        the original text without sentinels.
     *
     * @signature TSAValue toSuffixPosition(index, pos, offset);
     *
     * @param[in] index The FM index.
     * @param[in] pos The position in the suffix array of the FM index (with
     *                sentinels). Types: @link UnsignedIntegerConcept @endlink
     * @param[in] offset The number of sequences in the original text. Types: @link
     *                   UnsignedIntegerConcept @endlink
     *
     * @return TSAValue The function function computes the position of a specified
     *                  position in the compressed suffix array (additionally
     *                  containing entries for the sentinels). The returned position
     *                  corresponds to the suffix array of the original text without
     *                  sentinels. The return type is @link SAValue
     *                  @endlink&lt;@link Index @endlink&lt;TText, FMIndex&lt;TSpec,
     *                  TConfig&gt; &gt; &gt;::Type
     *
     * @fn FMIndex#begin
     *
     * @headerfile <seqan/index.h>
     *
     * @brief Returns an iterator pointing to the root node of the virtual prefix
     *        trie of the reversed text of the index.
     *
     * @signature TIterator begin(index, tag);
     *
     * @param[in] index The index to be traversed.
     * @param[in] tag The specialisation of the iterator to be returned by the
     *                function. Types: VSTree Iterator
     *
     * @return TIterator Returns an iterator pointing to the root node of the
     *                   virtual prefix trie of the reversed text of the the index.
     *                   Types: <tt>The result of Iterator&lt;Index&lt;TText,
     *                   TIndexSpec&gt;, TSpec&gt;::Type</tt>
     */