A position weight matrix (PWM), also known as a position-specific weight matrix (PSWM) or position-specific scoring matrix (PSSM), is a commonly used representation of motifs (patterns) in biological sequences. PWMs are often derived from a set of aligned sequences that are thought to be functionally related and have become an important part of many software tools for computational motif discovery.
Background
Creation
Conversion of sequence to position probability matrix A PWM has one row for each symbol of the alphabet (4 rows for nucleotides in DNA sequences or 20 rows for amino acids in protein sequences) and one column for each position in the pattern. In the first step in constructing a PWM, a basic position frequency matrix (PFM) is created by counting the occurrences of each nucleotide at each position. From the PFM, a position probability matrix (PPM) can now be created by dividing that former nucleotide count at each position by the number of sequences, thereby normalising the values. Formally, given a set X of N aligned sequences of length l, the elements of the PPM M are calculated:
M k , j = 1 N ∑ i = 1 N I ( X i , j = k ) , {\displaystyle M_{k,j}={\frac {1}{N}}\sum _{i=1}^{N}I(X_{i,j}=k),}
where i ∈ {\displaystyle \in } (1,...,N), j ∈ {\displaystyle \in } (1,...,l), k is the set of symbols in the alphabet and I(a=k) is an indicator function where I(a=k) is 1 if a=k and 0 otherwise. For example, given the following DNA sequences:
The corresponding PFM is:
M = A C G T [ 3 6 1 0 0 6 7 2 1 2 2 1 0 0 2 1 1 2 1 1 7 10 0 1 1 5 1 4 1 1 0 10 1 1 2 6 ] . {\displaystyle M={\begin{matrix}A\\C\\G\\T\end{matrix}}{\begin{bmatrix}3&6&1&0&0&6&7&2&1\\2&2&1&0&0&2&1&1&2\\1&1&7&10&0&1&1&5&1\\4&1&1&0&10&1&1&2&6\end{bmatrix}}.}
Therefore, the resulting PPM is:
… excerpt ends here. Continue reading the full article.

