Description Usage Arguments Details Value Author(s) Examples
Provides a summary plot for each observation (gene), showing data for each experiment group. The plot can optionally include one or more of the following layers: boxplot, violin plot, individual points and/or mean of all points. The layers are built up in the order listed with user settable transparency, colors etc. By default, the Boxplot, Point and Mean layers are active. Also, by default, the plots are faceted. Facet plot can be turned off to return a list of individual ggplot graphics for each gene.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | obsPlot(
data,
block,
blockOrder,
obsNames,
sampNames,
plotBy = "Gene",
valType = "Log2CPM",
boxLayer = TRUE,
violinLayer = FALSE,
pointLayer = TRUE,
meanLayer = TRUE,
xlab = NULL,
ylab = NULL,
title = NULL,
boxColor = "grey30",
boxFill = "deepskyblue3",
boxAlpha = 0.5,
boxNotch = FALSE,
boxNotchWidth = 0.8,
violinColor = "grey30",
violinFill = "goldenrod1",
ViolinAlpha = 0.5,
pointColor = "grey30",
pointFill = "dodgerblue4",
pointShape = 21,
pointAlpha = 1,
pointSize = 2,
pointJitter = 0,
meanColor = "red2",
meanFill = "goldenrod1",
meanShape = 22,
meanAlpha = 0.7,
meanSize = 3,
legenPosition = "right",
baseFontSize = 12,
themeStyle = "grey",
facet = TRUE,
facetCol = NULL,
xAngle = 30,
scales = "free_y",
returnPlotDat = FALSE,
debug = FALSE
)
|
data |
matrix or dataframe of whatever data you want to plot with samples in columns and observations (genes) in rows (with rownames and colnames). Bug: Currently requires at least 2 rows of data. |
block |
Character or numeric vector. Determines which samples belong to the same group. Must be same length as ncol(data). Assign the same value to each member of a group. Note that the block values are used to label the X Axis to identify the groups. Thus short pneumonic labels are useful here. |
blockOrder |
Character vector. Use this to explicitly set the display order of the blocks in the plots. blockOrder should contain unique(block) in the order you wish to items to be arranged along the X-axis. (Optional: Default = unique(block)) |
obsNames |
Character vector of row (observation) names to use instead of actual rownames. (Default = NULL) |
sampNames |
Character vector of column (sample) names to use instead of actual colnames. (Default = NULL) |
plotBy |
Name for the type of observation being plotted (Default = "Gene") |
valType |
name for the Value being plotted. (Default = "Log2CPM") |
boxLayer |
Adds a boxplot layer (Default = TRUE) |
violinLayer |
Adds a violin layer (Default = FALSE) |
pointLayer |
Adds a point layer (Default = True) |
meanLayer |
Adds a mean layer (Default = True) |
xlab |
X axis label (defaults to "Block") |
ylab |
Y axis label (defaults to valType) |
title |
Plot title (optional; Defaults = NULL) |
boxColor |
Color for the boxplot layer (Default = "grey30") |
boxFill |
Fill Color for the boxplot layer (Default = "deepskyblue3") |
boxAlpha |
Transparency for the box layer (Default = 0.5) |
boxNotch |
turn on/off confidence interval notches on boxplots (Default = FALSE) |
boxNotchWidth |
Set the width of boxnotches (0-1) (Default = 0.8) |
violinColor |
Color for the violin layer (Default = "grey30") |
violinFill |
Fill Color for the violin (Default = "yellow") |
pointColor |
Color for the point layer (Default = "grey30") |
pointFill |
Fill color for the point layer (Default = "dodgerblue4") |
pointShape |
Shape for the point layer (Default = 21; fillable circle) |
pointAlpha |
Transparency for the box layer (Default = 1) |
pointSize |
Size of the points (Default = 4) |
pointJitter |
Amount to jitter the points (Default = 0) Try 0.2 if you have alot of points. |
meanColor |
Color for the mean layer (Default = "red2") |
meanFill |
Fill color for the mean layer (Default = "goldenrod1") |
meanShape |
Shape for the mean layer (Default = 21; fillable circle) |
meanAlpha |
Transparency for the mean layer (Default = 0.7) |
meanSize |
Size of the mean points (Default = 3) |
baseFontSize |
The smallest size font in the figure in points. (Default = 12) |
themeStyle |
"bw" or "grey" which correspond to theme_bw or theme_grey respectively. Default = bw" |
facet |
Specifies whether to facet (TRUE) or print individual plots (FALSE) (Default = TRUE) |
xAngle |
Angle to set the sample labels on the Xaxis. (Default = 30; Range = 0-90) |
scales |
Specify same scales or independent scales for each subplot (Default = "free_y"; Allowed values: "fixed", "free_x", "free_y", "free") |
returnPlotDat |
Returns the dataframe used for the plot as a list member (default=FALSE) |
debug |
Used to open a breakpoint just before the melt step (default=FALSE) |
violinAlpha |
Transparency for the box layer (Default = 0.5) |
facetRow |
Explicitly set the number of Rows for the facet plot. Default behavior will automatically set the columns. (Default = NULL) |
Input is a dataframe or matrix of observations (rows; usually genes) by Samples (columns) and requires rownames to identify the observations (genes). A Block vector is required to define which Samples (columns) belong to the same group and generate a summary plot by group with a separate plot for each observation (gene).
Rownames are required and all the data columns should be numeric. Each observation (gene) generates a separate plot, so you should pass a smallish list of genes unless you want alot of output. By default the plot is faceted. You should turn facet off if you have more than ~25 genes to plot. Colnames and Rownames will be used to label the plots by default but custom col/row names can also be supplied as separate vectors.
ggplot If Facet=TRUE (default) returns a facetted ggplot object. If facet=FALSE or returnPlotDat=TRUE, returns a list of ggplot objects indexed by observation (gene) names. If returnPlotDat=TRUE, the last element of the list is the dataframe used to generate the plot.
John Thompson, jrt@thompsonclan.org
1 2 3 4 5 6 7 8 9 10 | Simple faceted plot with custom title
#get Log2CPM from an DGEobj object
dgeObj = readRDS("MyDGEobj.RDS")
dgelist <- getItem(dgeObj, "DGEList")
Log2CPM <- cpm(dgelist, log=TRUE)
genes = Log2CPM[1:12,] #first dozen genes
#define six treatment groups in triplicate
MyBlock = c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6)
MyPlot = obsPlot(genes, MyBlock, title = "Plot Title")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.