Convert h5Seurat files to H5AD files
Usage
H5SeuratToH5AD(
source,
dest,
assay = DefaultAssay(object = source),
overwrite = FALSE,
verbose = TRUE,
standardize = FALSE
)Arguments
- source
Source dataset: a Seurat object, filename path, or H5File connection
- dest
Name/path of destination file. If only a file type is provided (e.g., "h5seurat", "h5ad", "loom"), the extension is appended to the source filename (for file sources) or the Seurat project name (for Seurat objects). Supported formats: h5seurat, h5ad, loom
- assay
For h5Seurat -> other formats: name of assay to convert. For other formats -> h5Seurat: name to assign to the assay. Default is "RNA".
- overwrite
Logical; if
TRUE, overwrite an existing destination file. Default isFALSE.- verbose
Logical; if
TRUE(default), show progress updates- standardize
Logical; if
TRUE, convert Seurat-style metadata column names to scanpy/AnnData conventions when converting to h5ad format. For example,nCount_RNAbecomesn_counts,nFeature_RNAbecomesn_genes. Only applicable for conversions to h5ad format. Default isFALSE.
Value
Returns a handle to dest as an H5File
object
h5Seurat to AnnData/H5AD
The h5Seurat to AnnData/H5AD conversion will try to automatically fill in
datasets based on data presence. Data presense is determined by the h5Seurat
index (source$index()). It works in the following manner:
Assay data
Xwill be filled withscale.dataifscale.datais present; otherwise, it will be filled withdatavarwill be filled withmeta.featuresonly for the features present inX; for example, ifXis filled withscale.data, thenvarwill contain only features that have been scaledraw.Xwill be filled withdataifXis filled withscale.data; otherwise, it will be filled withcounts. Ifcountsis not present, thenrawwill not be filledraw.varwill be filled withmeta.featureswith the features present inraw.X; ifraw.Xis not filled, thenraw.varwill not be filled
Dimensional reduction information
Only dimensional reductions associated with assay or marked as
global will be transfered to the H5AD file. For
every reduction reduc:
cell embeddings are placed in
obsmand renamed toX_reducfeature loadings, if present, are placed in
varmand renamed to either “PCs” ifreducis “pca” otherwisereducin all caps
For example, if reduc is “ica”, then cell embeddings will be
“X_ica” in obsm and feature loaodings, if present, will be
“ICA” in varm
Nearest-neighbor graphs
If a nearest-neighbor graph is associated with assay, it will be
added to uns/neighbors/distances; if more than one graph is present,
then only the last graph according to the index will be added.
Layers
Data from other assays can be added to layers if they have the same
shape as X (same number of cells and features). To determine this,
the shape of each alternate assays's scale.data and data slots
are determined. If they are the same shape as X, then that slot
(scale.data is given priority over data) will be added as a
layer named the name of the assay (eg. “SCT”). In addition, the
features names will be added to var as assay_features
(eg. “SCT_features”).