rdkit-discuss Mailing List for RDKit (Page 6)
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(27) |
Oct
(4) |
Nov
(20) |
Dec
(4) |
| 2008 |
Jan
(12) |
Feb
(2) |
Mar
(23) |
Apr
(40) |
May
(30) |
Jun
(6) |
Jul
(35) |
Aug
(60) |
Sep
(31) |
Oct
(33) |
Nov
(35) |
Dec
(3) |
| 2009 |
Jan
(16) |
Feb
(77) |
Mar
(88) |
Apr
(57) |
May
(33) |
Jun
(27) |
Jul
(55) |
Aug
(26) |
Sep
(12) |
Oct
(45) |
Nov
(42) |
Dec
(23) |
| 2010 |
Jan
(64) |
Feb
(17) |
Mar
(30) |
Apr
(55) |
May
(30) |
Jun
(65) |
Jul
(112) |
Aug
(26) |
Sep
(67) |
Oct
(20) |
Nov
(67) |
Dec
(23) |
| 2011 |
Jan
(57) |
Feb
(43) |
Mar
(50) |
Apr
(66) |
May
(95) |
Jun
(73) |
Jul
(64) |
Aug
(47) |
Sep
(22) |
Oct
(56) |
Nov
(51) |
Dec
(34) |
| 2012 |
Jan
(64) |
Feb
(45) |
Mar
(65) |
Apr
(85) |
May
(76) |
Jun
(47) |
Jul
(75) |
Aug
(72) |
Sep
(31) |
Oct
(77) |
Nov
(61) |
Dec
(41) |
| 2013 |
Jan
(68) |
Feb
(63) |
Mar
(36) |
Apr
(73) |
May
(61) |
Jun
(69) |
Jul
(98) |
Aug
(60) |
Sep
(74) |
Oct
(102) |
Nov
(92) |
Dec
(63) |
| 2014 |
Jan
(112) |
Feb
(84) |
Mar
(72) |
Apr
(59) |
May
(96) |
Jun
(54) |
Jul
(91) |
Aug
(54) |
Sep
(38) |
Oct
(47) |
Nov
(33) |
Dec
(39) |
| 2015 |
Jan
(41) |
Feb
(115) |
Mar
(66) |
Apr
(87) |
May
(63) |
Jun
(53) |
Jul
(61) |
Aug
(59) |
Sep
(115) |
Oct
(42) |
Nov
(60) |
Dec
(20) |
| 2016 |
Jan
(52) |
Feb
(72) |
Mar
(100) |
Apr
(125) |
May
(61) |
Jun
(106) |
Jul
(62) |
Aug
(74) |
Sep
(151) |
Oct
(151) |
Nov
(117) |
Dec
(148) |
| 2017 |
Jan
(106) |
Feb
(75) |
Mar
(106) |
Apr
(67) |
May
(85) |
Jun
(144) |
Jul
(53) |
Aug
(73) |
Sep
(188) |
Oct
(106) |
Nov
(118) |
Dec
(74) |
| 2018 |
Jan
(96) |
Feb
(43) |
Mar
(40) |
Apr
(111) |
May
(77) |
Jun
(112) |
Jul
(64) |
Aug
(85) |
Sep
(73) |
Oct
(117) |
Nov
(97) |
Dec
(47) |
| 2019 |
Jan
(63) |
Feb
(112) |
Mar
(109) |
Apr
(61) |
May
(51) |
Jun
(41) |
Jul
(57) |
Aug
(68) |
Sep
(47) |
Oct
(126) |
Nov
(117) |
Dec
(96) |
| 2020 |
Jan
(84) |
Feb
(82) |
Mar
(80) |
Apr
(100) |
May
(78) |
Jun
(68) |
Jul
(76) |
Aug
(69) |
Sep
(76) |
Oct
(73) |
Nov
(69) |
Dec
(42) |
| 2021 |
Jan
(44) |
Feb
(30) |
Mar
(85) |
Apr
(65) |
May
(41) |
Jun
(72) |
Jul
(55) |
Aug
(9) |
Sep
(44) |
Oct
(44) |
Nov
(30) |
Dec
(40) |
| 2022 |
Jan
(35) |
Feb
(29) |
Mar
(55) |
Apr
(30) |
May
(31) |
Jun
(27) |
Jul
(49) |
Aug
(15) |
Sep
(17) |
Oct
(25) |
Nov
(15) |
Dec
(40) |
| 2023 |
Jan
(32) |
Feb
(10) |
Mar
(10) |
Apr
(21) |
May
(33) |
Jun
(31) |
Jul
(12) |
Aug
(17) |
Sep
(14) |
Oct
(12) |
Nov
(8) |
Dec
(12) |
| 2024 |
Jan
(10) |
Feb
(18) |
Mar
(7) |
Apr
(4) |
May
(6) |
Jun
(4) |
Jul
(5) |
Aug
(6) |
Sep
(8) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
|
From: Rafael L <raf...@us...> - 2023-09-01 06:04:40
|
Using rdReducedGraphs.GenerateMolExtendedReducedGraph() on RDKit mols obtained from certain SMILES (e.g. "O=C(OC3c1nccnc1C(=O)N3c2ncc(Cl)cc2)N4CCN(C)CC4") throws the following error: getNumImplicitHs() called without preceding call to calcImplicitValence() I tried removing sanitization/keeping hydrogens on conversion to mol, using Kekulized SMILES, mol.UpdatePropertyCache(), Chem.SanitizeMol()... but all I got were different errors, such as: - Can't kekulize mol - RingInfo not initialized I was finally able to solve all the errors by calling Chem.AddHs(mol) for all mols prior to calculation of the reduced graph. -- *Rafael da Fonseca Lameiro* PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED) São Carlos Institute of Chemistry - University of São Paulo - Brazil [image: orcid logo 16px] https://orcid.org/0000-0003-4466-2682 |
|
From: Rafael L <raf...@us...> - 2023-09-01 05:26:39
|
However, now that I have visualized the graphs generated, I believe this was not an optimal solution, since the graphs do not look reduced at all. Also, the Ac/Ar/D/Hf nomenclature presented on the original ErG paper does not seem to be implemented in RDKit. For now, I believe it's best to stick with the fingerprints and forget about the representations On Fri, 1 Sept 2023 at 01:13, Rafael L <raf...@us...> wrote: > Using rdReducedGraphs.GenerateMolExtendedReducedGraph() on RDKit > mols obtained from certain SMILES > (e.g. "O=C(OC3c1nccnc1C(=O)N3c2ncc(Cl)cc2)N4CCN(C)CC4") throws the > following error: > getNumImplicitHs() called without preceding call to calcImplicitValence() > > I tried removing sanitization/keeping hydrogens on conversion to mol, > using Kekulized SMILES, mol.UpdatePropertyCache(), Chem.SanitizeMol()... > but all I got were different errors, such as: > - Can't kekulize mol > - RingInfo not initialized > > I was finally able to solve all the errors by calling Chem.AddHs(mol) for > all mols prior to calculation of the reduced graph. > > -- > *Rafael da Fonseca Lameiro* > PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED) > São Carlos Institute of Chemistry - University of São Paulo - Brazil > [image: orcid logo 16px] https://orcid.org/0000-0003-4466-2682 > -- *Rafael da Fonseca Lameiro * PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED) São Carlos Institute of Chemistry - University of São Paulo - Brazil [image: orcid logo 16px] https://orcid.org/0000-0003-4466-2682 |
|
From: Greg L. <gre...@gm...> - 2023-08-26 04:32:31
|
If you're willing to live with the RDKit's definition of bridgehead (see
below), then there is built-in functionality you can use:
from rdkit.Chem import rdqueries
qa = rdqueries.IsBridgeheadQueryAtom()
mol = Chem.MolFromSmiles('C1CC2CCC1C2')
mol.GetAtomsMatchingQuery(qa)
That last call returns a sequence with the matching atoms.
The RDKit bridgehead definition:
// at least three ring bonds, all ring bonds in a ring which shares at
// least two bonds with another ring involving this atom
is definitely not perfect, primarily because of the use of the ring
systems, but it's the best that we were able to come up with while keeping
things efficient.
There's some discussion here https://github.com/rdkit/rdkit/pull/6061 and
in the linked issue.
-greg
On Fri, Aug 25, 2023 at 11:23 PM Wim Dehaen <wim...@gm...> wrote:
> greetings all,
> i have thought about the problem some more, and in the end came to the
> conclusion that looping through all rings really is necessary. In the gist
> below you can see the adjusted code, making use of Pat Walters' method
> <https://sourceforge.net/p/rdkit/mailman/message/30387811/> for finding
> all rings. Apologies for the code being messy.
> https://gist.github.com/dehaenw/41eb8e4c39c1158e88b36c6dfc2606d8
> fortunately, this one manages to also detect these difficult cases, see
> below:
> i did not check how fast it is, but i guess it will be a fair bit slower.
>
> best wishes,
> wim
>
> On Fri, Aug 25, 2023 at 8:28 PM Wim Dehaen <wim...@gm...> wrote:
>
>> Dear Andreas,
>> that's a good find. i agree the breaking case can be considered
>> bridgehead structure, as it's essentially bicyclo-[3.2.1]-octane plus an
>> extra bond. I need to think about this some more, but it might be related
>> to getting the ringinfo as SSSR instead of exhaustively. The best solution
>> may therefore be to just prune non ring atoms from the graph, enumerate all
>> rings and check it really exhaustively.
>> FWIW: rdMolDescriptors.CalcNumBridgeheadAtoms(mol) returns 0 for mol =
>> Chem.MolFromSmiles("C1CC2C3C2C1C3") too, so this may be an rdkit bug on
>> this end.
>> best wishes
>> wim
>>
>> On Fri, Aug 25, 2023 at 5:20 PM Andreas Luttens <
>> and...@gm...> wrote:
>>
>>> Dear Wim,
>>>
>>> Thanks for your reply!
>>>
>>> Apologies for the delay, finally got time to pick up this project again.
>>>
>>> Your suggestion works great, though I have found some cases where it
>>> breaks. For instance the molecule:
>>>
>>> mol = Chem.MolFromSmiles("C1CC2C3C2C1C3")
>>>
>>> It seems, in this case, a bridgehead atom is also a fused-ring atom.
>>> Maybe these looped compounds have too complex topology for this type of
>>> analysis.
>>>
>>> I don't see a straight way forward to identify just the bridgehead atoms.
>>>
>>> Best wishes,
>>> Andreas
>>>
>>> On Sat, Dec 3, 2022 at 12:53 PM Wim Dehaen <wim...@gm...> wrote:
>>>
>>>> Hi Andreas,
>>>> I don't have a good SMARTS pattern available for this but here is a
>>>> function that should return bridgehead idx and not include non bridgehead
>>>> fused ring atoms:
>>>>
>>>> ```
>>>> def return_bridgeheads_idx(mol):
>>>> bh_list=[]
>>>> intersections=[]
>>>> sssr_idx = [set(x) for x in list(Chem.GetSymmSSSR(mol))]
>>>> for i,ring1 in enumerate(sssr_idx):
>>>> for j,ring2 in enumerate(sssr_idx):
>>>> if i>j:
>>>> intersections+=[ring1.intersection(ring2)]
>>>> for iidx in intersections:
>>>> if len(iidx)>2: #condition for bridgehead
>>>> for idx in iidx:
>>>> neighbors = [a.GetIdx() for a in
>>>> mol.GetAtomWithIdx(idx).GetNeighbors()]
>>>> bh_list+=[idx for nidx in neighbors if nidx not in iidx]
>>>> return tuple(set(bh_list))
>>>> ```
>>>>
>>>> Here are 6 test molecules:
>>>>
>>>> ```
>>>> mol1 = Chem.MolFromSmiles("C1CC2CCC1C2")
>>>> mol2 = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
>>>> mol3 = Chem.MolFromSmiles("N1(CC2)CCC2CC1")
>>>> mol4 = Chem.MolFromSmiles("C1CCC12CCCCC2")
>>>> mol5 = Chem.MolFromSmiles("C1CC2C1CCCCC2")
>>>> mol6 = Chem.MolFromSmiles("C1CCC(C(CCC3)C23)C12")
>>>> for mol in [mol1,mol2,mol3,mol4,mol5,mol6]:
>>>> print(return_bridgeheads_idx(mol))
>>>> ```
>>>>
>>>> giving the expected answer:
>>>>
>>>> (2, 5)
>>>> (4, 7)
>>>> (0, 5)
>>>> ()
>>>> ()
>>>> ()
>>>>
>>>> hope this is helpful!
>>>>
>>>> best wishes
>>>> wim
>>>>
>>>> On Sat, Dec 3, 2022 at 8:34 AM Andreas Luttens <
>>>> and...@gm...> wrote:
>>>>
>>>>> Dear users,
>>>>>
>>>>> I am trying to identify bridgehead atoms in multi-looped ring systems.
>>>>> The issue I have is that it can be sometimes difficult to distinguish these
>>>>> atoms from ring-fusion atoms. The pattern I used (see below) looks for
>>>>> atoms that are part of three rings but cannot be bonded to an atom that
>>>>> also fits this description, in order to avoid ring-fusion atoms. The code
>>>>> works, except for cases where bridgehead atoms are bonded to a ring-fusion
>>>>> atom.
>>>>>
>>>>> *PASS:*
>>>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>>>>> rdkit_mol = Chem.MolFromSmiles("C1CC2CCC1C2")
>>>>> print(rdkit_mol.GetSubstructMatches(pattern))
>>>>> >>>((2,),(5,))
>>>>>
>>>>> *FAIL:*
>>>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>>>>> rdkit_mol = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
>>>>> print(rdkit_mol.GetSubstructMatches(pattern))
>>>>> >>>()
>>>>>
>>>>> Any hint on what alternative pattern I could use to isolate true
>>>>> bridgeheads would be greatly appreciated. Maybe other strategies are more
>>>>> suitable to find these atoms?
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>> Best regards,
>>>>> Andreas
>>>>> _______________________________________________
>>>>> Rdkit-discuss mailing list
>>>>> Rdk...@li...
>>>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>>>
>>>> _______________________________________________
> Rdkit-discuss mailing list
> Rdk...@li...
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
|
|
From: Wim D. <wim...@gm...> - 2023-08-25 21:21:11
|
greetings all, i have thought about the problem some more, and in the end came to the conclusion that looping through all rings really is necessary. In the gist below you can see the adjusted code, making use of Pat Walters' method <https://sourceforge.net/p/rdkit/mailman/message/30387811/> for finding all rings. Apologies for the code being messy. https://gist.github.com/dehaenw/41eb8e4c39c1158e88b36c6dfc2606d8 fortunately, this one manages to also detect these difficult cases, see below: i did not check how fast it is, but i guess it will be a fair bit slower. best wishes, wim On Fri, Aug 25, 2023 at 8:28 PM Wim Dehaen <wim...@gm...> wrote: > Dear Andreas, > that's a good find. i agree the breaking case can be considered bridgehead > structure, as it's essentially bicyclo-[3.2.1]-octane plus an extra bond. I > need to think about this some more, but it might be related to getting the > ringinfo as SSSR instead of exhaustively. The best solution may therefore > be to just prune non ring atoms from the graph, enumerate all rings and > check it really exhaustively. > FWIW: rdMolDescriptors.CalcNumBridgeheadAtoms(mol) returns 0 for mol = > Chem.MolFromSmiles("C1CC2C3C2C1C3") too, so this may be an rdkit bug on > this end. > best wishes > wim > > On Fri, Aug 25, 2023 at 5:20 PM Andreas Luttens <and...@gm...> > wrote: > >> Dear Wim, >> >> Thanks for your reply! >> >> Apologies for the delay, finally got time to pick up this project again. >> >> Your suggestion works great, though I have found some cases where it >> breaks. For instance the molecule: >> >> mol = Chem.MolFromSmiles("C1CC2C3C2C1C3") >> >> It seems, in this case, a bridgehead atom is also a fused-ring atom. >> Maybe these looped compounds have too complex topology for this type of >> analysis. >> >> I don't see a straight way forward to identify just the bridgehead atoms. >> >> Best wishes, >> Andreas >> >> On Sat, Dec 3, 2022 at 12:53 PM Wim Dehaen <wim...@gm...> wrote: >> >>> Hi Andreas, >>> I don't have a good SMARTS pattern available for this but here is a >>> function that should return bridgehead idx and not include non bridgehead >>> fused ring atoms: >>> >>> ``` >>> def return_bridgeheads_idx(mol): >>> bh_list=[] >>> intersections=[] >>> sssr_idx = [set(x) for x in list(Chem.GetSymmSSSR(mol))] >>> for i,ring1 in enumerate(sssr_idx): >>> for j,ring2 in enumerate(sssr_idx): >>> if i>j: >>> intersections+=[ring1.intersection(ring2)] >>> for iidx in intersections: >>> if len(iidx)>2: #condition for bridgehead >>> for idx in iidx: >>> neighbors = [a.GetIdx() for a in >>> mol.GetAtomWithIdx(idx).GetNeighbors()] >>> bh_list+=[idx for nidx in neighbors if nidx not in iidx] >>> return tuple(set(bh_list)) >>> ``` >>> >>> Here are 6 test molecules: >>> >>> ``` >>> mol1 = Chem.MolFromSmiles("C1CC2CCC1C2") >>> mol2 = Chem.MolFromSmiles("C1CC2C1C1CCC2C1") >>> mol3 = Chem.MolFromSmiles("N1(CC2)CCC2CC1") >>> mol4 = Chem.MolFromSmiles("C1CCC12CCCCC2") >>> mol5 = Chem.MolFromSmiles("C1CC2C1CCCCC2") >>> mol6 = Chem.MolFromSmiles("C1CCC(C(CCC3)C23)C12") >>> for mol in [mol1,mol2,mol3,mol4,mol5,mol6]: >>> print(return_bridgeheads_idx(mol)) >>> ``` >>> >>> giving the expected answer: >>> >>> (2, 5) >>> (4, 7) >>> (0, 5) >>> () >>> () >>> () >>> >>> hope this is helpful! >>> >>> best wishes >>> wim >>> >>> On Sat, Dec 3, 2022 at 8:34 AM Andreas Luttens < >>> and...@gm...> wrote: >>> >>>> Dear users, >>>> >>>> I am trying to identify bridgehead atoms in multi-looped ring systems. >>>> The issue I have is that it can be sometimes difficult to distinguish these >>>> atoms from ring-fusion atoms. The pattern I used (see below) looks for >>>> atoms that are part of three rings but cannot be bonded to an atom that >>>> also fits this description, in order to avoid ring-fusion atoms. The code >>>> works, except for cases where bridgehead atoms are bonded to a ring-fusion >>>> atom. >>>> >>>> *PASS:* >>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]") >>>> rdkit_mol = Chem.MolFromSmiles("C1CC2CCC1C2") >>>> print(rdkit_mol.GetSubstructMatches(pattern)) >>>> >>>((2,),(5,)) >>>> >>>> *FAIL:* >>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]") >>>> rdkit_mol = Chem.MolFromSmiles("C1CC2C1C1CCC2C1") >>>> print(rdkit_mol.GetSubstructMatches(pattern)) >>>> >>>() >>>> >>>> Any hint on what alternative pattern I could use to isolate true >>>> bridgeheads would be greatly appreciated. Maybe other strategies are more >>>> suitable to find these atoms? >>>> >>>> Thanks in advance! >>>> >>>> Best regards, >>>> Andreas >>>> _______________________________________________ >>>> Rdkit-discuss mailing list >>>> Rdk...@li... >>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >>>> >>> |
|
From: Wim D. <wim...@gm...> - 2023-08-25 18:28:41
|
Dear Andreas,
that's a good find. i agree the breaking case can be considered bridgehead
structure, as it's essentially bicyclo-[3.2.1]-octane plus an extra bond. I
need to think about this some more, but it might be related to getting the
ringinfo as SSSR instead of exhaustively. The best solution may therefore
be to just prune non ring atoms from the graph, enumerate all rings and
check it really exhaustively.
FWIW: rdMolDescriptors.CalcNumBridgeheadAtoms(mol) returns 0 for mol =
Chem.MolFromSmiles("C1CC2C3C2C1C3") too, so this may be an rdkit bug on
this end.
best wishes
wim
On Fri, Aug 25, 2023 at 5:20 PM Andreas Luttens <and...@gm...>
wrote:
> Dear Wim,
>
> Thanks for your reply!
>
> Apologies for the delay, finally got time to pick up this project again.
>
> Your suggestion works great, though I have found some cases where it
> breaks. For instance the molecule:
>
> mol = Chem.MolFromSmiles("C1CC2C3C2C1C3")
>
> It seems, in this case, a bridgehead atom is also a fused-ring atom. Maybe
> these looped compounds have too complex topology for this type of analysis.
>
> I don't see a straight way forward to identify just the bridgehead atoms.
>
> Best wishes,
> Andreas
>
> On Sat, Dec 3, 2022 at 12:53 PM Wim Dehaen <wim...@gm...> wrote:
>
>> Hi Andreas,
>> I don't have a good SMARTS pattern available for this but here is a
>> function that should return bridgehead idx and not include non bridgehead
>> fused ring atoms:
>>
>> ```
>> def return_bridgeheads_idx(mol):
>> bh_list=[]
>> intersections=[]
>> sssr_idx = [set(x) for x in list(Chem.GetSymmSSSR(mol))]
>> for i,ring1 in enumerate(sssr_idx):
>> for j,ring2 in enumerate(sssr_idx):
>> if i>j:
>> intersections+=[ring1.intersection(ring2)]
>> for iidx in intersections:
>> if len(iidx)>2: #condition for bridgehead
>> for idx in iidx:
>> neighbors = [a.GetIdx() for a in
>> mol.GetAtomWithIdx(idx).GetNeighbors()]
>> bh_list+=[idx for nidx in neighbors if nidx not in iidx]
>> return tuple(set(bh_list))
>> ```
>>
>> Here are 6 test molecules:
>>
>> ```
>> mol1 = Chem.MolFromSmiles("C1CC2CCC1C2")
>> mol2 = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
>> mol3 = Chem.MolFromSmiles("N1(CC2)CCC2CC1")
>> mol4 = Chem.MolFromSmiles("C1CCC12CCCCC2")
>> mol5 = Chem.MolFromSmiles("C1CC2C1CCCCC2")
>> mol6 = Chem.MolFromSmiles("C1CCC(C(CCC3)C23)C12")
>> for mol in [mol1,mol2,mol3,mol4,mol5,mol6]:
>> print(return_bridgeheads_idx(mol))
>> ```
>>
>> giving the expected answer:
>>
>> (2, 5)
>> (4, 7)
>> (0, 5)
>> ()
>> ()
>> ()
>>
>> hope this is helpful!
>>
>> best wishes
>> wim
>>
>> On Sat, Dec 3, 2022 at 8:34 AM Andreas Luttens <and...@gm...>
>> wrote:
>>
>>> Dear users,
>>>
>>> I am trying to identify bridgehead atoms in multi-looped ring systems.
>>> The issue I have is that it can be sometimes difficult to distinguish these
>>> atoms from ring-fusion atoms. The pattern I used (see below) looks for
>>> atoms that are part of three rings but cannot be bonded to an atom that
>>> also fits this description, in order to avoid ring-fusion atoms. The code
>>> works, except for cases where bridgehead atoms are bonded to a ring-fusion
>>> atom.
>>>
>>> *PASS:*
>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>>> rdkit_mol = Chem.MolFromSmiles("C1CC2CCC1C2")
>>> print(rdkit_mol.GetSubstructMatches(pattern))
>>> >>>((2,),(5,))
>>>
>>> *FAIL:*
>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>>> rdkit_mol = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
>>> print(rdkit_mol.GetSubstructMatches(pattern))
>>> >>>()
>>>
>>> Any hint on what alternative pattern I could use to isolate true
>>> bridgeheads would be greatly appreciated. Maybe other strategies are more
>>> suitable to find these atoms?
>>>
>>> Thanks in advance!
>>>
>>> Best regards,
>>> Andreas
>>> _______________________________________________
>>> Rdkit-discuss mailing list
>>> Rdk...@li...
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>>
|
|
From: S J. S. <swa...@gm...> - 2023-08-25 15:41:08
|
Perhaps using ring perception instead would work better?
On Fri, Aug 25, 2023 at 10:22 AM Andreas Luttens <and...@gm...>
wrote:
> Dear Wim,
>
> Thanks for your reply!
>
> Apologies for the delay, finally got time to pick up this project again.
>
> Your suggestion works great, though I have found some cases where it
> breaks. For instance the molecule:
>
> mol = Chem.MolFromSmiles("C1CC2C3C2C1C3")
>
> It seems, in this case, a bridgehead atom is also a fused-ring atom. Maybe
> these looped compounds have too complex topology for this type of analysis.
>
> I don't see a straight way forward to identify just the bridgehead atoms.
>
> Best wishes,
> Andreas
>
> On Sat, Dec 3, 2022 at 12:53 PM Wim Dehaen <wim...@gm...> wrote:
>
>> Hi Andreas,
>> I don't have a good SMARTS pattern available for this but here is a
>> function that should return bridgehead idx and not include non bridgehead
>> fused ring atoms:
>>
>> ```
>> def return_bridgeheads_idx(mol):
>> bh_list=[]
>> intersections=[]
>> sssr_idx = [set(x) for x in list(Chem.GetSymmSSSR(mol))]
>> for i,ring1 in enumerate(sssr_idx):
>> for j,ring2 in enumerate(sssr_idx):
>> if i>j:
>> intersections+=[ring1.intersection(ring2)]
>> for iidx in intersections:
>> if len(iidx)>2: #condition for bridgehead
>> for idx in iidx:
>> neighbors = [a.GetIdx() for a in
>> mol.GetAtomWithIdx(idx).GetNeighbors()]
>> bh_list+=[idx for nidx in neighbors if nidx not in iidx]
>> return tuple(set(bh_list))
>> ```
>>
>> Here are 6 test molecules:
>>
>> ```
>> mol1 = Chem.MolFromSmiles("C1CC2CCC1C2")
>> mol2 = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
>> mol3 = Chem.MolFromSmiles("N1(CC2)CCC2CC1")
>> mol4 = Chem.MolFromSmiles("C1CCC12CCCCC2")
>> mol5 = Chem.MolFromSmiles("C1CC2C1CCCCC2")
>> mol6 = Chem.MolFromSmiles("C1CCC(C(CCC3)C23)C12")
>> for mol in [mol1,mol2,mol3,mol4,mol5,mol6]:
>> print(return_bridgeheads_idx(mol))
>> ```
>>
>> giving the expected answer:
>>
>> (2, 5)
>> (4, 7)
>> (0, 5)
>> ()
>> ()
>> ()
>>
>> hope this is helpful!
>>
>> best wishes
>> wim
>>
>> On Sat, Dec 3, 2022 at 8:34 AM Andreas Luttens <and...@gm...>
>> wrote:
>>
>>> Dear users,
>>>
>>> I am trying to identify bridgehead atoms in multi-looped ring systems.
>>> The issue I have is that it can be sometimes difficult to distinguish these
>>> atoms from ring-fusion atoms. The pattern I used (see below) looks for
>>> atoms that are part of three rings but cannot be bonded to an atom that
>>> also fits this description, in order to avoid ring-fusion atoms. The code
>>> works, except for cases where bridgehead atoms are bonded to a ring-fusion
>>> atom.
>>>
>>> *PASS:*
>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>>> rdkit_mol = Chem.MolFromSmiles("C1CC2CCC1C2")
>>> print(rdkit_mol.GetSubstructMatches(pattern))
>>> >>>((2,),(5,))
>>>
>>> *FAIL:*
>>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>>> rdkit_mol = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
>>> print(rdkit_mol.GetSubstructMatches(pattern))
>>> >>>()
>>>
>>> Any hint on what alternative pattern I could use to isolate true
>>> bridgeheads would be greatly appreciated. Maybe other strategies are more
>>> suitable to find these atoms?
>>>
>>> Thanks in advance!
>>>
>>> Best regards,
>>> Andreas
>>> _______________________________________________
>>> Rdkit-discuss mailing list
>>> Rdk...@li...
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>> _______________________________________________
> Rdkit-discuss mailing list
> Rdk...@li...
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
--
Sent from Gmail Mobile
|
|
From: Andreas L. <and...@gm...> - 2023-08-25 15:20:26
|
Dear Wim,
Thanks for your reply!
Apologies for the delay, finally got time to pick up this project again.
Your suggestion works great, though I have found some cases where it
breaks. For instance the molecule:
mol = Chem.MolFromSmiles("C1CC2C3C2C1C3")
It seems, in this case, a bridgehead atom is also a fused-ring atom. Maybe
these looped compounds have too complex topology for this type of analysis.
I don't see a straight way forward to identify just the bridgehead atoms.
Best wishes,
Andreas
On Sat, Dec 3, 2022 at 12:53 PM Wim Dehaen <wim...@gm...> wrote:
> Hi Andreas,
> I don't have a good SMARTS pattern available for this but here is a
> function that should return bridgehead idx and not include non bridgehead
> fused ring atoms:
>
> ```
> def return_bridgeheads_idx(mol):
> bh_list=[]
> intersections=[]
> sssr_idx = [set(x) for x in list(Chem.GetSymmSSSR(mol))]
> for i,ring1 in enumerate(sssr_idx):
> for j,ring2 in enumerate(sssr_idx):
> if i>j:
> intersections+=[ring1.intersection(ring2)]
> for iidx in intersections:
> if len(iidx)>2: #condition for bridgehead
> for idx in iidx:
> neighbors = [a.GetIdx() for a in
> mol.GetAtomWithIdx(idx).GetNeighbors()]
> bh_list+=[idx for nidx in neighbors if nidx not in iidx]
> return tuple(set(bh_list))
> ```
>
> Here are 6 test molecules:
>
> ```
> mol1 = Chem.MolFromSmiles("C1CC2CCC1C2")
> mol2 = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
> mol3 = Chem.MolFromSmiles("N1(CC2)CCC2CC1")
> mol4 = Chem.MolFromSmiles("C1CCC12CCCCC2")
> mol5 = Chem.MolFromSmiles("C1CC2C1CCCCC2")
> mol6 = Chem.MolFromSmiles("C1CCC(C(CCC3)C23)C12")
> for mol in [mol1,mol2,mol3,mol4,mol5,mol6]:
> print(return_bridgeheads_idx(mol))
> ```
>
> giving the expected answer:
>
> (2, 5)
> (4, 7)
> (0, 5)
> ()
> ()
> ()
>
> hope this is helpful!
>
> best wishes
> wim
>
> On Sat, Dec 3, 2022 at 8:34 AM Andreas Luttens <and...@gm...>
> wrote:
>
>> Dear users,
>>
>> I am trying to identify bridgehead atoms in multi-looped ring systems.
>> The issue I have is that it can be sometimes difficult to distinguish these
>> atoms from ring-fusion atoms. The pattern I used (see below) looks for
>> atoms that are part of three rings but cannot be bonded to an atom that
>> also fits this description, in order to avoid ring-fusion atoms. The code
>> works, except for cases where bridgehead atoms are bonded to a ring-fusion
>> atom.
>>
>> *PASS:*
>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>> rdkit_mol = Chem.MolFromSmiles("C1CC2CCC1C2")
>> print(rdkit_mol.GetSubstructMatches(pattern))
>> >>>((2,),(5,))
>>
>> *FAIL:*
>> pattern = Chem.MolFromSmarts("[$([x3]);!$([x3][x3])]")
>> rdkit_mol = Chem.MolFromSmiles("C1CC2C1C1CCC2C1")
>> print(rdkit_mol.GetSubstructMatches(pattern))
>> >>>()
>>
>> Any hint on what alternative pattern I could use to isolate true
>> bridgeheads would be greatly appreciated. Maybe other strategies are more
>> suitable to find these atoms?
>>
>> Thanks in advance!
>>
>> Best regards,
>> Andreas
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdk...@li...
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
|
|
From: Andreas L. <and...@gm...> - 2023-08-24 12:30:41
|
That worked perfectly!
Bedankt Wim!
Best wishes,
Andreas
On Thu, Aug 24, 2023 at 2:27 PM Wim Dehaen <wim...@gm...> wrote:
> Dear Andreas,
> the issue is with your aldehyde/ketone smarts. it looks for an explicit
> aldehyde H that is not there. When the input smi is NCC(=O)C the
> substructure matches.
>
> An alternative smarts you can use that will match aldehyde but not esters
> and amides:
> [#7H2].[#6][C;!$(C-O);!$(C-N)](=[O])
>
> best wishes
> wim
>
> On Thu, Aug 24, 2023, 2:09 PM Andreas Luttens <and...@gm...>
> wrote:
>
>> Dear community,
>>
>> I'm looking for a way to identify molecules that have two functional
>> groups, for instance a primary amine and a ketone.
>>
>> How can I construct a single SMARTS pattern that encompasses two
>> functional groups?
>>
>> I've tried the following pattern:
>> [#7H2].[#6][#6](=[O])[#6,#1]
>>
>> This should ideally hit compounds that have both a primary amine and a
>> ketone/aldehyde. For instance, the molecule:
>> mol = Chem.MolFromSmiles("NCC(=O)")
>>
>> However, I get no matches using this SMARTS pattern. Is there anyway to
>> enforce the identification with a single pattern?
>>
>> Thanks in advance!
>>
>> Best regards,
>> Andreas
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdk...@li...
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
|
|
From: Wim D. <wim...@gm...> - 2023-08-24 12:27:30
|
Dear Andreas,
the issue is with your aldehyde/ketone smarts. it looks for an explicit
aldehyde H that is not there. When the input smi is NCC(=O)C the
substructure matches.
An alternative smarts you can use that will match aldehyde but not esters
and amides:
[#7H2].[#6][C;!$(C-O);!$(C-N)](=[O])
best wishes
wim
On Thu, Aug 24, 2023, 2:09 PM Andreas Luttens <and...@gm...>
wrote:
> Dear community,
>
> I'm looking for a way to identify molecules that have two functional
> groups, for instance a primary amine and a ketone.
>
> How can I construct a single SMARTS pattern that encompasses two
> functional groups?
>
> I've tried the following pattern:
> [#7H2].[#6][#6](=[O])[#6,#1]
>
> This should ideally hit compounds that have both a primary amine and a
> ketone/aldehyde. For instance, the molecule:
> mol = Chem.MolFromSmiles("NCC(=O)")
>
> However, I get no matches using this SMARTS pattern. Is there anyway to
> enforce the identification with a single pattern?
>
> Thanks in advance!
>
> Best regards,
> Andreas
> _______________________________________________
> Rdkit-discuss mailing list
> Rdk...@li...
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
|
|
From: Andreas L. <and...@gm...> - 2023-08-24 12:06:45
|
Dear community,
I'm looking for a way to identify molecules that have two functional
groups, for instance a primary amine and a ketone.
How can I construct a single SMARTS pattern that encompasses two functional
groups?
I've tried the following pattern:
[#7H2].[#6][#6](=[O])[#6,#1]
This should ideally hit compounds that have both a primary amine and a
ketone/aldehyde. For instance, the molecule:
mol = Chem.MolFromSmiles("NCC(=O)")
However, I get no matches using this SMARTS pattern. Is there anyway to
enforce the identification with a single pattern?
Thanks in advance!
Best regards,
Andreas
|
|
From: James D. <J.D...@ve...> - 2023-08-21 14:45:35
|
Hi Katrina, I must confess I haven't actually used rdDeprotect before (I have always created reactions and called the RunReactants() method)... I just tried your use case, and I think it is working as you would like (I can't immediately see what is wrong in the original code you posted). Here is a gist showing it (I hope): https://gist.github.com/jepdavidson/ec1664a8bfa8b921262fc844c0e523e4 Kind regards James ________________________________ From: Katrina Lexa <kl...@um...> Sent: 21 August 2023 14:58 To: James Davidson <J.D...@ve...> Cc: RDKit Discuss <rdk...@li...> Subject: Re: [Rdkit-discuss] rdDeprotect & DeprotectData Hi James, Thanks for the quick reply! You're quite right, I'm simply interested in the virtual reaction to remove the boronates. Thank you for fixing my incorrect mapping. At some point, I had had the aryl carbon properly specified, but I clearly lost my way with it along my quest. Sadly, the reaction_smarts = "[c:1][B;R0](O)O>>[*:1]" still does not remove any of the boronates from my input smiles, but it sounds like everything else about the specification of the reaction is correct, so I'll get there at some point with the right reaction_smarts. Thanks again, Katrina On Mon, Aug 21, 2023 at 3:26 AM James Davidson <J.D...@ve...<mailto:J.D...@ve...>> wrote: Hi Katrina, I'm slightly unsure what "deprotection" you are trying to represent, but I think there are a couple of problems with the rsmarts... reaction_smarts = "[c;H1]([B;R0](O)[O;R0:1])>>[c;H1]" This is looking for an aromatic carbon with one hydrogen AND connected to a non-ring boron. This pattern will never be found! Also, you have a mapped atom on the reactant side, but no mapped atoms on the product side. If your reaction is aiming to hydrolyse non-cyclic boronic esters (and return the alcohols), then you should map the oxygen atom on the product side as well - something like: reaction_smarts = "c[B;R0](O)[O:1]>>[*:1]" If, instead, you are interested in the virtual reaction that removes boronates from aryl R-groups (perhaps to calculate R-group fingerprints, etc) - then you should map the aryl carbon on both sides instead: reaction_smarts = "[c:1][B;R0](O)O>>[*:1]" In either case you probably want to deduplicate products (the boronic acids and esters will match the pattern twice). Kind regards James ________________________________ From: Katrina Lexa <kl...@um...<mailto:kl...@um...>> Sent: 21 August 2023 06:03 To: RDKit Discuss <rdk...@li...<mailto:rdk...@li...>> Subject: [Rdkit-discuss] rdDeprotect & DeprotectData Hi All, I don't know why I'm struggling so much with this, as it seems like it should be pretty straight forward. I'm trying to add some additional deprotection smirks to a data-cleaning python script and I'm not having success with the new reactions actually transforming my reactants to deprotected smiles. I have about 10 I'd like to add, so I know I could do it with simple reactions, but I'd rather figure out where I'm going wrong here. My definition of deprotect data: #deborylation deprotection_class = "boron" reaction_smarts = "[c;H1]([B;R0](O)[O;R0:1])>>[c;H1]" abbreviation = "BOO" full_name = "deboron" bdata = rdDeprotect.DeprotectData(deprotection_class, reaction_smarts, abbreviation, full_name) assert bdata.isValid() I tried adding this line: newDeprotect = rdDeprotect.DeprotectDataVect().append(bdata) but it seems to make no difference: try: #result = rdDeprotect.Deprotect(dep_m,deprotections=[bdata]) result = rdDeprotect.Deprotect(dep_m,newDeprotect) As an example, this is one of the smiles strings in the smiles file I'm reading in I would expect to deprotect" Cc1cc(B(O)O)ccc1OC(C)C Maybe I'm just awful at writing SMIRKS? Thanks for the help here, Katrina ________________________________ PLEASE READ - This email is confidential and may be privileged. It is intended for the named addressee(s) only and access to it by anyone else is unauthorised. If you are not an addressee, any disclosure or copying of the contents of this email or any action taken (or not taken) in reliance on it is unauthorised and may be unlawful. If you have received this email in error, please notify the sender or pos...@ve...<mailto:pos...@ve...>. Email is not a secure method of communication and the Company cannot accept responsibility for the accuracy or completeness of this message or any attachment(s). Please check this email for virus infection for which the Company accepts no responsibility. If verification of this email is sought then please request a hard copy. Unless otherwise stated, any views or opinions presented are solely those of the author and do not represent those of the Company. Vernalis (R&D) Limited (no. 1985479) Granta Park, Great Abington Cambridge, CB21 6GB, United Kingdom Tel: +44 (0)1223 895 555 ________________________________ |
|
From: Katrina L. <kl...@um...> - 2023-08-21 13:58:29
|
Hi James, Thanks for the quick reply! You're quite right, I'm simply interested in the virtual reaction to remove the boronates. Thank you for fixing my incorrect mapping. At some point, I had had the aryl carbon properly specified, but I clearly lost my way with it along my quest. Sadly, the reaction_smarts = "[c:1][B;R0](O)O>>[*:1]" still does not remove any of the boronates from my input smiles, but it sounds like everything else about the specification of the reaction is correct, so I'll get there at some point with the right reaction_smarts. Thanks again, Katrina On Mon, Aug 21, 2023 at 3:26 AM James Davidson <J.D...@ve...> wrote: > Hi Katrina, > > I'm slightly unsure what "deprotection" you are trying to represent, but I > think there are a couple of problems with the rsmarts... > > reaction_smarts = "[c;H1]([B;R0](O)[O;R0:1])>>[c;H1]" > > This is looking for an aromatic carbon with one hydrogen AND connected to > a non-ring boron. This pattern will never be found! > Also, you have a mapped atom on the reactant side, but no mapped atoms on > the product side. > > If your reaction is aiming to hydrolyse non-cyclic boronic esters (and > return the alcohols), then you should map the oxygen atom on the product > side as well - something like: > > reaction_smarts = "c[B;R0](O)[O:1]>>[*:1]" > > If, instead, you are interested in the virtual reaction that removes > boronates from aryl R-groups (perhaps to calculate R-group fingerprints, > etc) - then you should map the aryl carbon on both sides instead: > > reaction_smarts = "[c:1][B;R0](O)O>>[*:1]" > > In either case you probably want to deduplicate products (the boronic > acids and esters will match the pattern twice). > > Kind regards > > James > ------------------------------ > *From:* Katrina Lexa <kl...@um...> > *Sent:* 21 August 2023 06:03 > *To:* RDKit Discuss <rdk...@li...> > *Subject:* [Rdkit-discuss] rdDeprotect & DeprotectData > > Hi All, > > I don't know why I'm struggling so much with this, as it seems like it > should be pretty straight forward. I'm trying to add some additional > deprotection smirks to a data-cleaning python script and I'm not having > success with the new reactions actually transforming my reactants to > deprotected smiles. I have about 10 I'd like to add, so I know I could do > it with simple reactions, but I'd rather figure out where I'm going wrong > here. > > My definition of deprotect data: > #deborylation > deprotection_class = "boron" > reaction_smarts = "[c;H1]([B;R0](O)[O;R0:1])>>[c;H1]" > abbreviation = "BOO" > full_name = "deboron" > bdata = rdDeprotect.DeprotectData(deprotection_class, reaction_smarts, > abbreviation, full_name) > assert bdata.isValid() > > I tried adding this line: > newDeprotect = rdDeprotect.DeprotectDataVect().append(bdata) > > but it seems to make no difference: > try: > #result = > rdDeprotect.Deprotect(dep_m,deprotections=[bdata]) > result = rdDeprotect.Deprotect(dep_m,newDeprotect) > > > As an example, this is one of the smiles strings in the smiles file I'm > reading in I would expect to deprotect" > Cc1cc(B(O)O)ccc1OC(C)C > > Maybe I'm just awful at writing SMIRKS? > > > Thanks for the help here, > > Katrina > > ------------------------------ > > PLEASE READ - This email is confidential and may be privileged. It is > intended for the named addressee(s) only and access to it by anyone else is > unauthorised. If you are not an addressee, any disclosure or copying of the > contents of this email or any action taken (or not taken) in reliance on it > is unauthorised and may be unlawful. If you have received this email in > error, please notify the sender or pos...@ve.... Email is not > a secure method of communication and the Company cannot accept > responsibility for the accuracy or completeness of this message or any > attachment(s). Please check this email for virus infection for which the > Company accepts no responsibility. If verification of this email is sought > then please request a hard copy. Unless otherwise stated, any views or > opinions presented are solely those of the author and do not represent > those of the Company. > > Vernalis (R&D) Limited (no. 1985479) > Granta Park, Great Abington > Cambridge, CB21 6GB, United Kingdom > Tel: +44 (0)1223 895 555 > ------------------------------ > |
|
From: James D. <J.D...@ve...> - 2023-08-21 10:41:31
|
Hi Katrina,
I'm slightly unsure what "deprotection" you are trying to represent, but I think there are a couple of problems with the rsmarts...
reaction_smarts = "[c;H1]([B;R0](O)[O;R0:1])>>[c;H1]"
This is looking for an aromatic carbon with one hydrogen AND connected to a non-ring boron. This pattern will never be found!
Also, you have a mapped atom on the reactant side, but no mapped atoms on the product side.
If your reaction is aiming to hydrolyse non-cyclic boronic esters (and return the alcohols), then you should map the oxygen atom on the product side as well - something like:
reaction_smarts = "c[B;R0](O)[O:1]>>[*:1]"
If, instead, you are interested in the virtual reaction that removes boronates from aryl R-groups (perhaps to calculate R-group fingerprints, etc) - then you should map the aryl carbon on both sides instead:
reaction_smarts = "[c:1][B;R0](O)O>>[*:1]"
In either case you probably want to deduplicate products (the boronic acids and esters will match the pattern twice).
Kind regards
James
________________________________
From: Katrina Lexa <kl...@um...>
Sent: 21 August 2023 06:03
To: RDKit Discuss <rdk...@li...>
Subject: [Rdkit-discuss] rdDeprotect & DeprotectData
Hi All,
I don't know why I'm struggling so much with this, as it seems like it should be pretty straight forward. I'm trying to add some additional deprotection smirks to a data-cleaning python script and I'm not having success with the new reactions actually transforming my reactants to deprotected smiles. I have about 10 I'd like to add, so I know I could do it with simple reactions, but I'd rather figure out where I'm going wrong here.
My definition of deprotect data:
#deborylation
deprotection_class = "boron"
reaction_smarts = "[c;H1]([B;R0](O)[O;R0:1])>>[c;H1]"
abbreviation = "BOO"
full_name = "deboron"
bdata = rdDeprotect.DeprotectData(deprotection_class, reaction_smarts, abbreviation, full_name)
assert bdata.isValid()
I tried adding this line:
newDeprotect = rdDeprotect.DeprotectDataVect().append(bdata)
but it seems to make no difference:
try:
#result = rdDeprotect.Deprotect(dep_m,deprotections=[bdata])
result = rdDeprotect.Deprotect(dep_m,newDeprotect)
As an example, this is one of the smiles strings in the smiles file I'm reading in I would expect to deprotect"
Cc1cc(B(O)O)ccc1OC(C)C
Maybe I'm just awful at writing SMIRKS?
Thanks for the help here,
Katrina
________________________________
PLEASE READ - This email is confidential and may be privileged. It is intended for the named addressee(s) only and access to it by anyone else is unauthorised. If you are not an addressee, any disclosure or copying of the contents of this email or any action taken (or not taken) in reliance on it is unauthorised and may be unlawful. If you have received this email in error, please notify the sender or pos...@ve.... Email is not a secure method of communication and the Company cannot accept responsibility for the accuracy or completeness of this message or any attachment(s). Please check this email for virus infection for which the Company accepts no responsibility. If verification of this email is sought then please request a hard copy. Unless otherwise stated, any views or opinions presented are solely those of the author and do not represent those of the Company.
Vernalis (R&D) Limited (no. 1985479)
Granta Park, Great Abington
Cambridge, CB21 6GB, United Kingdom
Tel: +44 (0)1223 895 555
________________________________
|
|
From: Katrina L. <kl...@um...> - 2023-08-21 05:58:20
|
Hi All,
I don't know why I'm struggling so much with this, as it seems like it
should be pretty straight forward. I'm trying to add some additional
deprotection smirks to a data-cleaning python script and I'm not having
success with the new reactions actually transforming my reactants to
deprotected smiles. I have about 10 I'd like to add, so I know I could do
it with simple reactions, but I'd rather figure out where I'm going wrong
here.
My definition of deprotect data:
#deborylation
deprotection_class = "boron"
reaction_smarts = "[c;H1]([B;R0](O)[O;R0:1])>>[c;H1]"
abbreviation = "BOO"
full_name = "deboron"
bdata = rdDeprotect.DeprotectData(deprotection_class, reaction_smarts,
abbreviation, full_name)
assert bdata.isValid()
I tried adding this line:
newDeprotect = rdDeprotect.DeprotectDataVect().append(bdata)
but it seems to make no difference:
try:
#result =
rdDeprotect.Deprotect(dep_m,deprotections=[bdata])
result = rdDeprotect.Deprotect(dep_m,newDeprotect)
As an example, this is one of the smiles strings in the smiles file I'm
reading in I would expect to deprotect"
Cc1cc(B(O)O)ccc1OC(C)C
Maybe I'm just awful at writing SMIRKS?
Thanks for the help here,
Katrina
|
|
From: David C. <dav...@gm...> - 2023-08-20 21:22:21
|
RDKit supports range queries in SMARTS strings. They are not necessarily
supported by other cheminformatics toolkits such as OpenEye’s. So Wim’s
query below could be simplified by using [r{3-10}] to mean an atom in a
ring of size 3 to 10 atoms in size.
On Sun, 20 Aug 2023 at 18:38, Wim Dehaen <wim...@gm...> wrote:
> Hi,
> i'm not sure if i understand the question perfectly, so apologies if the
> below is behind the point. i think in general, for analysis like this it is
> better to make use of rdkit's SSSR functionality and then use the ring
> information in the way required for your purpose. this tends to be much
> more flexible and natural.
>
> however, here is a smarts pattern that matches both naphthalene and
> azulene, as both of them are aromatic and are are a ten-membered ring plus
> a single additional closure
> ```patt=Chem.MolFromSmarts("c1ccccccccc1")
> n=Chem.MolFromSmiles("c12ccccc1cccc2")
> a=Chem.MolFromSmiles("c12cccc1ccccc2")
> print(n.HasSubstructMatch(patt),a.HasSubstructMatch(patt))```
> this results in True True
>
> another way is to explicitly enumerate the possible ringsizes you are
> willing to consider in the SMARTS:
>
> [r3,r4,r5,r6,r7,r8,r9,r10]1[r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10]1
> as you can see this is much more ugly, but it's able to capture cases such
> as c1cc2c1c3c2c1c3cc1.
>
> best wishes
> wim
>
> On Sun, Aug 20, 2023 at 5:34 PM Eduardo Mayo <edu...@gm...>
> wrote:
>
>> Hello,
>>
>> I hope you are all doing well. I'm looking for a smart pattern that can
>> match rings of different sizes at the same time. The intention is to match
>> something like naphthalene and azulene with the same pattern. Is that
>> possible?
>>
>> Best,
>> Eduardo
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdk...@li...
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdk...@li...
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
--
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
|
|
From: Wim D. <wim...@gm...> - 2023-08-20 17:36:29
|
Hi,
i'm not sure if i understand the question perfectly, so apologies if the
below is behind the point. i think in general, for analysis like this it is
better to make use of rdkit's SSSR functionality and then use the ring
information in the way required for your purpose. this tends to be much
more flexible and natural.
however, here is a smarts pattern that matches both naphthalene and
azulene, as both of them are aromatic and are are a ten-membered ring plus
a single additional closure
```patt=Chem.MolFromSmarts("c1ccccccccc1")
n=Chem.MolFromSmiles("c12ccccc1cccc2")
a=Chem.MolFromSmiles("c12cccc1ccccc2")
print(n.HasSubstructMatch(patt),a.HasSubstructMatch(patt))```
this results in True True
another way is to explicitly enumerate the possible ringsizes you are
willing to consider in the SMARTS:
[r3,r4,r5,r6,r7,r8,r9,r10]1[r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10][r3,r4,r5,r6,r7,r8,r9,r10]1
as you can see this is much more ugly, but it's able to capture cases such
as c1cc2c1c3c2c1c3cc1.
best wishes
wim
On Sun, Aug 20, 2023 at 5:34 PM Eduardo Mayo <edu...@gm...>
wrote:
> Hello,
>
> I hope you are all doing well. I'm looking for a smart pattern that can
> match rings of different sizes at the same time. The intention is to match
> something like naphthalene and azulene with the same pattern. Is that
> possible?
>
> Best,
> Eduardo
> _______________________________________________
> Rdkit-discuss mailing list
> Rdk...@li...
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
|
|
From: Eduardo M. <edu...@gm...> - 2023-08-20 15:32:05
|
Hello, I hope you are all doing well. I'm looking for a smart pattern that can match rings of different sizes at the same time. The intention is to match something like naphthalene and azulene with the same pattern. Is that possible? Best, Eduardo |
|
From: Wim D. <wim...@gm...> - 2023-08-06 18:35:57
|
You need to run the reaction twice (or more generally you can rerun
runreactants on the products iteratively until their are no more new
products, so examples like phloroglucinol to 1,3,5-trifluorobenzene will
work too.)
best wishes
wim
On Sun, Aug 6, 2023 at 4:50 PM Andreas Luttens <and...@gm...>
wrote:
> Dear RDKit community,
>
> I'm trying to convert phenolic hydroxyls into fluorines with runReactants.
> In my example below, I attempt turning resorcinol into 3-fluorophenol and
> 1,3-difluorobenzene.
>
> #include <string>
> #include <vector>
> #include <GraphMol/GraphMol.h>
> #include <GraphMol/SmilesParse/SmilesParse.h>
> #include <GraphMol/SmilesParse/SmilesWrite.h>
> #include <GraphMol/ChemReactions/Reaction.h>
> #include <GraphMol/ChemReactions/ReactionParser.h>
>
> int main()
> {
> RDKit::ChemicalReaction *rxn = RDKit::RxnSmartsToChemicalReaction("
> [c:1][OH]>>[c:1][F]");
> rxn->initReactantMatchers();
>
> RDKit::ROMol *mol_to_convert(RDKit::SmilesToMol("c1cc(cc(c1)O)O"));
>
> RDKit::MOL_SPTR_VECT reacts;
>
> reacts.push_back(RDKit::ROMOL_SPTR(mol_to_convert));
>
> std::vector<RDKit::MOL_SPTR_VECT> converted_molecules;
>
> converted_molecules = rxn->runReactants(reacts,1);
>
> for (const auto& product_vector : converted_molecules)
> {
> for (const auto& product : product_vector)
> {
> std::string converted_smiles = RDKit::MolToSmiles(*product);
> std::cout << "Converted smiles: " << converted_smiles << std::endl;
> }
> }
> return 0;
> }
>
> No matter what *unsigned int* I choose for the number of products, I get
> a single molecule (3-fluorophenol) as output. Resorcinol has two hydroxyls
> that can turn into fluorines, why is 1,3-difluorobenzene not listed as a
> product?
>
> Thanks in advance!
>
> Best regards,
> Andreas
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdk...@li...
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
|
|
From: Andreas L. <and...@gm...> - 2023-08-06 14:47:38
|
Dear RDKit community,
I'm trying to convert phenolic hydroxyls into fluorines with runReactants.
In my example below, I attempt turning resorcinol into 3-fluorophenol and
1,3-difluorobenzene.
#include <string>
#include <vector>
#include <GraphMol/GraphMol.h>
#include <GraphMol/SmilesParse/SmilesParse.h>
#include <GraphMol/SmilesParse/SmilesWrite.h>
#include <GraphMol/ChemReactions/Reaction.h>
#include <GraphMol/ChemReactions/ReactionParser.h>
int main()
{
RDKit::ChemicalReaction *rxn = RDKit::RxnSmartsToChemicalReaction("
[c:1][OH]>>[c:1][F]");
rxn->initReactantMatchers();
RDKit::ROMol *mol_to_convert(RDKit::SmilesToMol("c1cc(cc(c1)O)O"));
RDKit::MOL_SPTR_VECT reacts;
reacts.push_back(RDKit::ROMOL_SPTR(mol_to_convert));
std::vector<RDKit::MOL_SPTR_VECT> converted_molecules;
converted_molecules = rxn->runReactants(reacts,1);
for (const auto& product_vector : converted_molecules)
{
for (const auto& product : product_vector)
{
std::string converted_smiles = RDKit::MolToSmiles(*product);
std::cout << "Converted smiles: " << converted_smiles << std::endl;
}
}
return 0;
}
No matter what *unsigned int* I choose for the number of products, I get a
single molecule (3-fluorophenol) as output. Resorcinol has two hydroxyls
that can turn into fluorines, why is 1,3-difluorobenzene not listed as a
product?
Thanks in advance!
Best regards,
Andreas
|
|
From: Jean-Marc N. <jm....@un...> - 2023-07-27 11:25:43
|
Yes ! Cheers, Jean-Marc Le 27/07/2023 à 12:54, Paolo Tosco a écrit : > from rdkit import Chem > from rdkit.Chem.Draw import rdDepictor > from rdkit.Chem.Draw import rdMolDraw2D > from PIL import Image > from io import BytesIO > smi = "C1CC[C@H]2CCCC[C@@H]2C1" > filenameOut = "img.png" > mol = Chem.MolFromSmiles(smi) > rdDepictor.SetPreferCoordGen(True) > rdDepictor.Compute2DCoords(mol) > d2d = rdMolDraw2D.MolDraw2DCairo(350, 300) > dopts = d2d.drawOptions() > dopts.baseFontSize = 0.6 > dopts.prepareMolsBeforeDrawing = False > mol_draw = rdMolDraw2D.PrepareMolForDrawing(mol, addChiralHs=False) > d2d.DrawMolecule(mol_draw, legend='', highlightAtoms=[]) > d2d.FinishDrawing() > bio = BytesIO(d2d.GetDrawingText()) > draw_code = Image.open(bio) > draw_code.save(filenameOut) > -- Jean-Marc Nuzillard Directeur de Recherches au CNRS Institut de Chimie Moléculaire de Reims CNRS UMR 7312 Moulin de la Housse CPCBAI, Bâtiment 18 BP 1039 51687 REIMS Cedex 2 France ORCID : 0000-0002-5120-2556 Tel : +33 (0)3 26 91 82 10 http://www.univ-reims.fr/icmr https://nuzillard.github.io/PyLSD |
|
From: Paolo T. <pao...@gm...> - 2023-07-27 10:54:25
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">Dear Jean-Marc.</div><div dir="ltr"><br></div><div dir="ltr">Then you only need addChiralHs=False:</div><div dir="ltr"><br></div><div dir="ltr"><table data-hpc="" class="highlight tab-size js-file-line-container js-code-nav-container js-tagsearch-file" data-tab-size="8" data-paste-markdown-skip="" data-tagsearch-lang="Python" data-tagsearch-path="msg11409.py" style="font-variant-caps: normal; border-spacing: 0px; border-collapse: collapse; tab-size: 8; caret-color: rgb(5, 12, 20); color: rgb(5, 12, 20); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; font-size: 14px; -webkit-text-size-adjust: 100%;"><tbody style="box-sizing: border-box;"><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC1" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC2" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Draw</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC3" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Draw</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-s1" style="box-sizing: border-box;">rdMolDraw2D</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC4" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">PIL</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Image</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC5" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">io</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">BytesIO</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC6" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC7" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">smi</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">"C1CC[C@H]2CCCC[C@@H]2C1"</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC8" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">filenameOut</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">"img.png"</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC9" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC10" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">mol</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">MolFromSmiles</span>(<span class="pl-s1" style="box-sizing: border-box;">smi</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC11" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC12" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">SetPreferCoordGen</span>(<span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">True</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC13" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC14" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Compute2DCoords</span>(<span class="pl-s1" style="box-sizing: border-box;">mol</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC15" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC16" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s1" style="box-sizing: border-box;">rdMolDraw2D</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">MolDraw2DCairo</span>(<span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">350</span>, <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">300</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC17" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">dopts</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">drawOptions</span>()</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC18" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">dopts</span>.<span class="pl-s1" style="box-sizing: border-box;">baseFontSize</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">0.6</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC19" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">dopts</span>.<span class="pl-s1" style="box-sizing: border-box;">prepareMolsBeforeDrawing</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">False</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC20" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">mol_draw</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s1" style="box-sizing: border-box;">rdMolDraw2D</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">PrepareMolForDrawing</span>(<span class="pl-s1" style="box-sizing: border-box;">mol</span>, <span class="pl-s1" style="box-sizing: border-box;">addChiralHs</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">False</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC21" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">DrawMolecule</span>(<span class="pl-s1" style="box-sizing: border-box;">mol_draw</span>, <span class="pl-s1" style="box-sizing: border-box;">legend</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span><span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">''</span>, <span class="pl-s1" style="box-sizing: border-box;">highlightAtoms</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span>[])</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC22" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">FinishDrawing</span>()</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC23" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">bio</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">BytesIO</span>(<span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">GetDrawingText</span>())</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC24" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">draw_code</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Image</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">open</span>(<span class="pl-s1" style="box-sizing: border-box;">bio</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC25" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">draw_code</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">save</span>(<span class="pl-s1" style="box-sizing: border-box;">filenameOut</span>)</td></tr></tbody></table></div><div dir="ltr"><br></div><div dir="ltr">Cheers,</div><div dir="ltr">p.</div><div dir="ltr"><br><blockquote type="cite">On 27 Jul 2023, at 12:01, Jean-Marc Nuzillard <jm....@un...> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Dear Paolo,<br>
<br>
your code works perfectly well.<br>
<br>
Running it with the SMILES of trans-decalin,
C1CC[C@H]2CCCC[C@@H]2C1,<br>
I obtained<br>
<div><F293bnUXx7pCSmb2.png></div>.<br>
The code with ReapplyMolBlockWedging() inside (that you proposed
me<br>
in a previous post) was intended to have no H atom displayed at
ring junctions.<br>
Sure, the SMILES of trans-decalin I propose, generated by rdkit
from a molblock<br>
devoid of H atoms, has explicit H atoms inside at the ring
junction.<br>
So, starting from an isomeric SMILES, I would like to produce PNG
drawings that retain<br>
the existing configuration information and do not show H atoms at
ring junctions.<br>
<br>
Best,<br>
<br>
Jean-Marc<br>
<br>
<br>
Le 27/07/2023 à 10:33, Paolo Tosco a écrit :<br>
</div>
<blockquote type="cite" cite="mid:E4B...@gm...">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Dear Jean-Marc,</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">You are generating the molecule from SMILES,
therefore it does not have molblock wedging information.</div>
<div dir="ltr">When you call ReapplyMolBlockWedging(), first
existing wedging info will be stripped.</div>
<div dir="ltr">Then, the molblock wedging will be applied, but
there is none.</div>
<div dir="ltr">Hence, you get no wedging.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">You may simplify your code and get the expected
wedging as follows:</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">
<table data-hpc="" class="highlight tab-size
js-file-line-container js-code-nav-container
js-tagsearch-file" data-tab-size="8" data-paste-markdown-skip="" data-tagsearch-lang="Python" data-tagsearch-path="msg11409.py" style="font-variant-caps:
normal; border-spacing: 0px; border-collapse: collapse;
tab-size: 8; caret-color: rgb(5, 12, 20); color: rgb(5, 12,
20); font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Noto Sans", Helvetica, Arial,
sans-serif, "Apple Color Emoji", "Segoe UI
Emoji"; font-size: 14px; -webkit-text-size-adjust: 100%;">
<tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC1" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC2" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Draw</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC3" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Draw</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-s1" style="box-sizing: border-box;">rdMolDraw2D</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC4" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">PIL</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Image</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC5" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">io</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">BytesIO</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC6" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC7" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">smi</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">"C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C"</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC8" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">filenameOut</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">"img.png"</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC9" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC10" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">mol</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">MolFromSmiles</span>(<span class="pl-s1" style="box-sizing: border-box;">smi</span>)</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC11" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC12" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">SetPreferCoordGen</span>(<span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">True</span>)</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC13" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Compute2DCoords</span>(<span class="pl-s1" style="box-sizing: border-box;">mol</span>)</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC14" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC15" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s1" style="box-sizing: border-box;">rdMolDraw2D</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">MolDraw2DCairo</span>(<span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">350</span>, <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">300</span>)</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC16" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">dopts</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">drawOptions</span>()</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC17" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">dopts</span>.<span class="pl-s1" style="box-sizing: border-box;">baseFontSize</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">0.6</span></td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC18" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">DrawMolecule</span>(<span class="pl-s1" style="box-sizing: border-box;">mol</span>, <span class="pl-s1" style="box-sizing: border-box;">legend</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span><span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">''</span>, <span class="pl-s1" style="box-sizing: border-box;">highlightAtoms</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span>[])</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC19" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">FinishDrawing</span>()</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC20" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">bio</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">BytesIO</span>(<span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">GetDrawingText</span>())</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC21" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">draw_code</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Image</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">open</span>(<span class="pl-s1" style="box-sizing: border-box;">bio</span>)</td>
</tr>
<tr style="box-sizing: border-box;">
<td id="file-msg11409-py-LC22" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">draw_code</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">save</span>(<span class="pl-s1" style="box-sizing: border-box;">filenameOut</span>)</td>
</tr>
</tbody>
</table>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Cheers.</div>
<div dir="ltr">p.</div>
<div dir="ltr"><br>
<blockquote type="cite">On 27 Jul 2023, at 07:31, Jean-Marc
Nuzillard <a class="moz-txt-link-rfc2396E" href="mailto:jm....@un..."><jm....@un...></a> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<div class="moz-cite-prefix">Hi David,<br>
<br>
thank you for your suggestion.<br>
Setting wedgeBonds=True does not change anything,<br>
probably because wedging is performed later by <br>
the call to Chem.ReapplyMolBlockWedging() <br>
<br>
Best,<br>
<br>
Jean-Marc<br>
<br>
Le 26/07/2023 à 22:28, David Cosgrove a écrit :<br>
</div>
<blockquote type="cite" cite="mid:CAJ...@ma...">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<div dir="auto">Hi,</div>
<div dir="auto">I’m away from my computer at the moment, so
can’t try anything, but I wonder if it’s anything to do
with the ‘wedgeBonds=False’ option you gave when preparing
the drawing. </div>
<div dir="auto">Dave</div>
<div dir="auto"><br>
</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, 26 Jul 2023 at
20:45, Jean-Marc Nuzillard <<a href="mailto:jm....@un..." moz-do-not-send="true" class="moz-txt-link-freetext">jm....@un...</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px
0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
<div> Dear all,<br>
<br>
I use the following code to produce PNG drawings. I
use RDKit version 2023.03.1 .<br>
The SMILES chain describes a molecule with a single
chiral center of defined configuration.<br>
<br>
<font style="font-family:monospace;color:rgb(0,0,0)" face="monospace">from rdkit import Chem<br>
from rdkit.Chem import rdCoordGen<br>
from rdkit.Chem.Draw import rdMolDraw2D<br>
from PIL import Image<br>
from io import BytesIO<br>
<br>
smi = "C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C"<br>
filenameOut = "img.png"<br>
<br>
mol = Chem.MolFromSmiles(smi)<br>
rdCoordGen.AddCoords(mol)<br>
print(Chem.MolToMolBlock(mol))<br>
d2d = rdMolDraw2D.MolDraw2DCairo(350, 300)<br>
dopts = d2d.drawOptions()<br>
dopts.baseFontSize = 0.6<br>
dopts.prepareMolsBeforeDrawing = False<br>
mol_draw = rdMolDraw2D.PrepareMolForDrawing(mol,
addChiralHs=False, wedgeBonds=False)<br>
Chem.ReapplyMolBlockWedging(mol_draw)<br>
d2d.DrawMolecule(mol_draw, legend='',
highlightAtoms=[])<br>
d2d.FinishDrawing()<br>
bio = BytesIO(d2d.GetDrawingText())<br>
draw_code = Image.open(bio)<br>
draw_code.save(filenameOut)<br>
</font><br>
The resulting image does not show the chirality
wedge:<br>
<div><wAS5dAnxRREFAFxp.png></div>
<br>
<br>
The script prints the MolBlock that comes from the
SMILES and the calculation of the 2D atomic
coordinates:<br>
_________________<br>
<font style="font-family:monospace;color:rgb(0,0,0)" face="monospace"><br>
RDKit 2D<br>
<br>
19 19 0 0 0 0 0 0 0 0999 V2000<br>
2.0515 1.2242 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
1.0515 1.2214 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
0.5539 0.3540 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-0.4459 0.3512 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-0.9435 -0.5162 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-1.9435 -0.5190 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-2.4411 -1.3866 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-3.4411 -1.3892 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-3.9435 -0.5246 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-3.4459 0.3428 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-2.4459 0.3456 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
-4.9435 -0.5274 0.0000 O 0 0 0 0 0
0 0 0 0 0 0 0<br>
1.4215 -0.1436 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
2.2861 0.3588 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
3.1535 -0.1388 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
4.0181 0.3636 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
4.0153 1.3636 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
4.8855 -0.1338 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
0.5567 -0.6460 0.0000 C 0 0 0 0 0
0 0 0 0 0 0 0<br>
1 2 2 0<br>
2 3 1 0<br>
3 4 1 0<br>
4 5 2 0<br>
5 6 1 0<br>
6 7 2 0<br>
7 8 1 0<br>
8 9 2 0<br>
9 10 1 0<br>
10 11 2 0<br>
9 12 1 0<br>
3 13 1 0<br>
13 14 1 0<br>
14 15 1 0<br>
15 16 2 0<br>
16 17 1 0<br>
16 18 1 0<br>
3 19 1 1<br>
11 6 1 0<br>
M END<br>
</font>_____________________<br>
<br>
The wedge bond (3-19) is apparently here but is not
drawn as such.<br>
<br>
Is there a remedy for that?<br>
<br>
Best regards,<br>
<br>
Jean-Marc<br>
<pre cols="72" style="font-family:monospace">--
Jean-Marc Nuzillard
Directeur de Recherches au CNRS
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France
ORCID : 0000-0002-5120-2556
Tel : +33 (0)3 26 91 82 10
<a href="http://www.univ-reims.fr/icmr" target="_blank" style="font-family:monospace" moz-do-not-send="true" class="moz-txt-link-freetext">http://www.univ-reims.fr/icmr</a>
<a href="https://nuzillard.github.io/PyLSD" target="_blank" style="font-family:monospace" moz-do-not-send="true" class="moz-txt-link-freetext">https://nuzillard.github.io/PyLSD</a></pre>
</div>
_______________________________________________<br>
Rdkit-discuss mailing list<br>
<a href="mailto:Rdk...@li..." target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">Rdk...@li...</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/rdkit-discuss" rel="noreferrer" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.sourceforge.net/lists/listinfo/rdkit-discuss</a><br>
</blockquote>
</div>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div>David Cosgrove<br>
</div>
Freelance computational chemistry and chemoinformatics
developer<br>
</div>
<a href="http://cozchemix.co.uk" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">http://cozchemix.co.uk</a><br>
<br>
</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Jean-Marc Nuzillard
Directeur de Recherches au CNRS
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France
ORCID : 0000-0002-5120-2556
Tel : +33 (0)3 26 91 82 10
<a class="moz-txt-link-freetext" href="http://www.univ-reims.fr/icmr" moz-do-not-send="true">http://www.univ-reims.fr/icmr</a>
<a class="moz-txt-link-freetext" href="https://nuzillard.github.io/PyLSD" moz-do-not-send="true">https://nuzillard.github.io/PyLSD</a></pre>
<span>_______________________________________________</span><br>
<span>Rdkit-discuss mailing list</span><br>
<span><a class="moz-txt-link-abbreviated" href="mailto:Rdk...@li...">Rdk...@li...</a></span><br>
<span><a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/rdkit-discuss">https://lists.sourceforge.net/lists/listinfo/rdkit-discuss</a></span><br>
</div>
</blockquote>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Jean-Marc Nuzillard
Directeur de Recherches au CNRS
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France
ORCID : 0000-0002-5120-2556
Tel : +33 (0)3 26 91 82 10
<a class="moz-txt-link-freetext" href="http://www.univ-reims.fr/icmr">http://www.univ-reims.fr/icmr</a>
<a class="moz-txt-link-freetext" href="https://nuzillard.github.io/PyLSD">https://nuzillard.github.io/PyLSD</a></pre>
</div></blockquote></body></html> |
|
From: Jean-Marc N. <jm....@un...> - 2023-07-27 10:01:41
|
Dear Paolo, your code works perfectly well. Running it with the SMILES of trans-decalin, C1CC[C@H]2CCCC[C@@H]2C1, I obtained . The code with ReapplyMolBlockWedging() inside (that you proposed me in a previous post) was intended to have no H atom displayed at ring junctions. Sure, the SMILES of trans-decalin I propose, generated by rdkit from a molblock devoid of H atoms, has explicit H atoms inside at the ring junction. So, starting from an isomeric SMILES, I would like to produce PNG drawings that retain the existing configuration information and do not show H atoms at ring junctions. Best, Jean-Marc Le 27/07/2023 à 10:33, Paolo Tosco a écrit : > Dear Jean-Marc, > > You are generating the molecule from SMILES, therefore it does not > have molblock wedging information. > When you call ReapplyMolBlockWedging(), first existing wedging info > will be stripped. > Then, the molblock wedging will be applied, but there is none. > Hence, you get no wedging. > > You may simplify your code and get the expected wedging as follows: > > from rdkit import Chem > from rdkit.Chem.Draw import rdDepictor > from rdkit.Chem.Draw import rdMolDraw2D > from PIL import Image > from io import BytesIO > smi = "C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C" > filenameOut = "img.png" > mol = Chem.MolFromSmiles(smi) > rdDepictor.SetPreferCoordGen(True) > rdDepictor.Compute2DCoords(mol) > d2d = rdMolDraw2D.MolDraw2DCairo(350, 300) > dopts = d2d.drawOptions() > dopts.baseFontSize = 0.6 > d2d.DrawMolecule(mol, legend='', highlightAtoms=[]) > d2d.FinishDrawing() > bio = BytesIO(d2d.GetDrawingText()) > draw_code = Image.open(bio) > draw_code.save(filenameOut) > > > Cheers. > p. > >> On 27 Jul 2023, at 07:31, Jean-Marc Nuzillard >> <jm....@un...> wrote: >> >> >> Hi David, >> >> thank you for your suggestion. >> Setting wedgeBonds=True does not change anything, >> probably because wedging is performed later by >> the call to Chem.ReapplyMolBlockWedging() >> >> Best, >> >> Jean-Marc >> >> Le 26/07/2023 à 22:28, David Cosgrove a écrit : >>> Hi, >>> I’m away from my computer at the moment, so can’t try anything, but >>> I wonder if it’s anything to do with the ‘wedgeBonds=False’ option >>> you gave when preparing the drawing. >>> Dave >>> >>> >>> On Wed, 26 Jul 2023 at 20:45, Jean-Marc Nuzillard >>> <jm....@un...> wrote: >>> >>> Dear all, >>> >>> I use the following code to produce PNG drawings. I use RDKit >>> version 2023.03.1 . >>> The SMILES chain describes a molecule with a single chiral >>> center of defined configuration. >>> >>> from rdkit import Chem >>> from rdkit.Chem import rdCoordGen >>> from rdkit.Chem.Draw import rdMolDraw2D >>> from PIL import Image >>> from io import BytesIO >>> >>> smi = "C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C" >>> filenameOut = "img.png" >>> >>> mol = Chem.MolFromSmiles(smi) >>> rdCoordGen.AddCoords(mol) >>> print(Chem.MolToMolBlock(mol)) >>> d2d = rdMolDraw2D.MolDraw2DCairo(350, 300) >>> dopts = d2d.drawOptions() >>> dopts.baseFontSize = 0.6 >>> dopts.prepareMolsBeforeDrawing = False >>> mol_draw = rdMolDraw2D.PrepareMolForDrawing(mol, >>> addChiralHs=False, wedgeBonds=False) >>> Chem.ReapplyMolBlockWedging(mol_draw) >>> d2d.DrawMolecule(mol_draw, legend='', highlightAtoms=[]) >>> d2d.FinishDrawing() >>> bio = BytesIO(d2d.GetDrawingText()) >>> draw_code = Image.open(bio) >>> draw_code.save(filenameOut) >>> >>> The resulting image does not show the chirality wedge: >>> <wAS5dAnxRREFAFxp.png> >>> >>> >>> The script prints the MolBlock that comes from the SMILES and >>> the calculation of the 2D atomic coordinates: >>> _________________ >>> >>> RDKit 2D >>> >>> 19 19 0 0 0 0 0 0 0 0999 V2000 >>> 2.0515 1.2242 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 1.0515 1.2214 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 0.5539 0.3540 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -0.4459 0.3512 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -0.9435 -0.5162 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -1.9435 -0.5190 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -2.4411 -1.3866 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -3.4411 -1.3892 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -3.9435 -0.5246 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -3.4459 0.3428 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -2.4459 0.3456 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> -4.9435 -0.5274 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 >>> 1.4215 -0.1436 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 2.2861 0.3588 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 3.1535 -0.1388 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 4.0181 0.3636 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 4.0153 1.3636 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 4.8855 -0.1338 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 0.5567 -0.6460 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 >>> 1 2 2 0 >>> 2 3 1 0 >>> 3 4 1 0 >>> 4 5 2 0 >>> 5 6 1 0 >>> 6 7 2 0 >>> 7 8 1 0 >>> 8 9 2 0 >>> 9 10 1 0 >>> 10 11 2 0 >>> 9 12 1 0 >>> 3 13 1 0 >>> 13 14 1 0 >>> 14 15 1 0 >>> 15 16 2 0 >>> 16 17 1 0 >>> 16 18 1 0 >>> 3 19 1 1 >>> 11 6 1 0 >>> M END >>> _____________________ >>> >>> The wedge bond (3-19) is apparently here but is not drawn as such. >>> >>> Is there a remedy for that? >>> >>> Best regards, >>> >>> Jean-Marc >>> >>> -- >>> Jean-Marc Nuzillard >>> Directeur de Recherches au CNRS >>> >>> Institut de Chimie Moléculaire de Reims >>> CNRS UMR 7312 >>> Moulin de la Housse >>> CPCBAI, Bâtiment 18 >>> BP 1039 >>> 51687 REIMS Cedex 2 >>> France >>> >>> ORCID : 0000-0002-5120-2556 >>> Tel : +33 (0)3 26 91 82 10 >>> >>> http://www.univ-reims.fr/icmr >>> >>> https://nuzillard.github.io/PyLSD >>> >>> _______________________________________________ >>> Rdkit-discuss mailing list >>> Rdk...@li... >>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >>> >>> -- >>> David Cosgrove >>> Freelance computational chemistry and chemoinformatics developer >>> http://cozchemix.co.uk >>> >> >> >> -- >> Jean-Marc Nuzillard >> Directeur de Recherches au CNRS >> >> Institut de Chimie Moléculaire de Reims >> CNRS UMR 7312 >> Moulin de la Housse >> CPCBAI, Bâtiment 18 >> BP 1039 >> 51687 REIMS Cedex 2 >> France >> >> ORCID : 0000-0002-5120-2556 >> Tel : +33 (0)3 26 91 82 10 >> >> http://www.univ-reims.fr/icmr >> >> https://nuzillard.github.io/PyLSD >> _______________________________________________ >> Rdkit-discuss mailing list >> Rdk...@li... >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss -- Jean-Marc Nuzillard Directeur de Recherches au CNRS Institut de Chimie Moléculaire de Reims CNRS UMR 7312 Moulin de la Housse CPCBAI, Bâtiment 18 BP 1039 51687 REIMS Cedex 2 France ORCID : 0000-0002-5120-2556 Tel : +33 (0)3 26 91 82 10 http://www.univ-reims.fr/icmr https://nuzillard.github.io/PyLSD |
|
From: Paolo T. <pao...@gm...> - 2023-07-27 08:34:04
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">Dear Jean-Marc,</div><div dir="ltr"><br></div><div dir="ltr">You are generating the molecule from SMILES, therefore it does not have molblock wedging information.</div><div dir="ltr">When you call ReapplyMolBlockWedging(), first existing wedging info will be stripped.</div><div dir="ltr">Then, the molblock wedging will be applied, but there is none.</div><div dir="ltr">Hence, you get no wedging.</div><div dir="ltr"><br></div><div dir="ltr">You may simplify your code and get the expected wedging as follows:</div><div dir="ltr"><br></div><div dir="ltr"><table data-hpc="" class="highlight tab-size js-file-line-container js-code-nav-container js-tagsearch-file" data-tab-size="8" data-paste-markdown-skip="" data-tagsearch-lang="Python" data-tagsearch-path="msg11409.py" style="font-variant-caps: normal; border-spacing: 0px; border-collapse: collapse; tab-size: 8; caret-color: rgb(5, 12, 20); color: rgb(5, 12, 20); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; font-size: 14px; -webkit-text-size-adjust: 100%;"><tbody style="box-sizing: border-box;"><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC1" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC2" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Draw</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC3" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">rdkit</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Draw</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-s1" style="box-sizing: border-box;">rdMolDraw2D</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC4" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">PIL</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Image</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC5" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">from</span> <span class="pl-s1" style="box-sizing: border-box;">io</span> <span class="pl-k" style="box-sizing: border-box; color: var(--color-prettylights-syntax-keyword);">import</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">BytesIO</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC6" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC7" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">smi</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">"C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C"</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC8" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">filenameOut</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">"img.png"</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC9" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC10" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">mol</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Chem</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">MolFromSmiles</span>(<span class="pl-s1" style="box-sizing: border-box;">smi</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC11" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC12" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">SetPreferCoordGen</span>(<span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">True</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC13" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">rdDepictor</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Compute2DCoords</span>(<span class="pl-s1" style="box-sizing: border-box;">mol</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC14" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;">
</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC15" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s1" style="box-sizing: border-box;">rdMolDraw2D</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">MolDraw2DCairo</span>(<span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">350</span>, <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">300</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC16" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">dopts</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">drawOptions</span>()</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC17" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">dopts</span>.<span class="pl-s1" style="box-sizing: border-box;">baseFontSize</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">0.6</span></td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC18" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">DrawMolecule</span>(<span class="pl-s1" style="box-sizing: border-box;">mol</span>, <span class="pl-s1" style="box-sizing: border-box;">legend</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span><span class="pl-s" style="box-sizing: border-box; color: var(--color-prettylights-syntax-string);">''</span>, <span class="pl-s1" style="box-sizing: border-box;">highlightAtoms</span><span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span>[])</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC19" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">FinishDrawing</span>()</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC20" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">bio</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">BytesIO</span>(<span class="pl-s1" style="box-sizing: border-box;">d2d</span>.<span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">GetDrawingText</span>())</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC21" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">draw_code</span> <span class="pl-c1" style="box-sizing: border-box; color: var(--color-prettylights-syntax-constant);">=</span> <span class="pl-v" style="box-sizing: border-box; color: var(--color-prettylights-syntax-variable);">Image</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">open</span>(<span class="pl-s1" style="box-sizing: border-box;">bio</span>)</td></tr><tr style="box-sizing: border-box;"><td id="file-msg11409-py-LC22" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; color: var(--color-fg-default); overflow-wrap: anywhere; white-space: pre;"><span class="pl-s1" style="box-sizing: border-box;">draw_code</span>.<span class="pl-en" style="box-sizing: border-box; color: var(--color-prettylights-syntax-entity);">save</span>(<span class="pl-s1" style="box-sizing: border-box;">filenameOut</span>)</td></tr></tbody></table></div><div dir="ltr"><br></div><div dir="ltr">Cheers.</div><div dir="ltr">p.</div><div dir="ltr"><br><blockquote type="cite">On 27 Jul 2023, at 07:31, Jean-Marc Nuzillard <jm....@un...> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Hi David,<br>
<br>
thank you for your suggestion.<br>
Setting wedgeBonds=True does not change anything,<br>
probably because wedging is performed later by <br>
the call to Chem.ReapplyMolBlockWedging() <br>
<br>
Best,<br>
<br>
Jean-Marc<br>
<br>
Le 26/07/2023 à 22:28, David Cosgrove a écrit :<br>
</div>
<blockquote type="cite" cite="mid:CAJ...@ma...">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">Hi,</div>
<div dir="auto">I’m away from my computer at the moment, so can’t
try anything, but I wonder if it’s anything to do with the
‘wedgeBonds=False’ option you gave when preparing the drawing. </div>
<div dir="auto">Dave</div>
<div dir="auto"><br>
</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, 26 Jul 2023 at
20:45, Jean-Marc Nuzillard <<a href="mailto:jm....@un..." moz-do-not-send="true" class="moz-txt-link-freetext">jm....@un...</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
<div> Dear all,<br>
<br>
I use the following code to produce PNG drawings. I use
RDKit version 2023.03.1 .<br>
The SMILES chain describes a molecule with a single chiral
center of defined configuration.<br>
<br>
<font style="font-family:monospace;color:rgb(0,0,0)" face="monospace">from rdkit import Chem<br>
from rdkit.Chem import rdCoordGen<br>
from rdkit.Chem.Draw import rdMolDraw2D<br>
from PIL import Image<br>
from io import BytesIO<br>
<br>
smi = "C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C"<br>
filenameOut = "img.png"<br>
<br>
mol = Chem.MolFromSmiles(smi)<br>
rdCoordGen.AddCoords(mol)<br>
print(Chem.MolToMolBlock(mol))<br>
d2d = rdMolDraw2D.MolDraw2DCairo(350, 300)<br>
dopts = d2d.drawOptions()<br>
dopts.baseFontSize = 0.6<br>
dopts.prepareMolsBeforeDrawing = False<br>
mol_draw = rdMolDraw2D.PrepareMolForDrawing(mol,
addChiralHs=False, wedgeBonds=False)<br>
Chem.ReapplyMolBlockWedging(mol_draw)<br>
d2d.DrawMolecule(mol_draw, legend='', highlightAtoms=[])<br>
d2d.FinishDrawing()<br>
bio = BytesIO(d2d.GetDrawingText())<br>
draw_code = Image.open(bio)<br>
draw_code.save(filenameOut)<br>
</font><br>
The resulting image does not show the chirality wedge:<br>
<div><wAS5dAnxRREFAFxp.png></div><br>
<br>
The script prints the MolBlock that comes from the SMILES
and the calculation of the 2D atomic coordinates:<br>
_________________<br>
<font style="font-family:monospace;color:rgb(0,0,0)" face="monospace"><br>
RDKit 2D<br>
<br>
19 19 0 0 0 0 0 0 0 0999 V2000<br>
2.0515 1.2242 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
1.0515 1.2214 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
0.5539 0.3540 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-0.4459 0.3512 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-0.9435 -0.5162 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-1.9435 -0.5190 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-2.4411 -1.3866 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-3.4411 -1.3892 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-3.9435 -0.5246 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-3.4459 0.3428 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-2.4459 0.3456 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
-4.9435 -0.5274 0.0000 O 0 0 0 0 0 0 0
0 0 0 0 0<br>
1.4215 -0.1436 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
2.2861 0.3588 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
3.1535 -0.1388 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
4.0181 0.3636 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
4.0153 1.3636 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
4.8855 -0.1338 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
0.5567 -0.6460 0.0000 C 0 0 0 0 0 0 0
0 0 0 0 0<br>
1 2 2 0<br>
2 3 1 0<br>
3 4 1 0<br>
4 5 2 0<br>
5 6 1 0<br>
6 7 2 0<br>
7 8 1 0<br>
8 9 2 0<br>
9 10 1 0<br>
10 11 2 0<br>
9 12 1 0<br>
3 13 1 0<br>
13 14 1 0<br>
14 15 1 0<br>
15 16 2 0<br>
16 17 1 0<br>
16 18 1 0<br>
3 19 1 1<br>
11 6 1 0<br>
M END<br>
</font>_____________________<br>
<br>
The wedge bond (3-19) is apparently here but is not drawn
as such.<br>
<br>
Is there a remedy for that?<br>
<br>
Best regards,<br>
<br>
Jean-Marc<br>
<pre cols="72" style="font-family:monospace">--
Jean-Marc Nuzillard
Directeur de Recherches au CNRS
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France
ORCID : 0000-0002-5120-2556
Tel : +33 (0)3 26 91 82 10
<a href="http://www.univ-reims.fr/icmr" target="_blank" style="font-family:monospace" moz-do-not-send="true" class="moz-txt-link-freetext">http://www.univ-reims.fr/icmr</a>
<a href="https://nuzillard.github.io/PyLSD" target="_blank" style="font-family:monospace" moz-do-not-send="true" class="moz-txt-link-freetext">https://nuzillard.github.io/PyLSD</a></pre>
</div>
_______________________________________________<br>
Rdkit-discuss mailing list<br>
<a href="mailto:Rdk...@li..." target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">Rdk...@li...</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/rdkit-discuss" rel="noreferrer" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.sourceforge.net/lists/listinfo/rdkit-discuss</a><br>
</blockquote>
</div>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div>David Cosgrove<br>
</div>
Freelance computational chemistry and chemoinformatics
developer<br>
</div>
<a href="http://cozchemix.co.uk" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">http://cozchemix.co.uk</a><br>
<br>
</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Jean-Marc Nuzillard
Directeur de Recherches au CNRS
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France
ORCID : 0000-0002-5120-2556
Tel : +33 (0)3 26 91 82 10
<a class="moz-txt-link-freetext" href="http://www.univ-reims.fr/icmr">http://www.univ-reims.fr/icmr</a>
<a class="moz-txt-link-freetext" href="https://nuzillard.github.io/PyLSD">https://nuzillard.github.io/PyLSD</a></pre>
<span>_______________________________________________</span><br><span>Rdkit-discuss mailing list</span><br><span>Rdk...@li...</span><br><span>https://lists.sourceforge.net/lists/listinfo/rdkit-discuss</span><br></div></blockquote></body></html> |
|
From: Jean-Marc N. <jm....@un...> - 2023-07-27 05:29:36
|
Hi David, thank you for your suggestion. Setting wedgeBonds=True does not change anything, probably because wedging is performed later by the call to Chem.ReapplyMolBlockWedging() Best, Jean-Marc Le 26/07/2023 à 22:28, David Cosgrove a écrit : > Hi, > I’m away from my computer at the moment, so can’t try anything, but I > wonder if it’s anything to do with the ‘wedgeBonds=False’ option you > gave when preparing the drawing. > Dave > > > On Wed, 26 Jul 2023 at 20:45, Jean-Marc Nuzillard > <jm....@un...> wrote: > > Dear all, > > I use the following code to produce PNG drawings. I use RDKit > version 2023.03.1 . > The SMILES chain describes a molecule with a single chiral center > of defined configuration. > > from rdkit import Chem > from rdkit.Chem import rdCoordGen > from rdkit.Chem.Draw import rdMolDraw2D > from PIL import Image > from io import BytesIO > > smi = "C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C" > filenameOut = "img.png" > > mol = Chem.MolFromSmiles(smi) > rdCoordGen.AddCoords(mol) > print(Chem.MolToMolBlock(mol)) > d2d = rdMolDraw2D.MolDraw2DCairo(350, 300) > dopts = d2d.drawOptions() > dopts.baseFontSize = 0.6 > dopts.prepareMolsBeforeDrawing = False > mol_draw = rdMolDraw2D.PrepareMolForDrawing(mol, > addChiralHs=False, wedgeBonds=False) > Chem.ReapplyMolBlockWedging(mol_draw) > d2d.DrawMolecule(mol_draw, legend='', highlightAtoms=[]) > d2d.FinishDrawing() > bio = BytesIO(d2d.GetDrawingText()) > draw_code = Image.open(bio) > draw_code.save(filenameOut) > > The resulting image does not show the chirality wedge: > > > The script prints the MolBlock that comes from the SMILES and the > calculation of the 2D atomic coordinates: > _________________ > > RDKit 2D > > 19 19 0 0 0 0 0 0 0 0999 V2000 > 2.0515 1.2242 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 1.0515 1.2214 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 0.5539 0.3540 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -0.4459 0.3512 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -0.9435 -0.5162 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -1.9435 -0.5190 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -2.4411 -1.3866 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -3.4411 -1.3892 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -3.9435 -0.5246 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -3.4459 0.3428 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -2.4459 0.3456 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -4.9435 -0.5274 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 > 1.4215 -0.1436 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 2.2861 0.3588 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 3.1535 -0.1388 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 4.0181 0.3636 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 4.0153 1.3636 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 4.8855 -0.1338 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 0.5567 -0.6460 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 1 2 2 0 > 2 3 1 0 > 3 4 1 0 > 4 5 2 0 > 5 6 1 0 > 6 7 2 0 > 7 8 1 0 > 8 9 2 0 > 9 10 1 0 > 10 11 2 0 > 9 12 1 0 > 3 13 1 0 > 13 14 1 0 > 14 15 1 0 > 15 16 2 0 > 16 17 1 0 > 16 18 1 0 > 3 19 1 1 > 11 6 1 0 > M END > _____________________ > > The wedge bond (3-19) is apparently here but is not drawn as such. > > Is there a remedy for that? > > Best regards, > > Jean-Marc > > -- > Jean-Marc Nuzillard > Directeur de Recherches au CNRS > > Institut de Chimie Moléculaire de Reims > CNRS UMR 7312 > Moulin de la Housse > CPCBAI, Bâtiment 18 > BP 1039 > 51687 REIMS Cedex 2 > France > > ORCID : 0000-0002-5120-2556 > Tel : +33 (0)3 26 91 82 10 > > http://www.univ-reims.fr/icmr > > https://nuzillard.github.io/PyLSD > > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > -- > David Cosgrove > Freelance computational chemistry and chemoinformatics developer > http://cozchemix.co.uk > -- Jean-Marc Nuzillard Directeur de Recherches au CNRS Institut de Chimie Moléculaire de Reims CNRS UMR 7312 Moulin de la Housse CPCBAI, Bâtiment 18 BP 1039 51687 REIMS Cedex 2 France ORCID : 0000-0002-5120-2556 Tel : +33 (0)3 26 91 82 10 http://www.univ-reims.fr/icmr https://nuzillard.github.io/PyLSD |
|
From: David C. <dav...@gm...> - 2023-07-26 20:29:01
|
Hi, I’m away from my computer at the moment, so can’t try anything, but I wonder if it’s anything to do with the ‘wedgeBonds=False’ option you gave when preparing the drawing. Dave On Wed, 26 Jul 2023 at 20:45, Jean-Marc Nuzillard < jm....@un...> wrote: > Dear all, > > I use the following code to produce PNG drawings. I use RDKit version > 2023.03.1 . > The SMILES chain describes a molecule with a single chiral center of > defined configuration. > > from rdkit import Chem > from rdkit.Chem import rdCoordGen > from rdkit.Chem.Draw import rdMolDraw2D > from PIL import Image > from io import BytesIO > > smi = "C=C[C@@](/C=C/c1ccc(cc1)O)(CCC=C(C)C)C" > filenameOut = "img.png" > > mol = Chem.MolFromSmiles(smi) > rdCoordGen.AddCoords(mol) > print(Chem.MolToMolBlock(mol)) > d2d = rdMolDraw2D.MolDraw2DCairo(350, 300) > dopts = d2d.drawOptions() > dopts.baseFontSize = 0.6 > dopts.prepareMolsBeforeDrawing = False > mol_draw = rdMolDraw2D.PrepareMolForDrawing(mol, addChiralHs=False, > wedgeBonds=False) > Chem.ReapplyMolBlockWedging(mol_draw) > d2d.DrawMolecule(mol_draw, legend='', highlightAtoms=[]) > d2d.FinishDrawing() > bio = BytesIO(d2d.GetDrawingText()) > draw_code = Image.open(bio) > draw_code.save(filenameOut) > > The resulting image does not show the chirality wedge: > > > The script prints the MolBlock that comes from the SMILES and the > calculation of the 2D atomic coordinates: > _________________ > > RDKit 2D > > 19 19 0 0 0 0 0 0 0 0999 V2000 > 2.0515 1.2242 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 1.0515 1.2214 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 0.5539 0.3540 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -0.4459 0.3512 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -0.9435 -0.5162 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -1.9435 -0.5190 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -2.4411 -1.3866 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -3.4411 -1.3892 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -3.9435 -0.5246 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -3.4459 0.3428 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -2.4459 0.3456 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -4.9435 -0.5274 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 > 1.4215 -0.1436 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 2.2861 0.3588 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 3.1535 -0.1388 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 4.0181 0.3636 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 4.0153 1.3636 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 4.8855 -0.1338 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 0.5567 -0.6460 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 1 2 2 0 > 2 3 1 0 > 3 4 1 0 > 4 5 2 0 > 5 6 1 0 > 6 7 2 0 > 7 8 1 0 > 8 9 2 0 > 9 10 1 0 > 10 11 2 0 > 9 12 1 0 > 3 13 1 0 > 13 14 1 0 > 14 15 1 0 > 15 16 2 0 > 16 17 1 0 > 16 18 1 0 > 3 19 1 1 > 11 6 1 0 > M END > _____________________ > > The wedge bond (3-19) is apparently here but is not drawn as such. > > Is there a remedy for that? > > Best regards, > > Jean-Marc > > -- > Jean-Marc Nuzillard > Directeur de Recherches au CNRS > > Institut de Chimie Moléculaire de Reims > CNRS UMR 7312 > Moulin de la Housse > CPCBAI, Bâtiment 18 > BP 1039 > 51687 REIMS Cedex 2 > France > > ORCID : 0000-0002-5120-2556 > Tel : +33 (0)3 26 91 82 10 > http://www.univ-reims.fr/icmr > https://nuzillard.github.io/PyLSD > > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > -- David Cosgrove Freelance computational chemistry and chemoinformatics developer http://cozchemix.co.uk |