ggplot_true_vs_esti: Plot true vs estimated cell composition

View source: R/function_plot_esti_vs_true.R

ggplot_true_vs_estiR Documentation

Plot true vs estimated cell composition

Description

'ggplot_true_vs_esti' can be used to evaluate a trained DTD model, in the way that it plots known/true quantities versus estimated quantities per cell type. As input, 'ggplot_true_vs_esti' expects a DTD.model, and test.data. For an example see section "Correlation per cell type" in the package vignette 'browseVignettes("DTD")'

Usage

ggplot_true_vs_esti(
  DTD.model,
  X.matrix = NA,
  test.data,
  norm.typewise = FALSE,
  estimate.c.type = NA,
  title = "",
  shape.indi = NA,
  show.legend = FALSE
)

Arguments

DTD.model

either a numeric vector with length of nrow(X), or a list returned by train_deconvolution_model, DTD_cv_lambda_cxx, or descent_generalized_fista.

X.matrix

numeric matrix, with features/genes as rows, and cell types as column. Each column of X.matrix is a reference expression profile. A trained DTD model includes X.matrix, it has been trained on. Therefore, X.matrix should only be set, if the 'DTD.model' is not a DTD model.

test.data

list, with two entries, a numeric matrix each, named 'mixtures' and 'quantities' For examples see mix_samples, mix_samples_with_jitter or the package vignette 'browseVignettes("DTD")'.

norm.typewise

logical, in the known AND estimated quantity matrix, should every type (=> row) be normalized to range from 0 to 1?

estimate.c.type

string, either "non_negative", or "direct". Indicates how the algorithm finds the solution of arg min_C ||diag(g)(Y - XC)||_2.

  • If 'estimate.c.type' is set to "direct", there is no regularization (see estimate_c),

  • if 'estimate.c.type' is set to "non_negative", the estimates "C" must not be negative (non-negative least squares) (see (see estimate_nn_c))

title

string, additionally title

shape.indi

vector with length 'ncol(test.data$quantities)', is passed to shape argument of aes in geom_point. Idea is to mark samples from different origin. If set to NA, the shape will not be showed.

show.legend

logical, should the legend be plotted? Notice, this function generates a plot, holding a subfigure for each type of the deconvolution. In every subfigure, the cell type, and the corresponding correlation is shown. This parameter only controls the additional legend.

Value

ggplot object


MarianSchoen/DTD documentation built on April 29, 2022, 1:59 p.m.