grassp.tl.leiden_mito_sweep

grassp.tl.leiden_mito_sweep#

leiden_mito_sweep(data, starting_resolution=0.5, resolution_increments=0.5, min_mito_fraction=0.9, increment_threshold=0.005, protein_ground_truth_column='protein_ground_truth', **leiden_kwargs)[source]#

Find optimal leiden clustering resolution based on mitochondrial protein clustering.

Performs a binary search to find the highest resolution that keeps mitochondrial proteins clustered together above a minimum fraction threshold.

Parameters:
data AnnData

Annotated data matrix with proteins as observations (rows)

starting_resolution float (default: 0.5)

Initial resolution parameter for leiden clustering

resolution_increments float (default: 0.5)

Step size for adjusting resolution during binary search

min_mito_fraction float (default: 0.9)

Minimum fraction of mitochondrial proteins that should be in the same cluster

increment_threshold float (default: 0.005)

Minimum step size before stopping binary search

protein_ground_truth_column str (default: 'protein_ground_truth')

Column in data.obs containing protein localization annotations

**leiden_kwargs

Additional keyword arguments passed to scanpy.tl.leiden()

Return type:

None

Returns:

None Modifies data.obs[‘leiden’] and data.uns[‘leiden’] inplace