Hi Diana,
you can follow this procedure:
# PFM from JASPAR = input file
A 16 352 3 354 268 360
C 46 0 10 0 0 3
G 18 2 2 5 0 20
T 309 35 374 30 121 6
# INPUT kmers
TTGGGG
TATATA
TATAAA
TAAATA
# To convert PFM to PWM
w = log2 ( ( f + sqrt(N) * p ) / ( N + sqrt(N) ) / p )
where
w - is a weight for the current nucleotide we are calculating
f - is a number of occurences of the current nucleotide in the current column (e.g., "61" for A in column 1, "46" for C etc)
N - total number of observations, the sum of all nucleotides occurences in a column (61+46+18+31=156 in this example)
p - [prior] [background] frequency of the current nucleotide; this one usually defaults to 0.25 (i.e. one nucleotide out of four)
# PWM we get:
A -0.43 1.11 -0.27 1.10 1.46 1.09
C -0.83 -0.21 -0.36 -0.21 -0.21 -0.23
G -0.42 -0.22 -0.26 -0.25 -0.21 -0.35
T 1.54 -0.44 1.09 -0.41 -1.53 -0.25
# To calculate z-score
z = (x - mean)/sd
The variables in the z-score formula are:
z = z-score
x = raw score or observation to be standardized
mean = mean of the population
sd = standard deviation of the population
For example:
kmer:TATAAA
raw score: 1.54+1.11+1.09+1.1+1.46+1.09 = 7.39
$zscore = ($raw_score - $mean)/$std_dev;
you can calculate $mean and $std_dev and get the zscores.
hope this helps.
z-score implies normal distribution. Check out "deseq" for this task instead.