Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-11 Thread Greenpharma S.A.S.
Dear Paolo, Thank you very much. I'll test this and revert to you. Have a nice day. Best regards, Quoc-Tuan > Le 10 mai 2020 à 13:09, Paolo Tosco mailto:paolo.tosco.m...@gmail.com > a écrit : > > > Dear Quoc-Tuan, > > I think I have come with a reasonably fast algorithm that seems to

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-10 Thread Paolo Tosco
Dear Quoc-Tuan, I think I have come with a reasonably fast algorithm that seems to be more robust: https://gist.github.com/ptosco/dc4d27153e6e8e45aed654761e4d7409 Cheers, p. On 06/05/2020 09:11, Quoc-Tuan DO wrote: Dear Paolo, Thank you again for your code. Sorry for bothering you again.

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-06 Thread Quoc-Tuan DO
Dear Paolo, Thank you again for your code. Sorry for bothering you again. It works all fine for monoterpenes but not for diterpenes, sesquiterpenes nor triterpenes. pattern: C~C~C(~C)~C mol1: CC(=O)O[C@H]1CC[C@]2([C@H](C1(C)C)CC=C([C@@H]2CC/C(=C/C(=O)O)/C)C)C => ((17, 18, 19, 20, 23), (16,

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-05 Thread Jean-Marc Nuzillard
Dear Paolo, this answers my question as well, but in an unexpected way. Best, Jean-Marc Le 05/05/2020 à 14:52, Paolo Tosco a écrit : Dear Quoc-Tuan, this should do what you need: https://gist.github.com/ptosco/dc4d27153e6e8e45aed654761e4d7409 Cheers, p. On 05/05/2020 11:52, Quoc-Tuan

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-05 Thread Paolo Tosco
Dear Quoc-Tuan, this should do what you need: https://gist.github.com/ptosco/dc4d27153e6e8e45aed654761e4d7409 Cheers, p. On 05/05/2020 11:52, Quoc-Tuan DO wrote: Dear Paolo, Thank you for your reply. I understand now... I did not use uniquify option first then only uniquify=True. I

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-05 Thread Quoc-Tuan DO
Dear Paolo, Thank you for your reply. I understand now... I did not use uniquify option first then only uniquify=True. I thought the default would be uniquify=False. Actually my problem is to find 2 distinct units of isoprene (pattern) in the borneol (smiles) as

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-04 Thread Jean-Marc Nuzillard
Dear Quoc-Tuan, GetSubstructMatches() tries to find isoprene at all positions where this is possible. You may want to test your SMARTS and its matching with structures at this great place: https://smartsview.zbh.uni-hamburg.de/ Maybe you would prefer to known whether borneol follows the

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-04 Thread Paolo Tosco
Dear Quoc-Tuan, On 04/05/2020 09:10, Greenpharma S.A.S. wrote: Dear All, Please could you help with the following problem (I could not find answers in discussion list) ? pattern='C~C~C(~C)~C' smiles='O[C@H]1C[C@H]2C([C@@]1(C)CC2)(C)C' pat = Chem.MolFromSmiles(pattern) mol =

[Rdkit-discuss] GetSubstructMatches and unique match

2020-05-04 Thread Greenpharma S.A.S.
Dear All, Please could you help with the following problem (I could not find answers in discussion list) ? pattern='C~C~C(~C)~C' smiles='O[C@H]1C[C@H]2C([C@@]1(C)CC2)(C)C' pat = Chem.MolFromSmiles(pattern) mol = Chem.MolFromSmiles(smiles) res = mol.GetSubstructMatches(pat, uniquify=True)

Re: [Rdkit-discuss] GetSubstructMatches() as smiles

2019-08-07 Thread Andrew Dalke
On Aug 7, 2019, at 13:08, Paolo Tosco wrote: > You can use > > Chem.MolFragmentToSmiles(mol, match) > > where match is a tuple of atom indices returned by GetSubstructMatch(). Note however that if only the atom indices are given then Chem.MolFragmentToSmiles() will include all bonds which

Re: [Rdkit-discuss] GetSubstructMatches() as smiles

2019-08-07 Thread Paolo Tosco
Hi Mel, You can use Chem.MolFragmentToSmiles(mol, match) where match is a tuple of atom indices returned by GetSubstructMatch(). Cheers, p. > On 7 Aug 2019, at 11:36, Melissa Adasme wrote: > > Dear rdkitters, > > I'm trying to find substructures (query molecules built from SMARTS) matching

[Rdkit-discuss] GetSubstructMatches() as smiles

2019-08-07 Thread Melissa Adasme
Dear rdkitters, I'm trying to find substructures (query molecules built from SMARTS) matching my molecules (SMILES). I found the GetSubstructMatches() method which works pretty well returning the indices of matching atoms in my molecule. I wonder if there is a way to directly obtain the SMILES

Re: [Rdkit-discuss] GetSubstructMatches

2016-12-14 Thread Greg Landrum
Hi Jean-Marc, The answer is in the error message, once you know how to read it, which isn't really trivial: On Wed, Dec 14, 2016 at 5:35 PM, Jean-Marc Nuzillard < jm.nuzill...@univ-reims.fr> wrote: > > Traceback (most recent call last): >File "glmap.py", line 11, in > matches =

Re: [Rdkit-discuss] GetSubstructMatches

2016-12-14 Thread Jean-Marc Nuzillard
Sure, it works! Thanks, Greg. Jean-Marc Le 14/12/2016 à 17:43, Greg Landrum a écrit : Hi Jean-Marc, The answer is in the error message, once you know how to read it, which isn't really trivial: On Wed, Dec 14, 2016 at 5:35 PM, Jean-Marc Nuzillard

[Rdkit-discuss] GetSubstructMatches

2016-12-14 Thread Jean-Marc Nuzillard
Hi all, I have encountered the following problem : Traceback (most recent call last): File "glmap.py", line 11, in matches = mol.GetSubstructMatches(skel) Boost.Python.ArgumentError: Python argument types in Mol.GetSubstructMatches(Mol, str) did not match C++ signature:

Re: [Rdkit-discuss] GetSubstructMatches() and resonance structures

2014-10-31 Thread Paolo Tosco
: [Rdkit-discuss] GetSubstructMatches() and resonance structures Dear all, The following code snippet compares two resonance structures of formate anion: import rdkit from rdkit import Chem mol1=Chem.MolFromSmiles('C([O-])=O') mol2=Chem.MolFromSmiles('C(=O)[O-]') mol1

[Rdkit-discuss] GetSubstructMatches() and resonance structures

2014-10-30 Thread Paolo Tosco
Dear all, The following code snippet compares two resonance structures of formate anion: import rdkit from rdkit import Chem mol1=Chem.MolFromSmiles('C([O-])=O') mol2=Chem.MolFromSmiles('C(=O)[O-]') mol1.GetSubstructMatches(mol2, uniquify = False) ((0, 2, 1),) mol1.GetSubstructMatches(mol1,

Re: [Rdkit-discuss] GetSubstructMatches()

2013-08-23 Thread S.L. Chan
Subject: Re: [Rdkit-discuss] GetSubstructMatches() Dear Ling, On Thu, Aug 22, 2013 at 11:49 PM, S.L. Chan slch...@yahoo.com wrote: Good afternoon folks, I would imagine that if you remove the hydrogens, the resulting molecule would be a substructure of the original molecule. However, when I

[Rdkit-discuss] GetSubstructMatches()

2013-08-22 Thread S.L. Chan
Good afternoon folks, I would imagine that if you remove the hydrogens, the resulting molecule would be a substructure of the original molecule. However, when I do the following to the attached MDL mol file, there is no matches. from rdkit import Chem mol = Chem.MolFromMolFile('temp.mol',

Re: [Rdkit-discuss] GetSubstructMatches()

2013-08-22 Thread Greg Landrum
Dear Ling, On Thu, Aug 22, 2013 at 11:49 PM, S.L. Chan slch...@yahoo.com wrote: Good afternoon folks, I would imagine that if you remove the hydrogens, the resulting molecule would be a substructure of the original molecule. However, when I do the following to the attached MDL mol file,