Create an H5AD file from a liger object. This function writes
only raw counts to adata.X
, while normalized and scaled expression
data will not be written, because LIGER use different normalization and
scaling strategy than most of the other tools utilizing H5AD format.
Supports for single sparse matrices or internal ligerDataset objects are also provided if there is a need to convert single datasets.
writeH5AD(object, ...)# S3 method for dgCMatrix
writeH5AD(
object,
filename,
obs = NULL,
var = NULL,
overwrite = FALSE,
verbose = getOption("ligerVerbose", TRUE),
...
)
# S3 method for ligerDataset
writeH5AD(
object,
filename,
obs = NULL,
overwrite = FALSE,
verbose = getOption("ligerVerbose", TRUE),
...
)
# S3 method for liger
writeH5AD(
object,
filename,
overwrite = FALSE,
verbose = getOption("ligerVerbose", TRUE),
...
)
No return value, an H5AD file is written to disk with the following
specification, assuming the file is loaded to adata
in Python:
adata.X
- Raw count CSR matrix, outer joined with all
datasets
adata.obs
- Cell metadata, with exactly same content of
cellMeta(object)
adata.var
- Feature metadata containing only the feature names
as the index of pd.DataFrame
.
adata.obsm['X_inmf_aligned']
- The integrated embedding,
aligned cell factor loading matrix, the primary output of LIGER, if
available.
adata.obsm['X_inmf']
- The raw cell factor loading matrix, if
available.
adata.obsm['<dimRedName>']
- The dimensional reduction matrix,
such as UMAP or TSNE, if available.
adata.uns['inmf']['W']
- The shared factor feature loading
matrix, if available.
adata.uns['inmf']['V']['<datasetName>']
- The dataset-specific
factor feature loading matrix, if available.
adata.uns['inmf']['features']
- The variable features being
used for factorization, supposed to match to the second shape of W and V,
if available.
adata.uns['inmf']['lambda']
- The hyperparameter lambda used,
the regularization parameter for the factorization, if available.
adata.uns['inmf']['k']
- The number of factors used for the
factorization, if available.
One of liger, ligerDataset or dgCMatrix-class object.
Arguments passed down to S3 methods
A character string, the path to the H5AD file to be written
External data.frame that contains metadata of the cells but does not embed inside the object. Rownames must be identical to the colnames of object.
External data.frame that contains metadata of the features but does not embed inside the object. Rownames must be identical to the rownames of object.
Logical, whether to overwrite the file if it exists.
Logical. Whether to show information of the progress. Default
getOption("ligerVerbose")
which is TRUE
if users have not set.
print("The example below works, but causes PDF manual rendering issue for some reason")
if (FALSE) {
writeH5AD(pbmc, filename = tempfile(fileext = ".h5ad"))
}
Run the code above in your browser using DataLab