cospar.pp.refine_state_info_by_leiden_clustering¶
-
cospar.pp.
refine_state_info_by_leiden_clustering
(adata, selected_key='state_info', selected_values=None, resolution=0.5, n_neighbors=20, confirm_change=False, cluster_name_prefix='S')¶ Refine state info by clustering states at given time points.
Select states at desired time points to improve the clustering. When first run, set confirm_change=False. Only when you are happy with the result, set confirm_change=True to update adata.obs[‘state_info’]. The original state_info will be stored at adata.obs[‘old_state_info’].
- Parameters
- adata :
AnnData
object - selected_key
A key in adata.obs, including ‘state_info’, or ‘time_info’
- selected_values : list, optional (default: include all)
A list of clusters/time_points for further sub-clustering. Should be among adata.obs[selected_key].
- adata
- n_neighbors : int, optional (default: 20)
Neighber number for constructing the KNN graph, using the UMAP method.
- resolution : float, optional (default: 0.5)
A parameter value controlling the coarseness of the clustering. Higher values lead to more clusters.
- confirm_change : bool, optional (default: False)
If True, update adata.obs[‘state_info’]
- cluster_name_prefix : str, optional (default: ‘S’)
prefix for the new cluster name to distinguish it from existing cluster names.
- adata :
- Returns
Update adata.obs[‘state_info’] if confirm_change=True.