corrExpPredPlot {digitalDLSorteR} | R Documentation |
Generate correlation plots between predicted and expected cell type proportions from test data
Description
Generate correlation plot between predicted and expected cell type
proportions from test data. Correlation plots can be displayed all mixed or
split by cell type (CellType
) or number of cell types present in the
samples (nCellTypes
). See the facet.by
argument and examples
for more information. Moreover, a user-selected correlation value is
displayed as an annotation on the plots. See the corr
argument for
details.
Usage
corrExpPredPlot(
object,
colors,
facet.by = NULL,
color.by = "CellType",
corr = "both",
filter.sc = TRUE,
pos.x.label = 0.01,
pos.y.label = 0.95,
sep.labels = 0.15,
size.point = 0.1,
alpha.point = 1,
ncol = NULL,
nrow = NULL,
title = NULL,
theme = NULL,
...
)
Arguments
object |
|
colors |
Vector of colors to be used. Only vectors with a number of
colors equal to or greater than the levels of |
facet.by |
Variable used to display data in different panels. If
|
color.by |
Variable used to color data. Options are |
corr |
Correlation value displayed as an annotation on the plot.
Available metrics are Pearson's correlation coefficient ( |
filter.sc |
Boolean indicating whether single-cell profiles are filtered
out and only errors associated with pseudo-bulk samples are displayed
( |
pos.x.label |
X-axis position of correlation annotations (0.95 by default). |
pos.y.label |
Y-axis position of correlation annotations (0.1 by default). |
sep.labels |
Space separating annotations if |
size.point |
Size of points (0.1 by default). |
alpha.point |
Alpha of points (0.1 by default). |
ncol |
Number of columns if |
nrow |
Number of rows if |
title |
Title of the plot. |
theme |
ggplot2 theme. |
... |
Additional arguments for the facet_wrap function
from ggplot2 if |
Value
A ggplot object with the correlation plots between expected and actual proportions.
See Also
calculateEvalMetrics
distErrorPlot
blandAltmanLehPlot
barErrorPlot
Examples
## Not run:
set.seed(123)
sce <- SingleCellExperiment::SingleCellExperiment(
assays = list(
counts = matrix(
rpois(30, lambda = 5), nrow = 15, ncol = 20,
dimnames = list(paste0("Gene", seq(15)), paste0("RHC", seq(20)))
)
),
colData = data.frame(
Cell_ID = paste0("RHC", seq(20)),
Cell_Type = sample(x = paste0("CellType", seq(6)), size = 20,
replace = TRUE)
),
rowData = data.frame(
Gene_ID = paste0("Gene", seq(15))
)
)
DDLS <- createDDLSobject(
sc.data = sce,
sc.cell.ID.column = "Cell_ID",
sc.gene.ID.column = "Gene_ID",
sc.filt.genes.cluster = FALSE,
sc.log.FC = FALSE
)
probMatrixValid <- data.frame(
Cell_Type = paste0("CellType", seq(6)),
from = c(1, 1, 1, 15, 15, 30),
to = c(15, 15, 30, 50, 50, 70)
)
DDLS <- generateBulkCellMatrix(
object = DDLS,
cell.ID.column = "Cell_ID",
cell.type.column = "Cell_Type",
prob.design = probMatrixValid,
num.bulk.samples = 50,
verbose = TRUE
)
# training of DDLS model
tensorflow::tf$compat$v1$disable_eager_execution()
DDLS <- trainDDLSModel(
object = DDLS,
on.the.fly = TRUE,
batch.size = 15,
num.epochs = 5
)
# evaluation using test data
DDLS <- calculateEvalMetrics(
object = DDLS
)
# correlations by cell type
corrExpPredPlot(
object = DDLS,
facet.by = "CellType",
color.by = "CellType",
corr = "both"
)
# correlations of all samples mixed
corrExpPredPlot(
object = DDLS,
facet.by = NULL,
color.by = "CellType",
corr = "ccc",
pos.x.label = 0.2,
alpha.point = 0.3
)
## End(Not run)