Error using readCbModel()

973 views
Skip to first unread message

Michel Lavoie

unread,
May 13, 2017, 7:36:21 PM5/13/17
to COBRA Toolbox

Hello, 

I tried to read several valid SBML files with the function readCbModel() using the CobraToolbox in MATLAB. However, no matter what SBML file I tried to read, I kept getting the following three error messages:

 

Error using convertSBMLToCobra

Too many input arguments.

 

Error in readCbModel>readSBMLCbModel (line 184)

model = convertSBMLToCobra(modelSBML,defaultBound,compSymbolList,compNameList);

 

Error in readCbModel (line 132)

            model = readSBMLCbModel([fileName '.xml'],defaultBound,compSymbolList,compNameList);

 

Note that all the SBML files I try to read have been previously validated to work well. My question is similar to the question of Amornpan Klanchui (posted on 12 february) (object : Cobra Toolbox: Error readCbModel with valid sbml file). However, I could not see an answer to the question of M. Klanchui. Could you please tell me what I could do to fix the problem?

Thank you,

Michel

Thomas Pfau

unread,
May 15, 2017, 1:03:54 AM5/15/17
to cobra-...@googlegroups.com

Hi Michel,

Which version of the toolbox are you using? readSBMLCbModel is removed from the readCbModel function since over a year. Could you please install the current version of the toolbox and the requirements detailed here :

https://github.com/opencobra/cobratoolbox/blob/master/.github/REQUIREMENTS.md

and here:

https://github.com/opencobra/cobratoolbox#installation

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

Michel Lavoie

unread,
Jul 20, 2017, 11:22:42 PM7/20/17
to COBRA Toolbox
Thank you very much Thomas for your answer. 
I have installed the current version of the Cobra toolbox, initialized it (initCobraToolbox), and tested all (TestAll) functions. However, I got some error messages when I tested with testAll(). Regarding my question about SBML file conversion into a Cobra file, I stil get error messages when I try to convert a valid SBML file into a matlab cobra file.

I consistently get the following error messages :

Error using TranslateSBML
Too many input arguments
USAGE: [model, (errors), (version)] = TranslateSBML((filename), (validateFlag), (verboseFlag))

Error in readSBML (line 31)
modelSBML = TranslateSBML(fileName,0,0,[1 1]);

Error in readCbModel (line 206)
        model = readSBML(fileName,defaultBound);

Could you please tell me how I can convert a SBML file (expressed as . xml) to a Cobra file (.m) ?

Thank you very much for your support,

Michel

Laurent Heirendt

unread,
Jul 21, 2017, 1:54:19 AM7/21/17
to COBRA Toolbox
Hi,

May you post here the output of >> generateSystemConfigReport ?

Thanks,

Laurent

Michel Lavoie

unread,
Jul 21, 2017, 8:08:29 AM7/21/17
to COBRA Toolbox
Hi Laurent , 
Here is the output of >> generateSystemConfigReport. Thanks for your help.


 > ---------------------------------- 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 ...  (not installed).
 > 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.
 > Retrieving models ... > The URL https://raw.github.com/snmendoz/Models/master/AntCore.mat cannot be reached.
 > The URL http://bigg.ucsd.edu/static/models/iIT341.xml cannot be reached.
 > The URL http://bigg.ucsd.edu/static/models/iAF1260.mat cannot be reached.
 > The URL http://bigg.ucsd.edu/static/models/iJO1366.mat cannot be reached.
 > The URL https://vmh.uni.lu/files/Recon2.v04.mat_.zip cannot be reached.
   Done.
 > Configuring solver environment variables ...
   - [----] ILOG_CPLEX_PATH :  --> set this path manually after installing the solver ( see instructions )
   - [*---] GUROBI_PATH: C:\gurobi702\win64\matlab
   - [----] TOMLAB_PATH :  --> set this path manually after installing the solver ( see instructions )
   - [----] MOSEK_PATH :  --> set this path manually after installing the solver ( see instructions )
   Done.
 > Checking available solvers and solver interfaces ... Done.
 > Setting default solvers ... Done.
 > Saving the MATLAB path ... Done.
   - The MATLAB path was saved in the default location.

 > Summary of available solvers and solver interfaces

Support           LP MILP   QP MIQP  NLP
----------------------------------------------------------------------
cplex_direct active            0    0    0    0    -
dqqMinos     active            0    -    -    -    -
glpk         active            1    1    -    -    -
gurobi       active            1    1    1    1    -
ibm_cplex     active            0    0    0    -    -
matlab       active            1    -    -    -    1
mosek         active            0    0    0    -    -
pdco         active            1    -    1    -    -
quadMinos     active            0    -    -    -    0
tomlab_cplex active            0    0    0    0    -
qpng         passive          -    -    1    -    -
tomlab_snopt passive          -    -    -    -    0
gurobi_mex   legacy            0    0    0    0    -
lindo_old     legacy            0    -    -    -    -
lindo_legacy legacy            0    -    -    -    -
lp_solve     legacy            1    -    -    -    -
opti         legacy            0    0    0    0    0
----------------------------------------------------------------------
Total         -                5    2    3    1    1

 + Legend: - = not applicable, 0 = solver not compatible or not installed, 1 = solver installed.


 > You can solve LP problems using: 'glpk' - 'gurobi' - 'matlab' - 'pdco' - 'lp_solve' 
 > You can solve MILP problems using: 'glpk' - 'gurobi' 
 > You can solve QP problems using: 'gurobi' - 'pdco' - 'qpng' 
 > You can solve MIQP problems using: 'gurobi' 
 > You can solve NLP problems using: 'matlab' 

