interscale.evaluation.calculate_gene_ranks

interscale.evaluation.calculate_gene_ranks#

interscale.evaluation.calculate_gene_ranks(adata, *, layers_local_pred='layers_local', layers_global_pred='layers_global', top_n=None)#

Calculate gene ranks comparing local and global model predictions.

Computes R² scores for both local and global predictions, merges the results, and calculates ranking statistics. Optionally prints top genes.

Parameters:
  • adata (AnnData) – AnnData object containing the data and prediction layers

  • layers_local_pred (str (default: 'layers_local')) – Name of the local model prediction layer. Defaults to ‘layers_local’.

  • layers_global_pred (str (default: 'layers_global')) – Name of the global model prediction layer. Defaults to ‘layers_global’.

  • top_n (int (default: None)) – Number of top genes to print for each category. If None, no printing occurs. Defaults to None.

Return type:

DataFrame

Returns:

pd.DataFrame DataFrame with columns: gene, Local Rank, Global Rank, Rank Difference, Avg Rank