Learn R Programming

CrispRVariants (version 1.0.2)

plotVariants: Plot alignments, frequencies and location of target sequence

Description

Combines a plot of transcript structure, alleles aligned with respect to a reference genome and a heatmap of counts or proportions of each allele in a set of data.

Usage

plotVariants(obj, ...)
"plotVariants"(obj, ..., txdb = NULL, add.chr = TRUE, plotAlignments.args = list(), plotFreqHeatmap.args = list())

Arguments

obj
The object to be plotted
...
extra arguments for plot layout
txdb
GenomicFeatures:TxDb object (default: NULL)
add.chr
If target chromosome does not start with "chr", e.g. "chr5", add the "chr" prefix. (Default:TRUE)
plotAlignments.args
Extra arguments for plotAlignments
plotFreqHeatmap.args
Extra arguments for plotFreqHeatmap

Value

A ggplot2 plot of the variants

See Also

arrangePlots for general layout options and annotateGenePlot for options relating to the transcript plot.

Examples

Run this code
#Load a CrisprSet object for plotting
data("gol_clutch1")

#Load the transcript db.  This is a subset of the Ensembl Danio Rerio v73 gtf
# for the region 18:4640000-4650000 which includes the targeted gol gene

library(GenomicFeatures)
fn <- system.file("extdata", "Danio_rerio.Zv9.73.gol.sqlite",
                 package = "CrispRVariants")
txdb <- loadDb(fn)

# Plot the variants
p <- plotVariants(gol, txdb = txdb)

#In the above plot, the bottom margin is too large, the legend is
#cut off, and the text within the plots should be larger.
#These issues can be fixed with some adjustments:
p <- plotVariants(gol, txdb = txdb,
                 plotAlignments.args = list(plot.text.size = 4, legend.cols = 2),
                 plotFreqHeatmap.args = list(plot.text.size = 4),
                 left.plot.margin = grid::unit(c(0.1,0,0.5,1), "lines"))

Run the code above in your browser using DataLab