Calculates the difference of the normalized number of interactions among genes within the same gene set and genes within different gene sets.
Parameters: |
|
---|---|
Type : | collection: list of lists |
Returns: | \(\nu(\mathbf{P})\) (float) - see definition below. |
Then the direct interactions statistic \(\nu(\mathbf{P}) = \alpha(\mathbf{P})-\beta(\mathbf{P})\). Higher values of \(\nu(\mathbf{P})\) indicate stronger collections.
>>> 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)
>>> 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)
>>> direct_interactions_stat(G, collection)
1.0
See also: direct_interactions_test(), eval_gene_sets_by_interactions().