1
2
3
4
5
6
7 """ Calculation of Lipinski parameters for molecules
8
9 """
10
11 from rdkit import Chem
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 HDonorSmarts = Chem.MolFromSmarts('[$([N;!H0;v3]),$([N;!H0;+1;v4]),$([O,S;H1;+0]),$([n;H1;+0])]')
30
31
32 HAcceptorSmarts = Chem.MolFromSmarts('[$([O,S;H1;v2]-[!$(*=[O,N,P,S])]),\
33 $([O,S;H0;v2]),$([O,S;-]),\
34 $([N;v3;!$(N-*=!@[O,N,P,S])]),\
35 $([nH0,o,s;+0])\
36 ]')
37 HeteroatomSmarts = Chem.MolFromSmarts('[!#6;!#1]')
38
39
40
41
42 RotatableBondSmarts = Chem.MolFromSmarts('[!$(*#*)&!D1]-&!@[!$(*#*)&!D1]')
43 NHOHSmarts = Chem.MolFromSmarts('[#8H1,#7H1,#7H2,#7H3]')
44 NOCountSmarts = Chem.MolFromSmarts('[#7,#8]')
45
46
49
50 NumHDonors = lambda x,y=HDonorSmarts:_NumMatches(x,y)
51 NumHDonors.__doc__="Number of Hydrogen Bond Donors"
52 NumHDonors.version="1.0.0"
53 _HDonors = lambda x,y=HDonorSmarts:x.GetSubstructMatches(y,uniquify=1)
54 NumHAcceptors = lambda x,y=HAcceptorSmarts:_NumMatches(x,y)
55 NumHAcceptors.__doc__="Number of Hydrogen Bond Acceptors"
56 NumHAcceptors.version="2.0.0"
57 _HAcceptors = lambda x,y=HAcceptorSmarts:x.GetSubstructMatches(y,uniquify=1)
58 NumHeteroatoms = lambda x,y=HeteroatomSmarts:_NumMatches(x,y)
59 NumHeteroatoms.__doc__="Number of Heteroatoms"
60 NumHeteroatoms.version="1.0.0"
61 _Heteroatoms = lambda x,y=HeteroatomSmarts:x.GetSubstructMatches(y,uniquify=1)
62 NumRotatableBonds = lambda x,y=RotatableBondSmarts:_NumMatches(x,y)
63 NumRotatableBonds.__doc__="Number of Rotatable Bonds"
64 NumRotatableBonds.version="1.0.0"
65 _RotatableBonds = lambda x,y=RotatableBondSmarts:x.GetSubstructMatches(y,uniquify=1)
66 NOCount = lambda x,y=NOCountSmarts:_NumMatches(x,y)
67 NOCount.__doc__="Number of Nitrogens and Oxygens"
68 NOCount.version="1.0.0"
69 NHOHCount = lambda x,y=NHOHSmarts:_NumMatches(x,y)
70 NHOHCount.__doc__="Number of NHs or OHs"
71 NHOHCount.version="1.0.0"
72
73
77 RingCount.version = "1.0.0"
78
80 " Number of heavy atoms a molecule."
81 return mol.GetNumAtoms(onlyHeavy=True)
82 HeavyAtomCount.version = "1.0.0"
83