Hi Nick,
When you import IPythonConsole it monkey patches the substructure function
so that it saves info about the results when you do a substructure search
on a molecule.
The data member is called __sssAtoms, and if you delete that you should no
longer get the coloring:
Heres a bit of demo:
In [1]: from rdkit import Chem
In [2]: from rdkit.Chem.Draw import IPythonConsole
In [3]: m = Chem.MolFromSmiles('CCOC')
In [4]: m.GetSubstructMatch(Chem.MolFromSmiles('CO'))
Out[4]: (1, 2)
In [5]: m.__sssAtoms
Out[5]: [1, 2]
In [7]: del m.__sssAtoms
You, of course, need to check that the data member is there.
If you're unlikely to want to see highlighting at all, it's easier to just
turn if off:
In [12]: IPythonConsole.highlightSubstructs=False
In [13]: m.GetSubstructMatch(Chem.MolFromSmiles('CO'))
Out[13]: (1, 2)
In [14]: m.__sssAtoms
Out[14]: []
I hope this helps,
-greg
On Thu, Nov 23, 2017 at 2:05 PM, Nicholas Firth <[email protected]>
wrote:
> Howdy RDKitters,
>
> Been a while since I used this list, so forgive me if my question is
> silly.
>
> I'm seeing some weird behaviour from drawing molecules. I've got some
> wrapper classes that I'm using to write some de novo design code, which
> involves fragmenting molecules, and I've obviously been fairly lax with my
> namespacing. Essentially when I fragment my molecule the first bond that is
> cut is highlighted when I draw the original molecule but the rest of the
> cuts aren't (because I reassign variables). There's an example of what I
> mean here <https://i.imgur.com/kvb3YyG.png> (https://i.imgur.com/
> kvb3YyG.png)
>
> I tried to ClearComputedProps on the molecule but it still highlights the
> bond, does anyone know of a way to clear this from the molecule so that it
> doesn't get drawn? I'm going to clear up my programming issues to stop this
> particular artefact, but it would definitely be helpful to understand this
> for the rest of my code.
>
> Cheers,
> Nick
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss