-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmaxATP.m
More file actions
54 lines (48 loc) · 1.73 KB
/
Copy pathmaxATP.m
File metadata and controls
54 lines (48 loc) · 1.73 KB
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
% Exploring the cellular objective in flux balance constraint-based models.
% Author: Rafael Costa
% Affiliation: Instituto de Engenharia de Sistemas e Computadores, Investigacão e Desenvolvimento (INESC-ID), Lisboa
% and
% Center for Intelligent Systems, LAETA, IDMEC, IST, University of Lisbon
% Author: Nguyen Hoang Son
function FBAsolution=maxATP(glob,model,netcode,taskcode,minNorm)
if exist('minNorm','var')
if isempty(minNorm)
minNorm=true;
end
else
minNorm=true;
end
[nMets,nRxns] = size(model.S);
model.c=zeros(nRxns,1);
if netcode==1 || netcode ==3
model=changeObjective(model,'ATPM');
elseif netcode==2
model=changeObjective(model,'maint');
end
A=[model.S(model.csense=='L',:);-model.S(model.csense=='G',:)];
b=[model.b(model.csense=='L',:);-model.b(model.csense=='G',:)];
Aeq=model.S(model.csense=='E',:);
beq=model.b(model.csense=='E',:);
if minNorm
FBAsolution=optimizeCbModel(model,'max','one');
if FBAsolution.stat < 1
warning('No solution found!');
FBAsolution.minE=-1;FBAsolution.maxE=-1;
return;
else
FBAsolution.minE=eclDistance(glob,FBAsolution.x)/100;
end
FBAsolution.maxE=FBAsolution.minE;
else
FBAsolution=optimizeCbModel(model,'max');
if FBAsolution.stat < 1
warning('No solution found!');
return;
end
x0=FBAsolution.x;
f0=FBAsolution.f;
Aeq=[Aeq;model.c'];
beq=[beq;f0];
[FBAsolution.minE,FBAsolution.maxE,FBAsolution.x]=fidelity4linear(glob,taskcode,x0,Aeq,beq,A,b,model.lb,model.ub);
end
end