Re: [Rdkit-discuss] tautomers in rdkit

2017-04-17 Thread JW Feng
Hi Maria,

>From looking at Roger's slides on https://github.com/rdkit/UGM_2
016/blob/master/Presentations/Sayle_RDKitTautomers.pdf.  Is he making an
argument that InChi values are insufficient in generating a canonical
string for different tautomers?  What if you perform a set of
standardization transformation prior to generating InChi values?  You may
want to look at how Genentech normalizes molecules for compound
registration. The code is based on OEChem and is open sourced on Github
https://github.com/chemalot/chemalot.  This package is actively being
developed and I am a contributor.  Specifically, you'll want to look at the
extensive standardization transformations in https://github.com/chemalot/ch
emalot/blob/master/src/com/genentech/struchk/oeStruchk/Struchk.xml

The last step in Struchk.xml is creating a canonical tautomer using
OpenEye's QuacPac toolkit.  QuacPac returns a canonical tautomer.  Could
one replace this step by converting a standardized molecule to InChi and
the back?  Another approach is using Dave Cosgrove's TautEnum package (
https://github.com/OpenEye-Contrib/TautEnum).  Both QuacPac and TautEnum
enumerates tautomers.  I believe that Roger is intimately familiar with
QuacPac

Best,

JW

___
JW Feng, Ph.D.
Denali Therapeutics Inc.
151 Oyster Point Blvd, 2nd Floor, South San Francisco, CA 94080 | (650)
270-0628

On Tue, Apr 11, 2017 at 6:52 AM,  wrote:

> Send Rdkit-discuss mailing list submissions to
> rdkit-discuss@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
> or, via email, send a message with subject or body 'help' to
> rdkit-discuss-requ...@lists.sourceforge.net
>
> You can reach the person managing the list at
> rdkit-discuss-ow...@lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Rdkit-discuss digest..."
>
>
> Today's Topics:
>
>1. tautomers in rdkit (MARIA BRANDL)
>2. Re: tautomers in rdkit (Peter S. Shenkin)
>3. official Tripos MOL2 file format PDF document (Francois BERENGER)
>
>
> --
>
> Message: 1
> Date: Tue, 11 Apr 2017 06:43:39 + (UTC)
> From: MARIA BRANDL 
> Subject: [Rdkit-discuss] tautomers in rdkit
> To: "rdkit-discuss@lists.sourceforge.net"
> 
> Message-ID: <1522420730.263132.1491893019...@mail.yahoo.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear all,
>
> Is there going to be an attempt at coding Roger Sayle's ?"Alternative
> Approach" to tautomers described inRDKit: Six Not-So-Easy Pieces [RDKit UGM
> 2016]?into RDKit ?
>
>
> I have managed to get reasonable tautomers out of Resonance.cpp using:
> suppl = 
> rdchem.ResonanceMolSupplier(m,rdchem.ResonanceFlags.ALLOW_CHARGE_SEPARATION
> | \? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
> rdchem.ResonanceFlags.ALLOW_INCOMPLETE_OCTETS
> | \? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
> rdchem.ResonanceFlags.UNCONSTRAINED_CATIONS
> | \? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rdchem.ResonanceFlags.UNCONSTR
> AINED_ANIONS)
> ?with some post-filtering for e.g. carbocations, but feel that it may be
> more efficient to put user defined constraints on each atom during the
> backtracking loops, as Roger suggests.
> Looking forward to hearing your thoughts on this.
> Best regards,
> Maria Brandl
> -- next part --
> An HTML attachment was scrubbed...
>
> --
>
> Message: 2
> Date: Tue, 11 Apr 2017 03:47:47 -0400
> From: "Peter S. Shenkin" 
> Subject: Re: [Rdkit-discuss] tautomers in rdkit
> To: MARIA BRANDL 
> Cc: "rdkit-discuss@lists.sourceforge.net"
> 
> Message-ID:
>  ail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Just from the slides, it's not clear that Roger had a solution; the slides
> seem to just suggest an approach. Am I missing something here?
>
> That is, he defined the invariants that all tautomers of a compound have to
> share and expressed it as a SMARTS + constraints; but I didn't see that he
> provided a methodology to derive a canonical matching SMILES from a SMARTS
> + constraints. True, if two structures match the SMARTS + constraints, they
> are likely tautomers. (I can't think of why they wouldn't be, but maybe
> it's not always the case.) So that part provides deduplication of an input
> stream, which is good, but no way to derive and store a canonical
> representation.
>
> Again, perhaps I'm missing something, but if so, what?
>
> -P.
>
> On Tue, Apr 11, 2017 at 2:43 AM, MARIA BRANDL 
> wrote:
>
> > Dear all,
> >
> >
> > Is there going to be an 

Re: [Rdkit-discuss] Filtering Out Highly Strained Ring Systems

2017-04-17 Thread Greg Landrum
Hi James,

There's not currently any way to get the contributions to the overall
energy from a force field.
Here's one approach to approximate what you're trying to do:

from rdkit import Chem
from rdkit.Chem import AllChem

def fragmentAndGetEnergies(mol,sma='[r]-[!r;!#1]'):
  pattern = Chem.MolFromSmarts(sma)
  m.GetSubstructMatches(pattern)
  bonds = [m.GetBondBetweenAtoms(x[0],x[1]).GetIdx() for x in matches]
  splitmol = AllChem.FragmentOnBonds(m,bonds)
  frags = Chem.GetMolFrags(splitmol,asMols=True)
  res = []
  for frag in frags:
   ff = AllChem.UFFGetMoleculeForceField(frag)
   res.append((Chem.MolToSmiles(frag,True),ff.CalcEnergy()))
  return res

m = Chem.AddHs(Chem.MolFromSmiles('c1cccn1CCC1=CC1'))
AllChem.EmbedMolecule(m,AllChem.ETKDG())
vs = fragmentAndGetEnergies(m)
for smi,energy in vs:
print(smi,energy)


The function splits molecules into pieces by breaking single bonds between
rings and non-ring atoms and then calculates the energies of those pieces.
This generates warnings from the UFF code since it doesn't have parameters
for the dummy atoms that FragmentOnBonds() inserts. I think this is
probably ok, but you may want to investigate changing those dummies to
hydrogens (and adjusting the corresponding bond lengths).

Best,
-greg



On Sat, Apr 15, 2017 at 5:11 PM, James Johnson 
wrote:

> Dear All,
>
> I'm generating analogs from a parent compound. An unfortunate side effect
> is the generation of various highly strained rings among other compounds.
> I'm developing filters to deal with any unwanted generated compounds, but
> I'm having difficulty with strained ring systems.
>
> Attached are some examples in mol2 format: https://ufile.io/bdmcp
>
> For this problem I'm thinking of using an energy/bond approach:
> ff = AllChem.UFFGetMoleculeForceField(mol)
> energy_per_bond = ff.CalcEnergy()/len(mol.GetBonds())
>
> If energy/bond is above a certain value it gets filtered out. Do you think
> this is the best solution? Is there a way of viewing each bonds energy
> (with increasing amount of bonds an unstable bond might not be filtered)?
> Do you have any suggestions on alternate ways of doing this?
>
> Thank you for the help, it is very much appreciated! :)
>
> - James
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss