tangram.utils.get_matched_genes

tangram.utils.get_matched_genes(prior_genes_names, sn_genes_names, excluded_genes=None)

Given the list of genes in the spatial data and the list of genes in the single nuclei, identifies the subset of genes included in both lists and returns the corresponding matching indices.

Parameters
  • prior_genes_names (sequence) – List of gene names in the spatial data.

  • sn_genes_names (sequence) – List of gene names in the single nuclei data.

  • excluded_genes (sequence) – Optional. List of genes to be excluded. These genes are excluded even if present in both datasets. If None, no genes are excluded. Default is None.

Returns

mask_prior_indices (list): List of indices for the selected genes in ‘prior_genes_names’.

mask_sn_indices (list): List of indices for the selected genes in ‘sn_genes_names’. selected_genes (list): List of names of the selected genes.

For each i, selected_genes[i] = prior_genes_names[mask_prior_indices[i]] = sn_genes_names[mask_sn_indices[i].

Return type

A tuple (mask_prior_indices, mask_sn_indices, selected_genes), with