# Spec ProfileSeqFrac 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, ProfileSeqFracScore>;`

## 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 ProfileSeqFrac Score.

### 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 two times unity, gap extends are scored proportional to the number of gaps in the profile at the position. Gap opens in the sequence are scored with two times unity, gap extends with one times unity.

### Examples

The following example uses the ProfileSeqFrac 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, ProfileSeqFracScore> 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_frac_score.cpp

The output is as follows:

    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 ProfileSeqFrac Score.

#### 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 ProfileSeqFracScore ProfileSeqFrac Score
     *
     * @extends Score
     *
     * @headerfile <seqan/align_profile.h>
     *
     * @brief Score for sequence-to-profile alignments.
     *
     * @signature template <typename TValue> class Score<TValue,
     *            ProfileSeqFracScore>;
     *
     * @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 two times unity, gap extends are scored
     * proportional to the number of gaps in the profile at the position. Gap opens
     * in the sequence are scored with two times unity, gap extends with one times
     * unity.
     *
     * @section Examples
     *
     * The following example uses the ProfileSeqFrac 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_frac_score.cpp
     *
     * The output is as follows:
     *
     * @code
     * 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 ProfileSeqFracScore::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
     * ProfileSeqFracScore#assignProfile @endlink is automatically used to assign
     * the profile to this class.
     *
     * @fn ProfileSeqFracScore#assignProfile
     *
     * @brief Assign profile to ProfileSeqFrac Score.
     *
     * @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.
     */