Elapsed time is 24.132318 seconds.

----------------------------------------------------------------------------------------------------
MATLAB Version: 9.1.0.441655 (R2016b)
MATLAB License Number: 310290
Operating System: Microsoft Windows 10 Famille Version 10.0 (Build 15063)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.1         (R2016b)
Simulink                                              Version 8.8         (R2016b)
Aerospace Toolbox                                     Version 2.18        (R2016b)
Communications System Toolbox                         Version 6.3         (R2016b)
Computer Vision System Toolbox                        Version 7.2         (R2016b)
Control System Toolbox                                Version 10.1        (R2016b)
Curve Fitting Toolbox                                 Version 3.5.4       (R2016b)
DSP System Toolbox                                    Version 9.3         (R2016b)
Data Acquisition Toolbox                              Version 3.10        (R2016b)
Database Toolbox                                      Version 7.0         (R2016b)
Financial Toolbox                                     Version 5.8         (R2016b)
Fixed-Point Designer                                  Version 5.3         (R2016b)
Fuzzy Logic Toolbox                                   Version 2.2.24      (R2016b)
Global Optimization Toolbox                           Version 3.4.1       (R2016b)
HDL Verifier                                          Version 5.1         (R2016b)
Image Acquisition Toolbox                             Version 5.1         (R2016b)
Image Processing Toolbox                              Version 9.5         (R2016b)
Instrument Control Toolbox                            Version 3.10        (R2016b)
MATLAB Coder                                          Version 3.2         (R2016b)
MATLAB Compiler                                       Version 6.3         (R2016b)
MATLAB Compiler SDK                                   Version 6.3         (R2016b)
Mapping Toolbox                                       Version 4.4         (R2016b)
Model Predictive Control Toolbox                      Version 5.2.1       (R2016b)
Neural Network Toolbox                                Version 9.1         (R2016b)
OPC Toolbox                                           Version 4.0.2       (R2016b)
Optimization Toolbox                                  Version 7.5         (R2016b)
Parallel Computing Toolbox                            Version 6.9         (R2016b)
Partial Differential Equation Toolbox                 Version 2.3         (R2016b)
RF Toolbox                                            Version 3.1         (R2016b)
Robust Control Toolbox                                Version 6.2         (R2016b)
Signal Processing Toolbox                             Version 7.3         (R2016b)
Simscape                                              Version 4.1         (R2016b)
Simscape Multibody                                    Version 4.9         (R2016b)
Simscape Power Systems                                Version 6.6         (R2016b)
Simulink Coder                                        Version 8.11        (R2016b)
Simulink Control Design                               Version 4.4         (R2016b)
Simulink Desktop Real-Time                            Version 5.3         (R2016b)
Simulink Real-Time                                    Version 6.5         (R2016b)
Statistics and Machine Learning Toolbox               Version 11.0        (R2016b)
Symbolic Math Toolbox                                 Version 7.1         (R2016b)
System Identification Toolbox                         Version 9.5         (R2016b)
Wavelet Toolbox                                       Version 4.17        (R2016b)

 > Default shell       :        
 > Version of shell    :        '--version' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
 > Architecture        :        PCWIN64
 > MATLAB folder       :        C:\Program Files\MATLAB\R2016b
 > COBRA Toolbox root  :        C:\Users\Utilisateur\Documents\GitHub\cobratoolbox
 > git version         :        git version 2.10.0.windows.1
 > curl version        :        'curl' n'est pas
 > CBT_LP_SOLVER       :        gurobi
 > CBT_MILP_SOLVER     :        gurobi
 > CBT_QP_SOLVER       :        gurobi
 > CBT_MIQP_SOLVER     :        gurobi
 > CBT_NLP_SOLVER      :        matlab
 > GUROBI_PATH         :        C:\gurobi702\win64\matlab
 > ILOG_CPLEX_PATH     :        
 > TOMLAB_PATH         :        
 > MOSEK_PATH          :        

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

Laurent Heirendt

unread,
Jul 21, 2017, 8:57:21 AM7/21/17
to COBRA Toolbox
Hi,


The binaries for reading SBML files will not be downloaded unless you have Git Bash installed, especially the system tools (make sure that you select the third option during installation). If you already have Git Bash installed, uninstall and then reinstall the software.

