diff --git a/doc/src/geckomat/utilities/ecFSEOF.html b/doc/src/geckomat/utilities/ecFSEOF.html index 5d80d73ae..eb327cf71 100644 --- a/doc/src/geckomat/utilities/ecFSEOF.html +++ b/doc/src/geckomat/utilities/ecFSEOF.html @@ -77,7 +77,7 @@

DESCRIPTION ^CROSS-REFERENCE INFORMATION ^

This function calls: +
  • getFluxTarget getFluxTarget
  • This function is called by: @@ -186,7 +186,7 @@

    SOURCE CODE ^% Simulate WT (100% growth) and forced (X% growth and the rest towards product): -0101 flux_WT = getFluxTarget(ecModel,targetRxn,csRxn); +0101 flux_WT = getFluxTarget(ecModel,params.bioRxn,targetRxn,1); 0102 0103 % Set values which are under solver tolerance 0104 flux_WT(flux_WT < 0 & ~enzRxns) = 0; @@ -194,7 +194,7 @@

    SOURCE CODE ^'Flux Scanning with Enforced Objective Function') 0108 for i = 1:length(alpha) -0109 flux_MAX = getFluxTarget(ecModel,targetRxn,csRxn,alpha(i)); +0109 flux_MAX = getFluxTarget(ecModel,params.bioRxn,targetRxn,alpha(i)); 0110 % Set values which are under solver tolerance 0111 flux_MAX(flux_MAX < 0 & ~enzRxns) = 0; 0112 flux_MAX(flux_MAX > 0 & enzRxns) = 0; diff --git a/doc/src/geckomat/utilities/getFluxTarget.html b/doc/src/geckomat/utilities/getFluxTarget.html index 6e6a93a2f..f790eec11 100644 --- a/doc/src/geckomat/utilities/getFluxTarget.html +++ b/doc/src/geckomat/utilities/getFluxTarget.html @@ -24,7 +24,7 @@

    PURPOSE ^getFluxTarget

    SYNOPSIS ^

    -
    function [maxFlux, minFlux] = getFluxTarget(model,targetRxn,csRxn,alpha,tolerance,modelAdapter)
    +
    function [maxFlux, minFlux] = getFluxTarget(model,bioRxn,targetRxn,alpha)

    DESCRIPTION ^

     getFluxTarget
    @@ -37,15 +37,11 @@ 

    DESCRIPTION ^DESCRIPTION ^CROSS-REFERENCE INFORMATION ^

    @@ -69,7 +65,7 @@

    CROSS-REFERENCE INFORMATION ^
 
 
 <h2><a name=SOURCE CODE ^

    -
    0001 function [maxFlux, minFlux] = getFluxTarget(model,targetRxn,csRxn,alpha,tolerance,modelAdapter)
    +
    0001 function [maxFlux, minFlux] = getFluxTarget(model,bioRxn,targetRxn,alpha)
     0002 % getFluxTarget
     0003 %
     0004 %   Function that performs a series of LP optimizations on an ecModel,
    @@ -80,77 +76,58 @@ 

    SOURCE CODE ^% 0010 % Input: 0011 % model an ecModel in GECKO 3 format (with ecModel.ec structure). -0012 % targetRxn rxn ID for the production target reaction, a exchange -0013 % reaction is recommended. -0014 % csRxn rxn ID for the main carbon source uptake reaction. +0012 % bioRxn rxn ID for the biomass reaction. +0013 % targetRxn rxn ID for the production target reaction, a exchange +0014 % reaction is recommended. 0015 % alpha scalling factor for desired suboptimal growth. 0016 % (Optional, default 0.95) -0017 % tolerance numerical tolerance for fixing bounds -0018 % (Optional, default 1e-4) -0019 % modelAdapter a loaded model adapter. (Optional, will otherwise use -0020 % the default model adapter) -0021 % -0022 % Output: -0023 % minFlux vector of minimum flux rates at minimum target production, -0024 % corresponding to model.rxns -0025 % maxFlux vector of maximum flux rates at maximum target production, -0026 % corresponding to model.rxns -0027 % -0028 % Usage: -0029 % [maxFlux, minFlux] = simulateGrowth(ecModel,targetRxn,csRxn,alpha,tol) +0017 % +0018 % Output: +0019 % minFlux vector of minimum flux rates at minimum target production, +0020 % corresponding to model.rxns +0021 % maxFlux vector of maximum flux rates at maximum target production, +0022 % corresponding to model.rxns +0023 % +0024 % Usage: +0025 % [maxFlux, minFlux] = getFluxTarget(ecModel,bioRxn,targetRxn,alpha) +0026 +0027 if nargin < 4 || isempty(alpha) +0028 alpha = 0.95; +0029 end 0030 -0031 if nargin < 6 || isempty(modelAdapter) -0032 modelAdapter = ModelAdapterManager.getDefault(); -0033 if isempty(modelAdapter) -0034 error('Either send in a modelAdapter or set the default model adapter in the ModelAdapterManager.') -0035 end -0036 end -0037 params = modelAdapter.getParameters(); -0038 -0039 if nargin < 5 || isempty(tolerance) -0040 tolerance = 1e-4; -0041 end -0042 -0043 if nargin < 4 || isempty(alpha) -0044 alpha = 0.95; -0045 end -0046 -0047 % Get relevant rxn indexes -0048 targetRxnIdx = getIndexes(model, targetRxn,'rxns'); -0049 csRxnIdx = getIndexes(model, csRxn,'rxns'); -0050 bioRxnIdx = getIndexes(model, params.bioRxn,'rxns'); -0051 -0052 % Maximize growth and fix carbon source and suboptimal growth -0053 model = setParam(model, 'obj', params.bioRxn, 1); -0054 sol = solveLP(model); -0055 model = setParam(model, 'var', csRxn, sol.x(csRxnIdx), tolerance); -0056 model = setParam(model, 'lb', params.bioRxn, sol.x(bioRxnIdx) * (1-tolerance) * alpha); -0057 -0058 % If minimum fluxes are required get them -0059 minFlux = []; -0060 if nargout == 2 -0061 % Minimize target -0062 model = setParam(model, 'obj', targetRxn, -1); -0063 sol = solveLP(model); -0064 -0065 % Now fix min value for target and minimize proteins usage -0066 model.lb(targetRxnIdx) = sol.x(targetRxnIdx) * (1-tolerance); -0067 model = setParam(model, 'obj', 'prot_pool_exchange', 1); -0068 minSol = solveLP(model,1); -0069 minFlux = minSol.x; -0070 end -0071 -0072 % Maximize target -0073 model = setParam(model, 'obj', targetRxn, 1); -0074 sol = solveLP(model); -0075 -0076 % Now fix max value for target and minimize proteins usage -0077 model.lb(targetRxnIdx) = sol.x(targetRxnIdx) * (1-tolerance); -0078 model = setParam(model, 'obj', 'prot_pool_exchange', 1); -0079 maxSol = solveLP(model); -0080 maxFlux = maxSol.x; -0081 -0082 end

    +0031 % Fix a suboptimal alpha if equal to 1 +0032 if alpha == 1 +0033 alpha = 0.99; +0034 end +0035 +0036 % Get relevant rxn indexes +0037 bioRxnIdx = getIndexes(model, bioRxn,'rxns'); +0038 poolIdx = strcmpi(model.rxns, 'prot_pool_exchange'); +0039 +0040 % Maximize growth and fix carbon source and suboptimal growth +0041 model = setParam(model, 'obj', bioRxn, 1); +0042 sol = solveLP(model); +0043 model = setParam(model, 'lb', bioRxn, sol.x(bioRxnIdx) * alpha); +0044 +0045 % Minimize prot_pool_exchange and fix +0046 model = setParam(model, 'obj', 'prot_pool_exchange', 1); +0047 sol = solveLP(model); +0048 model = setParam(model, 'lb', 'prot_pool_exchange', sol.x(poolIdx) * 1.01); +0049 +0050 % If minimum fluxes are required get them +0051 minFlux = []; +0052 if nargout == 2 +0053 % Minimize target +0054 model = setParam(model, 'obj', targetRxn, -1); +0055 minSol = solveLP(model); +0056 minFlux = minSol.x; +0057 end +0058 +0059 % Maximize target +0060 model = setParam(model, 'obj', targetRxn, 1); +0061 maxSol = solveLP(model); +0062 maxFlux = maxSol.x; +0063 end

    Generated by m2html © 2005
    \ No newline at end of file diff --git a/src/geckomat/utilities/ecFSEOF.m b/src/geckomat/utilities/ecFSEOF.m index a29b267e2..00a70c2f8 100644 --- a/src/geckomat/utilities/ecFSEOF.m +++ b/src/geckomat/utilities/ecFSEOF.m @@ -98,7 +98,7 @@ tolerance = 1e-4; % Simulate WT (100% growth) and forced (X% growth and the rest towards product): -flux_WT = getFluxTarget(ecModel,targetRxn,csRxn); +flux_WT = getFluxTarget(ecModel,params.bioRxn,targetRxn,1); % Set values which are under solver tolerance flux_WT(flux_WT < 0 & ~enzRxns) = 0; @@ -106,7 +106,7 @@ progressbar('Flux Scanning with Enforced Objective Function') for i = 1:length(alpha) - flux_MAX = getFluxTarget(ecModel,targetRxn,csRxn,alpha(i)); + flux_MAX = getFluxTarget(ecModel,params.bioRxn,targetRxn,alpha(i)); % Set values which are under solver tolerance flux_MAX(flux_MAX < 0 & ~enzRxns) = 0; flux_MAX(flux_MAX > 0 & enzRxns) = 0; diff --git a/src/geckomat/utilities/getFluxTarget.m b/src/geckomat/utilities/getFluxTarget.m index ba4308d97..be2059ed0 100644 --- a/src/geckomat/utilities/getFluxTarget.m +++ b/src/geckomat/utilities/getFluxTarget.m @@ -1,4 +1,4 @@ -function [maxFlux, minFlux] = getFluxTarget(model,targetRxn,csRxn,alpha,tolerance,modelAdapter) +function [maxFlux, minFlux] = getFluxTarget(model,bioRxn,targetRxn,alpha) % getFluxTarget % % Function that performs a series of LP optimizations on an ecModel, @@ -9,15 +9,11 @@ % % Input: % model an ecModel in GECKO 3 format (with ecModel.ec structure). +% bioRxn rxn ID for the biomass reaction. % targetRxn rxn ID for the production target reaction, a exchange % reaction is recommended. -% csRxn rxn ID for the main carbon source uptake reaction. % alpha scalling factor for desired suboptimal growth. % (Optional, default 0.95) -% tolerance numerical tolerance for fixing bounds -% (Optional, default 1e-4) -% modelAdapter a loaded model adapter. (Optional, will otherwise use -% the default model adapter) % % Output: % minFlux vector of minimum flux rates at minimum target production, @@ -26,57 +22,42 @@ % corresponding to model.rxns % % Usage: -% [maxFlux, minFlux] = simulateGrowth(ecModel,targetRxn,csRxn,alpha,tol) - -if nargin < 6 || isempty(modelAdapter) - modelAdapter = ModelAdapterManager.getDefault(); - if isempty(modelAdapter) - error('Either send in a modelAdapter or set the default model adapter in the ModelAdapterManager.') - end -end -params = modelAdapter.getParameters(); - -if nargin < 5 || isempty(tolerance) - tolerance = 1e-4; -end +% [maxFlux, minFlux] = getFluxTarget(ecModel,bioRxn,targetRxn,alpha) if nargin < 4 || isempty(alpha) alpha = 0.95; end +% Fix a suboptimal alpha if equal to 1 +if alpha == 1 + alpha = 0.99; +end + % Get relevant rxn indexes -targetRxnIdx = getIndexes(model, targetRxn,'rxns'); -csRxnIdx = getIndexes(model, csRxn,'rxns'); -bioRxnIdx = getIndexes(model, params.bioRxn,'rxns'); +bioRxnIdx = getIndexes(model, bioRxn,'rxns'); +poolIdx = strcmpi(model.rxns, 'prot_pool_exchange'); -% Maximize growth and fix carbon source and suboptimal growth -model = setParam(model, 'obj', params.bioRxn, 1); -sol = solveLP(model); -model = setParam(model, 'var', csRxn, sol.x(csRxnIdx), tolerance); -model = setParam(model, 'lb', params.bioRxn, sol.x(bioRxnIdx) * (1-tolerance) * alpha); +% Maximize growth and fix carbon source and suboptimal growth +model = setParam(model, 'obj', bioRxn, 1); +sol = solveLP(model); +model = setParam(model, 'lb', bioRxn, sol.x(bioRxnIdx) * alpha); + +% Minimize prot_pool_exchange and fix +model = setParam(model, 'obj', 'prot_pool_exchange', 1); +sol = solveLP(model); +model = setParam(model, 'lb', 'prot_pool_exchange', sol.x(poolIdx) * 1.01); % If minimum fluxes are required get them minFlux = []; if nargout == 2 % Minimize target model = setParam(model, 'obj', targetRxn, -1); - sol = solveLP(model); - - % Now fix min value for target and minimize proteins usage - model.lb(targetRxnIdx) = sol.x(targetRxnIdx) * (1-tolerance); - model = setParam(model, 'obj', 'prot_pool_exchange', 1); - minSol = solveLP(model,1); + minSol = solveLP(model); minFlux = minSol.x; end % Maximize target model = setParam(model, 'obj', targetRxn, 1); -sol = solveLP(model); - -% Now fix max value for target and minimize proteins usage -model.lb(targetRxnIdx) = sol.x(targetRxnIdx) * (1-tolerance); -model = setParam(model, 'obj', 'prot_pool_exchange', 1); maxSol = solveLP(model); maxFlux = maxSol.x; - end