refinePWMMotif: create a PWM (Position Weight Model) model given a initial...

Description Usage Arguments Value See Also Examples

View source: R/pwm.model.R

Description

Create a PWM model given a initial set of motif matches and input sequences

Usage

1
2
3
  refinePWMMotif(motifs=NULL, seqs,  pwm.ld= NULL, max.iter=50,
tol=10^-4, mod="oops", null=rep(0.25, 4),pseudo=1, weights=rep(1,
length(seqs)), motif.weights=NULL)

Arguments

motifs

The initial set of motif matches. character vector or DNAStringSet object

seqs

Input sequences. character vector or DNAStringSet object

pwm.ld

The initial PWM matrixes in logodds transformation. Either "motifs" or "pwm.ld" is not NULL

max.iter

Maximum number of iterations for refinement

tol

Convergence criteria. The percentage of total PWM scores improvement required for convergence.

mod

Motif ocurrence model. If mod=="oops", assume one motif match per sequence. If mod=="zoops", assume zero or one motif match per sequence.

null

A numeric vector specifying the background model

pseudo

Pseudo counts for PWM construction

weights

a numeric vector specifying the weights for all sequences. Default: 1 for all sequences

motif.weights

a numeric vector specifying the weights for initial sets of motifs. Default: NULL

Value

Return a list with two elements:

model

a list with two elements. "prob": PWM model, sum of columns add to 1. "logodd": PWM model in logodds form, log2 of original matrix substract the background model

.

match

a data.frame specifying the motif matches in each sequence. Columns are: "match": the sequence of the match, "score": PWM score, "strand", the strand of the match in the input sequence, "pos": start position of the motif match. If multiple matches are allowed, then "seq.id" specifies the index of the input sequence for the motif match.

score

Total PWM score of the motif matches

See Also

findMotif refinePWMMotifExtend

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ctcf.seq <- readDNAStringSet(system.file("extdata","ctcf.fa", package="motifRG"))
data(ctcf.motifs)
### refine PWM model based on motif matches
pwm.match <- refinePWMMotif(ctcf.motifs$motifs[[1]]@match$pattern, ctcf.seq)
### plot traditional motif logo
library("seqLogo")
seqLogo(pwm.match$model$prob)
### plot dinucleotide motif logo
plotMotif(pwm.match$match$pattern)
### automatically extend PWM model 
pwm.match.extend <-refinePWMMotifExtend(ctcf.motifs$motifs[[1]]@match$pattern, ctcf.seq)
### plot the new motif matches
plotMotif(pwm.match.extend$match$pattern)

motifRG documentation built on April 28, 2020, 8:46 p.m.