Skip to content

refactor: implement an updated parser [WIP]#6

Open
Midnighter wants to merge 15 commits intomasterfrom
refactor/lexer
Open

refactor: implement an updated parser [WIP]#6
Midnighter wants to merge 15 commits intomasterfrom
refactor/lexer

Conversation

@Midnighter
Copy link
Owner

  • Upgrade package infrastructure.
  • Implement a tokenizer (lexer) and a parser (compiler) that assembles the token values to SQLAlchemy models.
  • Add tests for many situations.

This PR is work in progress. It completely updates the structure, configuration, and adds continuous integration. Once merged the BRENDA-Parser will be installable from PyPI.

What's missing:

  1. More test cases.
  2. Relationships on Enzyme class.
  3. Some errors still occur during parsing.
  4. Documentation
  5. Automatic releases via Travis and readthedocs.

@codecov
Copy link

codecov bot commented Dec 2, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@999fbca). Click here to learn what that means.
The diff coverage is 83.92%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #6   +/-   ##
=========================================
  Coverage          ?   83.92%           
=========================================
  Files             ?       16           
  Lines             ?      591           
  Branches          ?        0           
=========================================
  Hits              ?      496           
  Misses            ?       95           
  Partials          ?        0
Impacted Files Coverage Δ
src/brenda_parser/cli.py 0% <0%> (ø)
src/brenda_parser/parsing/__init__.py 100% <100%> (ø)
src/brenda_parser/exceptions.py 100% <100%> (ø)
src/brenda_parser/models/__init__.py 100% <100%> (ø)
src/brenda_parser/models/organism.py 100% <100%> (ø)
src/brenda_parser/data/__init__.py 100% <100%> (ø)
src/brenda_parser/models/enzyme.py 100% <100%> (ø)
src/brenda_parser/models/comment.py 100% <100%> (ø)
src/brenda_parser/models/field_entry.py 100% <100%> (ø)
src/brenda_parser/api.py 30.88% <30.88%> (ø)
... and 6 more

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 999fbca...95e9b3c. Read the comment docs.

@matthiaskoenig
Copy link

@Midnighter Is this working/usable?
Any documentation on how to use this?

I just tried the following in the hope it parses the brenda file and puts it into a sqlite database:

from brenda_parser import cli
cli.parse(flat_file="brenda.sqlite", filename="./brenda_parser/brenda_download.txt")

But resulted in

Traceback (most recent call last):
  File "/home/mkoenig/git/pancreas_model/pypancreas/webservices/brendaparser/brenda.py", line 5, in <module>
    cli.parse(flat_file="brenda.sqlite", filename="./brenda_parser/brenda_download.txt")
  File "/home/mkoenig/envs/pancreas/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/mkoenig/envs/pancreas/lib/python3.6/site-packages/click/core.py", line 716, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/home/mkoenig/envs/pancreas/lib/python3.6/site-packages/click/core.py", line 639, in make_context
    ctx = Context(self, info_name=info_name, parent=parent, **extra)
TypeError: __init__() got an unexpected keyword argument 'flat_file'

Would be great to finish this up and release on pypi.

@Midnighter
Copy link
Owner Author

Hey, I wasn't sure it's still worth since I thought BRENDA was now included in SABIO-RK and other sources. However, you're the third person asking for it so, I guess, I should finish it up.

It's definitely not useable yet. I had experimented with different ways of parsing the flat file

  1. tried to improve the PLY setup
  2. gave tatsu a shot

but I ran into a lot of problems with both (and they were also fairly slow). So I might use pyparsing instead.

@matthiaskoenig
Copy link

I just talked to the SABIO-RK developers and there is no plan on BRENDA integration. BRENDA is quit restrictive with the availability of their data (for instance no database dump, only somehow limiting text download).
I solved all my Brenda issues for now (I had some old parser code which I updated and is solving my use case).
Thanks Matthias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants