Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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