sparrow.pl.score_genes

Contents

sparrow.pl.score_genes#

sparrow.pl.score_genes(sdata, table_layer, celltypes, img_layer=None, shapes_layer='segmentation_mask_boundaries', crd=None, filter_index=None, output=None)#

Function generates following plots:

  • umap of assigned celltype next to umap of calculated cleanliness.

  • umap of assigned celltype next to umap of assigned leiden cluster.

  • assigned celltype for all cells in region of interest (crd).

  • a heatmap of the assigned leiden cluster for each cell type.

  • a heatmap of the assigned leiden cluster for each cell type, with leiden cluster >= filter_index.

Parameters:
  • sdata (SpatialData) – Data containing spatial information for plotting.

  • table_layer (str) – The table layer in sdata to visualize.

  • celltypes (list[str]) – list of celltypes to plot.

  • img_layer (Optional[str] (default: None)) – Image layer to be plotted. If not provided, the last image layer in sdata will be used.

  • shapes_layer (str (default: 'segmentation_mask_boundaries')) – Name of the layer containing segmentation mask boundaries, by default “segmentation_mask_boundaries”.

  • crd (Optional[tuple[int, int, int, int]] (default: None)) – The coordinates for a region of interest in the format (xmin, xmax, ymin, ymax). Only used for plotting purposes.

  • filter_index (Optional[int] (default: None)) – Index used to filter leiden clusters when plotting the heatmap. Only leiden clusters >= filter index will be plotted.

  • output (Optional[str] (default: None)) – Filepath to save the plots. If not provided, plots will be displayed without being saved.

Return type:

None

Returns:

: None

Notes

This function uses scanpy for plotting and may save multiple plots based on the output parameter.