sparrow.pl.cluster_cleanliness#
- sparrow.pl.cluster_cleanliness(sdata, table_layer, img_layer=None, shapes_layer='segmentation_mask_boundaries', crd=None, color_dict=None, celltype_column='annotation', output=None)#
Generate plots that allow assessing the “cleanliness” or accuracy of the cell clustering:
a barplot with a bar for each cluster, showing the composition by cell type of that cluster;
a UMAP with cells colored by cell type;
an image of the tissue with cells colored by cell type.
- Parameters:
sdata (
SpatialData
) – SpatialData object containing the spatial data and annotations.table_layer (
str
) – The table layer insdata
to visualize.img_layer (
Optional
[str
] (default:None
)) – Name of the imgage layer insdata
(default is None).shapes_layer (
str
(default:'segmentation_mask_boundaries'
)) – Name of the shapes layer insdata
object (default is “segmentation_mask_boundaries”).crd (
Optional
[tuple
[int
,int
,int
,int
]] (default:None
)) – An optional rectangle [xmin, xmax, ymin, ymax] (default is None). If specified, the tissue image will be cropped to this rectangle, otherwise the full image will be displayed.color_dict (
Optional
[dict
] (default:None
)) – Custom colormap dictionary for coloring cell types in the barplot.celltype_column (
str
(default:'annotation'
)) – Name of the column insdata.tables[table_layer]
containing cell type annotations (default is_ANNOTATION_KEY
).output (
Optional
[str
] (default:None
)) – The file path prefix for the plots (default is None). If provided, the plots will be saved to the specified output file path with “_barplot.png”, “_{celltype_column}.png”, “_{celltype_column}_crop.png” and “_{celltype_column}_umap.png” as suffixes. If None, the plots will be displayed directly without saving.
- Return type:
None
- Returns:
: None