Register an Annotation Method into the Strategy Registry
Source:R/71-RegisterAnnoMethod.R
RegisterAnnoMethod.RdRegisters one or more user-defined annotation functions into a shared registry
environment (e.g., SCAnnotateStrategy). Each method is stored with minimal
metadata (method_name and executor) to enable dynamic dispatch in
annotation pipelines.
This function supports extensible cell type annotation frameworks—ideal for integrating novel classifiers (e.g., custom SingleR wrappers, marker-based assigners, or deep learning models) while maintaining a uniform execution interface.
Usage
RegisterAnnoMethod(
...,
registry = SCAnnotateStrategy,
overwrite = FALSE,
verbose = getFuncOption("verbose")
)Arguments
- ...
Named arguments where each value is a function implementing an annotation method. The name becomes the method identifier (e.g.,
SingleR = SingleRAnnotateregisters under key"SingleR"). Unnamed arguments are auto-named using their expression viaget_names_4_ids().- registry
Target registry to store annotation methods. Default:
SCAnnotateStrategy.- overwrite
Logical. If
FALSE(default), throws an error when attempting to replace an existing method. Set toTRUEto allow updates.- verbose
Logical. Whether to print a success message upon registration. Default: inherits from package option
getOption("SigBridgeRUtils.verbose").
See also
Other Registering:
Register(),
RegisterScreenMethod(),
RegisterSeuratMethod()
Other Single_Cell_Annotation_Method:
CellTypistAnnotate(),
SCAnnotateStrategy,
SingleRAnnotate(),
mLLMCelltypeAnnotate()
Examples
if (FALSE) { # \dontrun{
# Register a custom annotation wrapper
MyAnnotator <- function(sc, ...) {
# Custom logic returning annotated Seurat/SCE object
sc
}
RegisterAnnoMethod(
custom_annot = MyAnnotator,
registry = SCAnnotateStrategy
)
# Attempting to re-register without `overwrite = TRUE` will fail
# RegisterAnnoMethod(custom_annot = AnotherAnnotator) # Error!
} # }