### R code from vignette source 'vignettes/ggbio/inst/doc/ideogram.Rnw' ################################################### ### code chunk number 1: load ################################################### library(biovizBase) data(hg19IdeogramCyto) ## data structure hg19IdeogramCyto ## return TRUE, if the object could be visualized by ggbio biovizBase::isIdeogram(hg19IdeogramCyto) ################################################### ### code chunk number 2: ideo-ori ################################################### library(ggbio) p <- plotIdeogram(hg19IdeogramCyto, "chr1") print(p) ## big, need to be resized. ################################################### ### code chunk number 3: ideo-ori-viewport ################################################### ## to use function viewport, load grid library(grid) print(p, vp = viewport(height = 0.15, width = 1)) ################################################### ### code chunk number 4: ideo-ori-zoom ################################################### plotIdeogram(hg19IdeogramCyto, "chr1", zoom.region = c(1e8, 1.5e8)) ################################################### ### code chunk number 5: ideo-ori-xlabel ################################################### plotIdeogram(hg19IdeogramCyto, "chr1", xlabel = TRUE) ################################################### ### code chunk number 6: ideo-ori-nocyto ################################################### library(GenomicRanges) ## there are no seqlengths seqlengths(hg19IdeogramCyto) ## so directly plot will try to aggregate and estimate lengths of chromosomes, ## this is not accurate data(hg19IdeogramCyto) p1 <- plotIdeogram(hg19IdeogramCyto, "chr1", cytoband = FALSE, xlabel = TRUE) ## let's assign a short length to this object hg19_fake_chr1 <- hg19IdeogramCyto seqlengths(hg19_fake_chr1)[1] <- 1e8 ## this will use it's "seqlengths" information to visualize the chromosome. p2 <- plotIdeogram(hg19_fake_chr1, "chr1", cytoband = FALSE, xlabel = TRUE) ## see the difference tracks(p1, p2) ################################################### ### code chunk number 7: hg19-nocyto ################################################### data(hg19Ideogram) head(hg19Ideogram) ################################################### ### code chunk number 8: getIdeogram (eval = FALSE) ################################################### ## library(rtracklayer) ## ## need UCSC connection ## head(ucscGenomes()) ################################################### ### code chunk number 9: getideo-no (eval = FALSE) ################################################### ## library(biovizBase) ## obj <- getIdeogram() ################################################### ### code chunk number 10: mm9 ################################################### library(biovizBase) ## just need information about chromosome lengths mm9 <- getIdeogram("mm9", cytoband = FALSE) ## have head(mm9) ## need information about cytoband mm9 <- getIdeogram("mm9") head(mm9) ## with extra column 'name' and 'gieStain'. ################################################### ### code chunk number 11: cytoband ################################################### cyto.def <- getOption("biovizBase")$cytobandColor cyto.def setdiff(unique(values(mm9)$gieStain), names(cyto.def)) ################################################### ### code chunk number 12: cyto-color ################################################### p1 <- plotIdeogram(mm9, "chr1") cyto.def cyto.new <- c(cyto.def, c(gpos33 = "grey80", gpos66 = "grey60")) ## method 1: optlist <- getOption("biovizBase") optlist$cytobandColor <- cyto.new options(biovizBase = optlist) p2 <- plotIdeogram(mm9, "chr1") p3 <- plotIdeogram(mm9, "chr1") + scale_fill_manual(values = cyto.new) tracks(p1, p2, p3) ################################################### ### code chunk number 13: seqinfo ################################################### data(hg19Ideogram) seqs <- seqinfo(hg19Ideogram) class(seqs) p1 <- autoplot(seqs["chr1"]) p2 <- autoplot(seqs["chr1"], FALSE) tracks(type1 = p1, type2 = p2) ################################################### ### code chunk number 14: session-info ################################################### sessionInfo()