Parameter_Calculate: Adaptive Parameter Tuning for Single-Cell Data Annotation in...

View source: R/Probability_parameter.R

Parameter_CalculateR Documentation

Adaptive Parameter Tuning for Single-Cell Data Annotation in SlimR

Description

This function uses machine learning to automatically determine optimal min_expression and specificity_weight parameters for single-cell data analysis based on dataset characteristics.

Usage

Parameter_Calculate(
  seurat_obj,
  features,
  assay = NULL,
  cluster_col = NULL,
  method = "ensemble",
  n_models = 3,
  return_model = FALSE,
  verbose = TRUE
)

Arguments

seurat_obj

A Seurat object containing single-cell data

features

Character vector of feature names (genes) to analyze

assay

Name of assay to use (default: default assay)

cluster_col

Column name in metadata containing cluster information

method

Machine learning method: "rf" (random forest), "gbm" (gradient boosting), "svm" (support vector machine), or "ensemble" (default)

n_models

Number of models for ensemble learning (default: 3)

return_model

Whether to return trained model (default: FALSE)

verbose

Whether to print progress messages (default: TRUE)

Value

A list containing:

  • min_expression: Recommended expression threshold

  • specificity_weight: Recommended specificity weight

  • performance: Model performance metric (R-squared)

  • dataset_features: Extracted dataset characteristics

  • model: Trained model (if return_model = TRUE)

See Also

Other Section_3_Automated_Annotation: Celltype_Annotation(), Celltype_Calculate(), Celltype_Verification()

Examples

## Not run: 
# Basic usage 
SlimR_params <- Parameter_Calculate(
  seurat_obj = sce,
  features = c("CD3E", "CD4", "CD8A"),
  assay = "RNA",
  cluster_col = "seurat_clusters",
  method = "ensemble",
  n_models = 3,
  return_model = FALSE,
  verbose = TRUE
  )

# Use with custom method
SlimR_params <- Parameter_Calculate(
  seurat_obj = sce,
  features = unique(Markers_list_Cellmarker2$`B cell`$marker),
  assay = "RNA",
  cluster_col = "seurat_clusters",
  method = "rf",
  return_model = FALSE,
  verbose = TRUE
  )

## End(Not run)


SlimR documentation built on Dec. 17, 2025, 5:09 p.m.