Input of a reconstruction in Excel format - error using readCbModel() & no recognition of "Description" column in reaction sheet

91 views
Skip to first unread message

Diogo Lucena

unread,
Dec 10, 2019, 2:02:14 PM12/10/19
to COBRA Toolbox
Hi COBRA Toolbox Group,

I'm currently trying to import a genome-scale metabolic reconstruction in Excel format into the COBRA Toolbox. I'm following the tutorial "Input and output of reconstructions and models" (found in https://opencobra.github.io/cobratoolbox/latest/tutorials/tutorialIO.html) However, I'm facing two issues.

Firstly, when attempting to use the function "readCbModel()" directly (one of the possibilities suggested by the tutorial), I'm getting the following error:

Undefined function or variable 'sheets'.

Error in xls2model (line 102)
        fprintf(strrep(sheets, '\', '\\'));

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

When attempting to bypass this error with the other tutorial suggestion for reading a model, I am able to import the reconstruction into the Matlab environment. My command is as the example present in the tutorial (my file replaces "ecoli_core_model.mat"):

fileName = 'ecoli_core_model.mat';

model = readCbModel(fileName);


This works, but results in a new issue. In the Reaction List sheet, I have created the optional "Description" column with the descriptive name of each reaction, but it is not recognized by the COBRA Toolbox. This results in an imported reconstruction, but every reaction name (in model.rxnNames) is instead the repeated abbreviation. Upon inspecting the code, (to my untrained eye) the issue seems to lie in the function "xls2model()". Running the following code results in the same issue with the reactions "Description" column (my file replaces "ecoli_core_model.mat"):


fileName = 'ecoli_core_model.mat';

model = xls2model(fileName);



The "Description" column header is the exact same string as in the "Metabolite List" sheet "Description" column, yet the metabolite description column is properly recognized while the reaction one isn't.


I am attempting this in an Ubuntu 18.04 environment, with no Excel installed. My reconstruction file is a .xlsx format generated by LibreOffice Calc. I have also tried the format .xls (again generated by LibreOffice), but ran into the same issues. I have the two required sheets, properly named and with appropriate headers and column content. I have also attempted this in a separate Windows + Office environment, but ran into the exact same issues, despite the presence of Excel.


Attached is the "COBRAconfigReport.log" generated by the COBRA Toolbox in the Ubuntu enviornment, as per request. I currently do not have that file for the Windows + Office environment.


Best regards,

Diogo.

COBRAconfigReport.log

Thomas Pfau

unread,
Dec 10, 2019, 3:19:51 PM12/10/19
to cobra-...@googlegroups.com
Hi, Diogo,

Thanks for pointing out these issues. I've put in a pull request to update xls2model (which assumed, that the filename provided was always a relative filename not an absolute), which lead to readCbModel failing on xls files. It's really odd that we missed this, sorry.
As for the second issue:
This should also be solved, once the PR is merged.
It was due to createModel actually ignoring the rxnNamesList provided and always setting rxnNames to the rxns.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/3bf41ac1-1f08-4834-8753-564d1354ddb1%40googlegroups.com.


Diogo Lucena

unread,
Dec 10, 2019, 5:30:13 PM12/10/19
to COBRA Toolbox
Hi Thomas,

Thank you for the quick and thorough reply. 
When the changes get incorporated I'll try to import again and give the appropriate feedback.

Thank you for the attention.

Best regards,
Diogo.

Diogo Lucena

unread,
Dec 11, 2019, 1:55:15 PM12/11/19
to COBRA Toolbox
Hi again Thomas,

I have now tested the latest develop branch and can confirm my two issues are resolved. So, again, thank you for the help!

I don't know if you can comment on such things (and it's perfectly reasonable if you can't), but I noticed there hasn't been an update to the master branch in a while now. Should users be prepared for an incoming major update or is it simply a case of not enough develop changes yet?

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

Ronan M.T. Fleming

unread,
Dec 11, 2019, 2:24:13 PM12/11/19
to COBRA Toolbox
Hi Diogo,
for that, we need to wait till some io issues connected with legacy
model structures is sorted.
Regards,
Ronan
> To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/74986149-6e25-4fb0-82ff-f0a98bd77966%40googlegroups.com.



--
--
Mr. Ronan MT Fleming B.V.M.S. Dip. Math. Ph.D.
----------------------------------------------------------------------------
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
&
Adjunct Lecturer,
School of Medicine,
National University of Ireland, Galway.
----------------------------------------------------------------------------
Peer-reviewed publications: https://goo.gl/FZPG23
Mobile: +353 873 413 072
Skype: ronan.fleming
----------------------------------------------------------------------------
Upcoming course from 25-29 November 2019, at Leiden University on
"Constraint-based modelling: introduction and advanced topics".
https://www.biosb.nl/archive-courses/constraint-based-modelling-introduction-and-advanced-topics-2019/
----------------------------------------------------------------------------
(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