geom_motif: geom_motif

Description Usage Arguments Value Aesthetics Author(s) Examples

View source: R/plotMotifLogo.R

Description

geom_motif uses the locations of the four corners (xmin, xmax, ymin and ymax) to plot motifs.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
geom_motif(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  ic.scale = TRUE,
  use.xy = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping

Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer.

stat

The statistical transformation to use on the data for this layer, as a string.

position

Position adjustment, either as a string, or the result of a call to a position adjustment function.

...

Other arguments passed on to layer().

ic.scale

logical If TRUE, the height of each column is proportional to its information content. Otherwise, all columns have the same height.

use.xy

logical If TRUE, the required aesthethics will be x, y, width, height, and motif. Otherwise, xmin, ymin, xmax, ymax and motif.

show.legend

Not used.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them.

Value

a layer that contains GeomMotif object.

Aesthetics

geom_motif() understands the following aesthetics (required aesthetics are in bold):

OR

Author(s)

Jianhong Ou

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
pcm <- read.table(file.path(find.package("motifStack"), 
                            "extdata", "bin_SOLEXA.pcm"))
pcm <- pcm[,3:ncol(pcm)]
rownames(pcm) <- c("A","C","G","T")
motif <- new("pcm", mat=as.matrix(pcm), name="bin_SOLEXA")

df <- data.frame(xmin=c(.25, .25), ymin=c(.25, .75), xmax=c(.75, .75), ymax=c(.5, 1))
df$motif <- list(pcm2pfm(motif), pcm2pfm(motif))

library(ggplot2)
ggplot(df, aes(xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax, motif=motif)) + 
geom_motif() + theme_bw() + ylim(0, 1) + xlim(0, 1)

motifStack documentation built on Nov. 8, 2020, 7:43 p.m.