writeH5AD: Write H5AD

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/write.R

Description

Write a H5AD file from a SingleCellExperiment object.

Usage

1
writeH5AD(sce, file, X_name = NULL, skip_assays = FALSE)

Arguments

sce

A SingleCellExperiment object.

file

String containing a path to write the new .h5ad file.

X_name

Name of the assay to use as the primary matrix (X) of the AnnData object. If NULL, the first assay of sce will be used by default.

skip_assays

Logical scalar indicating whether assay matrices should be ignored when writing to file.

Details

Setting skip_assays=TRUE can occasionally be useful if the matrices in sce are stored in a format that is not amenable for efficient conversion to a numpy-compatible format. In such cases, it can be better to create an empty placeholder dataset in file and fill it in R afterwards.

When first run, this function will instantiate a conda environment containing all of the necessary dependencies. This will not be performed on any subsequent run or if any other zellkonverter function has been run prior to this one.

The anndata package automatically converts some character vectors to factors when saving .h5ad files. This can effect columns of rowData(sce) and colData(sce) which may change type when the .h5ad file is read back into R.

Value

A NULL is invisibly returned.

Author(s)

Luke Zappia

Aaron Lun

See Also

readH5AD(), to read a SingleCellExperiment file from a H5AD file.

SCE2AnnData(), for developers to create an AnnData object from a SingleCellExperiment.

Examples

1
2
3
4
5
6
7
8
9
# Using the Zeisel brain dataset
if (requireNamespace("scRNAseq", quietly = TRUE)) {
    library(scRNAseq)
    sce <- ZeiselBrainData()

    # Writing to a H5AD file
    temp <- tempfile(fileext = ".h5ad")
    writeH5AD(sce, temp)
}

zellkonverter documentation built on March 10, 2021, 2 a.m.