<p>Bits are not frequencies. If a position only contains an A (position 3 for example) then you would need 2 questions (bits) to derive that information without a priori knowledge.</p>

<ol>
<li>Is it a G or C? if no > then it is a A or T</li>
<li>Is it T? If no then it is an A</li>
</ol>

<p>Position 1 can be derived by 1 question only:</p>

<ol>
<li>is it a G or C?  If no then it is an A or T</li>
</ol>

<p>In this case the number of bits can be calculated using the frequenci)es. </p>

<p><strong>For 4 bases, A only (100%)</strong>:</p>

<p>4 * -0.25 * log2(0.25) - (-1 * log2(1)) = 2 (bits)</p>

<p><strong>For 8 letters, A only (100%)</strong>:</p>

<p>8 * -1/8 * log(1/8)- (-1 * log2(1)) = 3 (bits)</p>

<p><strong>Mixed base possibility (A/T 50% each) with 4 bases</strong>:</p>

<p>4 * -0.25 * log2(0.25) - (-0.5 * log2(0.5)+-0.5 * log2(0.5)) = 1 (bit)</p>

<p>As mentioned in the comments, you can follow the wiki link for an example.</p>

<p>Or, an example with a little more explanation from the biology SE site.</p>

<p><a href="https://biology.stackexchange.com/questions/64368/how-to-determine-the-height-bits-in-a-sequence-logo">sequence logo calcuation</a></p>

<p>Hopes this helps</p>

CC BY-SA 4.0
2019-07-30T03:15:12.760Z
Thanks for your answer. In this specific case, `4 bases` is being used, since there are a,t,g,c 4 Nucleotides in total, right?
czlsws
CC BY-SA 4.0
2019-07-30T18:09:53.407Z
correct. That is this part: 4 * -0.25 * log2(0.25) of the equation.
Mack123456
CC BY-SA 4.0
2019-07-29T18:50:44.053Z
2019-08-01T10:01:38.627Z
2019-08-01T10:01:38.627Z
Mack123456
<p>Following <a href="https://bioinformatics.stackexchange.com/questions/9087/what-is-aligned-sequences-and-consensus-sequence-in-the-context-of-sequence">this question</a>, I'm confused with the <a href="https://en.wikipedia.org/wiki/Sequence_logo" rel="nofollow noreferrer">computation of sequence logo</a> </p>

<p>Following data comes from the book "<a href="http://people.cs.ubc.ca/~murphyk/MLbook/" rel="nofollow noreferrer">Machine Learning - A Probabilistic Perspective</a> (Figure_1)"</p>

<p><a href="https://i.sstatic.net/ZoStG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZoStG.png" alt="enter image description here"></a></p>

<p>here is the corresponding <a href="https://bioinformatics.stackexchange.com/a/9089/4962">sequence logo</a> (Figure_2).</p>

<p><a href="https://i.sstatic.net/3jR8j.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3jR8j.png" alt="enter image description here"></a></p>

<p>ten rows represent sequences of DNA (e.g. row 1 could be a human sequence, row 2 could be the equivalent mouse sequence etc.)</p>

<p>Each column corresponds to a particular position.</p>

<p>Why do ten rows (Figure_1) correspond to 2 bits (Figure_2)?</p>

CC BY-SA 4.0
2019-07-29T15:37:03.893Z
You can find on e.g., [wiki](https://en.wikipedia.org/wiki/Sequence_logo) how a sequence logo is created.
benn
<phylogenetics><ngs><sequence-analysis>
Why do ten rows (Figure_1) correspond to 2 bits (Figure_2) in a sequence logo?
# Why do ten rows (Figure_1) correspond to 2 bits (Figure_2) in a sequence logo?

(Asked by: username_0 on 2019-07-29)

Following [this question](https://bioinformatics.stackexchange.com/questions/9087/what-is-aligned-sequences-and-consensus-sequence-in-the-context-of-sequence), I'm confused with the [computation of sequence logo](https://en.wikipedia.org/wiki/Sequence_logo)

Following data comes from the book "[Machine Learning - A Probabilistic Perspective](http://people.cs.ubc.ca/~murphyk/MLbook/) (Figure\_1)"

[![enter image description here](https://i.sstatic.net/ZoStG.png)](https://i.sstatic.net/ZoStG.png)

here is the corresponding [sequence logo](https://bioinformatics.stackexchange.com/a/9089/4962) (Figure\_2).

[![enter image description here](https://i.sstatic.net/3jR8j.png)](https://i.sstatic.net/3jR8j.png)

ten rows represent sequences of DNA (e.g. row 1 could be a human sequence, row 2 could be the equivalent mouse sequence etc.)

Each column corresponds to a particular position.

Why do ten rows (Figure\_1) correspond to 2 bits (Figure\_2)?

**Tags:** phylogenetics, ngs, sequence-analysis
> **Comments:**
> **username_1**: You can find on e.g., [wiki](https://en.wikipedia.org/wiki/Sequence_logo) how a sequence logo is created.  

---

## 1 answers

### Answer by username_2 on 2019-07-29. Score: 6 | Accepted answer

Bits are not frequencies. If a position only contains an A (position 3 for example) then you would need 2 questions (bits) to derive that information without a priori knowledge.

1. Is it a G or C? if no > then it is a A or T
2. Is it T? If no then it is an A

Position 1 can be derived by 1 question only:

1. is it a G or C? If no then it is an A or T

In this case the number of bits can be calculated using the frequenci)es.

**For 4 bases, A only (100%)**:

4 \* -0.25 \* log2(0.25) - (-1 \* log2(1)) = 2 (bits)

**For 8 letters, A only (100%)**:

8 \* -1/8 \* log(1/8)- (-1 \* log2(1)) = 3 (bits)

**Mixed base possibility (A/T 50% each) with 4 bases**:

4 \* -0.25 \* log2(0.25) - (-0.5 \* log2(0.5)+-0.5 \* log2(0.5)) = 1 (bit)

As mentioned in the comments, you can follow the wiki link for an example.

Or, an example with a little more explanation from the biology SE site.

[sequence logo calcuation](https://biology.stackexchange.com/questions/64368/how-to-determine-the-height-bits-in-a-sequence-logo)

Hopes this helps

> **Comments:**
> **username_0**: Thanks for your answer. In this specific case, `4 bases` is being used, since there are a,t,g,c 4 Nucleotides in total, right?  
> **username_2**: correct. That is this part: 4 * -0.25 * log2(0.25) of the equation.  

---

