stat_gene {ggbio}R Documentation

Calculate gene structure

Description

Calculate gene structure.

Usage

## S4 method for signature 'TranscriptDb'
stat_gene(data, ...)

Arguments

data

A GRanges or data.frame object.

...

Extra parameters such as aes() passed to geom_alignment.

Value

A 'Layer'.

Author(s)

Tengfei Yin

Examples

## loading package
## Deprecated
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
data(genesymbol, package = "biovizBase")
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
## made a track comparing full/reduce stat.
p1 <- ggplot() + geom_alignment(txdb, which = genesymbol["RBM17"])
## Aggregating TranscriptDb...
## Parsing exons...
## Parsing cds...
## Parsing transcripts...
## Aggregating...
## Done
## Constructing graphics...
p1 <- ggplot() + stat_gene(txdb, which = genesymbol["RBM17"])
## Warning: 'stat_gene' is deprecated. Use 'geom_alignment' instead. See
## help("Deprecated")
## Aggregating TranscriptDb...
## Parsing exons...
## Parsing cds...
## Parsing transcripts...
## Aggregating...
## Done
## Constructing graphics...
## or 
p1 <- ggplot(txdb) + stat_gene(which = genesymbol["RBM17"])
## Warning: 'stat_gene' is deprecated. Use 'geom_alignment' instead. See
## help("Deprecated")
## Aggregating TranscriptDb...
## Parsing exons...
## Parsing cds...
## Parsing transcripts...
## Aggregating...
## Done
## Constructing graphics...
p1 <- ggplot(txdb) + stat_gene(which = genesymbol["RBM17"])
## Warning: 'stat_gene' is deprecated. Use 'geom_alignment' instead. See
## help("Deprecated")
## Aggregating TranscriptDb...
## Parsing exons...
## Parsing cds...
## Parsing transcripts...
## Aggregating...
## Done
## Constructing graphics...
p2 <- ggplot(txdb) + stat_gene(which = genesymbol["RBM17"], stat =
"reduce")
## Warning: 'stat_gene' is deprecated. Use 'geom_alignment' instead. See
## help("Deprecated")
## Aggregating TranscriptDb...
## Parsing exons...
## Parsing cds...
## Parsing transcripts...
## Aggregating...
## Done
## Constructing graphics...
p2 <- ggplot(txdb) + stat_gene(which = genesymbol["RBM17"], stat = "reduce")
## Warning: 'stat_gene' is deprecated. Use 'geom_alignment' instead. See
## help("Deprecated")
## Aggregating TranscriptDb...
## Parsing exons...
## Parsing cds...
## Parsing transcripts...
## Aggregating...
## Done
## Constructing graphics...
## ggplot(txdb) + geom_alignment(which = genesymbol["RBM17"]) + stat_reduce()
## ggplot(txdb) + geom_alignment(which = genesymbol["RBM17"])
tracks(full = p1, reduce = p2, heights = c(3, 1))

plot of chunk unnamed-chunk-1

## change y labels
ggplot(txdb) + stat_gene(which = genesymbol["RBM17"], names.expr = "tx_id:::gene_id")
## Warning: 'stat_gene' is deprecated. Use 'geom_alignment' instead. See
## help("Deprecated")
## Aggregating TranscriptDb...
## Parsing exons...
## Parsing cds...
## Parsing transcripts...
## Aggregating...
## Done
## Constructing graphics...

plot of chunk unnamed-chunk-1


[Package ggbio version 1.5.20 ]