serialize: Save and load FacileAnalysisResult objects to/from disk.

fsaveR Documentation

Save and load FacileAnalysisResult objects to/from disk.

Description

[Experimental]

Saving and loading FacileAnalysisResults can be tricky because they rely on a chain of parent objects that created them, all of which have a reference to the FacileDataStore that they came from.

Currenly, the FacileDataStore is removed from every internal object when before it is serialized via fsave(). The FacileDataStore is then restored to "just where it needs to be" (using strong assumptions of where it needs to be, instead of logging where it was removed from in fsave()) when brought back to life via fload().

Usage

fsave(x, file, with_fds = FALSE, ...)

fload(x, fds = NULL, anno = NULL, with_fds = TRUE, ...)

Arguments

x

A FacileAnalysisResult object.

file

A path to a file to save. If filename ends with '.rds', then object will be serialized with saveRDS. If filename ends with '.qs', then qs::qsave will be used. In teh future, we should support base::connections.

with_fds

Serialize the FacileDataStore with the object? Default is FALSE and you should have a good reason to change this behavior.

fds

The FacileDataStore the object was run on.

Details

An fsave_info attribute will be attached to the serialized object before saving which will be a list that holds information required to materialize the analysis result successfully. Minimally this will include info about how to reconstitute and attach the FacileDataStore that the object was generated from.

Elements of fsave_info list so far include:

  • fds_class: A string indicating the class of the FacileDataStore that the result x was generated from.

  • fds_path: The path on the filesystem that teh FacileDataStore can be found. Currently we expect this to be a FacileDataSet

  • fds_anno_dir: The annotation directory for the FacileDataSet

  • fds_add: A descriptor that indicate which elements in the serialized object should have the fds attached to them, besides itself.

Value

NULL for fsave, the (correctly sublcassed) FacileAnalysisResult for fload, along with FacileDataStore (fds) attached


facileverse/FacileAnalysis documentation built on Sept. 26, 2024, 3:19 p.m.