### R code from vignette source 'vignettes/ggbio/inst/doc/mismatch.Rnw' ################################################### ### code chunk number 1: load ################################################### library(ggbio) library(BSgenome.Hsapiens.UCSC.hg19) data("genesymbol", package = "biovizBase") ################################################### ### code chunk number 2: load_bam ################################################### bamfile <- system.file("extdata", "SRR027894subRBM17.bam", package="biovizBase") library(Rsamtools) bf <- BamFile(bamfile) ################################################### ### code chunk number 3: BamFile ################################################### ggplot() + stat_mismatch(bf, which = genesymbol["RBM17"], bsgenome = Hsapiens,show.coverage = TRUE) + coord_cartesian(xlim = c(6134000, 6135000)) + theme_bw() ################################################### ### code chunk number 4: pag ################################################### library(biovizBase) pgr <- pileupAsGRanges(bamfile, region = genesymbol["RBM17"]) pgr.match <- pileupGRangesAsVariantTable(pgr, genome = Hsapiens) ################################################### ### code chunk number 5: pag_v ################################################### ggplot() + stat_mismatch(pgr.match) ################################################### ### code chunk number 6: pag_v2 ################################################### p1 <- ggplot() + stat_mismatch(pgr.match, show.coverage = FALSE, geom = "bar") + xlim(6132060,6132120) + ylim(0, 10) p2<- ggplot() + stat_mismatch(pgr.match, geom = "segment") + xlim(6132060,6132120) + ylim(0, 10) tracks(segment = p2, bar = p1) +scale_x_sequnit('mb') ################################################### ### code chunk number 7: autoplot ################################################### autoplot(bf, which = genesymbol["RBM17"], bsgenome = Hsapiens,show.coverage = TRUE, stat = "mismatch", geom = "bar") + xlim(6132060,6132120) + ylim(0, 10) ################################################### ### code chunk number 8: sessionInfo ################################################### sessionInfo()