Hi Yannick,

IIRC 1.5.6 and earlier had a bug where added terminal hydrogens had a null
impl H count. This is fixed in newer versions but to fix here you can loop
through and set any null impl H to 0. This isn't really correct but should
be okay if you stick to molfile/SMILES.

As I said already,* the CDK does not have SMIRKS transformations* and so I
can't help with any problems of the transformations.

J

Regards,
John W May
john.wilkinson...@gmail.com

On 29 January 2015 at 00:39, Yannick .Djoumbou <y.djoum...@gmail.com> wrote:

> Hi John,
>
> Thank you for you reply. The input molecule is in the file called
> "test.sdf"
>
> I have used the StructureDiagramGenerator and could indeed produce
> metabolites. However, I still notice some strange things:
> 1- I cannot convert the resulting metabolites into SMILES although I could
> write them in a SDF file.
> 2- I cannot remove the hydrogen atoms from the the resulting metabolites:
>          "ERRORS: java.lang.IllegalArgumentException: a non-pseudo atom
> had an unset hydrogen count"
>
>
>
> 1) here is a snippet of the code I wrote:
>
>             StructureDiagramGenerator sdg =  new
> StructureDiagramGenerator();
>
>
> AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); //
> where molecule is an AtomContainer object for the original input (without
> explicit hydrogens).
>
>             sdg.setMolecule(molecule);
>             sdg.generateCoordinates();
>             IAtomContainer mol_with_hydrogen = sdg.getMolecule();
>
>             System.out.println("WITH HYDROGENS: " +
> SmartsHelper.moleculeToSMILES(mol_with_hydrogen));
>
>     // metabolites is a IAtomContainerSet with metabolites resulting from
> the biotrasnformation
>
>     for (int j = 0; j < metabolites.getAtomContainerCount(); j++){
>             System.out.println("METABOLITE: " +
> metabolites.getAtomContainer(j).toString());
>             System.out.println("SMILES WITH HYDROGEN ATOMS: " +
> SmartsHelper.moleculeToSMILES(metabolites.getAtomContainer(j)));
>
>     }
>
> I get the results shown in the attached file "cdk_results.txt". As you can
> see, the conversion to SMILES does not return anything. I can however write
> the results in SDF format using SDFWriter as you can see in the attached
> file call "test_metabolites". In this file we have 6 molecules. This arises
> from the fact that for a C atom attached to 2 different explicit H atoms
> for example, each H atom is replaced by an hydroxyl group. Thus, two
> molecules  are produced, because of the difference of the added O-atom
> coordinates. In fact, there should be 3 molecules when we remove the
> explicit H atoms, ideally.
>
> Anyway, I would like to have SMILES of the metabolites and also remove the
> hydrogen atoms without errors. After trials and errors, it seems that the
> IAtomContainer returned after transformation might cause a problem.  But I
> do not know why. May be you could analyze and let me know.
>
> I tried this:
>
>
> I displayed one of the results in "test_metabolites.sdf" and copied it as
> SMILES String, which I loaded in the snippet below:
>
> --------
>         IAtomContainer ac =
> SmartsHelper.getMoleculeFromSmiles("[H]OC1([H])SC2=C([H])C([H])=C([H])C([H])=C2C(=C([H])C([H])(P([H])[H])C(=S)N(C([H])([H])[H])C(F)(F)F)C2=C([H])C([H])=C([H])C([H])=C12");
>
>         AtomContainerManipulator.suppressHydrogens(ac);
>         System.out.println("SMILES WITHOUT HYDROGEN ATOMS: " +
> SmartsHelper.moleculeToSMILES(ac));
>
> ---------
>
> This returns:
>
> SMILES WITHOUT HYDROGEN ATOMS:
> OC1SC2=CC=CC=C2C(=CC(P)C(=S)N(C)C(F)(F)F)C3=CC=CC=C13
>
>
> So, somehow, when I have the smiles string, I can easily remove hydrogen
> atoms without errors. However, using the first snippet, I could not remove
> the hydrogen atoms.
>
> Could you examine this and let me know where the problem might come from
> and how to fix it?
>
> Regards,
>
> Yannick
>
>
> On Tue, Jan 27, 2015 at 3:32 PM, John M <john.wilkinson...@gmail.com>
> wrote:
>
>> Hi Yannick,
>>
>> Check out the StrucutreDiagramGenerator API.
>>
>>
>> http://cdk.github.io/cdk/1.5/docs/api/index.html?org/openscience/cdk/layout/StructureDiagramGenerator.html
>>
>> StructureDiagramGenerator sdg = new StructureDiagramGenerator();
>> sdg.setUseTemplates(false); // only 1-2 substr templates by default lib
>> turn it off for speed... identity templates are left enabled
>> sdg.setMolecule(molecule, false); // clone or not
>> sdg.generateCoordinates();
>>
>> J
>>
>>
>>
>> Regards,
>> John W May
>> john.wilkinson...@gmail.com
>>
>> On 27 January 2015 at 20:29, Yannick .Djoumbou <y.djoum...@gmail.com>
>> wrote:
>>
>>> Hi John,
>>>
>>> Thanks for replying.Please look at my comments below.
>>>
>>> Kind regards,
>>>
>>> Yannick
>>>
>>> On Tue, Jan 27, 2015 at 3:12 AM, John M <john.wilkinson...@gmail.com>
>>> wrote:
>>>
>>>>
>>>> On 27 January 2015 at 09:32, Yannick .Djoumbou <y.djoum...@gmail.com>
>>>> wrote:
>>>>
>>>>> I get the same molecule in the smiles format. Have you tried
>>>>> concerting that into sdf? Does it generate a compound with H atoms and
>>>>> their coordinates? It looks like AtomContainer resulting from 
>>>>> AtomContainerManipulator.convertImplicitToExplicitHydrogens(m)
>>>>> does not have real hydrogen atoms with coordinates. This might be the
>>>>> reason why the transformation result does not look good. The 
>>>>> transformation
>>>>> is applied but the resulting molecule only has one hydrogen atom to which
>>>>> all these heteroatoms (which provously haf implicit hydrogens) are linked.
>>>>> The file transformed_products in my last email shows you some examples.
>>>>>
>>>>> I would like to be able to create a molecue with explicit hydrogens
>>>>> and their coordinates, and then remove those explicit hydrogen atoms after
>>>>> I have applied the transfrmation.
>>>>>
>>>>
>>>> > I get the same molecule in the smiles format. Have you tried
>>>> concerting that into sdf? Does it generate a compound with H atoms and
>>>> their coordinates?
>>>>
>>>> No, you need to generate a layout for them to have coordinates. I
>>>> thought your questions was asking why you only had one hydrogen added?
>>>>
>>>> > It looks like AtomContainer resulting from 
>>>> > AtomContainerManipulator.convertImplicitToExplicitHydrogens(m)
>>>> does not have real hydrogen atoms with coordinates. This might be the
>>>> reason why the transformation result does not look good. The transformation
>>>> is applied but the resulting molecule only has one hydrogen atom to which
>>>> all these heteroatoms (which provously haf implicit hydrogens) are linked.
>>>> The file transformed_products in my last email shows you some examples.
>>>>
>>>> > okay now that makes more sense, they are all there but coordinates
>>>> are not added (defaults to 0,0) because this is expensive and a
>>>> separate step. In an ideal world we would be able to lay out only part
>>>> of a molecule (i.e. unplaced hydrogens). Unfortunately this is not possible
>>>> and you can either lay out the molecule again, or simply just remove them
>>>> for depiction (better). I've never liked that SMIRKS needs explicit
>>>> hydrogens especially since you can still do hydrogen transformations
>>>> without it.
>>>>
>>>
>>> OK. I assume then that if I lay out the molecule with explicit
>>> hydrogens, I will then be able to easily remove them upon completion of my
>>> transformation, with removeHydrogens or suppresHydrogens. I do I generate
>>> the new molecule then with explicit hydrogens and their coordinates?
>>>
>>>
>>>>
>>>> I would like to be able to create a molecue with explicit hydrogens and
>>>> their coordinates, and then remove those explicit hydrogen atoms after I
>>>> have applied the transfrmation.
>>>>
>>>> > Yes you can do that, call removeHydrogens or suppressHydrogens.
>>>>
>>>> Regards,
>>>> John W May
>>>> john.wilkinson...@gmail.com
>>>>
>>>
>>>
>>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to