Hi Jan,

I have implemented this using some additional logic on smarts as David has
mentioned. I found this easiest to do by using reaction smarts. Take your
smarts, add identifiers to them, then add them to the product. Example:
[C]([#X:1])[#X:2]>>[#X:1][#X:2]. Then go through the products and check
that [#X:1] == [#X:2]. With some modifications this also allows you to run
reactions with molecules that require the same R-groups!

Best,
Hao

On Fri, Jul 24, 2020 at 10:19 AM Ivan Tubert-Brohman <
ivan.tubert-broh...@schrodinger.com> wrote:

> Hi Jan,
>
> I don't think there is a way to say "this atom has to be the same type as
> that atom" in a SMARTS, but a clunky alternative would be by enumerating
> all the elements of interest within a big recursive SMARTS. I hope it won't
> be every element in the periodic table! For example, let's say you only
> care about C, O, and F:
>
> In [6]: patt = Chem.MolFromSmarts('[C;$(C(C)C),$(C(O)O),$(C(F)F)]')
>
> In [7]: mols = [Chem.MolFromSmiles(s) for s in 'CCC CCO OCO FCF FCO
> CCF'.split()]
>
> In [8]: [Chem.MolToSmiles(m) for m in mols if m.HasSubstructMatch(patt)]
> Out[8]: ['CCC', 'OCO', 'FCF']
>
> Hope this helps,
> Ivan
>
>
> On Fri, Jul 24, 2020 at 10:07 AM Jan Halborg Jensen <jhjen...@chem.ku.dk>
> wrote:
>
>> Is there a way to find a [C]([#X])[#X] pattern, where X=X, that finds
>> C(C)C, C(O)O, C(F)F, etc., but not C(C)O, etc.?
>>
>> Best regards, Jan
>>
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to