scanpex.pp package
Module contents
- scanpex.pp.get_quantiles(data, metrics, by=0.1, area=None)[source]
Calculate quantiles for a specified metric in the observation metadata.
- Parameters:
data (ad.AnnData) – The annotated data matrix.
metrics (str) – The column name in data.obs for which to calculate quantiles.
by (float, optional) – The step size for generating quantile thresholds if area is None. Creates a range from 0 to 1 with this step, excluding the 0th percentile. By default 0.1.
area (list of float, optional) – A specific list of quantile thresholds (between 0 and 1) to compute. If provided, by is ignored. By default None.
- Returns:
The calculated quantile values corresponding to the requested thresholds.
- Return type:
list of float
- scanpex.pp.scrublet(adata, remove=False, update=False, **kwargs)[source]
Run Scrublet to predict and optionally remove doublets.
This function wraps scanpy.pp.scrublet. It checks if doublet prediction has already been performed to avoid redundant computation unless update is set to True.
- Parameters:
adata (ad.AnnData) – The annotated data matrix of shape (n_obs, n_vars).
remove (bool, optional) – If True, returns a new AnnData object with predicted doublets removed. If False, modifies adata in-place by adding ‘predicted_doublet’ column to .obs. By default False.
update (bool, optional) – If True, forces re-execution of Scrublet even if ‘predicted_doublet’ already exists in adata.obs. By default False.
**kwargs – Additional keyword arguments passed to scanpy.pp.scrublet.
- Returns:
If remove is True, returns a subsetted AnnData object with doublets filtered out. Otherwise, returns None (updates adata in-place).
- Return type:
ad.AnnData or None