frequencyScoring: Frequency scoring

Description Usage Arguments Value Examples

View source: R/getMotifFreq.R

Description

Frequency scoring

Usage

1
frequencyScoring(sequence.list, frequency.mat)

Arguments

sequence.list

A vector list of sequences

frequency.mat

A matrix output from 'createFrequencyMat'

Value

A vector of frequency score

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
data('phospho_L6_ratio')
data('KinaseMotifs')

# Extracting first 10 sequences for demonstration purpose
seqs = unlist(lapply(strsplit(rownames(phospho.L6.ratio), "~"),
                    function(i) {i[4]}))
seqs = seqs[1:10]

# extracting flanking sequences
seqWin = mapply(function(x) {
    mid <- (nchar(x)+1)/2
    substr(x, start=(mid-7), stop=(mid+7))
}, seqs)

# The first 10 for demonstration purpose
phospho.L6.ratio = phospho.L6.ratio[1:10,]

# minimum number of sequences used for compiling motif for each kinase.
numMotif=5

motif.mouse.list.filtered <-
    motif.mouse.list[which(motif.mouse.list$NumInputSeq >= numMotif)]

# scoring all phosphosites against all motifs
motifScoreMatrix <-
    matrix(NA, nrow=nrow(phospho.L6.ratio),
        ncol=length(motif.mouse.list.filtered))
rownames(motifScoreMatrix) <- rownames(phospho.L6.ratio)
colnames(motifScoreMatrix) <- names(motif.mouse.list.filtered)

# Scoring phosphosites against kinase motifs
for(i in seq_len(length(motif.mouse.list.filtered))) {
    motifScoreMatrix[,i] <-
        frequencyScoring(seqWin, motif.mouse.list.filtered[[i]])
    cat(paste(i, '.', sep=''))
}

PengyiYang/PhosR documentation built on June 21, 2020, 8:37 a.m.