# Class Align
Tabular alignment of same-type sequences.

Implements | EqualityComparableConcept
All Impl'd | EqualityComparableConcept
Defined in | <seqan/align.h>
Signature | `template <typename TSequence, typename TGapSpec> class Align;`

## Template Parameters

`TSequence` | Type of the underlying sequence.
`TGapSpec` | Tag for selecting the Gaps specialization.

## Member Function Overview

### Member Functions Inherited From EqualityComparableConcept

- `operator!=`
- `operator==`

## Interface Function Overview

- `void clearClipping(align);`
  Clear clipping on all rows.
- `void clearGaps(align);`
  Clear gaps of all Align rows.
- `TCol col(align);`
  Returns the columns of an Align object.
- `TCols cols(align);`
  Returns the columns of an Align object.
- `TStream operator<<(stream, align);`
  Stream-output for Align objects.
- `TRow row(align, pos);`
  Returns a single row of an Align object.
- `TRows rows(align);`
  Returns the rows of an Align object.
- `void setStrings(align, stringSet);`
  Loads the sequences of a string set into an alignment.
- `TStringSet stringSet(align);`
  Return string set with all ungapped sequences.
- `void write(stream, align);`
  Writing of Gaps to Streams in human-readable format.

## Interface Metafunction Overview

- `Col<TAlign>::Type`
  The column type for Align objects.
- `Cols<TAlign>::Type`
  Return the type representing a column in an Align object.
- `GetValue<TAlign>::Type`
  Return the get-value type for an Align object.
- `GetValue<TAlign>::Type`
  Return the reference type for an Align object.
- `Row<TAlign>::Type`
  Return the row type (Gaps specialization).
- `Rows<TAlign>::Type`
  Return the type used for rows in an Align object (a Gaps specialization).
- `Rows<TAlign>::Type;`
  Return the type of the underlying sequence.
- `Rows<TAlign>::Type`
  Return the type that would be used for a string set of the sources.
- `Value<TAlign>::Type`
  Return the value type for an Align object.

## Detailed Description

The Alignment class is for storing tabular alignments of sequences having the same type. They do so by being a container of Gaps objects. The most common use case is storing pairwise alignments that are generated by one of the dynamic programming alignment algorithms.

### Example

Here is an example of using an Align object with globalAlignment.

    #include <seqan/basic.h>
    #include <seqan/sequence.h>
    #include <seqan/stream.h>  // for I/O
    #include <seqan/align.h>
    #include <seqan/score.h>

    using namespace seqan;

    int main()
    {
        StringSet<DnaString> stringSet;
        appendValue(stringSet, "AGTTTAATCA");
        appendValue(stringSet, "AGTATACGA");

        Align<DnaString> align(stringSet);                        // Initialize the Align object using a StringSet.

        int score = globalAlignment(align, EditDistanceScore());  // Compute a global alingment using the Align object.

        std::cout << "score = " << score << std::endl;
        std::cout << "align\n" << align << std::endl;

        return 0;
    }

Demo: demos/dox/align/align.cpp

The output is as follows:

    score = -4
    align
          0     .    :
            AGTTTAATCA
            ||| | |  |
            AGTAT-ACGA

## See Also

- Gaps
- globalAlignment
- localAlignment

## Interface Functions Detail

### `void clearClipping(align);`

Clear clipping on all rows.

#### Parameters

`align` | Align object to clear clippings of.

#### Data Races

Thread safety unknown!

### `void clearGaps(align);`

Clear gaps of all Align rows.

#### Parameters

`align` | The Align object to clear all all gaps from.

#### Data Races

Thread safety unknown!

### `TCol col(align);`

Returns the columns of an Align object.

#### Parameters

`align` | The Align object to get the cols of.

#### Returns

`TCol` | The column of the Align object (Metafunction: Col).

#### Data Races

Thread safety unknown!

### `TCols cols(align);`

Returns the columns of an Align object.

#### Parameters

`align` | The Align object to get the cols of.

#### Returns

`TCols` | The columns of the Align object (Metafunction: Cols).

#### Data Races

Thread safety unknown!

### `TStream operator<<(stream, align);`

Stream-output for Align objects.

#### Parameters

`stream` | `std::ostream` to write to.
`align` | Align object to write out.

#### Returns

`TStream` | Reference to stream after output of align.

#### Data Races

Thread safety unknown!

### `TRow row(align, pos);`

Returns a single row of an Align object.

#### Parameters

`align` | The Align object to get the row of.
`pos` | The number of the row to get.

#### Returns

`TRow` | Reference to the given row of align (Metafunction: Row).

