CellScope.ga.plot_sankey
CellScope.ga. plot_sankey (label_str : np.ndarray, width : int = 1100, height : int = 600, save_fig : bool = False, save_path : str = ‘./sankey_diagram.png’)
The plot_sankey function generates a Sankey diagram to visualize gene type transitions across different layers.
The diagram illustrates flows among Housekeeper Gene, Type-Related Gene, and Type-Determining Gene,
based on the provided gene labels (label_str).
Parameters
label_str (
np.ndarray):A 2D NumPy array where each column contains gene labels, such as ‘Housekeeper Gene’, ‘Type-Related Gene’, or ‘Type-Determining Gene’.
width (
int, optional, default=1100):Width of the Sankey diagram.
height (
int, optional, default=600):Height of the Sankey diagram.
save_fig (
bool, optional, default=False):If set to True, saves the figure as an image.
save_path (
str, optional, default=’./sankey_diagram.png’):File path where the Sankey diagram is saved. Must have a valid image extension: ‘.png’, ‘.pdf’, or ‘.jpeg’.
Return
gene_counts (
pd.DataFrame):DataFrame showing the number of ‘Housekeeper Gene’, ‘Type-Related Gene’, and ‘Type-Determining Gene’ at each layer.