-
Notifications
You must be signed in to change notification settings - Fork 1
/
loc_PCA_CMI.m
executable file
·83 lines (57 loc) · 1.61 KB
/
loc_PCA_CMI.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
close all;
clc;
hybrid = exist('datafile'); %default
if(~hybrid)
if exist('result_loc_pcacmi')==0
system('mkdir result_loc_pcacmi');
end
datafile='/media/chenx/Program/Exp/bmrnet/db/Dream100/Dream100_Yeast.csv';
goldenfile= '/media/chenx/Program/Exp/bmrnet/db/Dream100/Dream100_Yeast_golden.txt';
clusterfile = '/media/chenx/Program/Exp/bmrnet/result_loc_pcacmi/Dream100_Yeast_cluster.mat';
adjmatrixfile = '/media/chenx/Program/Exp/bmrnet/result_loc_pcacmi/Dream100_Yeast_adjmatrixg.mat';
order0=2;
lamda=0.03;
else
datafile
goldenfile
clusterfile
adjmatrixfile
order0
lamda
end
x = importdata(datafile);
load(clusterfile);
gnum = size(x,2);
scoreIdxMatrix = zeros(gnum, gnum, gnum);
G = zeros(gnum,gnum);
data=x';
%% for each subnetwork
for i=1:size(adj,1)
ntvcsIdx = adj(i,:);
tvcsIdx = [i find(ntvcsIdx>0)];
nvcsIdx =[1:length(tvcsIdx)];
%if(length(tvcsIdx) <10) continue;end
subdata = data(tvcsIdx,:);
%lamda = 0.03; %order0 = 2;
%% go pca_cmi
[Gb,Gval,order] = pca_cmi(subdata,lamda,order0) ;
GvalSysmetric = triu(Gval,-1) + tril(Gval',0);
tGval = zeros(gnum, gnum);
for m = 1: length(nvcsIdx)
for n = 1: length(nvcsIdx)
tGval(tvcsIdx(nvcsIdx(m)), tvcsIdx(nvcsIdx(n))) = GvalSysmetric(m,n);
end
end
scoreIdxMatrix(:,:,i) = tGval;
end
for i =1: gnum
for j =1: gnum
[ii,~,v] = find(scoreIdxMatrix(i,j,:));
G(i,j) = mean(v);
end
end
indices = find(isnan(G) == 1);
G(indices) = 0;
save(adjmatrixfile,'G','-v6');
if(hybrid)exit;
end;