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

Change the OBAromTyper from using SMARTS patterns to a switch statement (rebased) #1545

merged 2 commits into from Mar 8, 2017


Copy link

commented Feb 26, 2017

The original OBAromTyper applies atom types (corresponding to the number of pi electrons donated by particular atom environments) by matching SMARTS patterns against a molecule. Which somewhat convenient, this is a very inefficient way of applying the types, as it is all-against-all involving redundant matches, and also has subsequent pruning (based on hybridisation) in the code. The use of the 'D' in the SMARTS patterns almost meant that different results were possible depending on whether implicit or explicit hydrogens were present.

This has been replaced with a more efficient, and fairly readable (IMO) switch statement on element, then on charge, and then heavy atom degree (in general). Pruning is now done before the switch statement.

Reading SMILES is about 3.5% faster (based on ChEMBL "-ismi -onul"). The SMILES output for ChEMBL, eMolecules and PubChem Compound is unchanged except for a single eMolecules entry where the output was previously in error.

@baoilleach baoilleach merged commit a34d0cf into openbabel:master Mar 8, 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:aromaticswitch branch Mar 8, 2017

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