c2v.utils.gs#
- c2v.utils.gs(adata, use_rep='X_pca', batch_key=None, n=0.2, obs_key='gs', random_state=42, progress_bar=False)#
Function to perform geometric sketching on an AnnData object. Might be useful to identify test and validation sets for model training. If batch_key is provided, the sketching is performed within each batch.
- Parameters:
- adata sc.AnnData
Annotated data matrix at the cell level.
- use_rep str, optional
Representation to use for geometric sketching, by default “X_pca”.
- batch_key str | None, optional
Key in adata.obs to use for batch-specific sketching, by default None.
- n float | int, optional
Either a fraction between 0 and 1 or an integer between 1 and the number of cells to sketch, by default 0.2.
- obs_key str, optional
Name of the new column in adata.obs to store sketching labels, by default “gs”.
- random_state int, optional
Random seed for reproducibility, by default 42.
- progress_bar bool, optional
Whether to display a progress bar, by default False.
- Return type:
- Returns:
None The adata object is modified in place with the new sketching labels stored in .obs[obs_key]. The parameters used for the sketching are stored in adata.uns[“gs”].