plotVariableFeature | R Documentation |
This function requires a SingleCellExperiment
object and the resulting
DataFrame after performing variance modelling, such as modelGeneVar()
from the scran package, and produces a mean-variance scatter plot.
plotVariableFeature(
sce,
var,
hvg = NULL,
top_n = 10,
point_size = 2,
text_size = 4,
text_color = "black",
trend_color = "gold",
trend_size = 2,
box.padding = 0.5,
max.overlaps = Inf,
seed = 12321,
xlab = "Mean log-counts",
ylab = "Variance of log-counts",
title = NULL,
theme_size = 18,
...
)
sce |
A |
var |
A DataFrame returned by variance modelling functions such as
|
hvg |
A character vector containing a set of highly variable genes
to highlight in red. Default is |
top_n |
An integer scalar indicating the first |
point_size |
A numeric scalar indicating the size of the points. Default is 2. |
text_size |
A numeric scalar indicating the size of the label. This
is passed to |
text_color |
A string indicating the colour of the label. This is
passed to |
trend_color |
A string indicating the colour of the smoothed curve. Default is "gold", |
trend_size |
A numeric scalar indicating the size of the smoothed curve. Default is 2. |
box.padding |
A scalar indicating the amount of padding around
bounding box, as unit or number. This is passed to |
max.overlaps |
Exclude text labels that overlap too many things.
This is passed to |
seed |
Random seed passed to |
xlab |
The title of the x-axis. Default is "Mean log-counts". |
ylab |
The title of the y-axis. Default is "Variance of log-counts". |
title |
Plot title. Default is |
theme_size |
A numeric scalar indicating the base font size. Default is 18. |
... |
Other arguments passed on to |
In addition to the two required inputs, if rowData(sce)
has is_pass
and/or is_ambient
columns containing logical values (i.e. TRUE
and
FALSE
), denoting if a gene passed QC or if its expression is attributable
to ambient contamination, the resulting figure will show the genes in
different shapes. Also, genes that are HVGs are coloured in red when a gene
list is provided using the hvg
argument.
A ggplot
object
I-Hsuan Lin
scran::modelGeneVar()
, scran::modelGeneVarByPoisson()
,
scran::modelGeneVarWithSpikes()
, ggrepel::geom_text_repel()
library(SingleCellExperiment)
# Load demo dataset
data(sce)
var <- metadata(sce)[["modelGeneVar"]]
hvg <- metadata(sce)[["HVG"]]
# View modelGeneVar result
plotVariableFeature(sce, var, top_n = 5, title = "modelGeneVar")
# Highlight HVGs
plotVariableFeature(sce, var, hvg, title = "modelGeneVar (highlight HVGs)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.