Drawing flux using drawFlux

747 views
Skip to first unread message

JM Seoane

unread,
Nov 16, 2011, 10:58:20 AM11/16/11
to COBRA Toolbox
Dear COBRA users,

I am trying to follow the protocol published in nature protocols by
Schellenberger et al. (2011), and everything worked fine until I
tried to plot optimal flux distributions with drawFlux. i am using
matlab 64 with w7 64 and gurobi, with this solvers:

>> initCobraToolbox()
LP solver set to gurobi successful
MILP solver set to gurobi successful
QP solver set failed
MIQP solver set failed
CB map output set to svg successful
>> model=readCbModel()

My numerical solution solution.f is 0.87 as in the example, but when I
try to plot using drawFlux I got the following message from Matlab:

>> drawFlux(map,model,solution.x,[],'ZeroFluxWith',1,'lb',-15,'ub',15,'FileName','EcoreOptFlux2.svg');
??? Error using ==> fprintf
Invalid file identifier. Use fopen to generate a valid file
identifier.

Error in ==> drawCbMap at 200
fprintf(mapHandle, '<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>\n');

Error in ==> drawFlux at 122
drawCbMap(map,options);

Could you please help me to solve this? Thanks a lot in advance for
any help!

Jose

Chris

unread,
Nov 21, 2011, 3:28:27 PM11/21/11
to COBRA Toolbox
Hi Jose,

Did you already initialize the map object? Before you use the drawFlux
function, you have to load the map file into a handle using the
function readCbMap().

> map1 = readCbMap('iAF1260_central.txt');

where the input file is obtained from the BiGG database.

Hope this helps,
Chris

On Nov 16, 10:58 am, JM Seoane <jm.seoane.redo...@gmail.com> wrote:
> Dear COBRA users,
>
> I am trying to follow the protocol published in nature protocols by
> Schellenberger et al.  (2011), and everything worked fine until I
> tried to plot  optimal flux distributions with drawFlux. i am using
> matlab 64 with w7 64 and gurobi, with this solvers:
>
> >> initCobraToolbox()
>
> LP solver set to gurobi successful
> MILP solver set to gurobi successful
> QP solver set failed
> MIQP solver set failed
> CB map output set to svg successful
>
> >> model=readCbModel()
>
> My numerical solution solution.f is 0.87 as in the example, but when I
> try to plot using drawFlux I got the following message from Matlab:
>

> >> drawFlux(map,model,solution.x,[],'ZeroFluxWith',1,'lb',-15,'ub',15,'FileNam e','EcoreOptFlux2.svg');

JM Seoane

unread,
Nov 24, 2011, 7:34:36 AM11/24/11
to COBRA Toolbox
Chris,

Thank you for your kind reply. I am doing as follows:

>> clear all


>> initCobraToolbox()
LP solver set to gurobi successful
MILP solver set to gurobi successful
QP solver set failed
MIQP solver set failed
CB map output set to svg successful

>> model = readCbModel('ecoli_core_model.xml');
>> map = readCbMap('ecoli_core_map.txt');
>> changeCbMapOutput('svg');
>> solution = optimizeCbModel(model);
>> drawFlux(map, model, solution.x, [], 'ZeroFluxWidth', 1, 'lb', -15, 'ub', 15, 'FileName', 'EcoreOptFlux2.svg');

Without problems until I get here:

??? Error using ==> fprintf
Invalid file identifier. Use fopen to generate a valid file
identifier.

Error in ==> drawCbMap at 200
fprintf(mapHandle, '<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>\n');

Error in ==> drawFlux at 122
drawCbMap(map,options);

Also problems when trying to plot it as a matlab figure, etc. The map
and model I used is the one provided with cobra toolbox as an
example :-(

Thank you for any help/advise you may have!

Jose

JM Seoane

unread,
Nov 24, 2011, 7:50:37 AM11/24/11
to COBRA Toolbox
Chris,

I figured this out by myself. It was an stupid mistake but may happen
to other people. You have to run MATLAB as administrator in order to
save files (I have installed cobra in the same location than the other
matlab toolboxes I have).

Thanks a lot and sorry for taking your time!

Jose

Chris Gowen

unread,
Nov 24, 2011, 8:53:34 AM11/24/11
to cobra-...@googlegroups.com
Hi Jose, 

Glad you figured it out, and thanks for posting your solution! 

Cheers!
Chris
Reply all
Reply to author
Forward
0 new messages