## Construct toy data
chrs <- paste0('chr', c(1:22, 'X', 'Y'))
chrs <- factor(chrs, levels=chrs)
library('GenomicRanges')
regs <- GRanges(rep(chrs, 10), ranges=IRanges(runif(240, 1, 4e7),
width=1e3), significant=sample(c(TRUE, FALSE), 240, TRUE, p=c(0.05,
0.95)), significantQval=sample(c(TRUE, FALSE), 240, TRUE, p=c(0.1,
0.9)), area=rnorm(240))
annotation <- data.frame(region=sample(c('upstream', 'promoter',
"overlaps 5'", 'inside', "overlaps 3'", "close to 3'", 'downstream'),
240, TRUE))
## Type pval
plotOverview(regs)
## Type qval
plotOverview(regs, type='qval')
## Annotation
plotOverview(regs, annotation, type='annotation')
## Resize the plots if needed.
## You might prefer to leave the legend at ggplot2's default option: right
plotOverview(regs, legend.position='right')
## Although the legend looks better on the bottom
plotOverview(regs, legend.position='bottom')
## Example knitr chunk for higher res plot using the CairoPNG device
```{r overview, message=FALSE, fig.width=7, fig.height=9, dev='CairoPNG', dpi=300}
plotOverview(regs, base_size=30, areaRel=10, legend.position=c(0.95, 0.12))
```
## For more custom plots, take a look at the ggplot2 and ggbio packages
## and feel free to look at the code of this function:
plotOverview
Run the code above in your browser using DataLab