Skip to contents

This function adds a rectangle to a genome track between two genomic positions. It is useful for highlighting specific genomic regions.

Usage

add_rect(
  plot,
  xmin,
  xmax,
  ymin = -Inf,
  ymax = Inf,
  fill = "yellow",
  alpha = 0.2,
  color = NA
)

Arguments

plot

A ggplot2 object representing a genome track

xmin

Minimum x-value (start position)

xmax

Maximum x-value (end position)

ymin

Minimum y-value (default: -Inf)

ymax

Maximum y-value (default: Inf)

fill

Fill color of the rectangle (default: "yellow")

alpha

Transparency (default: 0.2)

color

Border color of the rectangle (default: NA)

Value

A ggplot2 object with the rectangle added

Examples

if (FALSE) { # \dontrun{
track <- ez_coverage("signal.bw", "chr1:1000000-2000000")
track <- add_rect(track, 1200000, 1400000)
} # }