initialize_odm_from_backing_file: Initialize an 'odm' object

View source: R/s4_class.R

initialize_odm_from_backing_fileR Documentation

Initialize an odm object

Description

initialize_odm_from_backing_file() initializes an odm object from a backing .odm file.

Usage

initialize_odm_from_backing_file(odm_file)

Arguments

odm_file

file path to a backing .odm file.

Details

initialize_odm_from_backing_file() is portable: the user can create an .odm file (via create_odm_from_cellranger() or create_odm_from_r_matrix()) on one computer, transfer the .odm file to another computer, and then load the .odm file (via initialize_odm_from_backing_file()) on the second computer.

Value

an odm object

Examples

directories_to_load <- file.path(
 system.file("extdata", "highmoi_example", package = "ondisc"),
 paste0("gem_group_", c(1, 2))
)
directory_to_write <- tempdir()
# Set data.table threads to 1 to pass CRAN example timing checks.
old_threads <- data.table::setDTthreads(1L)
out_list <- create_odm_from_cellranger(
  directories_to_load = directories_to_load,
  directory_to_write = directory_to_write,
)
data.table::setDTthreads(old_threads)
gene_odm <- out_list$gene
gene_odm

# delete the gene_odm object
rm(gene_odm)

# reinitialize the gene_odm object
gene_odm <- initialize_odm_from_backing_file(
  paste0(tempdir(), "/gene.odm")
)
gene_odm

ondisc documentation built on June 17, 2026, 5:06 p.m.