plotRangesLinkedToData {ggbio}R Documentation

Plot Ranges Linked with Data

Description

Plot GRanges object structure and linked to a even spaced paralell coordinates plot which represting the data in elementeMetadata.

Usage

plotRangesLinkedToData(data, ..., stat.col, stat.label,
                                   stat.ylab,
                                   sig, sig.col = c("black", "red"),
                                   stat.coord.trans = coord_trans(),
                                   annotation = list(),
                                   width.ratio = 0.8,
                                   track.skip = -1,
                                   theme.stat = theme_grey(),
                                   theme.align = theme_gray(),
                                   linetype = 3, 
                                   heights)

Arguments

data

GRanges object with a DataFrame as elementMetadata.

...

Parameters passed to control lines in top plot.

stat.col

integer (variable position starting in DataFrame of data, start from 1) or strings (variable names) which indicate the column names.

stat.label

Labels of the columns, if missing, use stat.col.

stat.ylab

y label for stat track(the top track).

sig

a character of element meta data column of logical value, indicates which row is signficant. and will be shown in link lines and rectangle.

sig.col

colors for significant, valid when you specify "sig" argument, the first color indicates FALSE, non-significant, the second color indicates TRUE.

stat.coord.trans

transformation used for top plot.

annotation

A list of ggplot object.

width.ratio

Control the segment length of statistic layer.

track.skip

skip between tracks.

theme.stat

top plot theme.

theme.align

alignment themes.

linetype

linetype

heights

Heights of each track.

Details

Inspired by some graphics produced in some other packages, for example in package DEXseq, the author provides graphics with gene models and linked to an even spaced statistics summary. This is useful because we always plot everything along the genomic coordinates, but genomic features like exons are not evenly distributed, so we could actually treat the statistics associated with exons like categorical data, and show them as "Paralell Coordinates Plots". This is one special layout which represent the data in a nice manner and also keep the genomic structure information. With abliity of tracks, it's possible to generate such type of a graphic along with other annotations.

The data we want is a normal GRanges object, and make sure the intervals are not overlaped with each other(currently), and you may have multiple columns which store the statistics for multiple samples, then we produce the graphic we introduced above and users could pass other annotation track in the function which will be shown below the main linked track.

The reason you need to pass annotation into the function instead of binding them by tracks later is because binding manually with annotation tracks is tricky and this function doesn't return a ggplot object.

Value

return a frame grob; side-effect (plotting) if plot=T.

Author(s)

Tengfei Yin

Examples

## Not run: 
##D library(TxDb.Hsapiens.UCSC.hg19.knownGene)
##D library(ggbio)
##D data(genesymbol, package = "biovizBase")
##D txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
##D model <- exonsBy(txdb, by = "tx")
##D model17 <- subsetByOverlaps(model, genesymbol["RBM17"])
##D exons <- exons(txdb)
##D exon17 <- subsetByOverlaps(exons, genesymbol["RBM17"])
##D ## reduce to make sure there is no overlap
##D ## just for example
##D exon.new <- reduce(exon17)
##D ## suppose
##D values(exon.new)$sample1 <- rnorm(length(exon.new), 10, 3)
##D values(exon.new)$sample2 <- rnorm(length(exon.new), 10, 10)
##D values(exon.new)$score <- rnorm(length(exon.new))
##D values(exon.new)$significant <- sample(c(T,F), size =
##D length(exon.new),replace = TRUE)
##D plotRangesLinkedToData(exon.new, stat.col = c("sample1", "sample2"))
##D plotRangesLinkedToData(exon.new, stat.col = 1:2)
##D plotRangesLinkedToData(exon.new, stat.col = 1:2, size = 3, linetype = 4)
##D plotRangesLinkedToData(exon.new, stat.col = 1:2, size = 3, linetype = 4,
##D                        sig = "significant")
##D plotRangesLinkedToData(exon.new, stat.col = 1:2, size = 3, linetype = 4,
##D                        sig = "significant", sig.col = c("red",
##D "gray90"))
## End(Not run)

[Package ggbio version 1.5.20 ]