Learn R Programming

derfinderPlot (version 1.6.3)

plotCluster: Plot the coverage information surrounding a region cluster

Description

For a given region found in calculatePvalues, plot the coverage for the cluster this region belongs to as well as some padding. The mean by group is shown to facilitate comparisons between groups. If annotation exists, you can plot the trancripts and exons (if any) overlapping in the vicinity of the region of interest.

Usage

plotCluster(idx, regions, annotation, coverageInfo, groupInfo,
  titleUse = "qval", txdb = NULL, p.ideogram = NULL, ...)

Arguments

idx
A integer specifying the index number of the region of interest. This region is graphically highlighted by a red bar.
regions
The $regions output from calculatePvalues.
annotation
The output from running annotateNearest on the output from calculatePvalues.
coverageInfo
A DataFrame resulting from loadCoverage using cutoff=NULL.
groupInfo
A factor specifying the group membership of each sample. It will be used to color the samples by group.
titleUse
Whether to show the p-value (pval), the q-value (qval) or the FWER adjusted p-value (fwer) in the title. If titleUse=none then no p-value or q-value information is used; useful if no permutations were performed and thus p-value and q-value information is absent.
txdb
A transcript data base such as TxDb.Hsapiens.UCSC.hg19.knownGene. If NULL then no annotation information is used.
p.ideogram
If NULL, the ideogram for hg19 is built for the corresponding chromosome. Otherwise an ideogram resuling from plotIdeogram.
...
Arguments passed to other methods and/or advanced arguments.

Value

  • A ggplot2 plot that is ready to be printed out. Tecnically it is a ggbio object. The region with the red bar is the one whose information is shown in the title.

Details

See the parameter significantCut in calculatePvalues for how the significance cutoffs are determined.

See Also

loadCoverage, calculatePvalues, annotateNearest, plotIdeogram

Examples

Run this code
## Load data
library('derfinder')

## Annotate the results with bumphunter::matchGenes()
library('bumphunter')
library('TxDb.Hsapiens.UCSC.hg19.knownGene')
library('org.Hs.eg.db')
genes <- annotateTranscripts(txdb = TxDb.Hsapiens.UCSC.hg19.knownGene,
    annotationPackage = 'org.Hs.eg.db')
annotation <- matchGenes(x = genomeRegions$regions, subject = genes)

## Make the plot
plotCluster(idx=1, regions=genomeRegions$regions, annotation=annotation,
    coverageInfo=genomeDataRaw$coverage, groupInfo=genomeInfo$pop,
    txdb=TxDb.Hsapiens.UCSC.hg19.knownGene)
## Resize the plot window and the labels will look good.

## For a custom plot, check the ggbio and ggplot2 packages.
## Also feel free to look at the code for this function:
plotCluster

Run the code above in your browser using DataLab