-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrugGeneNetAA.m
69 lines (51 loc) · 2.22 KB
/
drugGeneNetAA.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
function drugnet = drugGeneNetAA(ds, idxdrug, net, idxpos, idxneg)
% Perform network integration and kernel calculation for responsive and
% resistant sampels of a certain drug
%
% idxdrug = strcmpi(ds.allDrugs, drug);
% if(strcmpi(criteria, 'aa'))
% prof = ds.AAMat(idxdrug, :);
% elseif(strcmpi(criteria, 'ic50'))
% prof = ds.IC50Mat(idxdrug, :);
% else
% error('Wrong type of criteria. Must be "aa" or "ic50"!');
% end
%
% idxneg = prof<=params(1);
% idxpos = prof>=params(2);
% drugnet.poscells = ds.cellNames(idxpos);
% posprof = prof(idxpos);
% drugnet.negcells = ds.cellNames(idxneg);
% negprof = prof(idxneg);
posprof = ds.AAMat(idxdrug, idxpos);
negprof = ds.AAMat(idxdrug, idxneg);
% Normalize weights;
% if(strcmp(criteria, 'aa'))
posprof = (posprof-min(posprof))./(max(posprof)-min(posprof));
negprof = (negprof-min(negprof))./(max(negprof)-min(negprof));
negprof = 1 - negprof;
% else
% posprof = (posprof-min(posprof))./(max(posprof)-min(posprof));
% negprof = (negprof-min(negprof))./(max(negprof)-min(negprof));
% posprof = 1 - posprof;
% end
drugnet.posprof = posprof;
drugnet.negprof = negprof;
% Build positive global network
disp('Computing positive kernel...');
globpos = buildNetMat(drugnet.posprof', ds.mutMat(:, idxpos), ds.mutGenes, ds.cnvMat(:, idxpos)~=0, ds.cnvGenes, ds.dgexMat(:, idxpos)~=0, ds.dgexGenes, net);
kernelmat = kernel(globpos.mat, 'LEXP', 0.01);
kernelmat = kernelNorm(kernelmat);
simpos = mean(kernelmat(globpos.startSample:globpos.endSample, 1:end));
globpos = rmfield(globpos, 'mat');
disp('Computing negative kernel...');
globneg = buildNetMat(drugnet.negprof', ds.mutMat(:, idxneg), ds.mutGenes, ds.cnvMat(:, idxneg)~=0, ds.cnvGenes, ds.dgexMat(:, idxneg)~=0, ds.dgexGenes, net);
kernelmat = kernel(globneg.mat, 'LEXP', 0.01);
kernelmat = kernelNorm(kernelmat);
simneg = mean(kernelmat(globneg.startSample:globneg.endSample, 1:end));
globneg = rmfield(globneg, 'mat');
drugnet.simpos = simpos;
drugnet.simneg = simneg;
drugnet.globpos = globpos;
drugnet.globneg = globneg;
end