-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoduleNodesSelection.m
56 lines (51 loc) · 1.55 KB
/
moduleNodesSelection.m
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function [ modulesFinal ] = moduleNodesSelection( Hc, xita )
% Assigning the module members by a soft node selection procedure
% and then truing the modules to obtain more accurate results
%
% INPUT:
% Hc: the consensus factor matrix
% xita: the parameter for selecting nodes
%
% OUTPUT:
% modulesFinal: a cell which contains the final result modules
%
% Peizhuo Wang ([email protected])
[N, K] = size(Hc);
candidateModules = cell(K, 1);
moduleSignal = zeros(K, 1);
H_mean = mean(Hc);
H_std = std(Hc, 0, 1);
for k = 1:K
candidateModules{k} = find(Hc(:, k) > H_mean(k) + xita*H_std(k)); % Z-score>=t
moduleSignal(k) = mean(Hc(candidateModules{k}, k));
end
HPI = setSimilarity( candidateModules );
modulesFinal = candidateModules;
for i = 1:size(HPI, 1)-1
for j = (i+1):size(HPI, 2)
if HPI(i,j)>0.5 % merge these two modules
[Y, I] = max([moduleSignal(i), moduleSignal(j)]);
if I == 1
modulesFinal{j} = [];
moduleSignal(j) = 0;
HPI(j, :) = zeros(1, size(HPI, 2));
HPI(:, j) = zeros(size(HPI, 1), 1);
else
modulesFinal{i} = [];
moduleSignal(i) = 0;
HPI(i, :) = zeros(1, size(HPI, 2));
HPI(:, i) = zeros(size(HPI, 1), 1);
end
end
end
end
% Only modules with no less than 5 nodes are kept
i = 1;
while i ~= length(modulesFinal)+1
if isempty(modulesFinal{i}) || (length(modulesFinal{i})<5)
modulesFinal(i) = [];
i = i - 1;
end
i = i + 1;
end
end