Re: [Cdk-user] CDK - issue with stereochemistry
Hi John, Thanks for the quick response. My concern is that I would like to preprocess the structures correctly so that no matter how the molecule was originally stored and what tools was used (OpenBabel, CDK, JChem/MarVin), I return one unique representation. Afterwards the molecule is subjected to another tool that uses CDK for transformations. BTW, I add the explicit hydrogens because most of the smarts string and smirks strings I use later on contain them, and I noticed that I have to do so in order for pattern matching or transformations to work. Also, if I understood correctly, I have many lines that I should remove? Which ones? Thanks, On Wed, Jun 7, 2017 at 2:12 PM, John Mayfieldwrote: > SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance >> ()); >> System.out.println(SmartsPattern.create("c1c1") >> .matches(smipar.parseSmiles("C1=CC=CC=C1"))); > > > Too many carbons in the SMILES... > > On 7 June 2017 at 21:11, John Mayfield > wrote: > >> You don't need to do any of this. >> >> - From your wording, it sounds like you store aromatic bonds in molfiles, >> do not do this. ChemAxon know this is bad, they should warn on write (like >> everyone else). Yes I know people use it but two wrongs don't make a right. >> >> - SINGLE_OR_DOUBLE is defunct do not use it... will get round to >> deprecating that at some point. If you must...do it: >> *if (bond.isAromatic() && bond.getOrder() == IBond.Order.UNSET)* >> >> - High level SMARTS matching automatically sets the aromaticity to be >> correct (Daylight's - which incidentally you're not using here anyways :-D): >> >> SmilesParser smipar = new >> SmilesParser(SilentChemObjectBuilder.getInstance()); >> System.out.println(SmartsPattern.create("c1c1") >> >> .matches(smipar.parseSmiles("C1=CC=CC=CC1"))); >> >> >> >> John >> >> On 7 June 2017 at 20:58, Yannick .Djoumbou wrote: >> >>> Thanks John, >>> >>> Because of the variety of sources from molecules, including the ones >>> generated by JChem (which handles aromatic bonds differently from most), I >>> decided to add a function that preprocesses molecules. here is the code. >>> Please let me know if this is OK. >>> >>> I basically percieve the atoms, ckeck the bonds, and make sure that the >>> aromatic bonds (which are represented in ChemAxon with 4 - query bonds) are >>> set appropriately. I then aromatize the structure (as I want to run them >>> against SMIRKS/SMARTS patterns that might include various representations >>> of rings). Subsequently, I convert implicit hydrogens to explicit >>> hydrogens and generate coordinates for the new atoms. >>> >>> AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); >>>Aromaticity aromaticity = new Aromaticity( ElectronDonation.cdk(), >>> Cycles.cdkAromaticSet()); >>> for (IBond bond : molecule.bonds()) { >>> if (bond.getFlag(CDKConstants.SINGLE_OR_DOUBLE)) { >>> bond.setFlag(CDKConstants.ISAROMATIC, true); >>> bond.getAtom(0).setFlag(CDKConstants.ISAROMATIC, true); >>> bond.getAtom(1).setFlag(CDKConstants.ISAROMATIC, true); >>> } >>> } >>> aromaticity.apply(molecule); >>> AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); >>> StructureDiagramGenerator sdg = new StructureDiagramGenerator(); >>> sdg.setMolecule(molecule); >>> sdg.generateCoordinates(); >>> IAtomContainer layedOutMol = sdg.getMolecule(); >>> return layedOutMol >>> >>> Thanks, >>> Yannick >>> >>> >>> >>> >>> >>> On Wed, Jun 7, 2017 at 1:43 PM, John Mayfield < >>> john.wilkinson...@gmail.com> wrote: >>> I tried MarvinSketch before I posted that and all the same there too.. let me know if you still think there is a problem. On 7 June 2017 at 18:13, Yannick .Djoumbou wrote: > Hi John, > > Thank you the fast response. I am using another viewer, which could > have brought the confusion. This just means the issue in my code might > come > from somewhere else. > > Thanks, > Yannick > > On Tue, Jun 6, 2017 at 3:25 AM, John Mayfield < > john.wilkinson...@gmail.com> wrote: > >> Hi Yannick, >> >> Please, please, please don't "add hydrogens" like this! The hydrogens >> are already there and don't need to be added - this is just wasted effort >> and worst of all the atom typing *might* change your structures >> valence!! If for some reason you want to make hydrogens explicit just >> call >> this method directly: >> >> AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule >>> ); >> >> >> Anyways why do you think the stereochemistry is different? All your >> SMILES are the same and the stereochemistry is preserved correctly - >> paste >> them in here to see: https://cdkdepict-openche >> m.rhcloud.com/depict.html >> >> >>
Re: [Cdk-user] CDK - issue with stereochemistry
I tried MarvinSketch before I posted that and all the same there too.. let me know if you still think there is a problem. On 7 June 2017 at 18:13, Yannick .Djoumbouwrote: > Hi John, > > Thank you the fast response. I am using another viewer, which could have > brought the confusion. This just means the issue in my code might come from > somewhere else. > > Thanks, > Yannick > > On Tue, Jun 6, 2017 at 3:25 AM, John Mayfield > wrote: > >> Hi Yannick, >> >> Please, please, please don't "add hydrogens" like this! The hydrogens are >> already there and don't need to be added - this is just wasted effort and >> worst of all the atom typing *might* change your structures valence!! If >> for some reason you want to make hydrogens explicit just call this method >> directly: >> >> AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); >> >> >> Anyways why do you think the stereochemistry is different? All your >> SMILES are the same and the stereochemistry is preserved correctly - paste >> them in here to see: https://cdkdepict-openchem.rhcloud.com/depict.html >> >> >> [image: Inline images 1] >> > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user
Re: [Cdk-user] CDK - issue with stereochemistry
Hi John, Thank you the fast response. I am using another viewer, which could have brought the confusion. This just means the issue in my code might come from somewhere else. Thanks, Yannick On Tue, Jun 6, 2017 at 3:25 AM, John Mayfieldwrote: > Hi Yannick, > > Please, please, please don't "add hydrogens" like this! The hydrogens are > already there and don't need to be added - this is just wasted effort and > worst of all the atom typing *might* change your structures valence!! If > for some reason you want to make hydrogens explicit just call this method > directly: > > AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); > > > Anyways why do you think the stereochemistry is different? All your SMILES > are the same and the stereochemistry is preserved correctly - paste them in > here to see: https://cdkdepict-openchem.rhcloud.com/depict.html > > > [image: Inline images 1] > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user
Re: [Cdk-user] CDK - issue with stereochemistry
Hi Yannick, Please, please, please don't "add hydrogens" like this! The hydrogens are already there and don't need to be added - this is just wasted effort and worst of all the atom typing *might* change your structures valence!! If for some reason you want to make hydrogens explicit just call this method directly: AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); Anyways why do you think the stereochemistry is different? All your SMILES are the same and the stereochemistry is preserved correctly - paste them in here to see: https://cdkdepict-openchem.rhcloud.com/depict.html [image: Inline images 1] -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user
[Cdk-user] CDK - issue with stereochemistry
Hi all, I have an issue handling stereochemistry with CDK. I am using CDK-1.5.13. I have the following molecule: Mol 1: [H][C@@]1(O)[C@@H](CO)O[C@@]([H])(OC2CCC3CCC(=O)OC3C2)[C@ ]([H])(O)[C@H]1O I am using the following code to add implicit hydrogens and further convert them into explicit ones. The resulting structure serves as input for another function. AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); CDKHydrogenAdder.getInstance(molecule .getBuilder()).addImplicitHydrogens(molecule); AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); Unfortunately, the stereochemistry in structure that results from this code is messed up. This is what I get in return: Mol2: [H][C@@]1(O[H])[C@@](C(O[H])([H])[H])(O[C@ @]([H])(OC2(C(C(C3(C(C(C(=O)OC3(C2([H])[H])[H])([H])[H])([H])[H])[H])([H])[H])([H])[H])[H])[C@ ]([H])(O[H])[C@]1(O[H])[H])[H] But what I think should be returned is Mol3: [H]OC([H])([H])[C@@]1([H])O[C@ @]([H])(OC2([H])C([H])([H])C([H])([H])C3([H])C([H])([H])C([H])([H])C(=O)OC3([H])C2([H])[H])[C@ ]([H])(O[H])[C@@]([H])(O[H])[C@]1([H])O[H] Is there a reason for the change of stereochemical information? How to fix the code in order to obtain the Mol3 structure? Thank you so much for your help. Best, Yannick -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user