COSIE.downstream_analysis

Functions

cluster_and_visualize

Cluster cell embeddings and visualize the results for each tissue section at the spot level.

cluster_and_visualize_superpixel

Perform clustering on superpixel embeddings across multiple tissue sections and visualize the results.

create_normalized_adata

Create a new AnnData object by min-max scaling the expression matrix of the input adata.

highlight_joint_clusters_all_sections

Visualize and highlight specified clusters across all tissue sections.

merge_clusters_to_new_ids

Merge specified cluster IDs into new classes with IDs starting from current max + 1.

perform_prediction

Perform KNN-based prediction for a specific modality in a target tissue section.

plot_histology_clusters

Visualize cluster maps from 2D cluster masks.

plot_marker_comparison

Compare the spatial expression pattern of a specified molecule (e.g., gene, protein..) across two tissue sections at the spot level, each represented by an AnnData object.

plot_marker_comparison_superpixel

Plot side-by-side spatial expression comparison of a target molecule at the superpixel level.

prepare_image

Prepare a 2D image from molecule expression and spatial coordinates in an AnnData object.

relabel_clusters_sequentially

Relabel all cluster IDs across sections to contiguous integers starting from 0.

truncate_gene_expression_smartclip

Truncate expression data based on non-zero values to reduce the impact of extreme outliers in visualization.

visualize_global_cluster_centroid_dendrogram

Visualize dendrogram for clusters shared across sections.

visualize_section_cluster_centroids_dendrogram

Visualize hierarchical clustering dendrogram within a single section.