Multi-Dendrix Logo

This Page

multi_dendrix.evaluate.network.avg_pair_dist_test

multi_dendrix.evaluate.network.avg_pair_dist_test(collection, G, Hs)[source]

Performs the average pairwise distance test on the collection of gene sets. If t (number of gene sets in the collection) is 1, then the statistic is 0 and the p-value is 1.

Parameters:
  • collection (list of lists) – collection of gene sets to be tested.
  • G (NetworkX Graph.) – original PPI network.
  • Hs (list of NetworkX Graphs) – permuted versions of G.
Returns:
A tuple consisting of the following:
  • \(\rho(\mathbf{P})\) (float) - the average pairwise distance test statistic.
  • pval (float) - the average pairwise distance test p-value of the given collection.

Test:

For the definition of the test statistic used by the average pairwise distance test, see avg_pair_dist_ratio(). The average pairwise distance test compares the average pairwise distance test statistic of the collection on the original and permuted PPI networks.

Note: Genes that are not in the graph G or are in different connected components than the other genes are given an average pairwise distance of 1e100. These genes should be removed before using the average pairwise distance test.

Examples:
A view of example input:
>>> import networkx as nx
>>> collection = [["G1", "G2"], ["G3", "G4"]]
>>> G = nx.Graph()
>>> G.add_edges_from([("G1", "G2"), ("G3", "G4"), ("G2", "G5"), ("G4", "G5")])
>>> Hs =[ nx.double_edge_swap(G.copy(), nswap=10, max_tries=1e75) for i in range(10) ]
>>> nx.draw_circular(G, node_size=125, font_size=8)
../../_images/direct_interactions_test_graph.png
A simple example
>>> avg_pair_dist_test(collection, G, Hs)
(0.33, 0.10)

See also: avg_pair_dist_ratio(), eval_gene_sets_by_dist(), direct_interactions_test().