Utilize the Anndata h5ad file format for storing and sharing single-cell expression data. Provided are tools for writing objects to h5ad files, as well as reading h5ad files into a Seurat object
ReadH5AD(file, ...)WriteH5AD(object, ...)
# S3 method for character
ReadH5AD(file, assay = "RNA", layers = "data",
verbose = TRUE, ...)
# S3 method for H5File
ReadH5AD(file, assay = "RNA", layers = "data",
verbose = TRUE, ...)
# S3 method for Seurat
WriteH5AD(object, file, assay = NULL, graph = NULL,
verbose = TRUE, overwrite = FALSE, ...)
Name of h5ad file, or an H5File object for reading in
arguments passed to other methods
An object
Name of assay to store
Slot to store layers as; choose from 'counts' or 'data'; pass
FALSE
to not pull layers; may pass one value of 'counts' or 'data' for
each layer in the H5AD file, must be in order
Show progress updates
Name of graph to write out, defaults to paste0(assay, '_snn')
Overwrite existing file
ReadH5AD
: A Seurat object with data from the h5ad file
WriteH5AD
: None, writes to disk
ReadH5AD
and WriteH5AD
will try to automatically fill slots based
on data type and presence. For example, objects will be filled with scaled and
normalized data if adata.X
is a dense matrix and raw
is present
(when reading), or if the scale.data
slot is filled (when writing). The
following is a list of how objects will be filled
adata.X
is dense and adata.raw
is filled; ScaleData
is filledObjects will be filled with scaled and normalized data
adata.X
is sparse and adata.raw
is filled; NormalizeData
has been run, ScaleData
has not been run
Objects will be filled with normalized and raw data
adata.X
is sparse and adata.raw
is not filled; NormalizeData
has not been runObjects will be filled with raw data only
In addition, dimensional reduction information and nearest-neighbor graphs will be searched for and added if and only if scaled data is being added.
When reading: project name is basename(file)
; identity classes will be
set as the project name; all cell-level metadata from adata.obs
will be
taken; feature level metadata from data.var
and adata.raw.var
(if present) will be merged and stored in assay meta.features
; highly
variable features will be set if highly_variable
is present in feature-level
metadata; dimensional reduction objects will be given the assay name provided
to the function call; graphs will be named assay_method
if method is
present, otherwise assay_adata
When writing: only one assay will be written; all dimensional reductions and
graphs associated with that assay will be stored, no other reductions or graphs
will be written; active identity classes will be stored in adata.obs
as
active_ident