scmet_plot_estimated_vs_true: Plot true versus inferred parameter estimated.

View source: R/utils_plots.R

scmet_plot_estimated_vs_trueR Documentation

Plot true versus inferred parameter estimated.

Description

Function for plotting true on x-axis and inferred parameter estimates on y-axis (either mean methylation or overdispersion). Along with posterior medians, the 80 high posterior density is shown as error bars. Wehn MLE estimates are provided, a plot showing the shrinkage introduced by scMET is shown as arrows.

Usage

scmet_plot_estimated_vs_true(
  obj,
  sim_dt,
  param = "mu",
  mle_fit = NULL,
  diff_feat_idx = NULL,
  hpd_thresh = 0.8,
  title = NULL,
  nfeatures = NULL
)

Arguments

obj

The scMET object after calling the scmet function.

sim_dt

The simulated data object. E.g. after calling the scmet_simulate function.

param

The parameter to plot posterior estimates, either "mu" or "gamma".

mle_fit

A three column matrix of beta-binomial maximum likelihood estimates. First column feature name, second column mean methylation and third column overdispersion estimates. Number of features should match the ones used by scMET.

diff_feat_idx

Vector with locations of features that were simulated to be differentially variable or methylated. This is stored in the object after calling the scmet_simulate_diff function.

hpd_thresh

The high posterior density threshold, as computed by the HPDinterval function.

title

Optional title, default NULL.

nfeatures

Optional parameter, denoting a subset of number of features to plot. Mostly to reduce over-plotting.

Value

A ggplot2 object.

Author(s)

C.A.Kapourani C.A.Kapourani@ed.ac.uk

See Also

scmet, scmet_simulate_diff, scmet_simulate, scmet_plot_mean_var, scmet_plot_vf_tail_prob, scmet_plot_efdr_efnr_grid, scmet_plot_volcano, scmet_plot_ma

Examples

# Fit scMET
obj <- scmet(Y = scmet_dt$Y, X = scmet_dt$X, L = 4, iter = 100)
scmet_plot_estimated_vs_true(obj = obj, sim_dt = scmet_dt, param = "mu")

# BB MLE fit to compare with scMET
mle_fit <- scmet_dt$Y[, bb_mle(cbind(total_reads, met_reads))
[c("mu", "gamma")], by = c("Feature")]
scmet_plot_estimated_vs_true(obj = obj, sim_dt = scmet_dt, param = "mu",
mle_fit = mle_fit)


andreaskapou/scMET documentation built on Feb. 1, 2024, 10:46 a.m.