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 <[email protected]>
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 <[email protected]> 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 <
>> [email protected]> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to