COSIE.linkage_construction.compute_linkages_per_subgraph

compute_linkages_per_subgraph(sub_data_dict, sec1, sub1_idx, sec2, sub2_idx, modality_pairs, num_hvg=3000)[source]

Compute triplet linkages between two spatial subgraphs, each from a different section.

This function operates on spatially partitioned data (e.g., from split_raw_data) and generates triplet-based cross-section linkages across paired subgraphs. It supports both strong and weak modality linkage based on the specified modality pairs.

Parameters

sub_data_dictdict

A nested dictionary containing split AnnData objects for each modality within each subgraph per section.

sec1str

Name of the first section (e.g., ‘s1’).

sub1_idxint

Index of the subgraph within the first section.

sec2str

Name of the second section (e.g., ‘s2’).

sub2_idxint

Index of the subgraph within the second section.

modality_pairslist of tuple of str

List of modality pairs to link across the two subgraphs. Each pair is a tuple like (‘RNA’, ‘RNA’) or (‘RNA’, ‘Protein’).

num_hvgint, optional

Number of highly variable features to retain for linkage construction. Default is 3000.

Returns

tripletsnp.ndarray

A NumPy array of shape (n_triplets, 3), where each row is a triplet: (anchor_index, positive_index, negative_index).