Re: [Rdkit-discuss] Don't let RDKit add hydrogens to sanitize a fragment

2019-08-22 Thread Henrique Castro
Thanks, Greg. I don't know how you find the time do take care of so much 
questions, but you are amazing!

Get Outlook for Android


From: Greg Landrum 
Sent: Thursday, August 22, 2019 2:04:05 PM
To: Henrique Castro 
Cc: rdkit-discuss@lists.sourceforge.net 
Subject: Re: [Rdkit-discuss] Don't let RDKit add hydrogens to sanitize a 
fragment

Hi Henrique,

The RDKit isn't actually adding Hs here, it just recognizes that the P atoms 
have implicit Hs on them and then when drawing the molecule shows those 
implicit Hs.

If you would like to draw some atoms without showing the implicit Hs, you can 
explicitly set the atom labels to be used by setting the "atomLabel" property 
on some/all atoms.
To change all the atoms you can do this:
for atom in m.GetAtoms():
atom.SetProp("atomLabel",atom.GetSymbol())
which results in the following rendering for your molecule:
[image.png]


Here's a complete gist for that:
https://gist.github.com/greglandrum/9283aeadfb66d0fe8a2900e63fb10f3e

I hope this helps,
-greg


On Tue, Aug 20, 2019 at 11:36 AM Henrique Castro 
mailto:henrique...@outlook.com>> wrote:
Dear colleagues,
I'm working with coordination compounds and using .mol (v3000) files to 
describe the immediate coordination environment of my molecules. This is an 
example of a cobalt complex (just the coordination environment):

Mrv1827 08101911143D

  0  0  0 0  0999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 6 5 0 0 0
M  V30 BEGIN ATOM
M  V30 1 Co 0.7663 2.1605 10.185 0
M  V30 2 Cl 2.423 1.0205 11.4441 0
M  V30 3 P 2.0121 2.3511 8.3115 0
M  V30 4 P 0.1302 0.2072 9.1724 0
M  V30 5 P -0.781 2.1773 11.8292 0
M  V30 6 P 1.3423 4.1551 11.1519 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 1 1 2
M  V30 2 9 3 1
M  V30 3 9 4 1
M  V30 4 9 5 1
M  V30 5 9 6 1
M  V30 END BOND
M  V30 END CTAB
M  END

The problem is that RDKit is adding hydrogens to make the fragment make sense 
and I'd like to avoid that:
[cid:16cba400826cb971f161]

Using Chem.RemoveHs(mol) is not working too.
Any help is much appreciated

--
Henrique C. S. Junior

___
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] Stereochemistry inversion upon replacement

2019-08-22 Thread Fiorella Ruggiu
Hi everyone,

I tried to virtually deprotect molecules using
the AllChem.ReplaceSubstructs() function. Stereochemistry of adjacent atoms
gets inverted in ChiralTag but not in _CIPCode. This gives me the wrong
output SMILES:

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.Draw import IPythonConsole

mol=Chem.MolFromSmiles('CC[C@@H](NC(=O)OCC1c2c2-c2c12)C1=CC=CC=C1')
mol
[image: image.png]

for atom in rms[0].GetAtoms():
if atom.HasProp('_CIPCode'):
print(atom.GetProp('_CIPCode'))
print(atom.GetChiralTag())

R
CHI_TETRAHEDRAL_CCW


fmoc = Chem.MolFromSmarts('NC(=O)OCC1c2c2-c2c12')
fmoc_repl = Chem.MolFromSmiles('N')
rms = AllChem.ReplaceSubstructs(mol,fmoc,fmoc_repl,replaceAll=True)
rms[0]

[image: image.png]
Chem.MolToSmiles(rms[0])

'CC[C@H](N)c1c1'


for atom in rms[0].GetAtoms():
if atom.HasProp('_CIPCode'):
print(atom.GetProp('_CIPCode'))
print(atom.GetChiralTag())

R
CHI_TETRAHEDRAL_CW


