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

Achieve 3D coordinate generation using RDKit.js? #338

Open
ben-ikt opened this issue May 30, 2023 · 2 comments
Open

Achieve 3D coordinate generation using RDKit.js? #338

ben-ikt opened this issue May 30, 2023 · 2 comments

Comments

@ben-ikt
Copy link

ben-ikt commented May 30, 2023

Is your feature request related to a problem? Please describe.
I want to display a molecule in 3D via ThreeJS and the PDBLoader.

Describe the solution you'd like
Be able to get 3D coordinates.

@MichelML
Copy link
Collaborator

Thanks for the request @ben-ikt, I would tend to say this isn't possible at the moment, but to be honest there are a few things I'm not sure of:

  1. Where does rdkit-js fit in your current use case? If you use ThreeJS and PDBLoader, it doesn't seem you need rdkit-js.
  2. Assuming you really want to retrieve 3D coordinates, that logic would currently be based on molfile (and not pdb, unless I'm wrong, rdkit-js doesn't support loading molecules from pdb) in rdkit-js. And the only way I can think of having 3D info at the moment, is you would have had initially loaded a molecule with get_mol using a molfile containing 3D coordinates, and then you would be able to retrieve it back calling get_molblock on the molecule object, but that would essentially give you back the original molfile, which contained the 3D coordinates in the first place.

We can continue the convo here if you have further questions after reading this, otherwise let me know and we'll close this.

@themoenen
Copy link

I'm running in the same limitation. In Python I'm able to generate 3D coordinates from an InChI or SMILES string:

mol_rdkit = Chem.MolFromSmiles(smiles)
mol_rdkit = Chem.AddHs(mol_rdkit) # Add explicit hydrogen atoms
Chem.rdDistGeom.EmbedMolecule(mol_rdkit) # Embed 3D coordinates
sdf = Chem.MolToMolBlock(mol_rdkit) # Generate SDF

Then in the frontend I render the 3D molecule based on the SDF coordinates.

I'm trying to move this logic into the frontend so I can render the molecule without having to wait for the slow API, but this doesn't seem possible due to lacking 3D coordinates.

IN JS this looks like:

const rdkMol = window.RDKit.get_mol(smiles)
rdkMol.add_hs() // Add explicit hydrogen atoms
// No way to embed 3D coordinates
const sdf = rdkMol.get_molblock() // Generate SDF

So, to be concrete, is a JS equivalent for Chem.rdDistGeom.EmbedMolecule not a priority or not possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants