Skip to contents

Create a motif x feature matrix from a set of genomic ranges, the genome, and a set of position weight matrices.

Usage

CreateMotifMatrix(
  features,
  pwm,
  genome,
  score = FALSE,
  use.counts = FALSE,
  ...
)

Arguments

features

A GRanges object containing a set of genomic features

pwm

A TFBSTools::PFMatrixList() or TFBSTools::PWMatrixList() object containing position weight/frequency matrices to use

genome

Any object compatible with the genome argument in motifmatchr::matchMotifs()

score

Record the motif match score, rather than presence/absence (default FALSE)

use.counts

Record motif counts per region. If FALSE (default), record presence/absence of motif. Only applicable if score=FALSE.

...

Additional arguments passed to motifmatchr::matchMotifs()

Value

Returns a sparse matrix

Details

Requires that motifmatchr is installed https://www.bioconductor.org/packages/motifmatchr/.

Examples

if (FALSE) { # \dontrun{
library(JASPAR2018)
library(TFBSTools)
library(BSgenome.Hsapiens.UCSC.hg38)

pwm <- getMatrixSet(
  x = JASPAR2018,
  opts = list(
    collection = "CORE",
    tax_group = "vertebrates",
    all_versions = FALSE
  )
)
motif.matrix <- CreateMotifMatrix(
  features = granges(atac_small),
  pwm = pwm[1:10],
  genome = BSgenome.Hsapiens.UCSC.hg38
)
} # }