scanpy.write

Contents

scanpy.write#

scanpy.write(filename, adata, *, ext=None, compression='gzip', compression_opts=None)[source]#

Write AnnData objects to file.

Parameters:
filename Path | str

If the filename has no file extension, it is interpreted as a key for generating a filename via sc.settings.writedir / (filename + sc.settings.file_format_data). This is the same behavior as in read().

adata AnnData

Annotated data matrix.

ext Optional[Literal['h5', 'csv', 'txt', 'npz']] (default: None)

File extension from wich to infer file format. If None, defaults to sc.settings.file_format_data.

compression Optional[Literal['gzip', 'lzf']] (default: 'gzip')

See https://docs.h5py.org/en/latest/high/dataset.html.

compression_opts int | None (default: None)

See https://docs.h5py.org/en/latest/high/dataset.html.