xsave: Save an R Object Using 'qs' Package for Fast Compressed...

View source: R/Seurat.Utils.R

xsaveR Documentation

Save an R Object Using 'qs' Package for Fast Compressed Saving

Description

This function saves an R object to a file in a quick and efficient format using the 'qs' package. It constructs the file name based on various inputs and stores additional metadata if the object is a Seurat object. The saving path can be adjusted by the presence of 'OutDir' in the global environment or defaults to the working directory.

Usage

xsave(
  obj,
  suffix = NULL,
  prefix = NULL,
  nthreads = if (object.size(obj) < 1e+07) 1 else .getNrCores(12),
  preset = "high",
  project = getProject(),
  dir = if (exists("OutDir")) OutDir else getwd(),
  showMemObject = TRUE,
  saveParams = if (exists("p")) TRUE else FALSE,
  paramList = if (exists("p")) p else NULL,
  allGenes = if (exists("all.genes")) all.genes else NULL,
  saveLocation = TRUE,
  backgroundJob = FALSE,
  v = TRUE
)

Arguments

obj

The R object to be saved.

suffix

Optional; a suffix to add to the filename.

prefix

Optional; a prefix to add to the filename.

nthreads

Number of threads to use when saving, defaults to 12.

preset

Compression preset, defaults to 'high'.

project

The project name to be included in the filename, defaults to the result of getProject().

dir

Output Directory

showMemObject

Logical; if TRUE, displays the memory size of the largest objects.

saveParams

Logical; if TRUE and if the object is a Seurat object, additional parameters are saved within it.

paramList

Optional; a list of parameters to save within the Seurat object.

allGenes

Optional; a list of all genes to save within the Seurat object.

saveLocation

Logical; if TRUE and if the object is a Seurat object, file location is saved into misc slot.

backgroundJob

NOT IMPLEMENTED. Logical; if TRUE, the compression is done in the background.

v

Verbose output.

Value

Invisible; The function is called for its side effects (saving a file) and does not return anything.

Note

The function uses the 'qs' package for quick and efficient serialization of objects and includes a timing feature from the 'tictoc' package.

See Also

qsave for the underlying save function used.


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.