There is an option to recompute the hydrogens... (RECOMPUTE_HYDROGENS)

https://github.com/cdk/cdk/blob/main/tool/smarts/src/main/java/org/openscience/cdk/smirks/SmirksOption.java#L80

Note the explicit [H] is better than setting H1 because unless you specify
H0 you may have invalid valence, e.g. [OH-] => [OH] would become.
The way the explicit H works is efficient in that it +1 to hydrogen count
rather than create an explicit atom.

On Mon, 25 Nov 2024 at 00:30, Uli Fechner <u...@pending.ai> wrote:

> There is a fair bit of information associated with the original PR:
> https://github.com/cdk/cdk/pull/916
>
> It's my understanding that hydrogens are not automatically adjusted, that
> is, modifying the charge on an atom requires adjusting the hydrogen count.
>
> In this comment are references to more information regarding the different
> matching modes:
> https://github.com/cdk/cdk/pull/916#issuecomment-1273164172
>
> Best
> Uli
>
> On Mon, Nov 25, 2024 at 4:59 AM Jonas Schaub via Cdk-user <
> cdk-user@lists.sourceforge.net> wrote:
>
>> Hi Egon,
>>
>>
>>
>> I also started playing with SMIRKS only a few days ago but I think you
>> need to specify the neutral charge and hydrogen saturation in the product
>> explicitly. I tried “[O-:1]>>[O;+0;H1:1]” and it produced the output you
>> are looking for (O=C(O)C).
>>
>>
>>
>> > let's say we have multiple carboxylic acids and amine groups, how would
>> one enumerate all possible charge states? Is that possible with just SMIRKS?
>>
>>
>>
>> If you use the transform mode “Unique”, you will get as many structures
>> returned as there are matches to your SMIRKS in the molecule. So in each
>> returned structure, one carboxylic acid would be neutralised. But I guess
>> this is only the first step towards what you are looking for. I am actually
>> faced with a similar problem right now, i.e. enumerating all possible
>> transformation combinations for one molecule and multiple SMIRKS…
>>
>>
>>
>> Hope this was of help.
>>
>>
>>
>> Kind regards,
>>
>> Jonas
>>
>>
>>
>> *From:* Egon Willighagen <egon.willigha...@gmail.com>
>> *Sent:* Saturday, November 23, 2024 6:52 PM
>> *To:* CDK users list <cdk-user@lists.sourceforge.net>
>> *Subject:* [Cdk-user] SMIRKS in 2.10-SNAPSHOT
>>
>>
>>
>>
>> Hi John, all,
>>
>>
>>
>> I am playing with SMIRKS but it's pretty new to me.
>>
>>
>>
>> Transform neutralAcid = Smirks.compile("[O-:1]>>[O:1]");
>>
>> IAtomContainer cdkStruct = parser.parseSmiles("CC(=O)[O-]");
>> Iterable<IAtomContainer> iterable = neutralAcid.apply(cdkStruct,
>> Transform.Mode.Exclusive);
>> for (IAtomContainer neutral : iterable) {
>>   String neutralSmiles = generator.createSMILES(neutral);
>>
>>   System.out.println(neutralSmiles);
>> }
>>
>>
>>
>> (I hope I did not make any copy/paste typos)
>>
>>
>>
>> Why am I not getting this as output: CC(=O)O ?
>>
>>
>>
>> (Actually, let's assume I can get that working, let's say we have
>> multiple carboxylic acids and amine groups, how would one enumerate all
>> possible charge states? Is that possible with just SMIRKS?)
>>
>>
>>
>> Egon
>>
>>
>>
>> --
>>
>> [NL] WikiPathways in actie voor MetaKids: We zamelen geld in voor
>> MetaKids met een actie rond WikiPathways, zie
>> https://sr24.wikipathways.org/. Doneer via
>> https://www.npo3fm.nl/kominactie/acties/wikipathways-in-actie-voor-metakids
>>
>>
>>
>> [EN] WikiPathways in action for MetaKids: We are fundraising for the
>> Dutch charity MetaKids by improving metabolic disorder pathways, see
>> https://sr24.wikipathways.org/. Donate at
>> https://www.npo3fm.nl/kominactie/acties/wikipathways-in-actie-voor-metakids
>>
>>
>>
>> --
>>
>> E.L. Willighagen
>> Department of Translational Genomics
>>
>> NUTRIM Institute of Nutrition and Translational Research in Metabolism
>> Maastricht University
>> Blog: https://chem-bla-ics.linkedchemistry.info/
>> Mastodon: https://social.edu.nl/@egonw
>> PubList: https://orcid.org/0000-0001-7542-0286
>> _______________________________________________
>> Cdk-user mailing list
>> Cdk-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/cdk-user
>>
> _______________________________________________
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to