Multi-Dendrix Logo

This Page

multi_dendrix.evaluate.network.direct_interactions_stat

multi_dendrix.evaluate.network.direct_interactions_stat(network, collection)[source]

Calculates the difference of the normalized number of interactions among genes within the same gene set and genes within different gene sets.

Parameters:
  • network (NetworkX Graph.) – PPI network (original or permuted).
  • collection – collection of gene sets to be tested.
Type :

collection: list of lists

Returns:

\(\nu(\mathbf{P})\) (float) - see definition below.

Test statistic:
For a collection of gene sets \(\mathbf{P}\):
  • Let \(\alpha(\mathbf{P})=\) normalized number of interactions among pairs of genes in the same gene set.
  • Let \(\beta(\mathbf{P})=\) normalized number of interactions among pairs of genes in different gene sets.

Then the direct interactions statistic \(\nu(\mathbf{P}) = \alpha(\mathbf{P})-\beta(\mathbf{P})\). Higher values of \(\nu(\mathbf{P})\) indicate stronger collections.

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")])
>>> nx.draw_circular(G, node_size=125, font_size=8)
../../_images/direct_interactions_test_graph.png
Calculating \(\alpha(\mathbf{P})\) and \(\beta(\mathbf{P})\):
>>> int_within = count_interactions(G, pairs_within(collection))
>>> alpha  = float(int_within) / float(len(pairs_within(collection)))
>>> (int_within, alpha)
(2, 1.0)
>>> int_between = count_interactions(G, pairs_between(collection))
>>> beta  = float(int_between) / float(len(pairs_between(collection)))
>>> (int_between, beta)
(0, 0)
The direct interactions test statistic:
>>> direct_interactions_stat(G, collection)
1.0

See also: direct_interactions_test(), eval_gene_sets_by_interactions().