Skip to contents

This function creates a geom for genomic feature tracks, such as ChIP-seq features, ATAC-seq features, or any interval-based features. It displays the features as rectangles.

Usage

geom_feature(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  height = 0.8,
  color = "#05b1d3",
  fill = "#05b1d3",
  alpha = 0.7,
  na.rm = TRUE,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping

Aesthetic mappings (default: NULL). xmin, xmax are required.

data

Dataset (default: NULL)

stat

Statistic to use (default: "identity")

position

Position adjustment (default: "identity")

...

Other arguments passed on to layer. These are often aesthetics, used to set an aesthetic to a fixed value.

height

Height of the features (default: 0.8)

color

Border color of the features (default: "#05b1d3")

fill

Fill color of the features (default: "#05b1d3")

alpha

Transparency (default: 0.7)

na.rm

If TRUE, silently removes NA values.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, use TRUE. If NA, all levels are shown in legend, but unobserved levels are omitted.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. annotation_borders().

Value

A ggplot2 layer

Examples

if (FALSE) { # \dontrun{
library(ggplot2)
p <- ggplot(feature_data) +
  geom_feature(aes(xmin = start, xmax = end, fill = score))
} # }