harreman.tools.compute_interacting_cell_scores

harreman.tools.compute_interacting_cell_scores#

harreman.tools.compute_interacting_cell_scores(adata, center_counts_for_np_test=False, test='both', restrict_significance='both', compute_significance='both', M=1000, seed=42, check_analytic_null=False, device=device(type='cpu'), verbose=False)[source]#

Compute interacting cell scores for gene pairs and metabolites.

Parameters:
  • adata (AnnData or str) – AnnData object containing: - uns['model'] and uns['mean'] (expression normalization model) - uns['gene_pairs'], uns['gene_pairs_per_metabolite'] - obsp['weights']: sparse spatial weight matrix - uns['ccc_results'] (for significance filtering)

  • center_counts_for_np_test (bool, optional) – If True, center/normalize counts prior to the non-parametric test.

  • test ({"parametric", "non-parametric", "both"}) – Which interacting cell score tests to compute.

  • restrict_significance ({"gene pairs", "metabolites", "both"}) – Use only significant gene pairs/metabolites from CCC results.

  • compute_significance ({"parametric", "non-parametric", "both"}) – Whether to compute significance (p-values, FDR) in each test.

  • M (int, default 1000) – Number of permutations for the non-parametric test.

  • seed (int, default 42) – Random seed for permutation reproducibility.

  • check_analytic_null (bool, default False) – If True, evaluate the analytic null distribution during permutations.

  • device (torch.device) – CPU or GPU device for tensor operations.

  • verbose (bool, default False) – Print status updates.

Returns:

Results are stored in adata.uns['interacting_cell_results'].

Return type:

None