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.
writeH5(x, file, ...)# S3 method for default
writeH5(x, file, ...)
# S3 method for 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 ligerDataset
writeH5(x, file, ...)
# S3 method for liger
writeH5(x, file, useDatasets, ...)
Nothing is returned. H5 file will be created on disk.
An object with in-memory data to be written into H5 file.
A character string of the file path to be written.
Arguments passed to other S3 methods.
Logical, whether to overwrite the file if it already exists.
Default FALSE.
The paths inside the H5 file where
the dgCMatrix constructor i, p, and x will
be written to, respectively. Default using cellranger convention
"matrix/indices", "matrix/indptr", and "matrix/data".
The path inside the H5 file where the shape of the matrix
will be written to. Default "matrix/shape".
The path inside the H5 file where the barcodes/colnames
will be written to. Default "matrix/barcodes". Skipped if the object
does not have colnames.
The path inside the H5 file where the features/rownames
will be written to. Default "matrix/features/name". Skipped if the
object does not have rownames.
For liger method. Names or indices of datasets to be written to H5 files. Required.
raw <- rawData(pbmc, "ctrl")
writeH5(raw, tempfile(pattern = "ctrl_", fileext = ".h5"))
Run the code above in your browser using DataLab