How come the ChiralTag changes upon the replacement? Sorry if this is
documented somewhere but I didn't quite find it. It works in this case
to do atom.SetChiralTag() to change the stereochemistry in the smiles.

Thanks a lot,
Fio
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Don't let RDKit add hydrogens to sanitize a fragment

2019-08-22 Thread Greg Landrum
Hi Henrique,

The RDKit isn't actually adding Hs here, it just recognizes that the P
atoms have implicit Hs on them and then when drawing the molecule shows
those implicit Hs.

If you would like to draw some atoms without showing the implicit Hs, you
can explicitly set the atom labels to be used by setting the "atomLabel"
property on some/all atoms.
To change all the atoms you can do this:

for atom in m.GetAtoms():
atom.SetProp("atomLabel",atom.GetSymbol())

which results in the following rendering for your molecule:
[image: image.png]


Here's a complete gist for that:
https://gist.github.com/greglandrum/9283aeadfb66d0fe8a2900e63fb10f3e

I hope this helps,
-greg


On Tue, Aug 20, 2019 at 11:36 AM Henrique Castro 
wrote:

> Dear colleagues,
> I'm working with coordination compounds and using .mol (v3000) files to
> describe the immediate coordination environment of my molecules. This is an
> example of a cobalt complex (just the coordination environment):
>
> Mrv1827 08101911143D
>
>   0  0  0 0  0999 V3000
> M  V30 BEGIN CTAB
> M  V30 COUNTS 6 5 0 0 0
> M  V30 BEGIN ATOM
> M  V30 1 Co 0.7663 2.1605 10.185 0
> M  V30 2 Cl 2.423 1.0205 11.4441 0
> M  V30 3 P 2.0121 2.3511 8.3115 0
> M  V30 4 P 0.1302 0.2072 9.1724 0
> M  V30 5 P -0.781 2.1773 11.8292 0
> M  V30 6 P 1.3423 4.1551 11.1519 0
> M  V30 END ATOM
> M  V30 BEGIN BOND
> M  V30 1 1 1 2
> M  V30 2 9 3 1
> M  V30 3 9 4 1
> M  V30 4 9 5 1
> M  V30 5 9 6 1
> M  V30 END BOND
> M  V30 END CTAB
> M  END
>
> The problem is that RDKit is adding hydrogens to make the fragment make
> sense and I'd like to avoid that:
>
>
> Using Chem.RemoveHs(mol) is not working too.
> Any help is much appreciated
>
> --
> Henrique C. S. Junior
>
> ___
> 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


Re: [Rdkit-discuss] Understanding Coloring in Similarity Maps

2019-08-22 Thread Axel Pahl

Hi Sereina,

thanks a ton for the elaborate and very helpful explanation.

Kind regards,
Axel

On 22.08.19 12:23, Sereina wrote:

Hi Axel,

What is calculated in the function GetAtomicWeightsForModel() is the
difference between the probability value of the complete molecule
(“base probability”) and the probability value when the bits of a
certain atom are deleted.

In the cookbook (and based on a quick glance also in your code), the
probability of the active class is used as the measure for the
similarity maps (that’s defined in the getProba() helper function).
This means that any atom whose missing bits lead to an increase in the
probability to be active is colored green. If it leads to a decrease,
it gets colored pink.

Now if you have an inactive molecule then your base probability for
the active class is close to zero. In your cases it looks like nearly
all of the atoms in the molecule are necessary to make these molecules
be considered inactive. In other words, deleting any of green colored
atoms results in a higher probability to be active – although it might
still be below 50% (note that the color range is not standardized
globally but based on the largest difference observed in the molecule).

I hope this helps.

Best,
Sereina



On 22 Aug 2019, at 11:38, Axel Pahl mailto:axelp...@gmx.de>> wrote:

Dear fellow RDKitters,

