Skip to contents

Reconstructs a DLBCLone model saved via DLBCLone_save_optimized() by restoring the serialized model list and the associated uwot UMAP object. Optionally performs an integrity check to verify that embeddings can be reproduced from the saved state.

Usage

DLBCLone_load_optimized(
  path = ".",
  name_prefix = "DLBCLone",
  check_integrity = FALSE
)

Arguments

path

Character scalar. Directory containing the saved files. Defaults to ".".

name_prefix

Character scalar. Common filename prefix used when the model was saved. The function looks for <name_prefix>_model.rds and <name_prefix>_umap.uwot in path. Defaults to "DLBCLone".

check_integrity

Logical. If TRUE, the function re-embeds the training samples (both batch and iterative modes, when available) and confirms that the coordinates match the saved embeddings (within a small tolerance). This requires that the saved model list contains projection_train, which is a consequence of activating the model with DLBCLone_activate().

Value

A list representing the reconstructed DLBCLone model, suitable for downstream use with DLBCLone_predict() or utilities that expect DLBCLone_model. On return, DLBCLone_model$model contains the restored uwot model object.

Details

This function expects two files produced by DLBCLone_save_optimized():

  • <name_prefix>_model.rds: a serialized list with the core model components (e.g., features, df, and optional test embeddings).

  • <name_prefix>_umap.uwot: a serialized uwot UMAP model saved with uwot::save_uwot().

If check_integrity = TRUE, the function computes fresh embeddings via make_and_annotate_umap() and compares them to the saved ones. A mismatch larger than 0.01 in either axis will throw an error.

Examples

if (FALSE) { # \dontrun{
# Restore a model for use in a fresh R session
DLBCLone_myfeats_opt <- DLBCLone_load_optimized(
  path = ".",
  name_prefix = "DLBCLone_myfeats"
)

# Restore and verify that saved embeddings can be reproduced
confirmed_DLBCLone <- DLBCLone_load_optimized(
  path = ".",
  name_prefix = "dlbclone_dlc_test",
  check_integrity = TRUE
)
} # }