Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsbml based SBML parser #685

Merged
merged 171 commits into from
Mar 18, 2019
Merged

libsbml based SBML parser #685

merged 171 commits into from
Mar 18, 2019

Conversation

matthiaskoenig
Copy link
Contributor

Hi all,

here a first version of the libsbml based SBML parser. This has the full feature set of the old parser and fixes a few smaller bugs I found on the way. All SBML based tests are passing.
The new parser is in the cobra.io.sbmlnew module, the tests are in test.test_io_sbmlnew. This is fully backwards compatible to the existing implementation (same function signatures).

I performed some timings and in the end the libsbml version is around 10-15% slower on reading very large models (RECON3D), and around 30-40% slower on writing very large models.

timings_libsbml

I did not look into any optimizations. Let me know what to change.
Best Matthias

@codecov-io
Copy link

codecov-io commented Mar 25, 2018

Codecov Report

Merging #685 into devel will decrease coverage by 0.48%.
The diff coverage is 77.6%.

Impacted file tree graph

@@            Coverage Diff             @@
##            devel     #685      +/-   ##
==========================================
- Coverage   84.62%   84.14%   -0.49%     
==========================================
  Files          43       43              
  Lines        3909     4105     +196     
  Branches      892      960      +68     
==========================================
+ Hits         3308     3454     +146     
- Misses        401      422      +21     
- Partials      200      229      +29
Impacted Files Coverage Δ
cobra/core/metabolite.py 70.58% <ø> (ø) ⬆️
cobra/core/gene.py 73.91% <100%> (+0.69%) ⬆️
cobra/manipulation/delete.py 81.37% <33.33%> (-1.46%) ⬇️
cobra/medium/boundary_types.py 95.65% <50%> (-4.35%) ⬇️
cobra/core/model.py 85.4% <55%> (-4.52%) ⬇️
cobra/io/sbml.py 79.25% <79.13%> (+13.25%) ⬆️
cobra/core/group.py 96.15% <96.15%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3f37ec...24c2b9a. Read the comment docs.

@Midnighter
Copy link
Member

When we last talked your new parser implementation was still faster than both existing versions. Is this due to the parsing of GPR associations or where is the biggest performance problem?

@matthiaskoenig
Copy link
Contributor Author

matthiaskoenig commented Mar 26, 2018 via email

@Midnighter
Copy link
Member

That sounds great. You could also check performance when you have symengine installed.

@cdiener
Copy link
Member

cdiener commented Apr 18, 2018

Honestly none of the time differences look very critical to me. In absolute terms they look pretty small. For small models this does not matter and for large ones the differences are pretty minor. I would rather concentrate on the following things:

  • make it pass flake8
  • use numpy style for the docstrings
  • the gene parsing is currently a recursion and that migh lead to RecursionLimit errors for large GPRs
  • what happens with models in the old COBRA format (GPR in notes)? we will probbaly have to support that for SBML 2 models...

Cheers and thanks for all the work. Looks very good!

@matthiaskoenig
Copy link
Contributor Author

All points addressed, all tests passing.
Test coverage of the sbml.py was increased by 14% (the reduce in codecov is due to the groups feature, which reduces coverage of the model.py).

@matthiaskoenig
Copy link
Contributor Author

Hi all,
any reasons why this cannot me merged in devel?
This is

  • completely backwards compatible
  • fixes a ton of issues
  • has higher test coverage than the original code
  • supports additional features (like reading and writing groups)
  • passes all tests and pep8
  • all requested changes have been implemented

I want to use this code in production.
Best Matthias

@Midnighter
Copy link
Member

any reasons why this cannot me merged in devel?

Lack of time 😞 sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants