Hi Markus,

The automatic substructure highlighting is one of the features of the
RDKit-Jupyter integration.
It works by monkey patching the substructure matching functions to store
the results on the molecule being queried in a data member called
__sssAtoms.
If you want to get rid of the highlights in particular molecules you can
just set the __sssAtoms attribute to None:
mol.__sssAtoms = None

There's not a function to disable the saving of substructure search results
entirely, but if you want to do that it's easy enough:
Chem.Mol.GetSubstructMatch = Chem.Mol.__GetSubstructMatch
Chem.Mol.GetSubstructMatches = Chem.Mol.__GetSubstructMatches

All of this is demonstrated in this gist:
https://gist.github.com/greglandrum/5d45b56afe75603b955103cdd0d8e038

-greg




On Thu, Nov 14, 2019 at 8:13 AM Markus Heller <mhel...@admarebio.com> wrote:

> Follow-up after some digging:
>
> I did do a substructure search in the affected Jupyter notebooks,
> specifically while calculating ESOL (using the function calc_esol() in
> esol.py from Pat Walters' github: https://github.com/PatWalters/solubility).
> This seems to explain why the matches are highlighted in the molecule
> column in my dataframe.
>
> I still haven't figured out how to turn this highlighting off though.
> Neither web searches nor searches in the RDkit docs were successful, or I
> have searched using the wrong terms ...  How can this be done?
>
> Cheers
> Markus
>
> From: Markus Heller <mhel...@admarebio.com>
>
> Sent: November 13, 2019 5:01 PM
>
> To: rdkit-discuss (rdkit-discuss@lists.sourceforge.net) <
> rdkit-discuss@lists.sourceforge.net>
>
> Subject: [Rdkit-discuss] Random (?) highlighting in pandas dataframe
>
>
>
>
> Hi all,
>
>
>
> I have an issue with molecule rendering in a pandas dataframe.  I read a
> csv file with SMILES strings and names into a dataframe, and add a mol
> column to the dataframe based on the SMILES.  I then display the molecules
> in the dataframe like so:
>
>
>
> from IPython.display import HTML
>
> HTML(df.to_html())
>
>
>
> What happens is that most of the molecules have a substructure
> highlighted, but not all.  My questions are: why is there a substructure
> highlighted, and how can I turn it off?
>
>
>
>
> More details: it happens in a new Jupyter notebook with compounds I save
> as SMILES or SDF that I obtained from a substructure search done with RDkit
> in a *different* notebook.  In the notebook where the issue arises, I have
> not performed any searches, nor have
>  I specified a substructure for highlighting.  I'm confused.
>
>
>
> Thanks
>
> Markus
>
>
>
>
>
>
>
> _______________________________________________
>
> Rdkit-discuss mailing list
>
> Rdkit-discuss@lists.sourceforge.net
>
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to