LocalMatchStore - SeqAn API Documentation

# Class LocalMatchStore
Stores information about local matches.

Defined in | <seqan/parse_lm.h>
Signature | `template <typename TSpec = void, TConfig = LocalMatchStoreConfig<TSpec> > struct LocalMatchStore;`

## Template Parameters

`TSpec` | Specialization tag.
`TConfig` | Configuration class.

## Interface Function Overview

- `void appendLocalMatchStore(store, subjectId, subjectBeginPos, subjectEndPos, queryId, queryBeginPos, queryEndPos);, void appendLocalMatchStore(store, subjectName, subjectBeginPos, subjectEndPos, queryName, queryBeginPos, queryEndPos, cigarStringBuffer);`
  Append a new local match to a LocalMatchStore
- `int readRecord(store, reader, tag);`
  Read Lastz "general" format record.

## Member Variable Overview

- `TCigarString LocalMatchStore::cigarStore`
  String storing the CIGAR strings.
- `TMatchStore LocalMatchStore::matchStore`
  String storing the LocalMatch local matches.
- `TStringSet LocalMatchStore::sequenceNameStore`
  StringSet storing the sequence names.

## Detailed Description

The LocalMatchStore provides information about matches. Similar to the FragmentStore, the information is split into multiple sub stores. Each sub store stores a part of the information.

The LocalMatchStore#matchStore stores the information about a match. The LocalMatchStore#sequenceNameStore stores the sequence names. These both sub stores are "core stores", they are filled with consistent information, i.e. for each sequence id in the matchStore, there has to be a valid entry in the sequenceNameStore.

The LocalMatchStore#cigarStore optionally stores CIGAR strings for the matches. Its entries are referenced by `matchStore[i].id`.

### Examples

Read Lastz matches from a link RecordReader and then print them to stdout.

    // Read local alignments from record reader.  Note that in real-world code,
    // you should have error handling.
    LocalMatchStore<> lmStore;
    while (!atEnd(recordReader))
        readRecord(lmStore, recordReader, StellarGff());

    // Print local alignment information to stdout.
    std::cout << "# Reverse strandness is indicated by end < begin\n"
              << "#db\tdb_beg\tdb_end\tquery\tq_beg\tq_end\n";
    for (unsigned i = 0; i < length(lmStore.matchStore); ++i)
        std::cout << lmStore.sequenceNameStore[lmStore.matchStore[i].queryId] << "\t"
                  << lmStore.matchStore[i].queryBeginPos << "\t"
                  << lmStore.matchStore[i].queryEndPos << "\t"
                  << lmStore.sequenceNameStore[lmStore.matchStore[i].subjectId] << "\t"
                  << lmStore.matchStore[i].subjectBeginPos << "\t"
                  << lmStore.matchStore[i].subjectEndPos << "\n";

## See Also

- LocalMatch

## Interface Functions Detail

### `void appendLocalMatchStore(store, subjectId, subjectBeginPos, subjectEndPos, queryId, queryBeginPos, queryEndPos); void appendLocalMatchStore(store, subjectName, subjectBeginPos, subjectEndPos, queryName, queryBeginPos, queryEndPos, cigarStringBuffer);`

Append a new local match to a LocalMatchStore

#### Parameters

`store` | The LocalMatchStore to add the local match to.
`subjectId` | Numeric subject sequence identifier, IntegerConcept.
`subjectName` | The textual name of the query sequence, CharString.
`subjectBegin` | The begin position of the match in the subject, IntegerConcept.
`subjectEnd` | The end position of the match in the subject, IntegerConcept.
`queryId` | Numeric query sequence identifier, IntegerConcept.
`queryName` | The textual name of the query sequence, CharString.
`queryBegin` | The begin position of the match in the query, IntegerConcept.
`queryEnd` | The end position of the match in the query, IntegerConcept.
`cigarStringBuffer` | Buffer with the cigar string of the local alignment, CharString.

Matches on the reverse-complement are encoded by the begin position being greater than the begin position.

#### Data Races

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

### `int readRecord(store, reader, tag);`

Read Lastz "general" format record.

#### Parameters

`store` | LocalMatchStore object to read into.
`stream` | SinglePassRecordReader to read from.
`tag` | The tag for selecting the format, one of BlastnTabular, LastzGeneral, and StellarGff.

#### Returns

`int` | 0 on success, non-0 on errors and EOF

#### Data Races

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

## Member Variables Detail

### `TCigarString LocalMatchStore::cigarStore`

String storing the CIGAR strings.

### `TMatchStore LocalMatchStore::matchStore`

String storing the LocalMatch local matches.

### `TStringSet LocalMatchStore::sequenceNameStore`

StringSet storing the sequence names.

