Learn R Programming

CrispRVariants (version 1.0.2)

plotFreqHeatmap: Plot a table of counts with colours indicating frequency

Description

Creates a heatmap from a matrix of counts or proportions, where tiles are coloured by the proportion and labeled with the value.

Usage

plotFreqHeatmap(obj, ...)
"plotFreqHeatmap"(obj, ..., col.sums = NULL, header = NA, header.name = "Total", group = NULL, group.colours = NULL, as.percent = TRUE, x.axis.title = NULL, x.size = 6, y.size = 8, x.angle = 90, legend.text.size = 6, plot.text.size = 3, line.width = 1, x.hjust = 1, legend.position = "right", x.labels = NULL, legend.key.height = grid::unit(1, "lines"))
"plotFreqHeatmap"(obj, ..., top.n = 50, min.freq = 0, min.count = 1, type = c("counts", "proportions"), order = NULL)

Arguments

obj
A matrix of counts with rows = feature, columns = sample
...
additional arguments
col.sums
Alternative column sums to be used for calculating the tile colours if as.percent = TRUE, e.g. if "obj" is a subset of a larger data set. If "NULL" (default), the column sums of "obj" are used.
header
Alternative column titles, e.g. column sums for the unfiltered data set when obj is a subset. If set to "NA", column sums of obj are displayed. If "NULL", no header is displayed (Default: NA).
header.name
Label for the header row (Default: "Total")
group
Grouping factor for columns. If supplied, columns are ordered to match the levels (Default: NULL)
group.colours
Colours for column groups, should match levels of "group". If "NULL", groups are coloured differently (Default: NULL)
as.percent
Should colours represent the percentage of reads per sample (TRUE) or the actual counts (FALSE)? (Default: TRUE)
x.axis.title
A title for the x-axis. (Default: NULL)
x.size
Font size for x-labels (Default: 16)
y.size
Font size for y-labels (Default: 16)
x.angle
Angle for x-labels (Default: 90, i.e. vertical)
legend.text.size
Font size for legend (Default: 16)
plot.text.size
Font size counts within plot (Default: 8)
line.width
Line thickness of title box'
x.hjust
Horizontal justification of x axis labels (Default: 1)
legend.position
The position of the legend (Default: right)
x.labels
X-axis labels (Default: NULL, column.names of the matrix, doesn't do anything at the moment)
legend.key.height
The height of the legend key, as a "unit" object. (See unit).
top.n
Show the n top ranked variants. Note that if the nth and n+1th variants have equal rank, they will not be shown. (Default: 50)
min.freq
i ( one sample (default: 0, i.e no frequency cutoff)
min.count
i (integer) only plot variants with count >= i in at least one sample (default: 0, i.e no count cutoff)
type
Plot either "counts" or "proportions"
order
A list of column names or indices specifying the order of the columns in the plot

Value

The ggplot2 plot of the variant frequencies

Examples

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

# Plot the frequency heatmap
plotFreqHeatmap(gol)

Run the code above in your browser using DataLab