# Spec ProfileSeq Score
Score for sequence-to-profile alignments.

Extends | Score
All Extended | Score
Defined in | <seqan/align_profile.h>
Signature | `template <typename TValue> class Score<TValue, ProfileSeqScore>;`

## Template Parameters

`TValue` | The integer type to use for representing scores.

## Member Function Overview

- `Score::Score();, Score::Score(profile);`
  Constructor

## Interface Function Overview

- `void assignProfile(score, profile);`
  Assign profile to ProfileSeqScore.

### Interface Functions Inherited From Score

- `loadScoreMatrix`
- `score`
- `scoreGapExtendHorizontal`
- `scoreGapExtendVertical`
- `scoreGapHorizontal`
- `scoreGapOpenHorizontal`
- `scoreGapOpenVertical`
- `scoreGapVertical`
- `sequenceEntryForScore`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From Score

- `SequenceEntryForScore`
- `Spec`
- `Value`

## Detailed Description

Using this class, you can align sequences to profiles. The profile is assumed to be in the horizontal direction (first row), the sequence in the vertical direction (second row).

Scoring works as follows.

The integer `SEQAN_CONSENSUS_UNITY` and fractions thereof are used to express scores. Gap opens in the profile are scored proportional to the number of gaps in the profile with two times unity, gap extends with one times unity at the position.

Gap opens in the sequence are scored with two times unity, gap extends in the sequence with unity. Alignments of profile characters to sequence characters are scored with the fraction of profile characters that match the sequence characters times unity.

### Examples

The following example uses the ProfileSeq Score to align a sequence against a profile. Note that we print the gap state for each position since profiles cannot be printed to one stdout character.

    #include <iostream>
    #include <seqan/align_profile.h>

    using namespace seqan;

    int main()
    {
        typedef ProfileChar<Dna, int> TDnaProfile;
        typedef String<TDnaProfile> TProfileString;

        TProfileString profile = "CGAT";
        DnaString seq = "CGGAAT";

        Gaps<TProfileString> gapsH(profile);
        Gaps<DnaString> gapsV(seq);

        Score<int, ProfileSeqScore> sScheme(profile);

        int val = globalAlignment(gapsH, gapsV, sScheme, NeedlemanWunsch());
        std::cout << "score value = " << val << "\n";

        std::cout << "gaps in profile/sequence\n"
                  << "pos\tG\tS\n";
        for (unsigned i = 0; i < length(gapsH); ++i)
            std::cerr << i << "\t" << isGap(gapsH, i) << "\t" << isGap(gapsV, i) << "\n";

        return 0;
    }

Demo: demos/dox/align_profile/profile_seq_score.cpp

The output is as follows:

    score value = -2097152
    gaps in profile/sequence
    pos G   S
    0   0   0
    1   1   0
    2   0   0
    3   1   0
    4   0   0
    5   0   0

## Member Functions Detail

### `Score::Score(); Score::Score(profile);`

Constructor

#### Parameters

`profile` | The profile to copy from (AllocString of ProfileChar objects).

When providing `profile`, the function assignProfile is automatically used to assign the profile to this class.

#### Data Races

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

## Interface Functions Detail

### `void assignProfile(score, profile);`

Assign profile to ProfileSeqScore.

#### Parameters

`score` | The ProfileSeqScore object to assign the profile for.
`profile` | The profile to assign to the score. AllocString of ProfileChar.

#### Data Races

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

#### Dox Sources

    /*!
     * @class ProfileSeqScore ProfileSeq Score
     *
     * @extends Score
     *
     * @headerfile <seqan/align_profile.h>
     *
     * @brief Score for sequence-to-profile alignments.
     *
     * @signature template <typename TValue> class Score<TValue, ProfileSeqScore>;
     *
     * @tparam TValue The integer type to use for representing scores.
     *
     * Using this class, you can align sequences to profiles. The profile is assumed
     * to be in the horizontal direction (first row), the sequence in the vertical
     * direction (second row).
     *
     * Scoring works as follows.
     *
     * The integer <tt>SEQAN_CONSENSUS_UNITY</tt> and fractions thereof are used to
     * express scores. Gap opens in the profile are scored proportional to the
     * number of gaps in the profile with two times unity, gap extends with one
     * times unity at the position.
     *
     * Gap opens in the sequence are scored with two times unity, gap extends in the
     * sequence with unity. Alignments of profile characters to sequence characters
     * are scored with the fraction of profile characters that match the sequence
     * characters times unity.
     *
     * @section Examples
     *
     * The following example uses the ProfileSeq Score to align a sequence against a
     * profile. Note that we print the gap state for each position since profiles
     * cannot be printed to one stdout character.
     *
     * @include demos/dox/align_profile/profile_seq_score.cpp
     *
     * The output is as follows:
     *
     * @code{.output}
     * score value = -2097152
     * gaps in profile/sequence
     * pos G   S
     * 0   0   0
     * 1   1   0
     * 2   0   0
     * 3   1   0
     * 4   0   0
     * 5   0   0
     * @endcode
     *
     *
     * @fn ProfileSeqScore::Score
     *
     * @brief Constructor
     *
     * @signature Score::Score();
     * @signature Score::Score(profile);
     *
     * @param[in] profile The profile to copy from (@link AllocString @endlink of
     *                    @link ProfileChar @endlink objects).
     *
     * When providing <tt>profile</tt>, the function @link
     * ProfileSeqScore#assignProfile @endlink is automatically used to assign the
     * profile to this class.
     *
     * @fn ProfileSeqScore#assignProfile
     *
     * @brief Assign profile to ProfileSeqScore.
     *
     * @signature void assignProfile(score, profile);
     *
     * @param[out] score The ProfileSeqScore object to assign the profile for.
     * @param[in] profile The profile to assign to the score. @link AllocString
     *                    @endlink of @link ProfileChar @endlink.
     */