troutpy.tl.segmentation_free_clustering#
- troutpy.tl.segmentation_free_clustering(sdata, params=None, layer='transcripts', coord_keys=None, gene_key='feature_name', method='points2regions', transcript_id_key='transcript_id_key', copy=False)#
Clusters transcriptomic data without relying on pre-defined cell or tissue segmentations.It supports multiple clustering methods, with Points2Regions being the default.
- Parameters:
sdata (spatialdata.SpatialData) – A spatial data object containing transcriptomic information.
params (
Optional[dict] (default:None)) – A dictionary of parameters for the selected clustering method.Forpoints2regions:coord_keys (
Optional[list] (default:None)) – List of x and y gene columns within sdata[layer]y (str) – Column name for the y-coordinates of transcripts.
gene_key (str) – Column name for the feature names.
method (str) –
- Clustering method to use. Options:
’points2regions’: Uses the Points2Regions algorithm for clustering.
’sainsc’: Placeholder for another clustering method.
transcript_id_key (str) – Column name for the transcript IDs.
copy (bool) – If True, returns a copy of the clustering results. If False, updates
sdatain-place.
- Returns:
anndata.AnnData If
copyis True, returns an AnnData object containing the clustering results.Otherwise, updates thesdataobject in-place and returns None.