I am experimenting with the classification example from the Cookbook
[1] using a RandomForestClassifier and Similarity Maps for visualization.
I need, however, some help with the interpretation of the coloring in
the similarity map.
In the attached example, the compounds were correctly predicted
("AC_Pred") as being inactive ("0") with a high probability.
But the corresponding similarity maps show mainly green areas,
indicating (in my understanding) a positive contribution to the
activity class, which should have lead to a different prediction.

What would be the correct interpretation of the coloring?
Many thanks in advance for any help.

Kind regards,
Axel

P.S.: The code is available in a repo [2], an example notebook can be
found in the tutorials folder.

[1] http://www.rdkit.org/docs/Cookbook.html#using-scikit-learn-with-rdkit
[2] https://github.com/apahl/mol_frame

___
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


Re: [Rdkit-discuss] Understanding Coloring in Similarity Maps

2019-08-22 Thread Sereina
Hi Axel,

What is calculated in the function GetAtomicWeightsForModel() is the difference 
between the probability value of the complete molecule (“base probability”) and 
the probability value when the bits of a certain atom are deleted. 

In the cookbook (and based on a quick glance also in your code), the 
probability of the active class is used as the measure for the similarity maps 
(that’s defined in the getProba() helper function). This means that any atom 
whose missing bits lead to an increase in the probability to be active is 
colored green. If it leads to a decrease, it gets colored pink. 

Now if you have an inactive molecule then your base probability for the active 
class is close to zero. In your cases it looks like nearly all of the atoms in 
the molecule are necessary to make these molecules be considered inactive. In 
other words, deleting any of green colored atoms results in a higher 
probability to be active – although it might still be below 50% (note that the 
color range is not standardized globally but based on the largest difference 
observed in the molecule).

I hope this helps.

Best,
Sereina 


> On 22 Aug 2019, at 11:38, Axel Pahl  wrote:
> 
> Dear fellow RDKitters,
> 
> I am experimenting with the classification example from the Cookbook [1] 
> using a RandomForestClassifier and Similarity Maps for visualization.
> I need, however, some help with the interpretation of the coloring in the 
> similarity map.
> In the attached example, the compounds were correctly predicted ("AC_Pred") 
> as being inactive ("0") with a high probability.
> But the corresponding similarity maps show mainly green areas, indicating (in 
> my understanding) a positive contribution to the activity class, which should 
> have lead to a different prediction.
> 
> What would be the correct interpretation of the coloring?
> Many thanks in advance for any help.
> 
> Kind regards,
> Axel
> 
> P.S.: The code is available in a repo [2], an example notebook can be found 
> in the tutorials folder.
> 
> [1] http://www.rdkit.org/docs/Cookbook.html#using-scikit-learn-with-rdkit 
> 
> [2] https://github.com/apahl/mol_frame 
> 
> ___
> 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


Re: [Rdkit-discuss] Setting custom coordinates for new atoms

2019-08-22 Thread Paolo Tosco

Hi Illimar,

AddAtom() will return the index i of the added atom, then you can call 
SetAtomPosition on that index on the molecule conformer and pass a 
Point3D with the desired coordinates:


conf.SetAtomPosition(i, Point3D(x, y, z))

Cheers,
p.

On 08/22/19 09:24, Illimar Hugo Rekand wrote:

Hello, everyone


I'm wondering whether there is a way to set custom coordinates to an atom in a 
conformer?

In particular I'm interested in using the AddAtom() function in the RWMol class 
to place a new dummy atom in a PDB-file.


Illimar Rekand
Ph.D. candidate,
Brenk-lab, Haug-lab
Department of Biomedicine
Department of Chemistry
University of Bergen



___
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] Setting custom coordinates for new atoms

2019-08-22 Thread Illimar Hugo Rekand
Hello, everyone


I'm wondering whether there is a way to set custom coordinates to an atom in a 
conformer?

In particular I'm interested in using the AddAtom() function in the RWMol class 
to place a new dummy atom in a PDB-file.


Illimar Rekand
Ph.D. candidate,
Brenk-lab, Haug-lab
Department of Biomedicine
Department of Chemistry
University of Bergen



___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss