plotGRanges: Plot GRanges

plotGRangesR Documentation

Plot GRanges

Description

Plot GRanges of several queries on the same reference, with one y-axis line per query. Each alignment can have a different color, specified via the "col" column of mcols(gr). If this column doesn't exist, it will be black by default.

Usage

plotGRanges(
  gr,
  main = "Alignments",
  xlab = NULL,
  xlim = NULL,
  col.qry.lab = "black",
  shape = "segments"
)

Arguments

gr

GRanges

main

main title

xlab

label of the x-axis (by default, will be the first level of seqnames(gr))

xlim

x-axis limits

col.qry.lab

color for the query labels used along the y-axis

shape

shape used to represent the alignments (segments/arrows)

Value

nothing

Author(s)

Timothee Flutre

See Also

plotAligns

Examples

## Not run: ## make fake coordinates to be plotted with a single color
library(GenomicRanges)
gr <- GRanges(seqnames=c("chr1"),
              ranges=IRanges(start=c(1, 15, 6), end=c(10, 20, 12)),
              strand=c("+", "-", "+"))
names(gr) <- c("qry1", "qry1", "qry2")
plotGRanges(gr)
plotGRanges(gr, shape="arrows")

## use color to distinguish different alignments of the same query
mcols(gr)["col"] <- c("black", "red", "black")
plotGRanges(gr, shape="arrows")

## outside of this function, one can always add other things to the plot
legend("right", legend=c("a", "b"), col=c("black", "red"), lwd=2, bty="n")

## End(Not run)

timflutre/rutilstimflutre documentation built on Feb. 7, 2024, 8:17 a.m.