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

Improve performance of SMILES parser #1589

merged 2 commits into from Jun 14, 2017


Copy link

commented Jun 13, 2017

Note: this pull request is on top of #1576, and should not be merged before that.

  1. Removed calls to SetType() from the SMILES parser, as well as from OBAtom::SetIsotope
  2. Changed ParseSimple and ParseComplex to (each) use a single switch statement, rather than a test for isupper() first of all
  3. In ParseComplex, parse the isotopes more efficiently and tighten up their handling when reading/writing

The test cases I wrote flushed out a few issues which I fixed:

  1. Parse 'new' elements (based on those present in elements.txt)
  2. Parse aromatic [te] and [bH]

In passing, I removed the warnings about "Illegal aromatic element". We handle these elements without trouble (by analogy with C, N or O), and I think they might cause a user to simply uppercase the element in the SMILES, which would not be correct.

baoilleach added 2 commits Jun 12, 2017
SMILES parsing performance improvements
1. Don't call SetType() during SMILES parsing.
2. Use a single switch for both aromatic and non-aromatic elements
3. Parse the isotopes more efficiently, and tighten up their handling when reading/writing
4. Accept Te as aromatic when parsing
5. Don't call SetType() during OBAtom::SetIsotope()
6. Test cases for SMILES parsing of elements and isotopes
1. Add aromatic boron to parse complex.
2. When kekulizing, treat like pyrrole nitrogen
3. Add tests for parsing aromatic atoms in organic subset

@ghutchis ghutchis merged commit 829aa40 into openbabel:master Jun 14, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

@baoilleach baoilleach deleted the baoilleach:smilesatomtypes branch Jun 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.