Skip to contents

Generates a dual-panel PCA dashboard for evaluating single-cell simulation benchmark metrics and methods across all 56 curated evaluation measures.

Usage

plot_metric_pca(
  benchmark_data,
  panel = c("both", "methods", "loadings"),
  assay_modality = c("auto", "scRNA-seq", "scATAC-seq", "multiomics"),
  group_by = c("category", "summary_type"),
  by_category = FALSE,
  as_list = FALSE,
  category = NULL,
  exclude_categories = NULL,
  metrics = NULL,
  normalize_scores = TRUE,
  palette = NULL,
  top_n_loadings = 14,
  base_size = 11
)

Arguments

benchmark_data

Benchmark summary data.frame, matrix, or list.

panel

Character. Which panel(s) to render: "both" (default; 2-panel stacked layout), "methods" (panel a only), or "loadings" (panel b only).

assay_modality

Character string specifying the molecular modality: "auto" (default; automatically detects from data attributes or metrics), "scRNA-seq", "scATAC-seq", or "multiomics". When "scATAC-seq", feature-level metrics are labeled "peak". When "scRNA-seq", feature-level metrics are labeled "gene". When "multiomics", feature-level metrics are labeled "features".

group_by

Character. Grouping variable for loading vectors in panel b: "category" (default) groups vectors by evaluation category (I–VIII); "summary_type" groups by feature/cell/global level.

by_category

Logical. If TRUE, perform separate PCA ordinations per evaluation category. Default FALSE.

as_list

Logical. If TRUE and by_category = TRUE, returns a named list of ggplot objects. Default FALSE.

category

Optional character vector to filter by evaluation category.

exclude_categories

Optional character vector of categories to exclude (default NULL, includes all 8 categories).

metrics

Optional character vector of specific metrics to include.

normalize_scores

Logical. If TRUE (default), direction-align and min-max normalize scores to [0, 1] before aggregation and PCA decomposition.

palette

Optional named character vector of colors for simulators.

top_n_loadings

Integer or NULL. Maximum number of loading vectors to plot in panel b (ordered by vector magnitude in PC1-PC2 space). Default is 14 to prevent visual clutter; set to NULL or 56 to display all evaluated metrics.

base_size

Numeric. Base font size. Default 11.

Value

A ggplot or patchwork object representing the ordination figure.

Details

All metrics present in benchmark_data (up to all 56 curated evaluation metrics across 8 canonical categories) are direction-normalized before PCA decomposition so higher values uniformly correspond to higher fidelity. Panel "both" displays:

  • Panel a (Methods Ordination): Simulators mapped into PC1 vs PC2 coordinates with solid black crosshairs, centroid markers, and white rounded badge labels with colored borders.

  • Panel b (PC Loadings Vectors): Directional loading vectors (arrows) radiating from the origin (0, 0) to loading coordinates (w1, w2), colored by canonical category or summary type and annotated with optimization-direction arrows (up-arrow / down-arrow). Pass top_n_loadings = NULL or 56 to render all metric loading vectors.

Examples

bm_df <- data.frame(
  Method = rep(c("scDesign3", "scMultiSim", "Splatter", "SymSim", "MOSim"), each = 8),
  Category = rep(c(
    "(I) Distributional Properties", "(I) Distributional Properties",
    "(I) Distributional Properties",
    "(II) Sparsity & Zero-Inflation Dynamics",
    "(III) Cellular Manifold & Clustering Concordance",
    "(III) Cellular Manifold & Clustering Concordance",
    "(IV) Technical Variation & Batch Mixing Dynamics",
    "(V) Biological Signal & Differential Fidelity"
  ), 5),
  Metric = rep(c("KS", "Wasserstein", "RMSE", "r2_discrepancy",
                 "ari", "silhouette_sim", "cms", "rna_de_f1"), 5),
  Value = c(
    0.10, 0.16, 0.22, 0.07, 0.85, 0.74, 0.88, 0.84,
    0.18, 0.20, 0.24, 0.15, 0.82, 0.81, 0.76, 0.79,
    0.21, 0.35, 0.31, 0.12, 0.64, 0.70, 0.80, 0.61,
    0.34, 0.42, 0.48, 0.26, 0.59, 0.52, 0.61, 0.68,
    0.15, 0.29, 0.26, 0.19, 0.75, 0.66, 0.70, 0.77
  ),
  stringsAsFactors = FALSE
)
p <- plot_metric_pca(bm_df, base_size = 9.5)
print(p)