<p>Since the Position Frequency Matrix is an estimate for the probability to find a particular letter at each position, I think the best way to deal with sequencing errors that result in <code>N</code> is to ignore that base for that position and normalize based on the number of non-<code>N</code> bases.</p>
<p>The Information Content at each position is just a function of the (estimated) probability distribution. So, once you have the 'best' estimate for the Position Frequency Matrix, I think you should use it directly with no penalty when calculating the IC.</p>
<p>If there is a position with a lot of <code>N</code>s, though, you might get a biased estimate of the IC for that position - since using observed frequencies to estimate entropy/information is strongly biased when the number of observations is small.</p>

CC BY-SA 4.0
2021-06-15T14:02:20.063Z
2021-06-15T14:02:20.063Z
David Ross
<p>This is an open question that came to my mind recently, though it might be that it is not a common use case. The purpose is to find common patterns in a collection of sequences by representing the patterns as PSSMs. However, some of the bases have sequencing errors and are thus missing. Is there a way of integrating these missing bases in the PSSM calculation?</p>
<p>For a collection of sequences, deriving a sequence logo is relatively straightforward. For the case:</p>
<pre><code>ACTAGCGT
ACGTACTC
ACGATCTC
ACGTCAGT
</code></pre>
<p>Taking the frequencies of each letter at each position would yield the following (pseudocount-corrected) Position Frequency Matrix:</p>
<pre><code>      A       G     T       C
0  0.85  0.0375  0.05  0.0625
1  0.05  0.0375  0.05  0.8625
2  0.05  0.6375  0.25  0.0625
3  0.45  0.0375  0.45  0.0625
4  0.25  0.2375  0.25  0.2625
5  0.25  0.0375  0.05  0.6625
6  0.05  0.4375  0.45  0.0625
7  0.05  0.0375  0.45  0.4625
</code></pre>
<p>And by including background frequencies, we can derive the total Infomation Content for each position, and sum them up to compute the total Infomation Content of the matrix.</p>
<p>But what would happen if the analyzed sequences had experimented errors in the sequencing and some of the letters were missing?</p>
<pre><code>ACNNGCGT
ACGTACTC
ACGATNTC
ACNTCAGT
</code></pre>
<ul>
<li>Would you consider <code>N</code> a new letter of the alphabet and follow the same procedure? (counting ocurrences per position, calculating background frequencies, include it in the sequence logo...)</li>
<li>Would you ignore them and normalize each column's frequencies to the number of non-N bases?</li>
<li>Would you penalize  positions/sequences bearing <code>N</code>'s when calculating the IC?</li>
<li>Other?</li>
</ul>
<p>I wanted to start with the case of <code>N</code> since it's the most generic wildcard, and therefore could be easier to address; but if you have ideas on incorporating other more specific wildcards, feel free to add it :)</p>

<sequence-analysis><motifs><pssm>
How to deal with wildcards (N) in sequence logos
# How to deal with wildcards (N) in sequence logos

(Asked by: username_0 on 2021-06-12)

This is an open question that came to my mind recently, though it might be that it is not a common use case. The purpose is to find common patterns in a collection of sequences by representing the patterns as PSSMs. However, some of the bases have sequencing errors and are thus missing. Is there a way of integrating these missing bases in the PSSM calculation?
For a collection of sequences, deriving a sequence logo is relatively straightforward. For the case:
ACTAGCGT
ACGTACTC
ACGATCTC
ACGTCAGT

Taking the frequencies of each letter at each position would yield the following (pseudocount-corrected) Position Frequency Matrix:
      A       G     T       C
0  0.85  0.0375  0.05  0.0625
1  0.05  0.0375  0.05  0.8625
2  0.05  0.6375  0.25  0.0625
3  0.45  0.0375  0.45  0.0625
4  0.25  0.2375  0.25  0.2625
5  0.25  0.0375  0.05  0.6625
6  0.05  0.4375  0.45  0.0625
7  0.05  0.0375  0.45  0.4625

And by including background frequencies, we can derive the total Infomation Content for each position, and sum them up to compute the total Infomation Content of the matrix.
But what would happen if the analyzed sequences had experimented errors in the sequencing and some of the letters were missing?
ACNNGCGT
ACGTACTC
ACGATNTC
ACNTCAGT


Would you consider N a new letter of the alphabet and follow the same procedure? (counting ocurrences per position, calculating background frequencies, include it in the sequence logo...)
Would you ignore them and normalize each column's frequencies to the number of non-N bases?
Would you penalize  positions/sequences bearing N's when calculating the IC?
Other?

I wanted to start with the case of N since it's the most generic wildcard, and therefore could be easier to address; but if you have ideas on incorporating other more specific wildcards, feel free to add it :)

**Tags:** sequence-analysis, motifs, pssm

---

## 1 answers

### Answer by username_1 on 2021-06-15. Score: 3 | Accepted answer

Since the Position Frequency Matrix is an estimate for the probability to find a particular letter at each position, I think the best way to deal with sequencing errors that result in `N` is to ignore that base for that position and normalize based on the number of non-`N` bases.

The Information Content at each position is just a function of the (estimated) probability distribution. So, once you have the 'best' estimate for the Position Frequency Matrix, I think you should use it directly with no penalty when calculating the IC.

If there is a position with a lot of `N`s, though, you might get a biased estimate of the IC for that position - since using observed frequencies to estimate entropy/information is strongly biased when the number of observations is small.


---

