bioalpha.h5ad_map.H5ADMap.diet_subset
- H5ADMap.diet_subset(subset_path: Path, X: str | None = 'X', keys: List[str] | None = None, row_index: ndarray | str | None = None, col_index: ndarray | str | None = None, copy: bool | None = True)
Subset an anndata with list of keys request. Obs and var are always kept in the new file.
- Parameters:
subset_path (str) – path to save new file.
X (str, default =
X
) – matrix using for X in new file, it can beX
,layers/...
or None.keys (Optional[List[str]], default =
None
) – features to keep in new file. Ex: “uns”, “obsm”, “obsm/X_pca”, …row_index (Union[np.ndarray, str], default =
None
) – slice obs index or feature inobs
. It must be a bool array.col_index (Union[np.ndarray, str], default =
None
) – slice var index or feature invar
. It must be a bool array.copy (Optional[
bool
], default =False
) – Whether return the H5ADMap or not.
- Returns:
A subset H5ADMap, raw_file is save as self._raw_file.
- Return type:
If copy