Source code deployed on Github.

## PyWMLogo

This project creates svg file of information content logo (or sequence logo)^{1} for PWM of DNA-binding proteins.

### Logo creation algorithm

Here we don’t consider about the experiments like microarray binding assay, data collection, and all other possible processes such as sequence alignments. Our assumption is that we already have the frequency matrix $M_f$.

The information content of position $i$ is given by^{2}:
$$ IC_{i} = 2 + \sum f_{b,i} \times \log_2 f_{b,i}$$
where $f_{a,i}$ is the relative frequency of base $b$ at position $i$.
Here we use $\log_2$ so that the information content is measured in bits.

In case that the expected average frequency of each base type is $25\%$, information content can also be written as: $$IC_i = \sum f_{b,i}\times \log_2 \frac{f_{b,i}}{0.25}.$$

The height of letter $b$ in column $i$ is then given by $$H_{b,i} = f_{b,i} \times IC_i.$$

### Plotting

The figure format is svg. All the information (height of base type characters) was “manually” written into the svg file.

- Sequence logo in Wikipedia.
^{^} - Schneider, T. D., Stormo, G. D., Gold, L. and Ehrenfeucht, A. Information content of binding sites on nucleotide sequences.
*J. Mol. Biol.*,**1986**, 188, 415–431.^{^}