8
$\begingroup$

I would like to be able to parse a molecule into its functional groups, and, also, know the number of occurrences of each.

A similar question was asked on matter modelling specifically for xyz files. I am going to assume at this point most large databases will have molecules either a SMILES or SMARTS tag, or, have a tag that can be converted into a SMILES or SMARTS.

There is a published python code for the Joback method which uses RDKit with github repo.

Looking over the code, which frankly captures the spirit of what I want, there seems to be alot of hardcoding. Is it possible to simply query a program(command line driven) with a molecules SMILE ID and get all of its functionals back?

I know you can ask rdkit if a molecule has a specific functional, but I don't really want that since I don't want to make a list of all possible functionals and then figure out how to count them in rdkit, as well as remove duplicates i.e, a parse for COOH would count as an carboxylic acid, but a separate parse for OH would return true for that same group, and a separate parse for =O would also return true, so I would have to correct for this. Also, I would want that to return as a carboxylic acid, not as an =O, OH and some kind of C. That affects a group contribution method in an undesired way.

Finally, I need every atom to be accounted for.

Python would be much preferred.

$\endgroup$
5
  • 1
    $\begingroup$ Neither of these is exactly what you are looking for, but they may point in the right direction. ErtlFunctionalGroupFinder a Java program for functional group detection. GlobalChem a list of functional group SMARTS/SMILES strings for use in Python programs. $\endgroup$
    – Tyberius
    Jun 29 at 20:00
  • $\begingroup$ @Tyberius in that case do you want to describe one of those in one-topic-per-answer format? $\endgroup$ Jun 29 at 20:18
  • $\begingroup$ I'm not sure I understand what you mean by "I need every atom to be accounted for." Do you mean, you want some sort of coverage for every possible atom environment? $\endgroup$ Jun 30 at 23:25
  • $\begingroup$ FYI, anyone who's written SMARTS patterns for functional groups has constructed them in such a way that the pattern for alcohols will not match -OH in a protonated carboxylic acid, e.g. github.com/openbabel/openbabel/blob/master/data/… $\endgroup$ Jun 30 at 23:27
  • $\begingroup$ @GeoffHutchison I just mean that when I do an atom mass balance with all of the returned functionals, it adds up to the molecule. This requires 1) no double counting and 2) no missing functionals and 3) not just functionals are returned, but number of each type. $\endgroup$
    – B. Kelly
    Jul 1 at 0:26
9
$\begingroup$

ErtlFunctionalGroupsFinder

A Java library for automated functional group implemented with the Chemical Development Kit (CDK) program. It should run on Windows/Mac/Linux operating systems.

It relies on the Ertl algorithm, which is also used by the RDKit for functional group detection. A key difference between the two implementations seems to be in their ability to account for the surrounding environment. For example, EFGF distinguishes a carboxyl group, an ester group and a formic acid ester group using pseudo SMILES strings, while RDKit would produce a single SMILES string for each of these.

The implementation is very fast, allowing them to process 1.8 million molecules from the ChEMBL database in 74s (50 million/hour) on a single core, with the option to parallelize if needed.

A somewhat more detailed description of the code is available in [1] and the code itself can be viewed/downloaded from its GitHub repo

  1. Fritsch, S., Neumann, S., Schaub, J. et al. ErtlFunctionalGroupsFinder: automated rule-based functional group detection with the Chemistry Development Kit (CDK). J Cheminform 11, 37 (2019). https://doi.org/10.1186/s13321-019-0361-8
$\endgroup$
4
  • 2
    $\begingroup$ As easy as python is i hate its slow speed. I doubt anything written in python could compete with that speed. I hope someone gives a Julia answer now haha, i love that language. $\endgroup$
    – B. Kelly
    Jun 29 at 22:24
  • $\begingroup$ @B.Kelly I would definitely also like to see a Julia answer if one exists. $\endgroup$
    – Tyberius
    Jun 29 at 23:17
  • $\begingroup$ @B.Kelly At least the original paper states it were Java, not Python. Then, the answer stated «with the option to parallelize it», which if the algorithm already is optimized, is today's approach to improve overall processing rate. On the other hand, «Julia -- Looks like Python, feels like Lisp, runs like C/Fortran» is something frequently read / used in promoting Julia, perhaps a question of surpassing a critical mass / interest until the algorithm is ported to (an) other language(s). $\endgroup$
    – Buttonwood
    Jun 30 at 18:08
  • $\begingroup$ Most RDKit implementations are, at the core, C++. While there's plenty of Python, the key code (e.g., SMARTS matching) is done in C++. $\endgroup$ Jun 30 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.