Re: [Rdkit-discuss] Chem.SmilesMolSupplier
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Greg L. <gre...@gm...> - 2016-06-09 09:17:01
|
Hi Bill, On Thu, Jun 9, 2016 at 11:00 AM, Shirley, Bill <bil...@no...> wrote: > > > -------- Original Message -------- > From: "Shirley, Bill" <bil...@no...> > Date: Thu, Jun 9, 2016, 01:57 > To: rdk...@so... > Subject: Chem.SmilesMolSupplier > > Given the differences in SMARTS and SMILES pattern matching and the > MolFromSmarts function which seems the way to convert from a string, when > reading SMARTS strings with the SmilesMolSupplier function will the ROMol > object always be the same (as a MolFromSmarts object converted from a > string) and HasSubstructMatch always produce the same boolean (as would the > MolFromSmarts converted string)? > Nope. A SmilesMolSupplier expects that the input is SMILES, not SMARTS. Though a valid SMILES is always a valid SMARTS and a valid SMARTS is often a valid SMILES, the meanings are not always the same. Section 4.7 on the Daylight Theory Manual page for SMARTS ( http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html) is well worth reading. The RDKit doesn't currently have a Supplier that deals with SMARTS. > > This is a "same and not the same" question since HasSubstructMatch seems > to be a function for SMILES and SMILES more than SMILES and SMARTS. > hmm, I'm not quite sure what you mean here. You can use molecules constructed from SMILES or SMARTS (or CTAB) as queries: In [4]: m = Chem.MolFromSmiles('c1cccnc1CCC') In [5]: m.HasSubstructMatch(Chem.MolFromSmiles('CCC')) Out[5]: True In [6]: m.HasSubstructMatch(Chem.MolFromSmarts('cCC')) Out[6]: True Best, -greg |