what is the format required for model.genes and model.comps in writeSBML.m

94 views
Skip to first unread message

James Metz

unread,
Dec 13, 2017, 6:08:21 PM12/13/17
to COBRA Toolbox
COBRA Toolbox Group,

Hello.  I am new to MATLAB and COBRA Toolbox.  I have created a small S matrix of 18 metabolites by 10 reactions - R1 - R10.  I am running a MATLAB script that is calling
writeSBML.m.  Inside writeSBML, there are  lines of code that require, model.genes, and another line of code that requires model.comps as input to convertSBMLID(model.genes) and convertSBMLID(model.comps).  Can someone tell me what model.genes and model.comps should be i.e., format.  Please note that I will not be using actual gene names so dummy names e.g., G1-G10 would be perfectly fine in my situation.  Should these be vector arrays as part of an input struc? 

Thank you.

Jim Metz
Northwestern University


Thomas Pfau

unread,
Dec 14, 2017, 1:15:09 AM12/14/17
to cobra-...@googlegroups.com

Hi JIm,

First off: please don't use writeSBML directly. Instead, use writeCbModel(model), (which will open a file Selection window, where you can write your filename (e.g. Test.xml)). This function will then automatically detect the type of output based on the file name. Or, if you don't want to use a dialog: use: writeCbModel(model,'fileName','OutputFileName.xml','format','SBML').
This will take care of the comps field (which is not a required field in the structure.

As for genes: its a Cell array of Strings.

Overall, if you initially create your model with createModel(), you will get a struct in which all parts are properly initialized, and if you use addMetabolite/addReaction to add your metabolites and reactions, those fields will be kept consistent.
The same applies when setting GPR rules. Please use the function changeGeneAssociation to do so, as this ensures that the model fields are kept in sync. You don't even need to add any genes, as they will automatically be created by the function.

In general we strongly discourage manually manipulating model fields, as it can quickly lead to models with out of sync fields.

Finally, a full listing of Model fields and their specifications can be found at https://opencobra.github.io/cobratoolbox/docs/COBRAModelFields.html

Best,

Thomas

--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu

James Metz

unread,
Dec 15, 2017, 8:43:30 PM12/15/17
to COBRA Toolbox
Thomas,

Thank you for your helpful response.  I am still having some problems.

I have created a struc which contains model (1x1 struc) which contains 13 fields.
I have saved this struc as model_Net_core.mat

In a separate MATLAB script, I load model_Net_core.mat and I try to run your suggested code:

load('model_Net_core.mat');
writeCbModel(model,'model_EM_core','model_EM_core.xml', 'format', 'sbml');

However, I get the following error messages:


Error using writeCbModel (line 230)
Unknown file format

Error in call_gen_elem_model_fcn (line 31)
writeCbModel(model,'model_EM_core','model_EM_core.sbml', 'format', 'sbml');


Any ideas what I am doing wrong?

Thomas PFAU

unread,
Dec 16, 2017, 3:00:56 AM12/16/17
to cobra-...@googlegroups.com
Hi Jim

Please have a look at the syntax of writeCbModel. It follows the standard Matlab 'Parametername',value scheme. I.e. the 'filename' in my example was the parameter name and not to be replaced by the actual filename.
This being said:
Three following command should also work in your instance: 
writeCbModel(model, 'filename', 'Outputfilename.xml')

The nondescript error message you get us unfortunately due to three necessity to keep backward comparability with a former syntax of the function. I'll have to see if I can find a way to provide a clearer error message in instances like yours. 
Best
Thomas

Am 16.12.2017 02:43 schrieb 'James Metz' via COBRA Toolbox <cobra-...@googlegroups.com>:

Unsubscribe

It appears that you have subscribed to commercial messages from this sender. To stop receiving such messages from this sender, please unsubscribe

--

---
You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.

James T. Metz

unread,
Dec 21, 2017, 3:49:45 PM12/21/17
to cobra-...@googlegroups.com, thoma...@uni.lu, jenniferg...@u.northwestern.edu, James...@aol.com
Thomas,

    I am still have some problems with writeSBML() and OutputSBML().  Please
note that I am not an experienced MATLAB user or metabolic modeler.  However, 
an experienced MATLAB user and metabolic modeler in the Tyo lab, Jennifer Greene (JG),
has examined errors be being generated in my code.

    Here are a set of messages generated when calling writeSBML()

Error from writeSBML()

Error using OutputSBML
Too many input arguments
USAGE: OutputSBML(SBMLModel, (filename))

Error in writeSBML (line 890)
OutputSBML(sbmlModel,fileName,1,0,[1,0]);

Error in writeCbModel (line 221)
        outmodel = writeSBML(model, fileName, input.compSymbols, input.compNames);




We have tried to modify writeSBML and then call OutputSBML, but we generate errors (see below)

Error when commenting out to workaround original error 

Change made in writeSBML to get around error:

%%%OutputSBML(sbmlModel,fileName,1,0,[1,0]);
OutputSBML(sbmlModel,fileName); %%% JG 12/21/17


MATLAB Command Window error:

Error using OutputSBML
First input must be a valid MATLAB_SBML Structure
USAGE: OutputSBML(SBMLModel, (filename))

Error in writeSBML (line 891)
OutputSBML(sbmlModel,fileName); %%% JG 12/21/17

Error in writeCbModel (line 221)
        outmodel = writeSBML(model, fileName, input.compSymbols, input.compNames);



The structur error is unclear because the SBMLModel is generated by the writeSBML function.


Hence, could there be a problem with the writeSBML function?


If you have sample code that begins with a very small stoichiometric matrix and generates an
appropriate SBML file, that would probably be helpful.


Regards,
Jim Metz

Northwestern University




You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/9zI67aJKuOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.

Thomas Pfau

unread,
Dec 22, 2017, 12:48:14 AM12/22/17
to James T. Metz, cobra-...@googlegroups.com, jenniferg...@u.northwestern.edu

Hi James,

As mentioned before, please do not use writeSBML directly but instead use writeCbModel. Explanation of the function is provided both in its documentation (either in the file or at https://opencobra.github.io/cobratoolbox/latest/modules/io.html?highlight=writecbmodel#src.base.io.writeCbModel) or in the respective tutorial (https://opencobra.github.io/cobratoolbox/latest/tutorials/tutorialIO.html).

A minimal working example is:

------------------
model = createModel();
%Reactions in {Rxn Name, MetaboliteNames, Stoichiometric coefficient, GPR} format
Reactions = {'R1',{'A','B'},[-1 1], 'G1 and G2';...
             'R2',{'B','C'},[-1 1],'G3 and (G4 or G5)';...
             'R3',{'C','D'},[-1 1],'G6 or G7'};
ExchangedMets = {'A','D'};
%Add Reactions
for i = 1:size(Reactions,1)
    %All reactions are irreversible
    model = addReaction(model,Reactions{i,1},'metaboliteList',Reactions{i,2},'stoichCoeffList',Reactions{i,3},'geneRule',Reactions{i,4});
end

%Add Exchangers
model = addExchangeRxn(model,ExchangedMets,-1000*ones(numel(ExchangedMets),1),1000*ones(numel(ExchangedMets),1));
model = changeObjective(model,'EX_D',1);
writeCbModel(model,'fileName','Test.xml')

-----------------
Be aware, that due to SBML requiring Compartments, all uncompartmentalised metabolites (i.e. those without a compartment specifier at the end of their id), will be localised either to an "unknown" compartment (if there are other compartments) or to the cytosol (if no metabolite has a specifier). This will lead to a model saved in SBML and read in again potentially having different metabolite identifiers (i.e. a model read from an SBML will have compartment ids for all metabolites).
If you want to specify compartment names you can use the comps and compNames fields of the model as specified in the model field definitions.

Best

Thomas

James T. Metz

unread,
Dec 28, 2017, 7:31:16 PM12/28/17
to cobra-...@googlegroups.com, thoma...@uni.lu, jenniferg...@u.northwestern.edu, James...@aol.com
Thomas,

    Thank you for your response and code below.  However, if I copy and paste your minimal working example,
and try to run it in MATLAB, it generates an error at the line:

    writeCbModel(model,'fileName','Test.xml')

    The output from the MATLAB command window is shown below.

    Any ideas why writeCbModel() is generating an error?

    Regards,
    Jim Metz
    Northwestern University



Warning: Metabolite A not in model - added to the model 
> In addReaction (line 299)
  In test_code_from_T_Pfau (line 12) 
Warning: Metabolite B not in model - added to the model 
> In addReaction (line 299)
  In test_code_from_T_Pfau (line 12) 
R1 A <=>
Warning: Metabolite C not in model - added to the model 
> In addReaction (line 299)
  In test_code_from_T_Pfau (line 12) 
R2 B <=>
Warning: Metabolite D not in model - added to the model 
> In addReaction (line 299)
  In test_code_from_T_Pfau (line 12) 
R3 C <=>
EX_A A <=>
EX_D D <=>
Error using writeCbModel (line 230)
Unknown file format

Error in test_code_from_T_Pfau (line 18)
writeCbModel(model,'fileName','Test.xml');

Thomas Pfau

unread,
Dec 29, 2017, 5:04:56 AM12/29/17
to James T. Metz, cobra-...@googlegroups.com, jenniferg...@u.northwestern.edu

Hello Jim,

You seem to be using an outdated version of the Cobra Toolbox, a modified version of the Toolbox or you have an outdated writeCbModel file on your path somewhere. The error you report should be coming (if at all) from line 220 and not 230.
Could you run generateSystemConfigReport() and post the results along with the result of which('writeCbModel.m','-all') ?

That code snipped I provided works fine on my machines.

Best

Thomas

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 423
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu 

James T. Metz

unread,
Dec 29, 2017, 4:18:36 PM12/29/17
to thoma...@uni.lu, cobra-...@googlegroups.com, james...@aol.com
Thomas,
       
    Below is the output from running generateSystemConfigReport() in my MATLAB environment.

    Please note that I do not have direct internet access for MATLAB as this requires proxy information.  
I have asked a few grad students here at Northwestern about this, and no one seems to know how to
set this up, or if it is available.  Hence, I hope this is not a serious problem.  If necessary, I would
rather download required files manually, and not have to deal with internet proxies which might
violate Northwestern IT internet access policies.

    Thanks again for your help.  I am hoping we can resolve this problem very soon!

    Regards,
    Jim Metz
    Northwestern University





>> generate_system_config_report

 > ---------------------------------- SYSTEM CONFIGURATION REPORT ----------------------------------


      _____   _____   _____   _____     _____     |
     /  ___| /  _  \ |  _  \ |  _  \   / ___ \    |   COnstraint-Based Reconstruction and Analysis
     | |     | | | | | |_| | | |_| |  | |___| |   |   The COBRA Toolbox - 2017
     | |     | | | | |  _  { |  _  /  |  ___  |   |
     | |___  | |_| | | |_| | | | \ \  | |   | |   |   Documentation:
     \_____| \_____/ |_____/ |_|  \_\ |_|   |_|   |   http://opencobra.github.io/cobratoolbox
                                                  | 

 > Checking if git is installed ...  Done.
 > Checking if the repository is tracked using git ...  Done.
 > Checking if curl is installed ...  Done.
 > Checking if remote can be reached ...  (unsuccessful - no internet connection).
 > Adding all the files of The COBRA Toolbox ...  Done.
 > Define CB map output... set to svg.

----------------------------------------------------------------------------------------------------
MATLAB Version: 9.2.0.556344 (R2017a)
MATLAB License Number: 256165
Operating System: Microsoft Windows 7 Enterprise  Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.2         (R2017a)
Simulink                                              Version 8.9         (R2017a)
Bioinformatics Toolbox                                Version 4.8         (R2017a)
Control System Toolbox                                Version 10.2        (R2017a)
Curve Fitting Toolbox                                 Version 3.5.5       (R2017a)
Data Acquisition Toolbox                              Version 3.11        (R2017a)
Database Toolbox                                      Version 7.1         (R2017a)
Datafeed Toolbox                                      Version 5.5         (R2017a)
Econometrics Toolbox                                  Version 4.0         (R2017a)
Financial Instruments Toolbox                         Version 2.5         (R2017a)
Financial Toolbox                                     Version 5.9         (R2017a)
Fixed-Point Designer                                  Version 5.4         (R2017a)
Fuzzy Logic Toolbox                                   Version 2.2.25      (R2017a)
Global Optimization Toolbox                           Version 3.4.2       (R2017a)
Image Acquisition Toolbox                             Version 5.2         (R2017a)
Image Processing Toolbox                              Version 10.0        (R2017a)
Instrument Control Toolbox                            Version 3.11        (R2017a)
MATLAB Coder                                          Version 3.3         (R2017a)
MATLAB Compiler                                       Version 6.4         (R2017a)
MATLAB Compiler SDK                                   Version 6.3.1       (R2017a)
Mapping Toolbox                                       Version 4.5         (R2017a)
Neural Network Toolbox                                Version 10.0        (R2017a)
Optimization Toolbox                                  Version 7.6         (R2017a)
Parallel Computing Toolbox                            Version 6.10        (R2017a)
Partial Differential Equation Toolbox                 Version 2.4         (R2017a)
Signal Processing Toolbox                             Version 7.4         (R2017a)
SimBiology                                            Version 5.6         (R2017a)
Simscape                                              Version 4.2         (R2017a)
Simscape Multibody                                    Version 5.0         (R2017a)
Simscape Power Systems                                Version 6.7         (R2017a)
Simulink Coder                                        Version 8.12        (R2017a)
Simulink Control Design                               Version 4.5         (R2017a)
Simulink Real-Time                                    Version 6.6         (R2017a)
Stateflow                                             Version 8.9         (R2017a)
Statistics and Machine Learning Toolbox               Version 11.1        (R2017a)
Symbolic Math Toolbox                                 Version 7.2         (R2017a)
Wavelet Toolbox                                       Version 4.18        (R2017a)

 > Default shell       :        
 > Version of shell    :        '--version' is not recognized as an internal or external command,
operable program or batch file.
 > Architecture        :        PCWIN64
 > MATLAB folder       :        C:\Program Files\MATLAB\R2017a
 > COBRA Toolbox root  :        C:\Users\JTMetz\cobratoolbox
 > git version         :        git version 2.10.2.windows.1
 > curl version        :        curl 7.49.0 (x86_64-pc-win32)
 > CBT_LP_SOLVER       :        
 > CBT_MILP_SOLVER     :        
 > CBT_QP_SOLVER       :        
 > CBT_MIQP_SOLVER     :        
 > CBT_NLP_SOLVER      :        
 > GUROBI_PATH         :        
 > ILOG_CPLEX_PATH     :        
 > TOMLAB_PATH         :        
 > MOSEK_PATH          :        

 > ----------------------------------- END OF CONFIGURATION REPORT -----------------------------------

 >  Please send the report located in
    C:\Users\JTMetz\cobratoolbox\COBRAconfigReport.log
    to the developers or post it in the forum:

James T. Metz

unread,
Dec 29, 2017, 4:46:54 PM12/29/17
to thoma...@uni.lu, cobra-...@googlegroups.com, James...@aol.com
Thomas,

    Per your request for more diagnostic information below.  Here is the output from

    which('writeCbModel.m','-all')

    C:\Users\JTMetz\cobratoolbox\src\base\io\writeCbModel.m


    This makes sense.  When I installed the cobra toolbox, all of the files went into a cobratoolbox directory
under my username on the C: drive.

    Since, much of our discussion seems to be centered around the code in writeCbModel.m, I have attached a 
copy of the code that I have to this email message.  Perhaps you can compare the code that I am using to
code that you are using.  Hopefully, something will be different and will stand out and explain the difficulties I 
am having.

    Thanks again.
writeCbModel.m

Laurent Heirendt

unread,
Dec 29, 2017, 5:18:02 PM12/29/17
to COBRA Toolbox
Hi,

Please note that in order for writeCbModel() to work, binaries are being downloaded from the Internet when running >> initCobraToolbox.

Now, as you do not have an active internet connection when running initCobraToolbox, you may try to download a fully packaged COBRA Toolbox when you have an active internet connection from here: http://prince.lcsb.uni.lu/releases/the_COBRA_Toolbox.zip

Please note though that this is a large file (300MB) and that this packaged version is experimental (for now).

Please also note that we do not support R2017a. May you use R2016b?

Let me know if this works.

Best regards,

Laurent
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbox+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu
--

---
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/9zI67aJKuOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbox+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu
--

---
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/9zI67aJKuOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbox+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thomas Pfau

unread,
Dec 29, 2017, 6:28:58 PM12/29/17
to James T. Metz, cobra-...@googlegroups.com

Hi James,

Indeed your toolbox seems to be slightly out of date, and yes there was an update that fixed the issue you describe with my example (i.e. that detects the format properly from the file extension).
As Laurent already mentioned, to properly use the toolbox you will (at least for the installation) need a working internet connection as the toolbox depends on submodules which are downloaded from the web.

I'm not entirely sure, which version the package pointed to by Laurent contains but I assume it should work.  

Another option you would have is to do a full installation at home (as detailed in the installation instruction, including starting up Matlab after the download and running initCobraToolbox) copy your cobratoolbox folder on a stick and copy it from there to your working machine. You will still not be able to update your toolbox, but at least you

As a third option (assuming, that the libsbml binaries were downloaded at some point), and that they are recent enough to be compatible with 2017a:
The writeCbModel call you would need would have to include the format specification. So my example would be:

model = createModel();
%Reactions in {Rxn Name, MetaboliteNames, Stoichiometric coefficient, GPR} format
Reactions = {'R1',{'A','B'},[-1 1], 'G1 and G2';...
             'R2',{'B','C'},[-1 1],'G3 and (G4 or G5)';...
             'R3',{'C','D'},[-1 1],'G6 or G7'};
ExchangedMets = {'A','D'};
%Add Reactions
for i = 1:size(Reactions,1)
    %All reactions are irreversible
    model = addReaction(model,Reactions{i,1},'metaboliteList',Reactions{i,2},'stoichCoeffList',Reactions{i,3},'geneRule',Reactions{i,4});
end

%Add Exchangers
model = addExchangeRxn(model,ExchangedMets,-1000*ones(numel(ExchangedMets),1),1000*ones(numel(ExchangedMets),1));
model = changeObjective(model,'EX_D',1);
writeCbModel(model,'fileName','Test.xml','format','SBML')

The only change is the additional 'format', 'SBML' parameter/value pair in the writeCbModel call.

Best

Thomas

James T. Metz

unread,
Dec 29, 2017, 7:13:40 PM12/29/17
to laurent....@gmail.com, thoma...@uni.lu, cobra-...@googlegroups.com, james...@aol.com
Laurent and Thomas,

    I downloaded and unzipped the COBRA Toolbox file described below.  I unzipped it
so that it took the same location and path as my previous cobra toolbox.  I noted that the
zipped file contained binary files which my previous version did not.

    The good news is that, now when I run the minimal example MATLAB code from Thomas, I am
able to generate a file, Test.xml, which seems to be reasonable.  And, I can do this using the code
that Thomas provided, without any modifications.

    I am not an expert with COBRA Toolbox or xml/sbml, so I can not really comment here, but
I opened Test.xml, and it seemed to be OK.  I have attached the Test.xml file to this email message
in case either you or Thomas want to inspect the output.

    Thanks again for help from both of you.  I will try to forge ahead, but so far, the toolbox and MATLAB
codes seem to be working.  I apologize in advance if my difficulties are rather simplistic!
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.
Test.xml

Laurent Heirendt

unread,
Dec 29, 2017, 7:28:15 PM12/29/17
to COBRA Toolbox
Hi,

Great to hear that it worked. The .zip version is the latest version of the master branch.

Best regards,

Laurent
To unsubscribe from this group and all its topics, send an email to cobra-toolbox+unsubscribe@googlegroups.com.

James T. Metz

unread,
Dec 29, 2017, 7:49:08 PM12/29/17
to Thoma...@uni.lu, cobra-...@googlegroups.com, James...@aol.com
Thomas,

    I just copied and pasted your code below, and I was able to run it and generate 
an xml output file, Test2.xml, using the newly installed version of cobra toolbox per
Laurent.

    I have attached a copy of Test2.xml in case you want to examine the output.

    Since both your earlier minimal example code and your new code (below) seem
to work, is there any significant difference that I should be aware of?

    Regards,
    Jim Metz
    Northwestern University



-----Original Message-----
From: Thomas Pfau <thoma...@uni.lu>
To: James T. Metz <james...@aol.com>; cobra-toolbox <cobra-...@googlegroups.com>
Sent: Fri, Dec 29, 2017 5:29 pm
Subject: Re: problems with writeCbModel()

Hi James,
Indeed your toolbox seems to be slightly out of date, and yes there was an update that fixed the issue you describe with my example (i.e. that detects the format properly from the file extension).
As Laurent already mentioned, to properly use the toolbox you will (at least for the installation) need a working internet connection as the toolbox depends on submodules which are downloaded from the web.
I'm not entirely sure, which version the package pointed to by Laurent contains but I assume it should work.  
Another option you would have is to do a full installation at home (as detailed in the installation instruction, including starting up Matlab after the download and running initCobraToolbox) copy your cobratoolbox folder on a stick and copy it from there to your working machine. You will still not be able to update your toolbox, but at least you
As a third option (assuming, that the libsbml binaries were downloaded at some point), and that they are recent enough to be compatible with 2017a:
The writeCbModel call you would need would have to include the format specification. So my example would be:

model = createModel();
%Reactions in {Rxn Name, MetaboliteNames, Stoichiometric coefficient, GPR} format
Reactions = {'R1',{'A','B'},[-1 1], 'G1 and G2';...
             'R2',{'B','C'},[-1 1],'G3 and (G4 or G5)';...
             'R3',{'C','D'},[-1 1],'G6 or G7'};
ExchangedMets = {'A','D'};
%Add Reactions
for i = 1:size(Reactions,1)
    %All reactions are irreversible
    model = addReaction(model,Reactions{i,1},'metaboliteList',Reactions{i,2},'stoichCoeffList',Reactions{i,3},'geneRule',Reactions{i,4});
end

%Add Exchangers
model = addExchangeRxn(model,ExchangedMets,-1000*ones(numel(ExchangedMets),1),1000*ones(numel(ExchangedMets),1));
model = changeObjective(model,'EX_D',1);
writeCbModel(model,'fileName','Test.xml','format','SBML')

The only change is the additional 'format', 'SBML' parameter/value pair in the writeCbModel call.

Best

Thomas

On 12/29/2017 10:46 PM, James T. Metz wrote:
Thomas,

    Per your request for more diagnostic information below.  Here is the output from

    which('writeCbModel.m','-all')

    C:\Users\JTMetz\cobratoolbox\src\base\io\writeCbModel.m


    This makes sense.  When I installed the cobra toolbox, all of the files went into a cobratoolbox directory
under my username on the C: drive.

    Since, much of our discussion seems to be centered around the code in writeCbModel.m, I have attached a 
copy of the code that I have to this email message.  Perhaps you can compare the code that I am using to
code that you are using.  Hopefully, something will be different and will stand out and explain the difficulties I 
am having.

    Thanks again.

To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu
--

---
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/9zI67aJKuOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu
--

---
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/9zI67aJKuOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 423
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu 

-- 
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 423
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: thoma...@uni.lu 
--

---
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/9zI67aJKuOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.
Test2.xml

Thomas Pfau

unread,
Jan 2, 2018, 12:24:37 AM1/2/18
to James T. Metz, cobra-...@googlegroups.com

Hi James,

The only difference is, that the latter explicitly states the format (SBML), while the former detects the format based on the file extension.

Best

Thomas

James T. Metz

unread,
Jan 2, 2018, 11:59:38 AM1/2/18
to cobra-...@googlegroups.com, thoma...@uni.lu
Thomas,

    Thank you for the clarification.

    Regards,
    Jim Metz
Reply all
Reply to author
Forward
0 new messages