10
$\begingroup$

There are a lot of chemical search engines (such as ChemSpider's Structure search) that allow users to draw and search for a molecule. How does it work? Is the comparison of images used? Could you give me an algorithm or pseudo code?

$\endgroup$
12
+50
$\begingroup$

Usually, structure search is implemented using a graph model. For example, let's take cyclohexane. On screen this is a hexagon - but this is converted on the server to a simple atom/bond graph model of six carbons in a ring.

This graph can then be compared to all the molecules in the database by various means. For example, subgraph isomorphism or fingerprints or even SMILES string comparison.

As far as I know, ChemSpider allows a variety of searches - with/without hydrogens, substructure search, element fingerprints, and so on. Each of these is a whole question by themselves, so I'm not sure how useful an algorithm that covers them all would be.

| improve this answer | |
$\endgroup$
6
$\begingroup$

Using image based search wouldn't work very well since the same compound can be drawn in a lot of different and correct ways. However, it is possible to convert drawn structures or even 3D structures into text, for example using SMILES or InChI. Those can then be used for standard text based database search.

| improve this answer | |
$\endgroup$
4
$\begingroup$

ChemSpider likely has an algorithm that takes the image and converts it to a SMILES string. It would likely have to do so in order to avoid problems in how the structure is drawn as @DSVA pointed out.

For example, if there's a large molecule (where there could be on the order of billions of slight conformational differences), it would be nearly impossible to find a perfect match in the database. However, by considering only the connectivity of atoms (as a SMILES string would achieve), the software could find a match nearly instantaneously.

ChemSpider has an option on their website to search using a SMILES string, so it's known that their software is capable of recognizing SMILES strings. However, I was unable to find confirmation as to whether SMILES is used as a search method as their software does not appear to be open-source.

| improve this answer | |
$\endgroup$

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.