tirank.Visualization.plot_STmap

tirank.Visualization.plot_STmap(savePath, group)[source]

Generates a composite spatial map for ST data showing cluster hubs.

This function is for Spatial Transcriptomics (ST) data. It loads prediction scores, cluster-to-rank mappings from a JSON file, and the AnnData object. It creates a new ‘new_Rank_Label’ based on the hub classification (‘Rank+’, ‘Rank-’, ‘Background’) of each spot’s group. It then saves a figure with three subplots: 1. Spatial plot colored by the original group. 2. The H&E image alone. 3. Spatial plot colored by ‘new_Rank_Label’ overlaid on the H&E image.

Parameters:
  • savePath (str) – The base directory containing ‘2_preprocessing’ and ‘3_Analysis’.

  • group (str) – The column name used for grouping (e.g., ‘cluster’) which corresponds to the JSON file (f”{group}_category_dict.json”).

Returns:

None

Raises:

ValueError – If the specified group column is not found in the loaded DataFrame.