drvi.utils.plotting.make_balanced_subsample#
- drvi.utils.plotting.make_balanced_subsample(adata, col, min_count=10)[source]#
Create a balanced subsample of AnnData based on a categorical column.
This function creates a balanced subsample by sampling an equal number of cells from each category in the specified column, ensuring balanced representation.
- Parameters:
- Return type:
- Returns:
AnnData Balanced subsample of the input AnnData object.
Notes
The function uses a fixed random state (0) for reproducible results. If a category has fewer samples than
min_count, sampling is done with replacement.