plotStackedOverview {ggbio}R Documentation

Plot stacked overview

Description

Plot stacked overview for genome with or without cytoband. It's a wrapper around layout_karyogram.

Usage

plotStackedOverview(obj, ..., xlab, ylab, main, geom = "rect",
                         cytoband = FALSE, rescale = TRUE,
                         rescale.range = c(0, 10))
plotKaryogram(obj, ..., xlab, ylab, main, geom = "rect",
                         cytoband = FALSE, rescale = TRUE,
                         rescale.range = c(0, 10))

Arguments

obj

a GRanges object, which could contain extra information about cytoband. If it's missing, will ask user to provide species information and download proper data set from UCSC. If you want an accurate genome mapping, please provide seqlengths with this GRanges object,otherwise it will emit a warning and use data space to estimate the chromosome space which is very rough.

...

arguments passed to graphic functions to control aesthetics. For example, if you use geom "point", you need to provide "y" in aes(), and if can also pass color, fill, size etc. to control graphics.

xlab

label for x

ylab

label for y

main

title for plot.

geom

geom plotted on the stacked layout. Default is "rect", which showing interval data as rectangles. It automatically figures out boundary so you don't have to provide information in aes, users could specify other supported geom works for data.frame.

cytoband

logical value. Default is FALSE. If TRUE, plotting cytoband, this require your data have arbitrary column as name and gieStain. the easiest way is to use getIdeogram to get your data. Notice for this function, when cytoband is TRUE, it will only plot cytoband without overlaying your data. If you really need to overlay extra data on cytoband, please plus layout_karyogram for that purpose.

rescale

logical value. Default is TRUE, which rescale your data into the rescale.range, this make sure your data will not be plotted outside the stacked overview box.

rescale.range

Numeric range of length 2. Default is (0, 10), because stacked layout draws a white background as chromosome space and this space is of height 10. We hide the y-axis since we don't need it for stacked overview. Sometime users may want to leave some margin for their data, they can use this arguments to control the rescale.

Details

Stacked overview is just a arbitrary layout for karyogram layout, it use facets seqnaems ~ . as default to stack the genome. For accurate mapping, you need to provide seqlengths information in your GRanges object. Otherwise, data space will be computed for stacked overview chromosome background, this is _NOT_ the actual chromosome space!.

Value

A ggplot object.

Author(s)

Tengfei Yin

Examples

## Not run: 
##D library(biovizBase)
##D data(hg19IdeogramCyto, package = "biovizBase")
##D library(GenomicRanges)
##D 
##D ## you can also get ideogram by biovizBase::getIdeogram
##D 
##D ## make shorter and clean labels
##D old.chrs <- seqnames(seqinfo(hg19IdeogramCyto))
##D new.chrs <- gsub("chr", "", old.chrs)
##D ## lst <- as.list(new.chrs)
##D names(new.chrs) <- old.chrs
##D new.ideo <- renameSeqlevels(hg19IdeogramCyto, new.chrs)
##D new.ideo <- keepSeqlevels(new.ideo, c(as.character(1:22) , "X", "Y"))
##D new.ideo
##D 
##D 
##D ## sample data
##D data(darned_hg19_subset500, package = "biovizBase")
##D idx <- is.na(values(darned_hg19_subset500)$exReg)
##D values(darned_hg19_subset500)$exReg[idx] <- "unknown"
##D 
##D ## you need to add seqlengths for accruate mapping
##D chrnames <- unique(as.character(seqnames(darned_hg19_subset500)))
##D data(hg19Ideogram, package = "biovizBase")
##D seqlengths(darned_hg19_subset500) <- seqlengths(hg19Ideogram)[sort(chrnames)]
##D 
##D 
##D dn <- darned_hg19_subset500
##D values(dn)$score <- rnorm(length(dn))
##D 
##D ## plotStackedOverview is a simple wrapper around this functions to
##D    create a stacked layout
##D plotStackedOverview(new.ideo, cytoband = TRUE)
##D 
##D plotStackedOverview(dn)
##D plotStackedOverview(dn, aes(color = exReg, fill = exReg))
##D ## this will did the trick for you to rescale the space
##D plotStackedOverview(dn, aes(x = midpoint, y = score), geom = "line")
##D plotStackedOverview(dn, aes(x = midpoint, y = score), geom = "line", rescale.range = c(4, 6))
##D ## no rescale
##D plotStackedOverview(dn, aes(x = midpoint, y = score), geom = "line", rescale = FALSE,
##D                     xlab = "xlab", ylab = "ylab", main  = "main") + ylab("ylab")
##D 
##D ## no object? will ask you for species and query the data on the fly
##D plotStackedOverview()
##D plotStackedOverview(cytoband = TRUE)
## End(Not run)

[Package ggbio version 1.5.20 ]