forked from opencobra/cobratoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
singleRxnDeletion.m
82 lines (77 loc) · 2.54 KB
/
singleRxnDeletion.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
function [grRatio,grRateKO,grRateWT,hasEffect,delRxn,fluxSolution] = singleRxnDeletion(model,method,rxnList,verbFlag)
%singleRxnDeletion Performs single reaction deletion analysis using FBA,
%MOMA or linearMOMA
%
% [grRatio,grRateKO,grRateWT,hasEffect,delRxns,hasEffect] = singleGeneDeletion(model,method,rxnList,verbFlag)
%
%INPUT
% model COBRA model structure including reaction names
%
%OPTIONAL INPUTS
% method Either 'FBA', 'MOMA', or 'lMOMA' (Default = 'FBA')
% rxnList List of reactions to be deleted (Default = all reactions)
% verbFlag Verbose output (Default = false)
%
%OUTPUTS
% grRatio Computed growth rate ratio between deletion strain and wild type
% grRateKO Deletion strain growth rates (1/h)
% grRateWT Wild type growth rate (1/h)
% hasEffect Does a reaction deletion affect anything
% delRxn Deleted reacction
% fluxSolution FBA/MOMA/lMOMA fluxes for KO strains
%
% Richard Que 12/04/2009
% Based on singleGeneDeletion.m written by Markus Herrgard
if (nargin < 2)
method = 'FBA';
end
if (nargin < 3)
rxnList = model.rxns;
else
if (isempty(rxnList))
rxnList = model.rxns;
end
end
if (nargin < 4)
verbFlag = false;
end
nRxns = length(model.rxns);
nDelRxns = length(rxnList);
solWT = optimizeCbModel(model,'max', 'one'); % by default uses the min manhattan distance norm FBA solution.
grRateWT = solWT.f;
grRateKO = ones(nDelRxns,1)*grRateWT;
grRatio = ones(nDelRxns,1);
hasEffect = true(nDelRxns,1);
fluxSolution = zeros(length(model.rxns),nDelRxns);
delRxn = columnVector(rxnList);
if (verbFlag)
fprintf('%4s\t%4s\t%10s\t%9s\t%9s\n','No','Perc','Name','Growth rate','Rel. GR');
end
h = waitbar(0,'Single reaction deletion analysis in progress ...');
for i = 1:nDelRxns
if mod(i,10) == 0
waitbar(i/nDelRxns,h);
end
modelDel = changeRxnBounds(model,rxnList{i},0,'b');
switch method
case 'lMOMA'
solKO = linearMOMA(model,modelDel,'max');
case 'MOMA'
solKO = MOMA(model,modelDel,'max',false,true);
otherwise
solKO = optimizeCbModel(modelDel,'max');
end
if (solKO.stat == 1)
grRateKO(i) = solKO.f;
fluxSolution(:,i) = solKO.x;
else
grRateKO(i) = NaN;
end
if (verbFlag)
fprintf('%4d\t%4.0f\t%10s\t%9.3f\t%9.3f\n',i,100*i/nDelRxns,rnxList{i},grRateKO(i),grRateKO(i)/grRateWT*100);
end
end
if ( regexp( version, 'R20') )
close(h);
end
grRatio = grRateKO/grRateWT;