scanWithPWM: Scan the whole sequence on both strands

Description Usage Arguments Details Value Examples

View source: R/pwm.R

Description

The whole sequence is scanned with a PWM and scores returned beginning at each position. Partial motif matches are not done, thus the last #[length of motif]-1 scores are NA.

Usage

1
2
3
4
5
6
7
8
scanWithPWM(
  pwm,
  dna,
  pwm.rev = NULL,
  odds.score = FALSE,
  both.strands = FALSE,
  strand.fun = "mean"
)

Arguments

pwm

PWM object

dna

a DNAString or other sequence from Biostrings

pwm.rev

the reverse complement for a pwm (if it is already pre-computed)

odds.score

if to return raw scores in odds (not logodds) space

both.strands

if to return results on both strands

strand.fun

which function to use to summarise values over two strands (default is "mean")

Details

The function returns either an odds average (*not* log-odds average), maximal score on each strand, or scores on both strands.

The function by default returns the score in log2 following the package Biostrings.

Value

a vector representing scores starting at each position, or a matrix with score in the two strands

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if(requireNamespace("PWMEnrich.Dmelanogaster.background")){
   data(MotifDb.Dmel, package = "PWMEnrich.Dmelanogaster.background")

   ttk = MotifDb.Dmel[["ttk"]]

   # odds average over the two strands expressed as log2-odds
   scanWithPWM(ttk, DNAString("CGTAGGATAAAGTAACT"))
   
   # log2-odds scores on both strands
   scanWithPWM(ttk, DNAString("CGTAGGATAAAGTAACT"), both.strands=TRUE)
}

PWMEnrich documentation built on Nov. 8, 2020, 7:45 p.m.