#### Dox Sources

    /*!
     * @class LocalMatchStore
     *
     * @headerfile <seqan/parse_lm.h>
     *
     * @brief Stores information about local matches.
     *
     * @signature template <typename TSpec = void, TConfig =
     *            LocalMatchStoreConfig<TSpec> > struct LocalMatchStore;
     *
     * @tparam TSpec Specialization tag.
     * @tparam TConfig Configuration class.
     *
     * The LocalMatchStore provides information about matches. Similar to the @link
     * FragmentStore @endlink, the information is split into multiple sub stores.
     * Each sub store stores a part of the information.
     *
     * The LocalMatchStore#matchStore stores the information about a match. The
     * LocalMatchStore#sequenceNameStore stores the sequence names. These both sub
     * stores are "core stores", they are filled with consistent information, i.e.
     * for each sequence id in the matchStore, there has to be a valid entry in the
     * sequenceNameStore.
     *
     * The LocalMatchStore#cigarStore optionally stores CIGAR strings for the
     * matches. Its entries are referenced by <tt>matchStore[i].id</tt>.
     *
     * @section Examples
     *
     * Read Lastz matches from a link RecordReader and then print them to stdout.
     *
     * @code{.cpp}
     * // Read local alignments from record reader.  Note that in real-world code,
     * // you should have error handling.
     * LocalMatchStore<> lmStore;
     * while (!atEnd(recordReader))
     *     readRecord(lmStore, recordReader, StellarGff());
     *
     * // Print local alignment information to stdout.
     * std::cout << "# Reverse strandness is indicated by end < begin\n"
     *           << "#db\tdb_beg\tdb_end\tquery\tq_beg\tq_end\n";
     * for (unsigned i = 0; i < length(lmStore.matchStore); ++i)
     *     std::cout << lmStore.sequenceNameStore[lmStore.matchStore[i].queryId] << "\t"
     *               << lmStore.matchStore[i].queryBeginPos << "\t"
     *               << lmStore.matchStore[i].queryEndPos << "\t"
     *               << lmStore.sequenceNameStore[lmStore.matchStore[i].subjectId] << "\t"
     *               << lmStore.matchStore[i].subjectBeginPos << "\t"
     *               << lmStore.matchStore[i].subjectEndPos << "\n";
     * @endcode
     *
     *
     * @see LocalMatch
     *
     * @var TMatchStore LocalMatchStore::matchStore;
     *
     * @brief String storing the LocalMatch local matches.
     *
     * @var TStringSet LocalMatchStore::sequenceNameStore;
     *
     * @brief StringSet storing the sequence names.
     *
     * @var TCigarString LocalMatchStore::cigarStore;
     *
     * @brief String storing the CIGAR strings.
     *
     * @fn LocalMatchStore#readRecord
     *
     * @headerfile <seqan/parse_lm.h>
     *
     * @brief Read Lastz "general" format record.
     *
     * @signature int readRecord(store, reader, tag);
     *
     * @param[in,out] store LocalMatchStore object to read into.
     * @param[in,out] stream SinglePassRecordReader to read from.
     * @param[in] tag The tag for selecting the format, one of BlastnTabular,
     *                LastzGeneral, and StellarGff.
     *
     * @return int 0 on success, non-0 on errors and EOF
     *
     * @fn LocalMatchStore#appendLocalMatch
     *
     * @brief Append a new local match to a @link LocalMatchStore @endlink
     *
     * @signature void appendLocalMatchStore(store, subjectId, subjectBeginPos,
     *            subjectEndPos, queryId, queryBeginPos, queryEndPos);
     * @signature void appendLocalMatchStore(store, subjectName, subjectBeginPos,
     *            subjectEndPos, queryName, queryBeginPos, queryEndPos,
     *            cigarStringBuffer);
     *
     * @param[in,out] store The LocalMatchStore to add the local match to.
     * @param[in] subjectId Numeric subject sequence identifier, @link
     *                      IntegerConcept @endlink.
     * @param[in] subjectName The textual name of the query sequence, @link
     *                        CharString @endlink.
     * @param[in] subjectBegin The begin position of the match in the subject, @link
     *                         IntegerConcept @endlink.
     * @param[in] subjectEnd The end position of the match in the subject, @link
     *                       IntegerConcept @endlink.
     * @param[in] queryId Numeric query sequence identifier, @link IntegerConcept
     *                    @endlink.
     * @param[in] queryName The textual name of the query sequence, @link CharString
     *                      @endlink.
     * @param[in] queryBegin The begin position of the match in the query, @link
     *                       IntegerConcept @endlink.
     * @param[in] queryEnd The end position of the match in the query, @link
     *                     IntegerConcept @endlink.
     * @param[in] cigarStringBuffer Buffer with the cigar string of the local
     *                              alignment, @link CharString @endlink.
     *
     * Matches on the reverse-complement are encoded by the begin position being
     * greater than the begin position.
     */