plotdisFeature: Plot distance distribution to a feature boundary.

Description Usage Arguments Value See Also Examples

View source: R/plotTypes.R

Description

Given a dataframe of samples and distance based annotation, the function calculates the distribution of data in or around the given annotation. From genomic point of view, the function can be used to identify distribution of data around genomic features like gene TSS, CpG island, etc.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plotdisFeature(
  dat = NULL,
  grouping = NULL,
  annotCol = NULL,
  breaks = NULL,
  discreteBins = TRUE,
  geom = "bar",
  stacked = FALSE,
  typeRatio = FALSE,
  printPlotData = FALSE
)

Arguments

dat

a dataframe/GRanges with required columns to make the plot.

grouping

name of the column grouping the data or denoting the samples

annotCol

name of the column holding the distance to feature data. This can also be boolean data in which case plot will be in/out of feature.

breaks

intervals by which to break up the distance data. Default is seq(-1e5,1e5,5e3). Not required if 'annotCol' is of type boolean.

discreteBins

whether to plot continuous variable supplied in annotCol as a discrete axis. This conserves plotting area, thus default is TRUE.

geom

plot distribution using bars or lines? Default is 'bar'. One can use 'line' as well when there are many groups.

stacked

make a stacked plot? Only applies when geom is 'bar'. Default is FALSE.

typeRatio

whether to plot data as ratio of experimental to controls. Default is FALSE. Enabling this requires a column in 'dat' called "type" with two values "expr" for experimental and "ctrl" for control. This column subdivides data within each group. Enabling this transforms the data into plotting distribution of ratios of experimental/controls around feature of interest.

printPlotData

return summarized plot data? Default is FALSE.

Value

ggplot2 plot and/or table of summarized plot data.

See Also

makeGRanges, getNearestFeature, getSitesInFeature, getFeatureCounts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Convert a dataframe to GRanges object
data(sites)
data(sites.ctrl)
sites$type <- "expr"
sites <- rbind(sites,sites.ctrl)
alldata.rd <- makeGRanges(sites,soloStart=TRUE)

data(genes)
genes.rd <- makeGRanges(genes)

res <- doAnnotation(annotType="within", alldata.rd, genes.rd, "InGene",
asBool=TRUE)
plotdisFeature(res, "virus", "InGene")
plotdisFeature(res, "virus", "InGene", typeRatio=TRUE)
## Not run: 
res <- doAnnotation(annotType="nearest", res, genes.rd, "NearestGene",
side='5p')
plotdisFeature(res, "virus", "X5pNearestGeneDist")
plotdisFeature(res, "virus", "X5pNearestGeneDist", typeRatio=TRUE)

## End(Not run)

malnirav/hiAnnotator documentation built on July 29, 2021, 6:32 a.m.