Skip to contents

Plot variant positions within a genomic region.

Usage

VariantTrack(variants, region)

Arguments

variants

Data frame with columns: position (numeric), rsid (character), color (character). Each row defines one SNP marker to display.

region

Genomic region (GenomicRanges::GRanges or a string like "chr10:112900000-113100000" that can be converted to GRanges)

Value

Returns a ggplot2 object

Examples

# Define SNPs to mark
variants <- data.frame(
  position = c(112951996, 112952395),
  rsid = c("rs10885396", "rs7094871"),
  color = c("steelblue", "darkred")
)

# Create stacked plot
VariantTrack(
  variants = variants,
  region = "chr10:112990000-113010000"
)
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_segment()`).
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_text()`).