refinePWMMotif {motifRG} | R Documentation |
Create a PWM model given a initial set of motif matches and input sequences
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)
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 |
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 |
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 |
findMotif
refinePWMMotifExtend
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)