-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpredictorMatrix.m
47 lines (43 loc) · 1.44 KB
/
predictorMatrix.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
function [pmat, mutfeats, cnvfeats, gexfeats] = predictorMatrix(ds, feats)
pmat = [];
cnvfeats = cell(0);
mutfeats = cell(0);
gexfeats = cell(0);
for i=1:length(feats)
ff = strsplit(feats{i}, '-');
genename = strjoin(ff(1:end-1), '-');
ptype = ff{end};
switch(ptype)
case 'MUT'
idxg = strcmpi(ds.mutGenes, genename);
if(sum(idxg)~=1)
error('Feature %s not found\n', feats{i});
pmat = [pmat; zeros(1, length(ds.cellNames))];
else
pmat = [pmat; ds.mutMat(idxg, :)];
mutfeats = [mutfeats; genename];
end
case 'CNV'
idxg = strcmpi(ds.cnvGenes, genename);
if(sum(idxg)~=1)
error('Feature %s not found\n', feats{i});
pmat = [pmat; zeros(1, length(ds.cellNames))];
else
pmat = [pmat; ds.cnvMat(idxg, :)];
cnvfeats = [cnvfeats; genename];
end
case 'GEX'
idxg = strcmpi(ds.dgexGenes, genename);
if(sum(idxg)~=1)
error('Feature %s not found\n', feats{i});
pmat = [pmat; zeros(1, length(ds.cellNames))];
else
pmat = [pmat; ds.dgexMat(idxg, :)];
gexfeats = [gexfeats; genename];
end
otherwise
pmat = NaN;
error('Unknown predictor type %s', ptype);
end
end
end