#### Data Races

Thread safety unknown!

### `TRows rows(align);`

Returns the rows of an Align object.

#### Parameters

`align` | The Align object to get the rows for.

#### Returns

`TRows` | A container with the Gaps of the Align object.

#### Data Races

Thread safety unknown!

### `void setStrings(align, stringSet);`

Loads the sequences of a string set into an alignment.

#### Parameters

`align` | Align object to set underlying sequence of.
`stringSet` | The StringSet with the data.

#### Data Races

Thread safety unknown!

### `TStringSet stringSet(align);`

Return string set with all ungapped sequences.

#### Parameters

`align` | Align object to get sequences of.

#### Returns

`TStringSet` | The set of ungapped sequences (Metafunction: StringSetType).

#### Data Races

Thread safety unknown!

### `void write(stream, align);`

Deprecated.

Old-style I/O.

Writing of Gaps to Streams in human-readable format.

#### Parameters

`stream` | The Stream to write to.
`align` | The Align object to write out.

#### Data Races

Thread safety unknown!

## Interface Metafunctions Detail

### `Col<TAlign>::Type`

The column type for Align objects.

#### Template Parameters

`TAlign` | The Align object to query for its column type.

#### Returns

`Type` | The resulting type.

### `Cols<TAlign>::Type`

Return the type representing a column in an Align object.

#### Template Parameters

`TAlign` | The Align object to get the column type for.

#### Returns

`Type` | The resulting column type.

### `GetValue<TAlign>::Type`

Return the get-value type for an Align object.

#### Template Parameters

`TAlign` | The Align object to get the get-value type for.

#### Returns

`Type` | The resulting get-value type.

### `GetValue<TAlign>::Type`

Return the reference type for an Align object.

#### Template Parameters

`TAlign` | The Align object to get the reference type for.

#### Returns

`Type` | The resulting reference type.

### `Row<TAlign>::Type`

Return the row type (Gaps specialization).

#### Template Parameters

`TAlign` | The Align object to get the row type for.

#### Returns

`Type` | The resulting row type.

### `Rows<TAlign>::Type`

Return the type used for rows in an Align object (a Gaps specialization).

#### Template Parameters

`TAlign` | The Align object to get the rows type for.

#### Returns

`Type` | The resulting rows type.

### `Rows<TAlign>::Type;`

Return the type of the underlying sequence.

#### Template Parameters

`TAlign` | The Align object to get the underlying sequence type for.

#### Returns

`Type` | The resulting sequence type.

### `Rows<TAlign>::Type`

Return the type that would be used for a string set of the sources.

#### Template Parameters

`TAlign` | The Align object to get the string set type for.

#### Returns

`Type` | The resulting string set type.

### `Value<TAlign>::Type`

Return the value type for an Align object.

#### Template Parameters

`TAlign` | The Align object to get the value type for.

#### Returns

`Type` | The resulting value type.

