netmap.masking.internal.create_pairwise_binary_mask¶
- netmap.masking.internal.create_pairwise_binary_mask(binary_matrix, gene_list, source_list, target_list)[source]¶
Creates a dense 2D array of pairwise masks using preallocation.
Edge genes are passed as separate
source_list/target_listarrays rather than parsed from “GeneA_GeneB” strings, since gene names may themselves contain underscores and would make that split ambiguous.- Parameters:
binary_matrix (np.ndarray) – Rows=cells, Cols=genes.
gene_list (list) – The names of the genes in binary_matrix columns.
source_list (Sequence[str]) – Source gene of each requested edge, in the order the output columns should follow.
target_list (Sequence[str]) – Target gene of each requested edge, aligned with
source_list.
- Returns:
A 2D array of shape (num_cells, len(source_list)).
- Return type:
np.ndarray