writeH5 {rliger} | R Documentation |
Write in-memory data into H5 file
Description
This function writes in-memory data into H5 file by default in 10x cellranger
HDF5 output format. The main goal of this function is to allow users to
integrate large H5-based dataset, that cannot be fully loaded into memory,
with other data already loaded in memory using runOnlineINMF
.
In this case, users can write the smaller in-memory data to H5 file instead
of loading subset of the large H5-based dataset into memory, where
information might be lost.
Basing on the goal of the whole workflow, the data will always be written in a CSC matrix format and colnames/rownames are always required.
The default method coerces the input to a dgCMatrix. Methods for other container classes tries to extract proper data and calls the default method.
Usage
writeH5(x, file, ...)
## Default S3 method:
writeH5(x, file, ...)
## S3 method for class 'dgCMatrix'
writeH5(
x,
file,
overwrite = FALSE,
indicesPath = "matrix/indices",
indptrPath = "matrix/indptr",
dataPath = "matrix/data",
shapePath = "matrix/shape",
barcodesPath = "matrix/barcodes",
featuresPath = "matrix/features/name",
...
)
## S3 method for class 'ligerDataset'
writeH5(x, file, ...)
## S3 method for class 'liger'
writeH5(x, file, useDatasets, ...)
Arguments
x |
An object with in-memory data to be written into H5 file. |
file |
A character string of the file path to be written. |
... |
Arguments passed to other S3 methods. |
overwrite |
Logical, whether to overwrite the file if it already exists.
Default |
indicesPath , indptrPath , dataPath |
The paths inside the H5 file where
the dgCMatrix constructor |
shapePath |
The path inside the H5 file where the shape of the matrix
will be written to. Default |
barcodesPath |
The path inside the H5 file where the barcodes/colnames
will be written to. Default |
featuresPath |
The path inside the H5 file where the features/rownames
will be written to. Default |
useDatasets |
For liger method. Names or indices of datasets to be written to H5 files. Required. |
Value
Nothing is returned. H5 file will be created on disk.
See Also
10X cellranger H5 matrix detail
Examples
raw <- rawData(pbmc, "ctrl")
writeH5(raw, tempfile(pattern = "ctrl_", fileext = ".h5"))