This is a test version of Biostars. For the public version, visit https://www.biostars.org.
FIMO score calculation

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

fimo pwm

1 answer

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)) [1] 10.9328

Log in to answer this question.