forked from opencobra/cobratoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestPathway.m
50 lines (48 loc) · 1.88 KB
/
testPathway.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
function [Flux FBAsolution model]= testPathway(model, MetIn,MetOut,AdditionalMetsInorOut,ObjectiveOption)
% this gapfiling function allows the user to see if given one metabolite A,
% downstream metabolite B can be made made. Additional sinks can be added
% for co-factors if needed
% A -->-->-->-->--> B
%INPUTS
% model COBRA model structure
% MetIn The input metabolite(s) (A)
% MetOut The output metabolite (B)
%
%OPTIONAL INPUTS
% AdditionalMetsInorOut Additional metabolites for which sinks will be added
% ObjectiveOption 1 = objective will be production of B (default)
% 0 = use objective in model
%
%OUTPUTS
% Flux The rate of B production
% FBAsolution
% model COBRA model with sinks in it
%
% Nathan Lewis Feb 16 2009
if ~iscell(MetIn)
Met = MetIn; clear MetIn; MetIn{1} = Met;
end
if ~iscell(MetOut)
Met = MetOut; clear MetOut; MetOut{1} = Met;
end
if nargin > 3
if ~iscell(AdditionalMetsInorOut)
Met = AdditionalMetsInorOut; clear AdditionalMetsInorOut; AdditionalMetsInorOut{1} = Met;
end
% add sink rxns for all AdditionalMetsInorOut
for i = 1:length(AdditionalMetsInorOut)
model = addReaction(model,cat(2,'Tempsink_',AdditionalMetsInorOut{i}),{AdditionalMetsInorOut{i} },-1 ,true);
end
end
if nargin <5,ObjectiveOption=1;end
for i = 1:length(MetIn) % add inputs
model = addReaction(model,cat(2,'TempInput_',MetIn{i}),{MetIn{i} },1 ,false);
end
model = addReaction(model,cat(2,'TempOutput_',MetOut{1}),{MetOut{1} },-1 ,false);
if ObjectiveOption==1,model = changeObjective(model,cat(2,'TempOutput_',MetOut{1}));end
FBAsolution = optimizeCbModel(model,'max');
Flux = FBAsolution.f;
if ~isempty(FBAsolution.x)
printFluxVector(model,FBAsolution.x);
else display('zero flux in network')
end