plotOverview: Plot a karyotype overview of the genome with the identified...

View source: R/plotOverview.R

plotOverviewR Documentation

Plot a karyotype overview of the genome with the identified regions

Description

Plots an overview of the genomic locations of the identified regions (see calculatePvalues) in a karyotype view. The coloring can be done either by significant regions according to their p-values, significant by adjusted p-values, or by annotated region if using matchGenes.

Usage

plotOverview(
  regions,
  annotation = NULL,
  type = "pval",
  significantCut = c(0.05, 0.1),
  ...
)

Arguments

regions

The ⁠$regions⁠ output from calculatePvalues.

annotation

The output from running matchGenes on the output from calculatePvalues. It is only required if type='annotation'.

type

Must be either pval, qval, fwer or annotation. It determines whether the plot coloring should be done according to significant p-values (<0.05), significant q-values (<0.10), significant FWER adjusted p-values (<0.05) or annotation regions.

significantCut

A vector of length two specifiying the cutoffs used to determine significance. The first element is used to determine significance for the p-values and the second element is used for the q-values.

...

Arguments passed to other methods and/or advanced arguments. Advanced arguments:

base_size

Base point size of the plot. This argument is passed to element_text (size argument).

areaRel

The relative size for the area label when type='pval' or type='qval'. Can be useful when making high resolution versions of these plots in devices like CairoPNG.

legend.position

This argument is passed to theme. From ggplot2: the position of legends. ('left', 'right', 'bottom', 'top', or two-element numeric vector).

Passed to extendedMapSeqlevels.

Value

A ggplot2 plot that is ready to be printed out. Tecnically it is a ggbio object.

Author(s)

Leonardo Collado-Torres

See Also

calculatePvalues, matchGenes

Examples

## 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)

## Not run: 
## 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

## End(Not run)

leekgroup/derfinderPlot documentation built on Dec. 17, 2024, 4:56 p.m.