stat_table {ggbio} | R Documentation

## Tabulate a GRanges object

### Description

Tabulate a GRanges object

### Usage

    ## S4 method for signature 'GRanges'
    stat_table(data, ..., xlab, ylab, main,
                geom = NULL,stat = NULL)
    ## S4 method for signature 'GRangesList'
    stat_table(data, ..., xlab, ylab, main,
                facets = NULL, geom = NULL)

### Arguments

`data` | A `GRanges` or `data.frame` object.
`...` | Extra parameters such as aes() passed to `geom_rect`, `geom_alignment`, or `geom_segment`.
`xlab` | Label for x
`ylab` | Label for y
`main` | Title for plot.
`facets` | Faceting formula to use.
`geom` | The geometric object to use display the data.
`stat` | The geometric object to use display the data.

### Value

A 'Layer'.

### Author(s)

Tengfei Yin

### Examples

    ##  load
    set.seed(1)
    N <- 100
    require(ggbio)
    require(GenomicRanges)
    ##  simul
    ## ======================================================================
    ##  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))

    gr <- c(gr[seqnames(gr) == "chr1"][sample(1:10, size = 1e4, replace = TRUE)],gr)

    ##  default
    ggplot(gr) + stat_table()
    ggplot(gr) + stat_table(geom = "segment", aes(y = ..score.., color = ..score..))
    ggplot(gr) + stat_table(aes(color = score))

[Package ggbio version 1.35.2 Index]