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
distancescontaining a categorical variablecontrol_level – Value of
conditionsthat should be used as a control groupnormalization_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 = 1000) – Number of bootstrap iterations to use
trimmed_fraction (float = 0.2) – Fraction of the most extreme values to remove from the distribution
compare_by_difference (bool = True) – If True, normalization is defined as difference (as in the original paper). Otherwise, it is defined as a ratio