Please let me know if this works.

Best,

Laurent

Michel Lavoie

unread,
Jul 21, 2017, 2:30:39 PM7/21/17
to COBRA Toolbox
Hi Laurent, I found the problem. Curl was not installed on my computer and hence, when I initialized and  tested the Cobra toolbox with "tinitCobratoolbox" and "testAll", several files could not be downloaded on my computer and several functions of the Cobra toolbox did not work. Now, after having installed Curl , almost all tests were passed except five tests 
'testFEA/testFEA'

'testSteadyCom/testSteadyCom'

'testWriteCbModel/testWriteCbModel'

'testXls2Model/testXls2Model' 

 'testPaint4Net/testPaint4Net' 

The command readCbModel() appears to work now! Thank you very much for your help!

Regards, Michel

Laurent Heirendt

unread,
Jul 21, 2017, 2:48:40 PM7/21/17
to COBRA Toolbox
Hi,

Great to hear that it worked. Curl is installed as part of Git Bash, which is a requirement for the COBRA Toolbox on Windows.

I am not sure why these tests did not pass - do you mind attaching the output of >> testAll?

Best,

Laurent

Michel Lavoie

unread,
Jul 21, 2017, 8:05:57 PM7/21/17
to COBRA Toolbox
Hi Laurent,
             The testing step (with the command " testAll" took more than 1 h and a half on my slow and old (i3, 2 ghz, PC) computer ! I can do another test and save the output for you (if my computer survive!) . Do you want only the end of the output or all the output?
Thanks,
Michel

Laurent Heirendt

unread,
Jul 22, 2017, 4:17:32 AM7/22/17
to COBRA Toolbox
Hi Michel,

Yes, testAll might take a while depending on the machine's specifications. If you can, it would be great to have all the output in order to see the error messages thrown for each test.

Thanks,

Laurent

Michel Lavoie

unread,
Jul 23, 2017, 7:08:25 AM7/23/17
to COBRA Toolbox
Hi Laurent, You may find attached the long output of testAll in a .txt file.

Michel
testCobraToolbox.txt

Mausmi Singh

unread,
May 12, 2022, 7:07:04 AM5/12/22
to COBRA Toolbox
Hi, 

I'm getting error using readCbModel() command. 
I tried uninstalling CobraToolbox.  Also, I did all the troubleshooting mentioned in this thread.   but nothing worked for me.
when I'm tried to load the model using readCbModel(), it's give some warning that excel is not installed and limit is 10000 reaction and then throwing this error.
I'm using MacBook Pro M1 chip. but when I used the same command  readCbModel to load the model in windows it was perfectly working.


Error using xls2model (line 320)
Not all metabolites could be matched

Error in readCbModel (line 221)
        model = xls2model(fileName, [], defaultBound);


Any help will be highly appreciated. Thank you.


kind regards,
Mausmi Singh

Thomas Pfau

unread,
May 13, 2022, 5:55:14 PM5/13/22
to cobra-...@googlegroups.com
Hi,

The problem is, that matlab doesn't like excel on *nix type systems, which includes mac.

There are a couple of options that can be used to still load the model:
1. Save it as a .mat file in Windows and load the .mat file with your mac.
2. Store it as an sbml and reload it on the mac.
3. install xlread (https://www.mathworks.com/matlabcentral/fileexchange/65824-xlread), and remove the whole isunix block in xls2model (113-126 along with the "end" in line 129) and replace xlsread by xlread.

Best

Thomas

Ronan M.T. Fleming

unread,
May 31, 2022, 7:05:28 AM5/31/22
to COBRA Toolbox
Hi Thomas/Masumi,
would one of you add
https://uk.mathworks.com/matlabcentral/fileexchange/65824-xlread to
cobratoolbox/external then edit xls2model and make a pull request?
Regards,
Ronan
> To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/5b38bd19-9681-030e-9305-4eb0aa2241e6%40thomaspfau.de.



--
--
Mr. Ronan MT Fleming B.V.M.S. Dip. Math. Ph.D.
----------------------------------------------------------------------------
Associate Professor,
School of Medicine,
National University of Ireland, Galway.
&
Assistant Professor,
Division of Systems Biomedicine and Pharmacology,
Leiden Academic Centre for Drug Research,
Faculty of Science,
Leiden University.
https://www.universiteitleiden.nl/en/staffmembers/ronan-fleming
&
H2020 Project Coordinator,
Systems Medicine of Mitochondrial Parkinson’s Disease,
http://sysmedpd.eu
----------------------------------------------------------------------------
Peer-reviewed publications: https://goo.gl/FZPG23
Mobile: +353 852 109 806
Skype: ronan.fleming
----------------------------------------------------------------------------
(This message is confidential and may contain privileged information.
It is intended for the named recipient only. If you receive it in
error please notify me and permanently delete the original message and
any copies.)
Reply all
Reply to author
Forward
0 new messages