Draws BED-like intervals as bars of fixed height, one row per level of the y
aesthetic. xmin and xmax default to the start and end columns. Pair with
coord_locus() to zoom to a window and theme_genomic() for track styling.
Usage
geom_bed_track(
mapping = NULL,
data = NULL,
bar_height = 5,
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)Arguments
- mapping
Set of aesthetic mappings created by
ggplot2::aes(). Typicallyy(e.g.sample) and optionallyfill.- data
GRanges object or data frame of intervals with
seqnames,start, andendcolumns, e.g. fromdevgru::read_bed_file().- bar_height
Height of the bars in mm, default: 5
- ...
Other arguments passed to
gggenes::geom_gene_arrow(), e.g.colouroralpha. Bars have no outline unlesscolouris mapped or set.- na.rm, show.legend, inherit.aes
See
ggplot2::layer().
Examples
if (FALSE) { # \dontrun{
chrom_states <- devgru::read_bed_file("segments.bed", additional_col_names = "segment_label")
ggplot2::ggplot() +
geom_bed_track(data = chrom_states, ggplot2::aes(y = sample, fill = segment_label)) +
coord_locus("chr1:203296001-203313000") +
theme_genomic()
# Tornado sort: order rows by interval width, largest at top
ggplot2::ggplot() +
geom_bed_track(data = chrom_states, ggplot2::aes(y = reorder(sample, end - start))) +
coord_locus("chr1:203296001-203313000")
} # }
