# Spec N2 AFScore
N2 computes the inner product of the standardised neighbourhood kmer count vectors.

Extends | AFScore
All Extended | AFScore
Defined in | <seqan/alignment_free.h>
Signature | `template <> struct AFScore<N2>;`

## Member Function Overview

- `AFScore::AFScore(kmerSize, bgModelOrder, outputFile, verbose);, AFScore::AFScore(kmerSize, bgModelOrder, revCom, outputFile, verbose);, AFScore::AFScore(kmerSize, bgModelOrder, revCom, mismatches, mismatchWeight, outputFile, verbose);`
  Constructor

## Member Variable Overview

- `unsigned N2AFScore::bgModelOrder`
  Order of the background model
- `unsigned N2AFScore::kmerSize`
  Size of the kmers.
- `unsigned N2AFScore::mismatches`
  Approximate word matches [0(exact)/1(one mismatch)]
- `double N2AFScore::mismatchWeight`
  Weight for approximate word matches
- `CharString N2AFScore::outputFile`
  When specified, all kmerWeights for every sequence will be written to this file.
- `CharString N2AFScore::revCom`
  Scoring of reverse complements words, CharString [''/'max'/'min'/'mean'/'both_strands'/].
- `bool N2AFScore::verbose`
  `true` to enable verbose debug output.

## Detailed Description

N2 can be used for alignment-free sequence comparison.

### References

Jonathan Goeke, Marcel H. Schulz, Julia Lasserre, and Martin Vingron. timation of Pairwise Sequence Similarity of Mammalian Enhancers with Word Neighbourhood Counts. Bioinformatics 012).

## Member Functions Detail

### `AFScore::AFScore(kmerSize, bgModelOrder, outputFile, verbose); AFScore::AFScore(kmerSize, bgModelOrder, revCom, outputFile, verbose); AFScore::AFScore(kmerSize, bgModelOrder, revCom, mismatches, mismatchWeight, outputFile, verbose);`

Constructor

#### Parameters

`kmerSize` | Size of kmer, `unsigned`.
`bgModelOrder` | Order of the background Markov model, `unsigned`.
`outputFile` | When specified, all normalised and standardised kmer neighbourhood counts will be written to this file for every sequence, CharString.
`revCom` | Scoring of reverse complements words [''/'max'/'min'/'mean'/'both_strands'/], CharString.
`verbose` | This option will report progress to standard output, `bool`, defaults to `false`.
`mismatches` | Includes words with one mismatch into the word neighbourhood, `unsigned`, 0 or 1.
`mismatchWeight` | Weight of word counts with one mismatch, double.

#### Data Races

Thread safety unknown!

#### See Also

- alignmentFreeComparison

## Member Variables Detail

### `unsigned N2AFScore::bgModelOrder`

Order of the background model

### `unsigned N2AFScore::kmerSize`

Size of the kmers.

### `unsigned N2AFScore::mismatches`

Approximate word matches [0(exact)/1(one mismatch)]

### `double N2AFScore::mismatchWeight`

Weight for approximate word matches

### `CharString N2AFScore::outputFile`

When specified, all kmerWeights for every sequence will be written to this file.

### `CharString N2AFScore::revCom`

Scoring of reverse complements words, CharString [''/'max'/'min'/'mean'/'both_strands'/].

### `bool N2AFScore::verbose`

`true` to enable verbose debug output.

#### Dox Sources

    /*!
     * @class N2AFScore N2 AFScore
     *
     * @extends AFScore
     *
     * @headerfile <seqan/alignment_free.h>
     *
     * @brief N2 computes the inner product of the standardised neighbourhood kmer
     *        count vectors.
     *
     * @signature template <> struct AFScore<N2>;
     *
     * N2 can be used for alignment-free sequence comparison.
     *
     * @section References
     *
     * Jonathan Goeke, Marcel H. Schulz, Julia Lasserre, and Martin Vingron.
     * timation of Pairwise Sequence Similarity of Mammalian Enhancers with Word
     * Neighbourhood Counts. Bioinformatics 012).
     *
     * @fn N2AFScore::AFScore
     *
     * @brief Constructor
     *
     * @signature AFScore::AFScore(kmerSize, bgModelOrder, outputFile, verbose);
     * @signature AFScore::AFScore(kmerSize, bgModelOrder, revCom, outputFile,
     *            verbose);
     * @signature AFScore::AFScore(kmerSize, bgModelOrder, revCom, mismatches,
     *            mismatchWeight, outputFile, verbose);
     *
     * @param[in] kmerSize Size of kmer, <tt>unsigned</tt>.
     * @param[in] bgModelOrder Order of the background Markov model,
     *                         <tt>unsigned</tt>.
     * @param[in] outputFile When specified, all normalised and standardised kmer
     *                       neighbourhood counts will be written to this file for
     *                       every sequence, @link CharString @endlink.
     * @param[in] revCom Scoring of reverse complements words
     *                   [''/'max'/'min'/'mean'/'both_strands'/], @link CharString
     *                   @endlink.
     * @param[in] verbose This option will report progress to standard output,
     *                    <tt>bool</tt>, defaults to <tt>false</tt>.
     * @param[in] mismatches Includes words with one mismatch into the word
     *                       neighbourhood, <tt>unsigned</tt>, 0 or 1.
     * @param[in] mismatchWeight Weight of word counts with one mismatch, double.
     *
     * @see alignmentFreeComparison
     *
     * @var unsigned N2AFScore::kmerSize;
     *
     * @brief Size of the kmers.
     *
     * @var double N2AFScore::mismatchWeight;
     *
     * @brief Weight for approximate word matches
     *
     * @var CharString N2AFScore::revCom;
     *
     * @brief Scoring of reverse complements words, @link CharString @endlink
     *        [''/'max'/'min'/'mean'/'both_strands'/].
     *
     * @var CharString N2AFScore::outputFile;
     *
     * @brief When specified, all kmerWeights for every sequence will be written to
     *        this file.
     *
     * @var unsigned N2AFScore::bgModelOrder;
     *
     * @brief Order of the background model
     *
     * @var unsigned N2AFScore::mismatches;
     *
     * @brief Approximate word matches [0(exact)/1(one mismatch)]
     *
     * @var bool N2AFScore::verbose;
     *
     * @brief <tt>true</tt> to enable verbose debug output.
     */