Question: FIMO score calculation
0
bharata1803420 wrote:

Hello,

So, I use FIMO for calculating PWM score for a sequence.

How does FIMO calculate the score actually? It says it is the log likelihood of the PWM given background.

Can anyone give step by step? Suppose I have PWM:

``````    A   C   G   T
1   0.2 0.4 0.4 0
2   0.4 0.2 0.4 0
3   0.6 0   0.2 0.2
4   0   1   0   0
5   1   0   0   0
6   0   0   0.8 0.2
7   0   0.2 0.8 0
8   0   0   0   1
9   0   0   1   0
10  0   0.2 0.4 0.4
11  0   0.4 0   0.6
12  0.2 0   0.6 0.2
``````

And sequence: GGGCAGCTGGCA And background:

``````A   0.275
C   0.225
G   0.275
T   0.225
``````

FIMO score is: 10.8211

pwm fimo • 704 views
modified 10 days ago by caokai0010 • written 17 months ago by bharata1803420

0
caokai0010 wrote:

Hi,i have try do it ,FiMO score is 10.9328,It's closer to your value，is it correct?

``````A=c(0.2 ,0.4 ,0.4 ,0.0 ,0.4 ,0.2, 0.4, 0.0, 0.6, 0.0, 0.2, 0.2, 0.0,1.0, 0.0 ,0.0 ,1.0 ,0.0, 0.0 ,0.0, 0.0, 0.0, 0.8, 0.2, 0.0, 0.2,0.8, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.2, 0.4,0.4, 0.0, 0.4, 0.0, 0.6, 0.2, 0.0, 0.6, 0.2)

pfm=matrix(A, nrow =4,dimnames = list(c("A","C","G","T")))
B=matrix(c(rep(0.275,12),rep(0.225,12),rep(0.275,12),rep(0.225,12)),nrow = 4,byrow = T)
C=log(pfm/B,2)
C=round(C,4)
Seq="GGGCAGCTGGCA"
tmp=unlist(strsplit(Seq,""))
Sum=0
for (i in seq(1,12)){
#print(C[tmp[i],as.integer(i)])
Sum=Sum+C[tmp[i],as.integer(i)]
}
print(as.vector(Sum))
``````

`> print(as.vector(Sum))` ` 10.9328`