scanWithPWM {PWMEnrich} | R Documentation

## Scan the whole sequence on both strands

### 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

    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

    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)
    }

[Package PWMEnrich version 4.28.1 Index]