snapatac2.AnnDataSet.split_obs_by#

AnnDataSet.split_obs_by(key, out_dir='./')#

Split the AnnDataSet object into multiple AnnData objects based on grouping keys. The length of the grouping keys must match the number of observations.

Parameters:
  • key (str | list[str]) – Grouping key(s). Can be a single column name or a list of column names in obs. The grouping keys may contain None values, in which case the corresponding observations are ignored.

  • out_dir (Path) – Output directory to save the split AnnData files.

Returns:

A dictionary mapping each unique key to its corresponding AnnData object.

Return type:

dict[str, AnnData]