Skip to contents

Plot a motif as a sequence logo

Usage

# S3 method for class 'matrix'
plot_motif_logo(
  x,
  motifs = NULL,
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

# S3 method for class 'PWMatrix'
plot_motif_logo(
  x,
  motifs = NULL,
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

# S3 method for class 'PFMatrix'
plot_motif_logo(
  x,
  motifs = NULL,
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

# S3 method for class 'ICMatrix'
plot_motif_logo(
  x,
  motifs = NULL,
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

# S3 method for class 'list'
plot_motif_logo(
  x,
  motifs = NULL,
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

# S3 method for class 'PWMatrixList'
plot_motif_logo(
  x,
  motifs = NULL,
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

# S3 method for class 'PFMatrixList'
plot_motif_logo(
  x,
  motifs = NULL,
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

# S3 method for class 'MarchRProject'
plot_motif_logo(
  x,
  motifs = NULL,
  name = character(0),
  method = c("bits", "probability"),
  reverse_complement = FALSE,
  ncol = NULL,
  base_size = 10,
  ...
)

Arguments

x

(MarchRProject, PWMatrixList, PFMatrixList, list, PWMatrix, PFMatrix, ICMatrix, or matrix) Motif source.

motifs

(character or NULL) Case-insensitive partial-match motif names to plot. NULL (default) plots all. Must be NULL for single-motif and plain-matrix input.

method

(character) Letter height scale. "bits" (information content, default) or "probability".

reverse_complement

(logical) Plot the reverse complement. Default FALSE.

ncol

(integer or NULL) Facet columns for multi-motif plots. NULL (default) lets the facet engine choose.

base_size

(numeric) Base font size. Default 10.

...

Currently unused.

name

(character) Peak annotation name. MarchRProject method only; auto-selected when exactly one annotation carries motif profiles.

Value

A ggplot object.

Details

Renders the motif profiles retained by add_motif_annotations(), which correspond to ArchR's peakAnnotation[[name]]$motifs. ArchR stores those profiles but ships no logo plotting function.

Profiles reach this function in three scales and each is converted differently: counts (PFMatrix) and information content (ICMatrix) are column-normalized directly, while log2 odds (PWMatrix, the scale used by the "cisbp", "encode", and "homer" motif sets) are first mapped back to probabilities with 2^x * bg. A plain numeric matrix must already be non-negative; log-odds supplied as a bare matrix are rejected rather than guessed at, because inverting them requires background frequencies.

Requires the optional ggseqlogo package.