patpy.tl.test_distances_significance

patpy.tl.test_distances_significance#

patpy.tl.test_distances_significance(distances, conditions, control_level, normalization_type, n_bootstraps=1000, trimmed_fraction=0.2, compare_by_difference=True)#

Test if distances are significantly different from the null distribution

Based on Petukhov et al (2022): https://www.biorxiv.org/content/10.1101/2022.03.15.484475v1.full.pdf

Parameters:
  • distances (square matrix) – Matrix of distances between samples

  • conditions (array-like) – Vector with the same length as distances containing a categorical variable

  • control_level – Value of conditions that should be used as a control group

  • normalization_type (Literal['total', 'shift', 'var']) – Type of normalization to use. In the text below, “case” means enything that is not a control group. - total: normalize distances between control and case groups to the median of within-control group distances - shift: normalize distances between control and case groups to the average of within-control and within-case group median distances - var: normalize distances within case group to the median of within-control group distances

  • n_bootstraps (int (default: 1000)) – Number of bootstrap iterations to use

  • trimmed_fraction (float (default: 0.2)) – Fraction of the most extreme values to remove from the distribution

  • compare_by_difference (bool (default: True)) – If True, normalization is defined as difference (as in the original paper). Otherwise, it is defined as a ratio