Chem.Lipinski

Package Chem :: Module Lipinski |
[hide private]
[frames] | no frames]

# Source Code for Module Chem.Lipinski

     1  # $Id: Lipinski.py 270 2007-07-07 07:50:14Z glandrum $
     2  #
     3  # Copyright (C) 2001-2006 greg Landrum and Rational Discovery LLC
     4  #
     5  #   @@ All Rights Reserved  @@
     6  #
     7  """ Calculation of Lipinski parameters for molecules
     8
     9  """
    10  #from Chem import rdchem
    11  import Chem
    12
    13  #-----------------------------------
    14  # on import build the SMARTS patterns so we only have to do it once
    15  #-----------------------------------
    16
    17  # The Daylight SMARTS expressions for
    18  # recognizing H-bond donors and acceptors in the Lipinski scheme.
    19  # HDonor     '[!#6;!H0;-0]'
    20  # HAcceptor  '[$([!#6;+0]);!$([F,Cl,Br,I]);
    21  #             !$([o,s,nX3]);!$([Nv5,Pv5,Sv4,Sv6])]'
    22  # Heteroatom '[B,N,O,P,S,F,Cl,Br,I]'
    23
    24
    25  # 2 definitions from Gobbi Paper
    26  #  NOTE: if you want traditional Lipinski numbers, you
    27  #  should use NOCounts (below) instead of HAcceptor
    28  #
    29  HDonorSmarts = Chem.MolFromSmarts('[$([N;!H0;v3]),$([N;!H0;+1;v4]),$([O,S;H1;+0]),$([n;H1;+0])]')
    30  HAcceptorSmarts = Chem.MolFromSmarts('[$([O,S;H1;v2]-[!$(*=[O,N,P,S])]),$([O,S;H0;v2]),$([O,S;-]),$([N&v3;H1,H2]-[!$(*=[O,N,P,S])]),$([N;v3;H0]),$([n,o,s;+0]),F]')
    31  HeteroatomSmarts = Chem.MolFromSmarts('[!#6;!#1]')
    32  #  NOTE: the Rotatable bond smarts here doesn't treat deuteriums (which are left in the graph
    33  #  and therefore contribute to the degree of a carbon) the same as hydrogens (which are removed
    34  #  from the graph). So the bond in [2H]C([2H])([2H])C([2H])([2H])[2H] *is* considered
    35  #  rotatable.
    36  RotatableBondSmarts = Chem.MolFromSmarts('[!$(*#*)&!D1]-&!@[!$(*#*)&!D1]')
    37  NHOHSmarts = Chem.MolFromSmarts('[#8H1,#7H1,#7H2,#7H3]')
    38  NOCountSmarts = Chem.MolFromSmarts('[#7,#8]')
    39
    40  # this little trick saves duplicated code
    41 -def _NumMatches(mol,smarts):
    42    return len(mol.GetSubstructMatches(smarts,uniquify=1))
    43
    44  NumHDonors = lambda x,y=HDonorSmarts:_NumMatches(x,y)
    45  NumHDonors.__doc__="Number of Hydrogen Bond Donors"
    46  NumHDonors.version="1.0.0"
    47  _HDonors = lambda x,y=HDonorSmarts:x.GetSubstructMatches(y,uniquify=1)
    48  NumHAcceptors = lambda x,y=HAcceptorSmarts:_NumMatches(x,y)
    49  NumHAcceptors.__doc__="Number of Hydrogen Bond Acceptors"
    50  NumHAcceptors.version="1.0.0"
    51  _HAcceptors = lambda x,y=HAcceptorSmarts:x.GetSubstructMatches(y,uniquify=1)
    52  NumHeteroatoms = lambda x,y=HeteroatomSmarts:_NumMatches(x,y)
    53  NumHeteroatoms.__doc__="Number of Heteroatoms"
    54  NumHeteroatoms.version="1.0.0"
    55  _Heteroatoms = lambda x,y=HeteroatomSmarts:x.GetSubstructMatches(y,uniquify=1)
    56  NumRotatableBonds = lambda x,y=RotatableBondSmarts:_NumMatches(x,y)
    57  NumRotatableBonds.__doc__="Number of Rotatable Bonds"
    58  NumRotatableBonds.version="1.0.0"
    59  _RotatableBonds = lambda x,y=RotatableBondSmarts:x.GetSubstructMatches(y,uniquify=1)
    60  NOCount = lambda x,y=NOCountSmarts:_NumMatches(x,y)
    61  NOCount.__doc__="Number of Nitrogens and Oxygens"
    62  NOCount.version="1.0.0"
    63  NHOHCount = lambda x,y=NHOHSmarts:_NumMatches(x,y)
    64  NHOHCount.__doc__="Number of NHs or OHs"
    65  NHOHCount.version="1.0.0"
    66