Restore links (to HDF5 files) for reloaded liger/ligerDataset object
Source:R/h5Utility.R
restoreH5Liger.Rd
When loading the saved liger object with HDF5 data in a new R session, the links to HDF5 files would be closed. This function enables the restoration of those links so that new analyses can be carried out.
Arguments
- object
liger or ligerDataset object.
- filePath
Paths to HDF5 files. A single character path for ligerDataset input or a list of paths named by the datasets for liger object input. Default
NULL
looks for the path(s) of the last valid loading.- file.path
Will be deprecated with
restoreOnlineLiger
. The same asfilePath
.
Examples
h5Path <- system.file("extdata/ctrl.h5", package = "rliger")
tempPath <- tempfile(fileext = ".h5")
file.copy(from = h5Path, to = tempPath)
#> [1] TRUE
lig <- createLiger(list(ctrl = tempPath))
#> Found more than one class "H5D" in cache; using the first, from namespace 'rliger'
#> Also defined by ‘hdf5r’
#> Found more than one class "H5D" in cache; using the first, from namespace 'rliger'
#> Also defined by ‘hdf5r’
#> Found more than one class "H5D" in cache; using the first, from namespace 'rliger'
#> Also defined by ‘hdf5r’
#> ! No human mitochondrial gene found in the union of dataset "ctrl"
#> ℹ calculating QC for dataset "ctrl"
#>
#> ℹ Updated QC variables: "nUMI", "nGene", "mito", "ribo", and "hemo"
#> ℹ calculating QC for dataset "ctrl"
#> ✔ calculating QC for dataset "ctrl" ... done
#>
# Now it is actually an invalid object! which is equivalent to what users
# will get with `saveRDS(lig, "object.rds"); lig <- readRDS("object.rds")``
closeAllH5(lig)
#> ℹ Closing H5 file: /private/var/folders/k9/nwtr_c_57kd43cmbtz82ywlr0000gn/T/Rtmp7iLTzn/filed38f3456de47.h5
lig <- restoreH5Liger(lig)
#> ℹ Restoring dataset "ctrl"
#> Found more than one class "H5D" in cache; using the first, from namespace 'rliger'
#> Also defined by ‘hdf5r’
#> ℹ Restoring HDF5 link from: /private/var/folders/k9/nwtr_c_57kd43cmbtz82ywlr000…
#> Found more than one class "H5D" in cache; using the first, from namespace 'rliger'
#> Also defined by ‘hdf5r’
#> Found more than one class "H5D" in cache; using the first, from namespace 'rliger'
#> Also defined by ‘hdf5r’
#> Found more than one class "H5D" in cache; using the first, from namespace 'rliger'
#> Also defined by ‘hdf5r’
#> ✔ Restoring HDF5 link from: /private/var/folders/k9/nwtr_c_57kd43cmbtz82ywlr000…
#>
#> ℹ Restoring dataset "ctrl"
#> ✔ Restoring dataset "ctrl" ... done
#>