forked from DriesVanDaele/OMEN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
probabilistic_network.pl
41 lines (34 loc) · 1.75 KB
/
probabilistic_network.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
component_edges(Connected_Component, Edge_Selection, Relevant_Edges) :-
findall([G1, G2],
(member([G1, G2], Edge_Selection),
member(G1, Connected_Component),
member(G2, Connected_Component)),
Relevant_Edges).
connected_components(Node_Selection, Connected_Components) :-
nodes_connected_components(Node_Selection, Connected_Components).
connected_components(Node_Selection, Edge_Selection, Connected_Components) :-
nodes_connected_components_edge_set(Node_Selection, Connected_Components, Edge_Selection).
% probabilistic_network_nodes(+Normalized_Patterns, -Gene, -Total_Score)
probabilistic_network_nodes(Normalized_Patterns, Gene, Total_Score) :-
findall(X1/A, (member(X1-X2, Normalized_Patterns), member(A, X2)), As),
bagof(Score, member(Score/Gene, As), Scores),
sumlist(Scores, Total_Score).
probabilistic_network_edges(Normalized_Patterns, Edge, Total_Score) :-
findall(X1/A, (member(X1-X2, Normalized_Patterns), member_edge(A, X2)), As),
bagof(Score, member(Score/Edge, As), Scores),
sumlist(Scores, Total_Score).
probabilistic_network_node_pairs(Normalized_Patterns, Edge, Total_Score) :-
findall(X1/A, (member(X1-X2, Normalized_Patterns), member_node_pair(A, X2)), As),
bagof(Score, member(Score/Edge, As), Scores),
sumlist(Scores, Total_Score).
member_edge(Edge, [X, Y | _]) :-
sort([X, Y], Edge).
member_edge(Edge, [_ | Xs]) :-
member_edge(Edge, Xs).
% ?- findall(Node_Pair, member_node_pair(Node_Pair, [1, 5, 3, 2]), Node_Pairs), writeln(Node_Pairs).
% Node_Pairs = [[1, 5], [1, 3], [1, 2], [3, 5], [2, 5], [2, 3]].
member_node_pair(Node_Pair, [X | Ys]) :-
member(Y, Ys),
sort([X, Y], Node_Pair).
member_node_pair(Node_Pair, [_ | Xs]) :-
member_node_pair(Node_Pair, Xs).