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