mantispy.io.read#
- mantispy.io.read(path, backed=None, migrate_schema=True, lazy=False)[source]#
Read a mantispy h5ad or zarr store, checking its schema version.
- Parameters:
- path
str|Path File to read. A
.zarrsuffix selects the zarr reader.- backed
Literal['r','r+'] |None(default:None) "r"leavesXon disk and reads it a group at a time.obsandvarare always in memory, so QC, feature flags and metadata work unchanged, but a function that rewritesXneedscopy=Trueorkey_added=. h5ad only; zarr stores are read whole.- migrate_schema
bool(default:True) Bring an older but known schema up to the current one on read. Set it to
Falseto see the version the file carries.- lazy
bool(default:False) Hold
Xand every layer as a dask array read in row chunks, for a screen that does not fit in memory.obs,var,obsmandunsare read into memory.normalize(),tvn()andaggregate()stream it and give the same numbers as in memory, as doesscanpy.pp.pca()withsvd_solver="covariance_eigh"; a function that needs the whole matrix warns before it reads it. Needs dask, frommantispy[lazy], and cannot be combined withbacked.
- path
- Return type:
- Returns:
The object, backed, lazy or in memory.
adata.to_memory()loads a backed one into memory.- Raises:
ImportError –
lazywas given and dask is not installed.ValueError –
backedwas given for a zarr store or together withlazy, or the file carries a schema version this build cannot migrate from or was told not to migrate.