Skip to content

Instantly share code, notes, and snippets.

@laurentheirendt
Created November 25, 2017 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laurentheirendt/0820ecc4613d5d8b0bdba09221890fef to your computer and use it in GitHub Desktop.
Save laurentheirendt/0820ecc4613d5d8b0bdba09221890fef to your computer and use it in GitHub Desktop.
Example for FVA in R2017a
initCobraToolbox
% Input the E.coli core model
model = readCbModel('ecoli_core_model.mat');
model = changeRxnBounds(model,'EX_glc(e)',0,'l');
model = changeRxnBounds(model,'EX_succ(e)',-20,'l');
% Set objective function
model = changeObjective(model,'EX_etoh(e)');
% model = changeObjective(model,'Biomass_Ecoli_core_N(w/GAM)_Nmet2');
% set the solver
changeCobraSolver('ibm_cplex')
% Perform flux variability analysis
[minFlux,maxFlux]=fluxVariability(model,100,'max',model.rxns);
% Print flux values
Difference = abs(maxFlux - minFlux);
FluxDifference = Difference;
n = length(Difference);
for i=1:n
if Difference(i) < 0.0001
FluxDifference(i) = 0;
end
end
printFluxVector(model, [minFlux, maxFlux, FluxDifference],true)
% printFluxVector(model, [minFlux, maxFlux, FluxDifference]) % print all reactions
% Save flux variability map
map=readCbMap('ecoli_Textbook_ExportMap');
% Please note: drawFluxVariability will be deprecated
%drawFluxVariability(map,model,minFlux,maxFlux)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment