calculateProbability - SeqAn API Documentation

# fn() calculateProbability
Calculates the probability of a sequence given a Bernoulli model.

Defined in | <seqan/alignment_free.h>
Signature | `void calculateProbability(probability, sequence, bgFrequencies);`

## Parameters

`probability` | Probability (`double`) of the sequence given the model.
`sequence` | String, usually of Dna characters.
`bgFrequencies` | String of background frequencies (`double`) representing the model.

## Detailed Description

### Examples

Calculate the probability for the word CCCAAGTTT with p(A) = p(T) = 0.3 and p(C) = p(G) = 0.2.

    using namespace seqan;
    double p = 0.0;
    DnaString word = "CCCAAGTTT";
    String<double> model;
    resize(model, 4);
    model[0] = 0.3;  // p(A)
    model[1] = 0.2;  // p(C)
    model[2] = 0.2;  // p(G)
    model[3] = 0.3;  // p(T)
    calculateProbability(p, word, model);  // p = 3.888e-06

## Data Races

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

## See Also

- alignmentFreeComparison
- calculateCovariance
- calculateVariance
- countKmers

#### Dox Sources

    /*!
     * @fn calculateProbability
     *
     * @headerfile <seqan/alignment_free.h>
     *
     * @brief Calculates the probability of a sequence given a Bernoulli model.
     *
     * @signature void calculateProbability(probability, sequence, bgFrequencies);
     *
     * @param[out] probability Probability (<tt>double</tt>) of the sequence given
     *                         the model.
     * @param[in] sequence @link String @endlink, usually of Dna characters.
     * @param[in] bgFrequencies @link String @endlink of background frequencies
     *                          (<tt>double</tt>) representing the model.
     *
     * @section Examples
     *
     * Calculate the probability for the word CCCAAGTTT with <i>p(A) = p(T) =
     * 0.3</i> and <i>p(C) = p(G) = 0.2</i>.
     *
     * @code{.cpp}
     * using namespace seqan;
     * double p = 0.0;
     * DnaString word = "CCCAAGTTT";
     * String<double> model;
     * resize(model, 4);
     * model[0] = 0.3;  // p(A)
     * model[1] = 0.2;  // p(C)
     * model[2] = 0.2;  // p(G)
     * model[3] = 0.3;  // p(T)
     * calculateProbability(p, word, model);  // p = 3.888e-06
     * @endcode
     *
     *
     * @see calculateVariance
     * @see alignmentFreeComparison
     * @see calculateCovariance
     * @see countKmers
     */