Question: How to build HMM from position weight matrix?

0

jespinoz •

**20**wrote:Is there a way to convert a position weight matrix into a HMM that I can use with HMMER. I have a (n,m) matrix where each n_i is a position along the motif, each m_j is a nucleotide in {A, T, C, G}, and each i,j is the probability nucleotide m_j occurring at n_i.

For example, the following would be a 7 bp motif. I have longer ones but I just wanted to show this for an example. How can I convert this into a HMM that can be used with HMMER?

```
0.000000 0.009876 0.990124 0.000000
0.000420 0.968691 0.000420 0.030469
0.010086 0.989704 0.000000 0.000210
0.005884 0.000630 0.003362 0.990124
0.010506 0.979828 0.009036 0.000630
0.001471 0.007144 0.008405 0.982980
0.002732 0.986132 0.010717 0.000420
```

I am not quite sure this is exactly what you need, but look at this article:

https://hal.inria.fr/hal-01244770/document

3.7kThis doesn't look like a typical position weight matrix but rather a matrix of probabilities at each position. A position weight matrix corresponds to the log of the frequencies normalized to a background model. Anyway, you could view it has an HMM (the values represent emission probabilities) so convert it into HMMER's text format.

22kInteresting, I will check this out. I wasn't thinking about the additional fields that are left out of a probability matrix. I was naively using the terminology. So I need to have emission and transition state probabilites for a position weight matrix?

20No, you need emission and transition probabilities for a HMM. A PWM only encodes the probabilities of seeing each nucleotide for every position. What I am suggesting is to view the PWM as a HMM by considering the PWM as giving emission probabilities with transition probabilities set to 1.

22k