% Author: Elsa W. Birch, ewbirch@stanford.edu, Covert Lab - Stanford Bioengineering
% Date: 4/24/2011
% Version: associated with production of the figures for Birch et al. 2012 
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
%
% Summary: Set the flux bounds that are based on regulation
% 
%
% Inputs: 
%
% Outputs: 
%
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
%
% Notes: 
%
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function [fluxBoundsCurrent, rxnActivity ] = FBA_EB_setCurrentRegulationFluxBounds(geneProductActivity, currentMedia,fluxBoundsDefault,...
                                                                 rxnRegulationRulesEvalStrings)
% This function updates the flux bounds to account for enzyme activity

% rxn activity is calculated using boolean rules including only enzyme activities
rxnActivity = false(size(fluxBoundsDefault,1),1);
for iRule = 1 : size(fluxBoundsDefault,1)
    rxnActivity(iRule) = eval(rxnRegulationRulesEvalStrings{iRule});
end

% rxnActivity is boolean logical vlaues t/f represented as 1/0, so use as
% multiplicative factor on current flux bounds (element wise) which will set all
% off-regulated fluxes to bother upper and lower bounds of 0,

fluxBoundsCurrent = fluxBoundsDefault .* [rxnActivity, rxnActivity];
end % FBA_EB_setCurrentRegulationFluxBounds