#### Dox Sources

    /*!
     * @class Align
     *
     * @implements EqualityComparableConcept
     *
     * @headerfile <seqan/align.h>
     *
     * @brief Tabular alignment of same-type sequences.
     *
     * @signature template <typename TSequence, typename TGapSpec> class Align;
     *
     * @tparam TSequence Type of the underlying sequence.
     * @tparam TGapSpec Tag for selecting the @link Gaps @endlink specialization.
     *
     * The Alignment class is for storing tabular alignments of sequences having the
     * same type. They do so by being a container of @link Gaps @endlink objects.
     * The most common use case is storing pairwise alignments that are generated by
     * one of the dynamic programming alignment algorithms.
     *
     * @section Example
     *
     * Here is an example of using an Align object with @link globalAlignment
     * @endlink.
     *
     * @include demos/dox/align/align.cpp
     *
     * The output is as follows:
     *
     * @include demos/dox/align/align.cpp.stdout
     *
     * @see globalAlignment
     * @see localAlignment
     * @see Gaps
     *
     * @mfn Align#Cols
     *
     * @brief Return the type representing a column in an Align object.
     *
     * @signature Cols<TAlign>::Type
     *
     * @tparam TAlign The Align object to get the column type for.
     *
     * @return Type The resulting column type.
     *
     * @mfn Align#Value
     *
     * @brief Return the value type for an Align object.
     *
     * @signature Value<TAlign>::Type
     *
     * @tparam TAlign The Align object to get the value type for.
     *
     * @return Type The resulting value type.
     *
     * @mfn Align#GetValue
     *
     * @brief Return the get-value type for an Align object.
     *
     * @signature GetValue<TAlign>::Type
     *
     * @tparam TAlign The Align object to get the get-value type for.
     *
     * @return Type The resulting get-value type.
     *
     * @mfn Align#Reference
     *
     * @brief Return the reference type for an Align object.
     *
     * @signature GetValue<TAlign>::Type
     *
     * @tparam TAlign The Align object to get the reference type for.
     *
     * @return Type The resulting reference type.
     *
     * @mfn Align#Row
     *
     * @brief Return the row type (@link Gaps @endlink specialization).
     *
     * @signature Row<TAlign>::Type
     *
     * @tparam TAlign The Align object to get the row type for.
     *
     * @return Type The resulting row type.
     *
     * @mfn Align#Rows
     *
     * @brief Return the type used for rows in an Align object (a Gaps
     *        specialization).
     *
     * @signature Rows<TAlign>::Type
     *
     * @tparam TAlign The Align object to get the rows type for.
     *
     * @return Type The resulting rows type.
     *
     * @mfn Align#Source
     *
     * @brief Return the type of the underlying sequence.
     *
     * @signature Rows<TAlign>::Type;
     *
     * @tparam TAlign The Align object to get the underlying sequence type for.
     *
     * @return Type The resulting sequence type.
     *
     * @mfn Align#StringSetType
     *
     * @brief Return the type that would be used for a string set of the sources.
     *
     * @signature Rows<TAlign>::Type
     *
     * @tparam TAlign The Align object to get the string set type for.
     *
     * @return Type The resulting string set type.
     *
     * @mfn Align#Col
     *
     * @headerfile <seqan/align.h>
     *
     * @brief The column type for @link Align @endlink objects.
     *
     * @signature Col<TAlign>::Type
     *
     * @tparam TAlign The @link Align @endlink object to query for its column type.
     *
     * @return Type The resulting type.
     *
     * @fn Align#rows
     *
     * @brief Returns the rows of an Align object.
     *
     * @signature TRows rows(align);
     *
     * @param[in] align The Align object to get the rows for.
     *
     * @return TRows A container with the Gaps of the Align object.
     *
     * @fn Align#row
     *
     * @brief Returns a single row of an Align object.
     *
     * @signature TRow row(align, pos);
     *
     * @param[in] align The Align object to get the row of.
     * @param[in] pos The number of the row to get.
     *
     * @return TRow Reference to the given row of align (Metafunction: @link
     *              Align#Row @endlink).
     *
     * @fn Align#cols
     *
     * @brief Returns the columns of an Align object.
     *
     * @signature TCols cols(align);
     *
     * @param[in] align The Align object to get the cols of.
     *
     * @return TCols The columns of the Align object (Metafunction: @link Align#Cols
     *               @endlink).
     *
     * @fn Align#col
     *
     * @brief Returns the columns of an Align object.
     *
     * @signature TCol col(align);
     *
     * @param[in] align The Align object to get the cols of.
     *
     * @return TCol The column of the Align object (Metafunction: @link Align#Col
     *              @endlink).
     *
     * @fn Align#write
     *
     * @brief Writing of Gaps to Streams in human-readable format.
     *
     * @deprecated Old-style I/O.
     *
     * @signature void write(stream, align);
     *
     * @param[in,out] stream The Stream to write to.
     * @param[in] align The Align object to write out.
     *
     * @fn Align#clearClipping
     *
     * @brief Clear clipping on all rows.
     *
     * @signature void clearClipping(align);
     *
     * @param[in,out] align Align object to clear clippings of.
     *
     * @fn Align#operator<<
     *
     * @brief Stream-output for Align objects.
     *
     * @signature TStream operator<<(stream, align);
     *
     * @param[in,out] stream <tt>std::ostream</tt> to write to.
     * @param[in] align Align object to write out.
     *
     * @return TStream Reference to stream after output of align.
     *
     * @fn Align#setStrings
     *
     * @brief Loads the sequences of a string set into an alignment.
     *
     * @signature void setStrings(align, stringSet);
     *
     * @param[in,out] align Align object to set underlying sequence of.
     * @param[in] stringSet The @link StringSet @endlink with the data.
     *
     * @fn Align#clearGaps
     *
     * @brief Clear gaps of all Align rows.
     *
     * @signature void clearGaps(align);
     *
     * @param[in] align The Align object to clear all all gaps from.
     *
     * @fn Align#stringSet
     *
     * @brief Return string set with all ungapped sequences.
     *
     * @signature TStringSet stringSet(align);
     *
     * @param[in] align Align object to get sequences of.
     *
     * @return TStringSet The set of ungapped sequences (Metafunction: @link
     *                    Align#StringSetType @endlink).
     */