3Dmol.js icon indicating copy to clipboard operation
3Dmol.js copied to clipboard

Smiles support?

Open prismofeverything opened this issue 7 years ago • 7 comments

Wondering what you think of the idea of being able to translate SMILES strings into visualizations? I know it would be missing the position information, so would possibly require some inference there, but it would be really useful to take all of these SMILES strings I have laying around and see what they look like.

I suppose this could be accomplished by simply converting a SMILES string into PDB or some other amenable format and filling in some plausible positions. Hmmm.... what would be the best format for that?

Thanks for the consideration!

prismofeverything avatar Mar 15 '17 02:03 prismofeverything

SMILES is particularly painful because they can "lie" and ignore stereochemistry that must be in the 3D visualization.

That said, I'd recommend converting SMILES into SDF or Mol2, since those formats retain bonding information.

ghutchis avatar Mar 15 '17 02:03 ghutchis

I wonder just theoretically how much the positions of the atoms are constrained by the bond network alone? I assume I would have to use some kind of constraint solver to find a selection of optimal configurations or something, and provide a heuristic for the rotation of single bonds (force-directed maybe?) Just throwing things out there.

This could be even more amenable if the outcome did not need to be correct, but merely plausible enough to give people an idea of the structure.

prismofeverything avatar Mar 15 '17 03:03 prismofeverything

The goal for this sort of thing is to use emscripten compiled javascript versions of openbabel and/or rdkit. I just need to find the time to investigate what is out there (e.g., https://github.com/cheminfo/RDKitjs) and see what we can do to better integrate with it.

dkoes avatar Mar 15 '17 13:03 dkoes

@prismofeverything - what you're describing is the distance-geometry method (e.g., set a lower and upper constraint on atom-atom distances based on the bond network). This is what RDKit uses.

As I said, my big issue with SMILES depiction in 3D is that many SMILES ignore stereochemistry, making the 3D coordinates unspecified (e.g., CC=CF).

ghutchis avatar Mar 15 '17 22:03 ghutchis

@ghutchis Aha, understood. I think in that case could a reasonable guess be made? As in, apply some quick rule of thumb consistently to these cases knowing the result will be approximate. I think everyone can grant that there is ambiguity in translating a SMILES string, but that does not mean it wouldn't be useful to be able to visualize what we can.

Either way, thanks for the discussion! Going to look up the distance-geometry method right now.

@dkoes That is a good lead! Curious if that gets us everything we need here, I'll take a look.

prismofeverything avatar Mar 15 '17 22:03 prismofeverything

Both openbabel and rdkit will do conformer generation, picking an arbitrary stereochemistry if it isn't specified.

Another thing they can do is generate 2D coordinates for drawing the molecule. It doesn't make a huge amount of sense to visualize these in 3D, but you can if you want.

In theory you can do this now with one of the javascript versions of rdkit/openbabel, convert the resulting molecule to an sdf string and visualize it with 3Dmol.js.

dkoes avatar Mar 15 '17 23:03 dkoes

Hello guys,

We have now, a web assembly version of rdkitjs. 3 time faster ;-) hopefully the next generation of Chrome "V10 engine" will be fully optimized for web assembly and we can expect to gain more in April.

https://www.cheminfo.org/Chemistry/Cheminformatics/RDKit_demo/index.html

Guillaume GODIN

thegodone avatar Feb 23 '18 08:02 thegodone