[Rdkit-discuss] Creating Mol Object From SD File
Hi, I finally realized that when passing an sdf string to Chem.MolFromMolBlock, the Mol object will not retain the properties from the sdf. Knowing that, I am wondering if there is a way to create a single Mol object from a SDF string. Right now, the only way I know is by using SDMolSupplier: my_mol = None suppl = Chem.SDMolSupplier(filename, ) for mol in suppl: my_mol = mol ... Are there other ways to do this without needing to create a SDMolSupplier? Also, it seems that SDMolSupplier.next() does not work anymore? I am getting the following: AttributeError: 'SDMolSupplier' object has no attribute 'next' Any help is much appreciated, thanks! Best, Chris Murphy -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Removing and Setting STEREOANY For Double Bonds
Thanks so much for the help. This did the trick for setting single bonds to squiggly bonds, and setting double bonds to the crossed any stereo worked. However, what is not seeming to work is setting a double bond to STEREONONE so I can return it to a normal double bond without any stereo indication. Is this not supported or is there a different function I can use to clear the stereochemistry for just this bond? Thanks again! -Chris On Wed, Jul 11, 2018 at 12:42 AM Greg Landrum wrote: > Hi Chris, > > I think at least some of what you observed may be due to older bugs that > have been fixed. > Here's your example using a recent version of the RDKit: > > In [9]: rdkit.rdBase.rdkitVersion > Out[9]: '2018.03.1' > > In [10]: m = Chem.MolFromMolBlock(mb) > > In [11]: Chem.MolToSmiles(m) > Out[11]: 'CNC(C)=CCc1c1' > > In [12]: print(Chem.MolToMolBlock(m)) > SomeID > RDKit 3D > > 12 12 0 0 0 0 0 0 0 0999 V2000 > 1.42900.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 > 0.7145 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 > 0.0.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 > 1.42901.03130. N 0 0 0 0 0 0 0 0 0 0 0 0 > 2.1434 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 > 2.14341.44380. C 0 0 0 0 0 0 0 0 0 0 0 0 >-0.7143 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 >-1.42880.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 >-2.1433 -0.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 >-2.1434 -1.03120. C 0 0 0 0 0 0 0 0 0 0 0 0 >-1.4289 -1.44380. C 0 0 0 0 0 0 0 0 0 0 0 0 >-0.7144 -1.03120. C 0 0 0 0 0 0 0 0 0 0 0 0 > 2 1 2 3 > 2 3 1 0 > 1 5 1 0 > 1 4 1 0 > 4 6 1 0 > 3 7 1 0 > 8 9 1 0 > 9 10 2 0 > 10 11 1 0 > 11 12 2 0 > 7 8 2 0 > 12 7 1 0 > M END > > > A bit more detail: > The RDKit "prefers" to mark the unknown stereo directly on the double > bond, so it writes mol files with crossed double bonds. It should, however, > do the right thing with squiggly bonds that are attached to double bonds > (as your example shows). > > I would also expect setting double bond stereo to STEREOANY to work from > Python: > > In [17]: m = Chem.MolFromSmiles('C/C=C/C') > > In [18]: Chem.MolToSmiles(m) > Out[18]: 'C/C=C/C' > > In [19]: m.GetBondWithIdx(1).SetStereo(Chem.BondStereo.STEREOANY) > > In [20]: Chem.MolToSmiles(m) > Out[20]: 'CC=CC' > > > Though if you want to use the adjacent squiggle bonds, you need to > re-perceive aromaticity: > > In [28]: m = Chem.MolFromSmiles('C/C=C/C') > > In [29]: m.GetBondWithIdx(0).SetBondDir(Chem.BondDir.UNKNOWN) > > In [30]: Chem.AssignStereochemistry(m,cleanIt=True,force=True) > > In [31]: Chem.MolToSmiles(m) > Out[31]: 'CC=CC' > > > I hope this helps, > -greg > > > On Tue, Jul 10, 2018 at 11:51 PM Chris Murphy < > chris.mur...@schrodinger.com> wrote: > >> Hi, >> >> I want to manipulate the "any" stereochemistry representation of double >> bonds. I am trying to set the stereo property for a double bond as >> STEREOANY so it appears as a crossed bond, but I know that the SetStereo >> method does not actually work in Python (not sure if it's just python >> actually?). Alternatively, I also want to be able to remove the STEREOANY >> from a double bond and set one of the adjacent single bonds as STEREOANY so >> it appears as a wiggly bond. Is there a way to manipulate this, directly or >> indirectly, in Python? >> >> Additionally, it seems that when the following sdf is read into a Mol >> object, with a wiggly bond present, it automatically converts the double >> bond to a crossed bond so there is both a wiggly single bond and a crossed >> double bond when the Mol is written back out to MolBlock. Is this because >> the crossed bond is the preferred standard for this situation? >> = >> >> SomeID >> >> 12 12 0 0 0 0999 V2000 >> 1.42900.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 0.7145 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 0.0.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 1.42901.03130. N 0 0 0 0 0 0 0 0 0 0 0 0 >> 2.1434 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 2.14341.44380. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-0.7143 -0.20620. C 0 0
[Rdkit-discuss] Removing and Setting STEREOANY For Double Bonds
Hi, I want to manipulate the "any" stereochemistry representation of double bonds. I am trying to set the stereo property for a double bond as STEREOANY so it appears as a crossed bond, but I know that the SetStereo method does not actually work in Python (not sure if it's just python actually?). Alternatively, I also want to be able to remove the STEREOANY from a double bond and set one of the adjacent single bonds as STEREOANY so it appears as a wiggly bond. Is there a way to manipulate this, directly or indirectly, in Python? Additionally, it seems that when the following sdf is read into a Mol object, with a wiggly bond present, it automatically converts the double bond to a crossed bond so there is both a wiggly single bond and a crossed double bond when the Mol is written back out to MolBlock. Is this because the crossed bond is the preferred standard for this situation? = SomeID 12 12 0 0 0 0999 V2000 1.42900.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 0.7145 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 0.0.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 1.42901.03130. N 0 0 0 0 0 0 0 0 0 0 0 0 2.1434 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 2.14341.44380. C 0 0 0 0 0 0 0 0 0 0 0 0 -0.7143 -0.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.42880.20620. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.1433 -0.20630. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.1434 -1.03120. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.4289 -1.44380. C 0 0 0 0 0 0 0 0 0 0 0 0 -0.7144 -1.03120. C 0 0 0 0 0 0 0 0 0 0 0 0 2 1 2 0 0 0 0 2 3 1 0 0 0 0 1 5 1 0 0 0 0 1 4 1 4 0 0 0 4 6 1 0 0 0 0 3 7 1 0 0 0 0 8 9 1 0 0 0 0 9 10 2 0 0 0 0 10 11 1 0 0 0 0 11 12 2 0 0 0 0 7 8 2 0 0 0 0 12 7 1 0 0 0 0 M END === This is with the 17.3 release, so not sure if anything has been updated since. Thanks for any and all help! -Chris -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] SetBondDir not Affecting Chiral Centers
I did need to add hydrogens for it work correctly, since the exocyclic hydrogens needed to be there to be wedged/dashed, however I used these two lines to ensure I only added the ones I needed: On Thu, Oct 19, 2017 at 2:41 PM, Chris Murphy <chris.mur...@schrodinger.com> wrote: > Greg, > > That did the trick, thanks so much for the help! > > On Wed, Oct 18, 2017 at 2:13 AM, Greg Landrum <greg.land...@gmail.com> > wrote: > >> >> >> On Tue, Oct 17, 2017 at 8:16 PM, Chris Murphy < >> chris.mur...@schrodinger.com> wrote: >> >>> >>> I am trying to implement a function that cleans up chiral centers by >>> moving the wedged/dashed stereo bond out of a ring and onto a function >>> group or hydrogen if possible. >>> >> >> As a general thing: the existing function Chem.WedgeMolBonds() should >> already handle assigning wedged bonds to exocyclic atoms. It does not, >> however, remove existing wedging. I think that this is probably what you >> should be using, but for that to be useful you first need to have a >> molecule with atomic stereochemistry assigned and wedging info removed from >> bonds. >> >> If you skip sanitization when processing a mol block (which is what I >> suspect based on your previous messages), you end up with a molecule that >> has the atomic stereochemistry assigned, but with the wedging information >> still there. Removing the existing wedging info and then calling >> Chem.WedgeMolBonds() should get you what you're looking for. >> >> The function to remove bond wedging isn't currently exposed to Python, I >> can do that, but in the meantime a python translation isn't complicated: >> >> In [42]: def ClearSingleBondDirFlags(m): >> ...: for bond in m.GetBonds(): >> ...: if bond.GetBondType() == Chem.BondType.SINGLE: >> ...: if bond.GetBondDir() == Chem.BondDir.UNKNOWN: >> ...: bond.SetProp("_UnknownStereo",1) >> ...: bond.SetBondDir(Chem.BondDir.NONE) >> >> The piece with the _UnknownStereo property is important to make sure info >> about wavy (I call them "squiggle") bonds is maintained. >> >> If the combination of this function and Chem.WedgeMolBonds() isn't enough >> to solve the problem, I'll get into the rest of your question, but I >> think/hope that this might do it and save you some time and effort. >> >> P.S. If anyone could offer a good suggestion for how to determine if the >>> bond I am moving the dash/wedge to should be dashed or wedged that would >>> also be super helpful. >>> >> >> That's a non-trivial bit of C++ code that isn't currently exposed to the >> python interface. I don't think it would be hard to do that if it would be >> helpful. >> >> -greg >> >> >> >> >>> I have been able to successfully identify the wedged bonds and the >>> adjacent bond to move the wedge/dash stereo bond to and move the stereo >>> bond off of the ring bond, but when I check the result, I notice that I >>> assigned the wrong wedge/dash form to one of the bonds, so I want to check >>> the chirality of the atoms after doing my changes and flip the ones that >>> are wrong. >>> >>> However, I am noticing that the output of Chem.FindMolChiralCenters(mol) >>> does not change (as well as atom.GetProp('_CIPCode')), even if I change all >>> of the bonds to either dashed or wedged, or another combination that should >>> clearly change the original chirality of the stereocenters. I tried >>> calling rdmolops.AssignStereochemistry(mol), but the result of >>> FindMolChiralCenters and atom.GetProp('_CIPCode') still does not change. >>> >> >>> Does SetBondDir actually affect the R/S chiral tags on the atoms? Is >>> there a good way to check if the changes in the bonds have changed the >>> chirality at a given chiral center? >>> >>> >>> >> > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] SetBondDir not Affecting Chiral Centers
chiral_atoms = [center[0] for center in Chem.FindMolChiralCenters(mol)] mol = Chem.AddHs(mol, explicitOnly=False, addCoords=True, onlyOnAtoms=chiral_atoms) On Thu, Oct 19, 2017 at 2:43 PM, Chris Murphy <chris.mur...@schrodinger.com> wrote: > I did need to add hydrogens for it work correctly, since the exocyclic > hydrogens needed to be there to be wedged/dashed, however I used these two > lines to ensure I only added the ones I needed: > > > On Thu, Oct 19, 2017 at 2:41 PM, Chris Murphy < > chris.mur...@schrodinger.com> wrote: > >> Greg, >> >> That did the trick, thanks so much for the help! >> >> On Wed, Oct 18, 2017 at 2:13 AM, Greg Landrum <greg.land...@gmail.com> >> wrote: >> >>> >>> >>> On Tue, Oct 17, 2017 at 8:16 PM, Chris Murphy < >>> chris.mur...@schrodinger.com> wrote: >>> >>>> >>>> I am trying to implement a function that cleans up chiral centers by >>>> moving the wedged/dashed stereo bond out of a ring and onto a function >>>> group or hydrogen if possible. >>>> >>> >>> As a general thing: the existing function Chem.WedgeMolBonds() should >>> already handle assigning wedged bonds to exocyclic atoms. It does not, >>> however, remove existing wedging. I think that this is probably what you >>> should be using, but for that to be useful you first need to have a >>> molecule with atomic stereochemistry assigned and wedging info removed from >>> bonds. >>> >>> If you skip sanitization when processing a mol block (which is what I >>> suspect based on your previous messages), you end up with a molecule that >>> has the atomic stereochemistry assigned, but with the wedging information >>> still there. Removing the existing wedging info and then calling >>> Chem.WedgeMolBonds() should get you what you're looking for. >>> >>> The function to remove bond wedging isn't currently exposed to Python, I >>> can do that, but in the meantime a python translation isn't complicated: >>> >>> In [42]: def ClearSingleBondDirFlags(m): >>> ...: for bond in m.GetBonds(): >>> ...: if bond.GetBondType() == Chem.BondType.SINGLE: >>> ...: if bond.GetBondDir() == Chem.BondDir.UNKNOWN: >>> ...: bond.SetProp("_UnknownStereo",1) >>> ...: bond.SetBondDir(Chem.BondDir.NONE) >>> >>> The piece with the _UnknownStereo property is important to make sure >>> info about wavy (I call them "squiggle") bonds is maintained. >>> >>> If the combination of this function and Chem.WedgeMolBonds() isn't >>> enough to solve the problem, I'll get into the rest of your question, but I >>> think/hope that this might do it and save you some time and effort. >>> >>> P.S. If anyone could offer a good suggestion for how to determine if the >>>> bond I am moving the dash/wedge to should be dashed or wedged that would >>>> also be super helpful. >>>> >>> >>> That's a non-trivial bit of C++ code that isn't currently exposed to the >>> python interface. I don't think it would be hard to do that if it would be >>> helpful. >>> >>> -greg >>> >>> >>> >>> >>>> I have been able to successfully identify the wedged bonds and the >>>> adjacent bond to move the wedge/dash stereo bond to and move the stereo >>>> bond off of the ring bond, but when I check the result, I notice that I >>>> assigned the wrong wedge/dash form to one of the bonds, so I want to check >>>> the chirality of the atoms after doing my changes and flip the ones that >>>> are wrong. >>>> >>>> However, I am noticing that the output of Chem.FindMolChiralCenters(mol) >>>> does not change (as well as atom.GetProp('_CIPCode')), even if I change all >>>> of the bonds to either dashed or wedged, or another combination that should >>>> clearly change the original chirality of the stereocenters. I tried >>>> calling rdmolops.AssignStereochemistry(mol), but the result of >>>> FindMolChiralCenters and atom.GetProp('_CIPCode') still does not change. >>>> >>> >>>> Does SetBondDir actually affect the R/S chiral tags on the atoms? Is >>>> there a good way to check if the changes in the bonds have changed the >>>> chirality at a given chiral center? >>>> >>>> >>>> >>> >> > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] SetBondDir not Affecting Chiral Centers
Greg, That did the trick, thanks so much for the help! On Wed, Oct 18, 2017 at 2:13 AM, Greg Landrum <greg.land...@gmail.com> wrote: > > > On Tue, Oct 17, 2017 at 8:16 PM, Chris Murphy < > chris.mur...@schrodinger.com> wrote: > >> >> I am trying to implement a function that cleans up chiral centers by >> moving the wedged/dashed stereo bond out of a ring and onto a function >> group or hydrogen if possible. >> > > As a general thing: the existing function Chem.WedgeMolBonds() should > already handle assigning wedged bonds to exocyclic atoms. It does not, > however, remove existing wedging. I think that this is probably what you > should be using, but for that to be useful you first need to have a > molecule with atomic stereochemistry assigned and wedging info removed from > bonds. > > If you skip sanitization when processing a mol block (which is what I > suspect based on your previous messages), you end up with a molecule that > has the atomic stereochemistry assigned, but with the wedging information > still there. Removing the existing wedging info and then calling > Chem.WedgeMolBonds() should get you what you're looking for. > > The function to remove bond wedging isn't currently exposed to Python, I > can do that, but in the meantime a python translation isn't complicated: > > In [42]: def ClearSingleBondDirFlags(m): > ...: for bond in m.GetBonds(): > ...: if bond.GetBondType() == Chem.BondType.SINGLE: > ...: if bond.GetBondDir() == Chem.BondDir.UNKNOWN: > ...: bond.SetProp("_UnknownStereo",1) > ...: bond.SetBondDir(Chem.BondDir.NONE) > > The piece with the _UnknownStereo property is important to make sure info > about wavy (I call them "squiggle") bonds is maintained. > > If the combination of this function and Chem.WedgeMolBonds() isn't enough > to solve the problem, I'll get into the rest of your question, but I > think/hope that this might do it and save you some time and effort. > > P.S. If anyone could offer a good suggestion for how to determine if the >> bond I am moving the dash/wedge to should be dashed or wedged that would >> also be super helpful. >> > > That's a non-trivial bit of C++ code that isn't currently exposed to the > python interface. I don't think it would be hard to do that if it would be > helpful. > > -greg > > > > >> I have been able to successfully identify the wedged bonds and the >> adjacent bond to move the wedge/dash stereo bond to and move the stereo >> bond off of the ring bond, but when I check the result, I notice that I >> assigned the wrong wedge/dash form to one of the bonds, so I want to check >> the chirality of the atoms after doing my changes and flip the ones that >> are wrong. >> >> However, I am noticing that the output of Chem.FindMolChiralCenters(mol) >> does not change (as well as atom.GetProp('_CIPCode')), even if I change all >> of the bonds to either dashed or wedged, or another combination that should >> clearly change the original chirality of the stereocenters. I tried >> calling rdmolops.AssignStereochemistry(mol), but the result of >> FindMolChiralCenters and atom.GetProp('_CIPCode') still does not change. >> > >> Does SetBondDir actually affect the R/S chiral tags on the atoms? Is >> there a good way to check if the changes in the bonds have changed the >> chirality at a given chiral center? >> >> >> > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] SetBondDir not Affecting Chiral Centers
Hi, I am trying to implement a function that cleans up chiral centers by moving the wedged/dashed stereo bond out of a ring and onto a function group or hydrogen if possible. I have been able to successfully identify the wedged bonds and the adjacent bond to move the wedge/dash stereo bond to and move the stereo bond off of the ring bond, but when I check the result, I notice that I assigned the wrong wedge/dash form to one of the bonds, so I want to check the chirality of the atoms after doing my changes and flip the ones that are wrong. However, I am noticing that the output of Chem.FindMolChiralCenters(mol) does not change (as well as atom.GetProp('_CIPCode')), even if I change all of the bonds to either dashed or wedged, or another combination that should clearly change the original chirality of the stereocenters. I tried calling rdmolops.AssignStereochemistry(mol), but the result of FindMolChiralCenters and atom.GetProp('_CIPCode') still does not change. Does SetBondDir actually affect the R/S chiral tags on the atoms? Is there a good way to check if the changes in the bonds have changed the chirality at a given chiral center? P.S. If anyone could offer a good suggestion for how to determine if the bond I am moving the dash/wedge to should be dashed or wedged that would also be super helpful. Thanks -Chris -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Reaction changing bonds but not charges
That works, thanks! I'll be sure to include an explicit +0 when converting when I need the product to be neutral. On Mon, Oct 9, 2017 at 11:15 AM, Chris Earnshaw <cgearns...@gmail.com> wrote: > Hi > > I don't think the reaction SMARTS does specify a change in the > charges. The N and O have to be charged in order to match the reactant > pattern but they won't be altered by the transformation. If you > specify that the product atoms are explicitly neutral I think you'll > get the result you want - > [#8-:2]-[#7+:1]=[O:3]>>[O+0:2]=[N+0:1]=[O:3] > > Chris Earnshaw > > On 9 October 2017 at 15:57, Chris Murphy <chris.mur...@schrodinger.com> > wrote: > > Hi, > > > > I am using rdChemReactions to perform substructure transformations as > > defined by configurable reaction smarts. When I create the reaction and > run > > a mol through it that I expect to be transformed by the indicated > reaction > > smarts, I see that the bonds have been changed according to the smarts, > but > > the charges are not changed. > > > > I am using the following smarts to define the transformation: > > [#8-:2]-[#7+:1]=[O:3]>>[O:2]=[N:1]=[O:3] > > > > The input molecule is as follows: > > > > Mrv16c5 10061718252D > > > > 9 9 0 0 0 0999 V2000 > >-0.5916 -0.06780. C 0 0 0 0 0 0 0 0 0 0 0 0 > >-1.3060 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 > >-1.3060 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 > >-0.5916 -1.71790. C 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.1229 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.1229 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 > >-0.59160.75720. N 0 3 0 0 0 0 0 0 0 0 0 0 > >-1.30611.16970. O 0 5 0 0 0 0 0 0 0 0 0 0 > > 0.12291.16970. O 0 0 0 0 0 0 0 0 0 0 0 0 > > 1 2 2 0 0 0 0 > > 2 3 1 0 0 0 0 > > 3 4 2 0 0 0 0 > > 4 5 1 0 0 0 0 > > 5 6 2 0 0 0 0 > > 6 1 1 0 0 0 0 > > 1 7 1 0 0 0 0 > > 7 8 1 0 0 0 0 > > 7 9 2 0 0 0 0 > > M END > > > > > > and the output ends up being: > > > > RDKit 2D > > > > 9 9 0 0 0 0 0 0 0 0999 V2000 > >-1.30611.16970. O 0 0 0 0 0 0 0 0 0 0 0 0 > >-0.59160.75720. N 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.12291.16970. O 0 0 0 0 0 0 0 0 0 0 0 0 > >-0.5916 -0.06780. C 0 0 0 0 0 0 0 0 0 0 0 0 > >-1.3060 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.1229 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 > >-1.3060 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.1229 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 > >-0.5916 -1.71790. C 0 0 0 0 0 0 0 0 0 0 0 0 > > 1 2 2 0 > > 2 3 2 0 > > 4 2 1 0 > > 4 5 2 0 > > 6 4 1 0 > > 5 7 1 0 > > 8 6 2 0 > > 7 9 2 0 > > 9 8 1 0 > > M CHG 2 1 -1 2 1 > > M END > > > > It seems the that NO bond is successfully converted to a double bond, but > > the charges have not been changed, even though the reaction smarts > indicates > > that they N and O should be changed to neutral. Are there any glaring > issues > > with using reactions to do transformations like this? > > > > Thanks! > > > > -Chris > > > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > ___ > > Rdkit-discuss mailing list > > Rdkit-discuss@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Reaction changing bonds but not charges
Hi, I am using rdChemReactions to perform substructure transformations as defined by configurable reaction smarts. When I create the reaction and run a mol through it that I expect to be transformed by the indicated reaction smarts, I see that the bonds have been changed according to the smarts, but the charges are not changed. I am using the following smarts to define the transformation: [#8-:2]-[#7+:1]=[O:3]>>[O:2]=[N:1]=[O:3] The input molecule is as follows: Mrv16c5 10061718252D 9 9 0 0 0 0999 V2000 -0.5916 -0.06780. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.3060 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.3060 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 -0.5916 -1.71790. C 0 0 0 0 0 0 0 0 0 0 0 0 0.1229 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 0.1229 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 -0.59160.75720. N 0 3 0 0 0 0 0 0 0 0 0 0 -1.30611.16970. O 0 5 0 0 0 0 0 0 0 0 0 0 0.12291.16970. O 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 0 0 0 0 2 3 1 0 0 0 0 3 4 2 0 0 0 0 4 5 1 0 0 0 0 5 6 2 0 0 0 0 6 1 1 0 0 0 0 1 7 1 0 0 0 0 7 8 1 0 0 0 0 7 9 2 0 0 0 0 M END and the output ends up being: RDKit 2D 9 9 0 0 0 0 0 0 0 0999 V2000 -1.30611.16970. O 0 0 0 0 0 0 0 0 0 0 0 0 -0.59160.75720. N 0 0 0 0 0 0 0 0 0 0 0 0 0.12291.16970. O 0 0 0 0 0 0 0 0 0 0 0 0 -0.5916 -0.06780. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.3060 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 0.1229 -0.48030. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.3060 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 0.1229 -1.30540. C 0 0 0 0 0 0 0 0 0 0 0 0 -0.5916 -1.71790. C 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 0 2 3 2 0 4 2 1 0 4 5 2 0 6 4 1 0 5 7 1 0 8 6 2 0 7 9 2 0 9 8 1 0 M CHG 2 1 -1 2 1 M END It seems the that NO bond is successfully converted to a double bond, but the charges have not been changed, even though the reaction smarts indicates that they N and O should be changed to neutral. Are there any glaring issues with using reactions to do transformations like this? Thanks! -Chris -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Implicit Hydrogens On Aromatic Hetereoatoms
Greg, That fixed it! Thanks so much, that makes a lot more sense now. -Chris On Fri, Oct 6, 2017 at 1:25 AM, Greg Landrum <greg.land...@gmail.com> wrote: > Hi Chris, > > There's an additional step performed during sanitization that recognizes > that the implicit H needs to be on the N. The steps of a normal full > molecular sanitization operation are documented here: > http://www.rdkit.org/docs/RDKit_Book.html#molecular-sanitization > > The adjustHs() function is not exposed directly to Python, but you can > take care of aromaticity assignment and adjustHs in a single call with the > SanitizeMol() function: > > In [21]: m = Chem.MolFromMolBlock(mb,sanitize=False) > > In [22]: Chem.SanitizeMol(m,sanitizeOps=Chem.SANITIZE_SETAROMATICITY| > Chem.SANITIZE_ADJUSTHS) > Out[22]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE > > In [23]: Chem.MolToSmiles(m) > Out[23]: 'CC(C)c12c(Cl)cc(-c3ccc(-c4ccc(C(=O)O)cc4)[nH]3)nc12' > > I highlighted the N in the heterocyle with the implicit H. > > Hopefully this helps. > > Best, > -greg > p.s. Note: while testing parts of this answer I uncovered a bug in > AdjustHs() that causes it to fail for molecules that include atoms with > "bad valences": https://github.com/rdkit/rdkit/issues/1605 This looks > like it should be easy to fix for the upcoming release. > > > On Thu, Oct 5, 2017 at 11:06 PM, Chris Murphy < > chris.mur...@schrodinger.com> wrote: > >> Hi! >> >> I'm running at an issue with implicit hydrogens on aromatic heteroatoms. >> I am feeding the following sdf into a mol object: >> >> >> Mrv16c5 10021719092D >> >> 28 31 0 0 0 0999 V2000 >>-2.90000.20760. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-2.18710.62280. N 0 0 0 0 0 0 0 0 0 0 0 0 >> 0.00630.29570. N 0 0 0 0 0 0 0 0 0 0 0 0 >>-0.74860.63540. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-1.46570.21180. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 0.55990.91640. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-2.9000 -0.62280. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-2.1829 -1.03800. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-1.4657 -0.62280. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-3.62140.62280. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-0.67311.45740. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 0.14051.63350. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 3.86460.59760. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 1.38600.83670. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 3.03840.67310. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 4.34691.26870. O 0 0 0 0 0 0 0 0 0 0 0 0 >> 1.72570.08180. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 1.86411.51610. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 2.68611.43220. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 2.5477 -0.00210. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-2.1829 -1.86830. Cl 0 0 0 0 0 0 0 0 0 0 0 0 >>-3.62971.45320. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 4.2085 -0.16560. O 0 0 0 0 0 0 0 0 0 0 0 0 >>-3.6214 -1.04630. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-4.33850.19920. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-4.3385 -0.63110. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-4.34691.86000. C 0 0 0 0 0 0 0 0 0 0 0 0 >>-2.90421.86830. C 0 0 0 0 0 0 0 0 0 0 0 0 >> 2 1 1 0 0 0 0 >> 3 4 1 0 0 0 0 >> 4 5 1 0 0 0 0 >> 5 2 2 0 0 0 0 >> 6 3 1 0 0 0 0 >> 7 1 1 0 0 0 0 >> 8 7 1 0 0 0 0 >> 9 8 2 0 0 0 0 >> 10 1 2 0 0 0 0 >> 11 4 2 0 0 0 0 >> 12 11 1 0 0 0 0 >> 13 15 1 0 0 0 0 >> 14 6 1 0 0 0 0 >> 15 19 1 0 0 0 0 >> 16 13 2 0 0 0 0 >> 17 14 2 0 0 0 0 >> 18 14 1 0 0 0 0 >> 19 18 2 0 0 0 0 >> 20 17 1 0 0 0 0 >> 21 8 1 0 0 0 0 >> 22 10 1 0 0 0 0 >> 23 13 1 0 0 0 0 >> 24 7 2 0 0 0 0 >> 25 10 1 0 0 0 0 >> 26 25 2 0 0 0 0 >> 27 22 1 0 0 0 0 >> 28 22 1 0 0 0 0 >> 24 26 1 0 0 0 0 >> 9 5 1 0 0 0 0 >> 6 12 2 0 0 0 0 >> 20 15 2 0 0 0 0 &g
[Rdkit-discuss] Implicit Hydrogens On Aromatic Hetereoatoms
Hi! I'm running at an issue with implicit hydrogens on aromatic heteroatoms. I am feeding the following sdf into a mol object: Mrv16c5 10021719092D 28 31 0 0 0 0999 V2000 -2.90000.20760. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.18710.62280. N 0 0 0 0 0 0 0 0 0 0 0 0 0.00630.29570. N 0 0 0 0 0 0 0 0 0 0 0 0 -0.74860.63540. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.46570.21180. C 0 0 0 0 0 0 0 0 0 0 0 0 0.55990.91640. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.9000 -0.62280. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.1829 -1.03800. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.4657 -0.62280. C 0 0 0 0 0 0 0 0 0 0 0 0 -3.62140.62280. C 0 0 0 0 0 0 0 0 0 0 0 0 -0.67311.45740. C 0 0 0 0 0 0 0 0 0 0 0 0 0.14051.63350. C 0 0 0 0 0 0 0 0 0 0 0 0 3.86460.59760. C 0 0 0 0 0 0 0 0 0 0 0 0 1.38600.83670. C 0 0 0 0 0 0 0 0 0 0 0 0 3.03840.67310. C 0 0 0 0 0 0 0 0 0 0 0 0 4.34691.26870. O 0 0 0 0 0 0 0 0 0 0 0 0 1.72570.08180. C 0 0 0 0 0 0 0 0 0 0 0 0 1.86411.51610. C 0 0 0 0 0 0 0 0 0 0 0 0 2.68611.43220. C 0 0 0 0 0 0 0 0 0 0 0 0 2.5477 -0.00210. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.1829 -1.86830. Cl 0 0 0 0 0 0 0 0 0 0 0 0 -3.62971.45320. C 0 0 0 0 0 0 0 0 0 0 0 0 4.2085 -0.16560. O 0 0 0 0 0 0 0 0 0 0 0 0 -3.6214 -1.04630. C 0 0 0 0 0 0 0 0 0 0 0 0 -4.33850.19920. C 0 0 0 0 0 0 0 0 0 0 0 0 -4.3385 -0.63110. C 0 0 0 0 0 0 0 0 0 0 0 0 -4.34691.86000. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.90421.86830. C 0 0 0 0 0 0 0 0 0 0 0 0 2 1 1 0 0 0 0 3 4 1 0 0 0 0 4 5 1 0 0 0 0 5 2 2 0 0 0 0 6 3 1 0 0 0 0 7 1 1 0 0 0 0 8 7 1 0 0 0 0 9 8 2 0 0 0 0 10 1 2 0 0 0 0 11 4 2 0 0 0 0 12 11 1 0 0 0 0 13 15 1 0 0 0 0 14 6 1 0 0 0 0 15 19 1 0 0 0 0 16 13 2 0 0 0 0 17 14 2 0 0 0 0 18 14 1 0 0 0 0 19 18 2 0 0 0 0 20 17 1 0 0 0 0 21 8 1 0 0 0 0 22 10 1 0 0 0 0 23 13 1 0 0 0 0 24 7 2 0 0 0 0 25 10 1 0 0 0 0 26 25 2 0 0 0 0 27 22 1 0 0 0 0 28 22 1 0 0 0 0 24 26 1 0 0 0 0 9 5 1 0 0 0 0 6 12 2 0 0 0 0 20 15 2 0 0 0 0 M END The nitrogen in the heterocycle should have 1 implicit hydrogen on it, and when I look at it after initially creating the mol object, it does. I want to convert it to aromatic form, so I am calling rdmolops.SetAromatize(mol). Once I do this however, it seems that the implicit hydrogen on the nitrogen is removed, which then causes an error to be thrown if I ever try to convert it back to kekule form or do any kind of sanitization. Maybe my understanding of aromaticity is wrong, but shouldn't the hydrogen be on the nitrogen regardless of whether or not it is considered to be in an aromatic form? I could be misunderstanding rdkit's aromaticity models, but for my purposes, I want to be able to convert the mol to either kekule or aromatic form depending on some configuration settings. Is there a way to manipulate the hydogrens on an atom in this case? Thanks! Chris -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss