# Class Fragment
A type for pairwise segment matches.

All Subcl's | ExactFragment, ExactReversableFragment
Defined in | <seqan/align.h>
Signature | `template <[typename TSize[, typename TSpec]]> class Fragment;`

## Template Parameters

`TSize` | The size type of the underlying sequence. Default: `Size<CharString>Type`.
`TSpec` | Specializing type. Default: `ExactFragment<>`.

## Interface Function Overview

- `TSize fragmentBegin(frag, seqId);`
  Return fragment begin.
- `TSize fragmentLength(frag);`
  Return fragment begin.
- `TInfix label(frag, stringSet, seqID);`
  Access to the Fragment's label.
- `TId sequenceId(frag, seqNum);`
  Access to the sequence ID of a fragment.

## Detailed Description

### Examples

    // Construct fragment.
    unsigned seqId1 = 0, beg1 = 0, seqId2 = 32, beg2 = 42, len = 33;
    Fragment<> fragment(seqId1, beg1, seqId2, beg2, len);

    // Update fragment's properties.
    fragmentBegin(fragment, 0) = 10;
    fragmentBegin(fragment, 1) = 10;
    sequenceId(fragment, 0) = 33;
    sequenceId(fragment, 1) = 44;
    fragmentLength(fragment) += 42;

## Interface Functions Detail

### `TSize fragmentBegin(frag, seqId);`

Return fragment begin.

#### Parameters

`frag` | The Fragment to query.
`seqId` | The id of the sequence to get the begin for.

#### Returns

`TSize` | Reference to the fragment begin position member.

#### Data Races

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

### `TSize fragmentLength(frag);`

Return fragment begin.

#### Parameters

`frag` | The Fragment to query for its length.

#### Returns

`TSize` | Reference to the Fragment's length.

#### Data Races

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

### `TInfix label(frag, stringSet, seqID);`

Access to the Fragment's label.

#### Parameters

`frag` | The Fragment to query.
`stringSet` | The StringSet with the sequences.
`seqID` | The id of the sequence for which the label should be retrieved.

#### Data Races

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

### `TId sequenceId(frag, seqNum);`

Access to the sequence ID of a fragment.

#### Parameters

`frag` | A Fragment.
`seqNum` | The sequence number for which the id should be retrieved. Note that Fragment stores information about exactly two sequences which can be accessed with seqNum 0 or 1 but whose ids may differ from their seqNum.

#### Returns

`TId` | Reference to the sequence fragment id member.

#### Data Races

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

#### Dox Sources

    /*!
     * @class Fragment
     *
     * @headerfile <seqan/align.h>
     *
     * @brief A type for pairwise segment matches.
     *
     * @signature template <[typename TSize[, typename TSpec]]> class Fragment;
     *
     * @tparam TSize The size type of the underlying sequence. Default:
     *               <tt>Size&lt;CharString&gt;Type</tt>.
     * @tparam TSpec Specializing type. Default: <tt>ExactFragment&lt;&gt;</tt>.
     *
     * @section Examples
     *
     * @code{.cpp}
     * // Construct fragment.
     * unsigned seqId1 = 0, beg1 = 0, seqId2 = 32, beg2 = 42, len = 33;
     * Fragment<> fragment(seqId1, beg1, seqId2, beg2, len);
     *
     * // Update fragment's properties.
     * fragmentBegin(fragment, 0) = 10;
     * fragmentBegin(fragment, 1) = 10;
     * sequenceId(fragment, 0) = 33;
     * sequenceId(fragment, 1) = 44;
     * fragmentLength(fragment) += 42;
     * @endcode
     *
     *
     * @fn Fragment#label
     *
     * @brief Access to the Fragment's label.
     *
     * @signature TInfix label(frag, stringSet, seqID);
     *
     * @param[in] frag The Fragment to query.
     * @param[in] stringSet The @link StringSet @endlink with the sequences.
     * @param[in] seqID The id of the sequence for which the label should be
     *                  retrieved.
     *
     * @fn Fragment#sequenceId
     *
     * @brief Access to the sequence ID of a fragment.
     *
     * @signature TId sequenceId(frag, seqNum);
     *
     * @param[in] frag A Fragment.
     * @param[in] seqNum The sequence number for which the id should be retrieved.
     *                   Note that @link Fragment @endlink stores information about
     *                   exactly two sequences which can be accessed with seqNum 0
     *                   or 1 but whose ids may differ from their seqNum.
     *
     * @return TId Reference to the sequence fragment id member.
     *
     * @fn Fragment#fragmentBegin
     *
     * @brief Return fragment begin.
     *
     * @signature TSize fragmentBegin(frag, seqId);
     *
     * @param[in] frag The Fragment to query.
     * @param[in] seqId The id of the sequence to get the begin for.
     *
     * @return TSize Reference to the fragment begin position member.
     *
     * @fn Fragment#fragmentLength
     *
     * @brief Return fragment begin.
     *
     * @signature TSize fragmentLength(frag);
     *
     * @param[in] frag The Fragment to query for its length.
     *
     * @return TSize Reference to the Fragment's length.
     */