plot_event | R Documentation |
Generate a plot of PSI values for a given exon. The PSI values and corresponding quality scores are typically obtained from the vast-tools pipeline.
plot_event(x, config = NULL, subg = FALSE, subg.show = c("mean", "all", "beeswarm"), trim_colnames = NULL, qual = c("VLOW", "N", "LOW", "OK", "SOK"), errorbar = TRUE, groupmean = ifelse(is.null(config), FALSE, TRUE), col = NULL, title = NULL, xlab = "", ylab = "PSI", ylim = c(0, 100), cex.main = 14, cex.yaxis = 12, cex.xaxis = 12, pch = 20, cex.pch = 3, plot = NULL, gridlines = TRUE, show_group_legend = TRUE)
x |
A 1-row data frame containing PSI values to be plotted. |
config |
Optional configuration settings for |
subg |
Logical indicating whether samples should be subgrouped for plotting. |
subg.show |
Only applies when |
trim_colnames |
String that must be searched for and trimmed at the end
of every sample column in x. If no string must be trimmed, leave as |
qual |
String indicating the minimun vast-tools quality score
for the PSI to be accepted. Defaults to |
errorbar |
Logical indicating whether error bars should be drawn. |
groupmean |
Logical indicating whether grouped means should be drawn.
Requires |
col |
Vector of colors with length matching the number of samples. If
specified, this will override the color settings specified in |
title |
Title of the plot. If |
xlab |
The x-axis label. |
ylab |
The y-axis label. |
ylim |
Range of y-axis. |
cex.main |
Plot title size (pts). |
cex.yaxis |
Y-axis font size (pts). |
cex.xaxis |
X-axis font size (i.e. the sample names) (pts). |
pch |
Point symbol. |
cex.pch |
Size of datapoints. |
plot |
(deprecated) Prints the plot. |
gridlines |
Logical indicating whether grid lines should be drawn. |
show_group_legend |
Set to FALSE to avoid showing a legend with the sample groups and their colors. |
Plots can be customized via the config
option. Either a data frame or
the filepath to the config file can be used. Alternatively, plots can be
customized using a limited set of graphical parameters as described above.
The order of samples (e.g. columns in x
) as it appears on the
resulting plot can be customized using a config file. If a config file is not
used and re-ordering is desired, then it must be done manually before calling
plot_event
by altering the columns of x
.
If subgroups are defined in config
and subg=TRUE
:
The mean PSI of the samples within each subgroup are drawn as a single data point.
If subg=TRUE
and errorbar=TRUE
, confidence intervals for
the subgroup are derived from a joint beta distribution, fitted to a set of
points derived from individual beta distributions corresponding to each
sample (see get_beta_ci_subg
). This is an experimental feature,
computationally expensive, and CIs may not be shown for some subgroups,due
to failure in fitting the joint distribution, especially for events with low
coverage and PSI values near 0 or 1.
Subgroups will be ordered by the minimum Order value of their samples, and assigned to the first group to which they are matched.
(Experimental) Instead of computing the average PSI, the individual
PSI values can be plotted for each subgroup by setting subg.show
. The
default is "mean", which plots the average PSI. The other two options are
"all" or "beeswarm". For "all", the individual PSI values and error bars
are plotted for each subgroup and sorted in increasing order. For
"beeswarm", the optional
ggbeeswarm package is used to
create beeswarm scatterplots for each subgroup (error bars are not possible).
As this is an optional feature, please manually install the package first
before using it: install.packages("ggbeeswarm")
.
If no subgroups are defined in config
, or subg=FALSE
(default),
a subgroup will be defined for each sample, preserving their name and order.
If groups and colors are defined in config
, all the samples in a group
will be colored with the first color assigned to the group. Else, all
samples will be plotted in black.
If groups are defined in config
and groupmean=TRUE
, the mean
PSI of the samples within each group are drawn as horizontal lines. The
colors of the lines are determined by the color set to the first sample of
each group by RColorCode
in config
. A corresponding legend key
will also be drawn.
(See also preprocess_sample_colors
and vignette('psiplot-usage')
for details on how to use config files).
PSI values that have NA value are omitted and not plotted.
Error bars based on the confidence interval of the PSI estimation can be
shown by setting errorbar=TRUE
.
ggplot2 object
format_table
for performing some initial conversion steps of
x
.
preprocess_sample_colors
for pre-processing of x
usingconfig
.
plot_multievent
for plotting more than one
event in the same plot.
## Not run: plot_event(psi[1,]) # Plot with custom configuration config plot_event(psi[1,], config = config, groupmean=TRUE) plot_event(psi[1,], config = "/path/to/config") # Plot with subgrouped samples config plot_event(psi[1,], config = config, subg = TRUE, errorbar = FALSE) # Plot with subroups and error bars (slow, experimental feature) \dontrun{ plot_event(psi[1,], config = config, subg = TRUE, errorbar = TRUE) } # Plot using custom configuration, changing point symbol, and y-axis # scale plot_event(psi[1,], config = config, pch = 9, ylim = c(20, 80)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.