geom_arch-method: Arch geoms for GRanges object

Description Usage Arguments Details Value Author(s) Examples

Description

Show interval data as arches.

Usage

1
2
3
4
5
6
7
## S4 method for signature 'data.frame'
geom_arch(data, ..., n = 25, max.height = 10)


## S4 method for signature 'GRanges'
geom_arch(data, ..., xlab, ylab, main, facets = NULL,
                 rect.height = 0, n = 25, max.height = 10)

Arguments

data

A GRanges or data.frame object.

...

Extra parameters passed to autoplot function, aes mapping support height, x, xend.

  • xstart of the arches

  • xendend of the arches

  • heightheight of arches

xlab

Label for x

ylab

Label for y

main

Title for plot.

n

Integer values at which interpolation takes place to create 'n' equally spaced points spanning the interval ['min(x)', 'max(x)'].

facets

Faceting formula to use.

rect.height

When data is GRanges, this padding the arches from original y value to allow users putting arches 'around' the interval rectangles.

max.height

Max height of all arches.

Details

To draw a interval data as arches, we need to provide a special geom for this purpose. Arches is popular in gene viewer or genomoe browser, when they try to show isoforms or gene model.geom_arch, just like any other geom_* function in ggplot2, you can pass aes() to it to map variable to height of arches.

Value

A 'Layer'.

Author(s)

Tengfei Yin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
set.seed(1)
N <- 100
library(GenomicRanges)

## =======================================
##  simmulated GRanges
## =======================================
gr <- GRanges(seqnames = 
              sample(c("chr1", "chr2", "chr3"),
                     size = N, replace = TRUE),
              IRanges(
                      start = sample(1:300, size = N, replace = TRUE),
                      width = sample(70:75, size = N,replace = TRUE)),
              strand = sample(c("+", "-", "*"), size = N, 
                replace = TRUE),
              value = rnorm(N, 10, 3), score = rnorm(N, 100, 30),
              sample = sample(c("Normal", "Tumor"), 
                size = N, replace = TRUE),
              pair = sample(letters, size = N, 
                replace = TRUE))

## =======================================
##  default
## =======================================
ggplot(gr) + geom_arch()
# or
ggplot() + geom_arch(gr)

## =======================================
##  facetting and aesthetics
## =======================================
ggplot(gr) + geom_arch(aes(color = value, height = value, size = value),
                     alpha = 0.2, facets = sample ~ seqnames)

ggbio documentation built on Nov. 8, 2020, 5:04 p.m.