adataviz.adata module¶
- class adataviz.adata.AnnDataCollection(adata_paths: List[str], adata: AnnData | None = None, source_info: List[Dict] | None = None)[source]¶
Bases:
objectWrapper representing a merged collection of AnnData files. .. rubric:: Example
ds = AnnDataCollection.from_files([“a.h5ad”, “b.h5ad”], out_path=”merged.h5ad”) view = ds[[True]*100, [“GeneA”, “GeneB”]] adata = view.to_memory()
- classmethod from_files(paths: Sequence[str], out_path: str | None = None, metadata_path: str | None = None) AnnDataCollection[source]¶
Create a merged AnnDataCollection from existing .h5ad files. This will merge obs (stacked) and var (union by var_names). X is not merged; the saved on-disk AnnData will contain an empty sparse matrix of shape (n_obs_total, n_vars_total).
- classmethod read(path: str) AnnDataCollection[source]¶
Load a merged .h5ad file created by from_files and return an AnnDataCollection.
Expects src_paths (or individual_adata_paths) in adata.uns and src_info which may be JSON-serialized or a list.
- update_paths(mapping: Dict[str, str] | None = None, search_dirs: Sequence[str] | None = None, recursive: bool = True) Dict[str, str | None][source]¶
Update stored source paths after files have been moved.
Parameters - mapping: optional dict mapping old_path -> new_path. If provided,
entries in adata_paths will be replaced according to this map.
search_dirs: optional sequence of directories to search for moved files by matching basenames (first match wins). Used when mapping is not provided or doesn’t contain an entry for a given source.
recursive: if True, search directories recursively when using search_dirs.
Returns a dict mapping the original absolute path -> new absolute path (or None if not found).
- class adataviz.adata.AnnDataView(dataset: AnnDataCollection, obs_idx: ndarray | None = None, var_names: List[str] | None = None)[source]¶
Bases:
objectHelper representing a (cells, genes) subset of an AnnDataCollection. Call to_memory() to read and assemble the actual AnnData with X.
- adataviz.adata.is_annadatacollection(path: str) bool[source]¶
Return True if path points to an AnnData file produced by AnnDataCollection.from_files. Heuristic: the AnnData must have uns entries src_paths or individual_adata_paths and its obs must contain either _source_idx or _orig_obs_name markers.