plotMarker2D | R Documentation |
Function to plot variable of interest (e.g. scATAC-seq gene score, motif score, scRNA-seq expression etc.) onto existing tSNE/UMAP coordinates of single cell clusters
plotMarker2D( df, markers, markerMat, pointSize = 0.5, plotClean = TRUE, rasteRize = TRUE, splitBy = NULL, minCutoff = NULL, maxCutoff = NULL, colorPalette = "solar_extra", legend.position = "bottom", showDataRange = TRUE, combine = TRUE, ... )
df |
data.frame object of 2-D coordinates, where each row is a cell and the first two columns corresponds to the first (x-axis) and second (y-axis) dimensions to use for the plot (e.g. UMAP coordinates). Can have additional cell metadata columns used for splitting (see splitBy parameter) |
markers |
character vector of markers to visualize (can list multiple). Must be one of the rownames in markerMat |
markerMat |
matrix of scores containing markers to visualize. Can be a sparse matrix. Must have rownames |
pointSize |
integer specifying point size to use for ggplot (passed to the geom_point() layer in ggplot). Default is 0.5 |
plotClean |
boolean indicating whether or not to return a 'clean' plot without any axes |
rasteRize |
boolean indicating whether to use raster point rendering (to avoid giant file sizes and too many point layers in PDFs). Requires ggrastr package if set to TRUE (Default) |
splitBy |
character indicating a single variable to split cells by using facets when visualizing. Must be a valid column name in df |
minCutoff |
cut off to use for capping minimum values prior to visualization. Can either be a raw numeric value, a percentile value cut-off (0-1) or the number of standard deviations below the mean, used to set the minimum value in the dataset prior to plotting. For percentiles, must be a character with 'q' before the percentile cut-off value (e.g. 'q0.1' for 10%ile minimum). For standard deviation-based capping, must be a character with 'sd' before the cut-off value (e.g. 'sd2' for using 2 standard deviations below the mean as the minimum value displayed) |
maxCutoff |
cut off to use for capping maximum values prior to visualization. Can either be a raw numeric value, a percentile value cut-off (0-1) or the number of standard deviations above the mean, used to set the minimum value in the dataset prior to plotting. For percentiles, must be a character with 'q' before the percentile cut-off value (e.g. 'q0.9' for 90%ile maximum). For standard deviation-based capping, must be a character with 'sd' before the cut-off value (e.g. 'sd2' for using 2 standard deviations above the mean as the maximum value displayed) |
colorPalette |
color palette name specification to use for coloring points. Default is "solar_extra". See BuenColors package developed by Caleb Lareau for more palette options |
legend.position |
character specifying where to place the legend. Valid options are "top", "bottom", "left", "right", or "none" (to remove the legend completely). Default is bottom |
showDataRange |
boolean indicating whether or not to show the data numeric range in the legends (only applies if legends are being displayed). Default is TRUE. If set to FALSE, just shows as min and max |
combine |
boolean indicating whether or not to merge plots and display as grid.Default is TRUE |
... |
extra parameters passed to cowplot's |
If a single marker is queried, or combine is set to TRUE for multiple markers, a ggplot object will be printed to graphics window unless assigned to variable. If combine is set to FALSE, then a list object of individual plots per marker is returned
Vinay Kartha
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.