View source: R/visualisation.R
make_benchmarking_scatterplot | R Documentation |
Make a Scatterplot for Benchmarking
make_benchmarking_scatterplot(result_list, ref_data, file_name = NULL)
result_list |
A named list containing all deconvolution results that should be considered, cell type annotations need to contain the same cell types as the ones in ref_data |
ref_data |
reference cell types which are used as the ground truth |
file_name |
(optional) plot is saved in this file |
the ggplot object
data("single_cell_data_1")
data("cell_type_annotations_1")
data("batch_ids_1")
data("bulk")
data("RefData")
common_genes <- intersect(rownames(single_cell_data_1), rownames(bulk))[1:2000]
single_cell_data <- single_cell_data_1[common_genes, 1:500]
cell_type_annotations <- cell_type_annotations_1[1:500]
batch_ids <- batch_ids_1[1:500]
bulk <- bulk[common_genes, ]
RefData <- RefData[, order(colnames(RefData))]
res_bisque <- deconvolute(
bulk, NULL, "bisque", single_cell_data,
cell_type_annotations, batch_ids
)
res_scdc <- deconvolute(bulk, NULL, "scdc", batch_ids,
single_cell_object = single_cell_data,
cell_type_annotations = cell_type_annotations
)
result_list <- list(SCDC = res_scdc, Bisque = res_bisque)
# Merging the two T cell props
result_list <- lapply(result_list, function(x) {
cbind(x, T = (x[, "CD4 T"] + x[, "CD8 T"]))[, -c(2, 3)]
})
make_benchmarking_scatterplot(result_list, RefData)
# Alternative if you want to save the plot in a file
# make_benchmarking_scatterplot(result_list, RefData, "predictionVsGroundtruth.png")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.