metachat.pp.LRC_cluster
- metachat.pp.LRC_cluster(adata, LRC_name=None, LRC_source='marker', spatial_index='spatial', density_cutoff=10.0, delta_cutoff=10.0, outlier_cutoff=2.0, fraction=0.02, plot_savepath=None)[source]
Perform local density clustering on unfiltered LRC candidate points.
This function applies a density–delta based clustering (as implemented in pydpc.dpc.Cluster) to identify candidate regions corresponding to a specific long-range channel (LRC). The results are visualized as density–delta plots and spatial cluster assignments.
Parameters
- adataanndata.AnnData
Annotated data matrix (
n_obs × n_var) containing spatial coordinates.- LRC_namestr
Name of the long-range channel (e.g.
'Blood'or'CSF').- LRC_sourcestr, default=’marker’
Type of source feature used for identifying LRC candidates (included in the key name).
- spatial_indexstr, default=’spatial’
Key in
adata.obsmstoring spatial coordinates for clustering.- density_cutofffloat, default=10.0
Threshold for selecting cluster centers based on local density.
- delta_cutofffloat, default=10.0
Threshold for selecting cluster centers based on delta distance.
- outlier_cutofffloat, default=2.0
Density cutoff for filtering out low-density outliers.
- fractionfloat, default=0.02
Fraction of points relative to total used to estimate local density and delta.
- plot_savepathstr, optional
Path to save the clustering diagnostic plots (e.g.,
'results/LRC_cluster.png'). If None, the plot will be displayed interactively.
Returns
- LRC_clusterpydpc.dpc.Cluster
The cluster object containing attributes such as density, delta, membership, and outlier, which can be used as input for
mc.pp.LRC_filtered().
Notes
The function requires that
mc.pp.LRC_unfiltered()has been run beforehand, which stores unfiltered LRC candidates inadata.obs['LRC_<LRC_name>_<LRC_source>_unfiltered'].