compact.pairwise_scoring

module to perform pairwise rbo scoring between interaction datasets

Important functions:
  • pairwise_rbo_scoring: perform rbo scoring between two interaction matrices

  • score_comparison: rbo scoring between two correlation datasets

  • determine_top_weightedness: determine contribution of top d ranks to rbo score

  • det_search_deph: determine required search depth for given value for p parameter an mininum score weight

compact.pairwise_scoring.pairwise_rbo_scoring(left_scores, right_scores, mapping=False, p_param=0.9, search_depth=None, processes=1, chunksize=1000)

perform rbo scoring between 2 interaction matrices

Args:
[left|right]_scores (pd df): symmetric interaction matrix

values: within-sample pairwise interaction scores

mapping (bool, optional): Defaults to False.

if not False: mapping (dict): id mapping/orthology between two collections keys: identifiers of “left” collection values: corresponding identifiers of “right” collection

p_param (float, optional): Defaults to 0.90.

Rank Biased Overlap “p” parameter range: 0 to 1 this parameter determines top-weightedness of rbo metric lower values result in more top-weightedness

search_depth (int, optional): Defaults to None.

number of ranks to consider when computing RBO scores if None, considers complete ranked lists

processes (int, optional): Defaults to 1.

number of processes/threads.

Returns:
pd df: rbo scores for all pairs between left right

matrix-structured dataframe with: rows: left index. columns: right index, values are rbo scores

compact.pairwise_scoring.determine_top_weightedness(p, d)

determine the contribution the top d ranks have to the rbo score

taken from https://github.com/changyaochen/rbo/blob/master/rbo/rbo.py

Args:
p (float): Rank Biased Overlap “p” parameter range: 0 to 1

this parameter determines top-weightedness of rbo metric lower values result in more top-weightedness

d (int):

top d ranks for which to determine contribution

Returns:
float: the fraction of the rbo score that is determined

by the top d ranks for the given p parameter

compact.pairwise_scoring.det_search_depth(p, min_weight, shortest_list_len, stepsize=1)

determine required search depth for given p and min_weight

Args:
p (float): Rank Biased Overlap “p” parameter range: 0 to 1

this parameter determines top-weightedness of rbo metric lower values result in more top-weightedness

min_weight (float): minimal weight of contribution to total

rbo score requirement

shortest_list_len (int): length of shortest ranked list to be

used in calculating rbo score (search depth will be maximally this length)

stepsize (int, optional): Defaults to 1.

stepsize for walking over search depth values to consider. will stop if it reaches search depth with adequate weight contribution

Returns:

int: the selected search depth