Learn R Programming

Rariant (version 1.8.3)

plotCIs: Plotting Functions

Description

The 'plotConfidenceIntervals' is a high-level plotting function for visualizing confidence intervals. The 'plotAbundanceShift' function visualizes the shift in mismatch rates between two samples.

Usage

plotConfidenceIntervals(x, ylim = c(-1.05, 1.05), color = NULL, ...)

plotAbundanceShift(x, ylim = c(-0.05, 1.05), rates = TRUE, ...)

Arguments

x
'GRanges' with mcols of a CI method, or 'data.frame' as returned by one of the CI methods, with the optional column 'start'.
ylim
Limits of the y-axis. Using this instead of using the 'ylim' prevents ugly warnings of 'ggplot2'.
color
Variable that determines the coloring of the confidence axis (character).
rates
Should the non-consensus rates of both samples be visualized as colored end points of the line range? (logical, default: TRUE).
...
Additional plotting arguments that are passed on to ggplot2::geom_pointrange.

Value

  • For a 'GRanges' input: A 'ggbio' object

    For a 'data.frame' input: A 'ggplot' object

Examples

Run this code
## Generate sample data
counts = data.frame(x1 = 1:5, n1 = 30, x2 = 0:4, n2 = 30)

## Agresti-Caffo
ci_ac = with(counts, acCi(x1, n1, x2, n2))

library(GenomicRanges)
gr = GRanges("1", IRanges(start = 1:nrow(counts), width = 1))
mcols(gr) = ci_ac

## GRanges
plotConfidenceIntervals(gr)

## data.frame
plotConfidenceIntervals(ci_ac)

## abundance shift
plotAbundanceShift(gr)

plotAbundanceShift(ci_ac)

Run the code above in your browser using DataLab