Skip to contents

Trains a reference model for cell type annotation using selectable metric learning methods. Supports both standard mode (cell type only) and time-course aware mode (cell type + time point). Available methods: DCA, LMNN, NCA, ITML, and MMC.

Usage

scLearn_model_learning(
  high_varGene_names,
  expression_profile,
  sample_information_cellType,
  sample_information_timePoint = NULL,
  method = c("DCA", "LMNN", "MSL", "NCA", "ITML", "MMC"),
  bootstrap_times = 10,
  cutoff = 0.01,
  dim_para = 0.999,
  ...
)

Arguments

high_varGene_names

Character vector of high-variance gene names

expression_profile

Expression matrix (genes x cells)

sample_information_cellType

Named vector of cell type annotations

sample_information_timePoint

Optional time point annotations (default: NULL)

method

Metric learning method to use. One of:

  • "DCA" - Discriminative Component Analysis (linear transformation maximizing between-class/within-class variance ratio)

  • "LMNN" - Large Margin Nearest Neighbors (preserves k-NN classification boundaries with margin constraints)

  • "MSL" - Multi-Similarity Loss-Based Large Margin Nearest Neighbors (preserves k-NN classification boundaries with margin constraints)

  • "NCA" - Neighborhood Components Analysis (maximizes leave-one-out classification probability)

  • "ITML" - Information-Theoretic Metric Learning (uses relative distance constraints with information-theoretic regularization)

  • "MMC" - Maximum Margin Clustering (explicitly optimizes within-class/between-class scatter matrices)

Default: "DCA"

bootstrap_times

Bootstrap iterations for standard mode (default: 10)

cutoff

Percentile cutoff for similarity threshold (default: 0.01)

dim_para

Variance explained threshold for time-course mode (default: 0.999)

...

Additional parameters passed to metric learning functions

Value

A scLearn model object containing:

  • high_varGene_names: High-variance genes used

  • simi_threshold_learned: List of correlation thresholds

  • feature_matrix_learned: Reference feature matrices

  • trans_matrix_learned: Transformation matrices

  • method: Used metric learning method

Author

Bin Duan (binduan\@sjtu.edu.cn)

Examples

if (FALSE) { # \dontrun{

scLearn_model_learning_result <- scLearn_model_learning(
  high_varGene_names = RefDataQC_HVG_names,
  expression_profile = RefDataQC_filtered$expression_profile,
  sample_information_cellType = RefDataQC_filtered$sample_information_cellType,
  sample_information_timePoint = NULL,
  method = "DCA",
  bootstrap_times = 1,
  cutoff = 0.01,
  dim_para = 0.999
)
} # }