Open markarchibald opened 9 months ago
@markarchibald You are right about deuterium and tritium - JSMol::remove_hs()
calls MolOps::removeAllHs()
which will remove ALL hydrogens, including isotopic ones. I will add an optional flag to enable retaining isotopic Hs, similarly to C++ and Python.
Regarding H atoms that are required to define stereochemistry, those are not actually present in the molecule graph, they are only added on-the-fly for visualization. You may avoid that those Hs are added by calling get_svg_with_highlights()
or draw_to_canvas_with_highlights()
and passing '{"addChiralHs":"false"}'
as JSON details.
@ptosco thanks for the quick reply. Do you have a guess for when the change will find its way into a release?
(Regarding Hs defining stereo, I do want these to be displayed but it's useful to understand it better.)
The rdkit-js
release cycle follows the main rdkit
repo release cycle, which is reported here:
https://github.com/rdkit/rdkit/milestones
Alternatively, as soon as I have made the change in master
and it has been reviewed and merged (which will probably happen before the end of this week), you can build your own RDKit_minimal
library using the Dockerfile
:
https://github.com/rdkit/rdkit/blob/master/Code/MinimalLib/docker/Dockerfile
Documentation how to build the library is provided as comments in the Dockerfile itself.
That's great, thank you
@ptosco after some delays RDKitJS was released, but I can't see how to implement the option to retain isotopic H.
I might be looking in the wrong place, but I can't see anything either here: https://docs.rdkitjs.com/interfaces/JSMol.html#remove_hs or here: https://www.rdkit.org/docs/source/rdkit.Chem.rdmolops.html#rdkit.Chem.rdmolops.RemoveAllHs
Could you let me know the name of the flag?
@markarchibald Sorry, this one slipped through the cracks. JSMol::remove_hs()
calls MolOps::removeAllHs()
which will remove ALL hydrogens, including isotopic ones. I had very limited time to dedicate to community requests during the last year. I'll try and get this done for the 2024.09 release.
@ptosco no problem - we appreciate the time that you and others commit to this
@ptosco I understand time is in short supply and don't want to hassle you – as the 2024.09 release date is not far away I just wanted to ask if there's any update on this one?
Using the remove_hs function to remove unnecessary explicit H atoms, I found that while it does not remove H atoms that are required to define stereochemistry, it does remove H atoms that are labelled as the isotopes deuterium or tritium – altering the chemical structure. The analogous Chem.RemoveHs function in core RDKit does not remove deuterium/tritium.
Can be reproduced on the RDKitJS demo page (https://www.rdkitjs.com/#introduction) by running this code using a mol block for D2O:
which produces this depiction:
Expected behavior Expected behaviour is that D atoms are not removed (as they define chemical information that is otherwise lost), resulting in this depiction: