PSSM or PWM (Positional Weighted Matrix) is a common thing in biological science, used often to observe the distribution of letters inside a group of strings of the same length. It's composed by log-odds of observing a letter inside a given positions, so the value of each cell in the matrix could be either a positive or negative float. Follows an example of a PWM.
A | C | D | E | F | G | H | I | K | L | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 0.426379 | -2.96691 | -1.137176 | -1.859917 | 1.523913 | -0.404392 | -1.913876 | 0.330149 | 0.065161 | 0.570567 |
1 | -1.104135 | -2.96691 | -1.400210 | -1.859917 | -2.012140 | -2.519869 | -2.498838 | 0.165090 | -2.567107 | 2.644822 |
2 | -0.186597 | -2.96691 | 1.322256 | -0.637524 | 0.753395 | 1.270208 | -1.176910 | -0.486986 | -1.429604 | 0.093245 |
3 | -0.750498 | -2.96691 | 1.005782 | 0.777513 | -1.164143 | 0.180571 | 0.588625 | -1.178864 | 1.177054 | -0.449897 |
4 | -0.186597 | -1.96691 | -0.634675 | -0.171861 | 0.189494 | -0.712514 | -0.176910 | 1.003339 | -0.496718 | 0.175707 |
5 | -0.573621 | -2.96691 | -1.722138 | 0.255561 | 0.250895 | -2.519869 | 1.086124 | 0.290621 | -0.982145 | 0.253710 |
6 | 0.369796 | -1.96691 | -2.137176 | 0.584868 | -0.012140 | -0.934906 | 0.086124 | -0.124416 | 0.783390 | -0.055618 |
7 | -0.229666 | -2.96691 | -3.137176 | -2.222487 | -0.427177 | -3.104831 | -1.913876 | 0.478248 | -2.304073 | 1.476102 |
This makes possible to assign a score to a string, which would be the sum of the positional weights. For example:
string: DDFGKKLA
score: -3,3616
What I was trying to achieve is the following: given a desiderable interval (defined by a score
± tolerance
), I want to obtain all the possible sequences of length l
(with l
== num_rows
) whose score falls inside the interval.
At a first sight it looks like a knapsack problem, despite that weights are defined inside $\mathbb{R}$ and I'm not finding a single, optimal solution.
I've got no formal CS background, so I got a bit lost when looking for similar algorithms on literature. Any idea or suggestion are very well accepted.