COSIE.linkage_construction.perform_strong_linkage_knn

perform_strong_linkage_knn(data1, data2)[source]

Construct triplet pairs between two sections of the same modality using symmetric KNN-based linkage.

This function is designed to identify strong linkages between shared-modality data across two tissue sections. For each anchor cell, a positive sample is selected from the other section, and a negative sample is randomly selected from the same section as the anchor.

Parameters

data1np.ndarray

Feature matrix of dataset 1, of shape (n1, d).

data2np.ndarray

Feature matrix of dataset 2, of shape (n2, d).

Returns

tripletsnp.ndarray

An array of shape (n1 + n2, 3), where each row contains:

  • anchor index

  • positive index (from the other section via KNN)

  • negative index (randomly chosen from the same section as anchor)

Indices are in concatenated form:

  • [0, …, n1 - 1] for data1

  • [n1, …, n1 + n2 - 1] for data2