diff --git a/Code/GraphMol/Descriptors/Lipinski.cpp b/Code/GraphMol/Descriptors/Lipinski.cpp index fa8f42522..996b00e43 100644 --- a/Code/GraphMol/Descriptors/Lipinski.cpp +++ b/Code/GraphMol/Descriptors/Lipinski.cpp @@ -89,6 +89,7 @@ namespace RDKit{ } SMARTSCOUNTFUNC(NumRotatableBonds, "[!$(*#*)&!D1]-&!@[!$(*#*)&!D1]", "1.0.1" ) ; + SMARTSCOUNTFUNC(NumStrictRotatableBonds, "[!$(*#*)&!D1&!$(C(F)(F)F)&!$(C(Cl)(Cl)Cl)&!$(C(Br)(Br)Br)&!$(C([CH3])([CH3])[CH3])&!$([CD3](=[N,O,S])-!@[#7,O,S!D1])&!$([#7,O,S!D1]-!@[CD3]=[N,O,S])&!$([CD3](=[N+])-!@[#7!D1])&!$([#7!D1]-!@[CD3]=[N+])]-!@[!$(*#*)&!D1&!$(C(F)(F)F)&!$(C(Cl)(Cl)Cl)&!$(C(Br)(Br)Br)&!$(C([CH3])([CH3])[CH3])]", "1.0.0" ) ; //SMARTSCOUNTFUNC(NumHBD, "[$([N;!H0;v3]),$([N;!H0;+1;v4]),$([O,S;H1;+0]),$([n;H1;+0])]","2.0.1" ) ; SMARTSCOUNTFUNC(NumHBD, "[N&!H0&v3,N&!H0&+1&v4,O&H1&+0,S&H1&+0,n&H1&+0]","2.0.1" ) ; SMARTSCOUNTFUNC(NumHBA, "[$([O,S;H1;v2]-[!$(*=[O,N,P,S])]),$([O,S;H0;v2]),$([O,S;-]),$([N;v3;!$(N-*=!@[O,N,P,S])]),$([nH0,o,s;+0])]","2.0.1") ; diff --git a/Code/GraphMol/Descriptors/Lipinski.h b/Code/GraphMol/Descriptors/Lipinski.h index 97f1d005c..c52b46605 100644 --- a/Code/GraphMol/Descriptors/Lipinski.h +++ b/Code/GraphMol/Descriptors/Lipinski.h @@ -31,6 +31,10 @@ namespace RDKit{ //! calculates the number of rotatable bonds unsigned int calcNumRotatableBonds(const ROMol &mol); + extern const std::string NumStrictRotatableBondsVersion; + //! calculates the number of rotatable bonds more strictly, excluding amides, esters etc + unsigned int calcNumStrictRotatableBonds(const ROMol &mol); + extern const std::string NumHBDVersion; //! calculates the number of H-bond donors unsigned int calcNumHBD(const ROMol &mol); diff --git a/Code/GraphMol/Descriptors/Wrap/rdMolDescriptors.cpp b/Code/GraphMol/Descriptors/Wrap/rdMolDescriptors.cpp index 2b12747d5..165a4fe68 100644 --- a/Code/GraphMol/Descriptors/Wrap/rdMolDescriptors.cpp +++ b/Code/GraphMol/Descriptors/Wrap/rdMolDescriptors.cpp @@ -770,6 +770,12 @@ BOOST_PYTHON_MODULE(rdMolDescriptors) { (python::arg("mol")), docString.c_str()); python::scope().attr("_CalcNumRotatableBonds_version")=RDKit::Descriptors::NumRotatableBondsVersion; + docString="returns a strict count of the number of rotatable bonds for a molecule"; + python::def("CalcNumStrictRotatableBonds", + RDKit::Descriptors::calcNumStrictRotatableBonds, + (python::arg("mol")), + docString.c_str()); + python::scope().attr("_CalcNumStrictRotatableBonds_version")=RDKit::Descriptors::NumStrictRotatableBondsVersion; docString="returns the number of rings for a molecule"; python::def("CalcNumRings", RDKit::Descriptors::calcNumRings, diff --git a/Code/JavaWrappers/Lipinski.java b/Code/JavaWrappers/Lipinski.java index 0d40b20b6..2af4ffe94 100644 --- a/Code/JavaWrappers/Lipinski.java +++ b/Code/JavaWrappers/Lipinski.java @@ -52,6 +52,7 @@ public class Lipinski { // from the graph). So the bond in [2H]C([2H])([2H])C([2H])([2H])[2H] *is* considered // rotatable. static ROMol RotatableBondSmarts = RWMol.MolFromSmarts("[!$(*#*)&!D1]-&!@[!$(*#*)&!D1]"); + static ROMol StrictRotatableBondSmarts = RWMol.MolFromSmarts("[!$(*#*)&!D1&!$(C(F)(F)F)&!$(C(Cl)(Cl)Cl)&!$(C(Br)(Br)Br)&!$(C([CH3])([CH3])[CH3])&!$([CD3](=[N,O,S])-!@[#7,O,S!D1])&!$([#7,O,S!D1]-!@[CD3]=[N,O,S])&!$([CD3](=[N+])-!@[#7!D1])&!$([#7!D1]-!@[CD3]=[N+])]-!@[!$(*#*)&!D1&!$(C(F)(F)F)&!$(C(Cl)(Cl)Cl)&!$(C(Br)(Br)Br)&!$(C([CH3])([CH3])[CH3])]"); static ROMol NHOHSmarts = RWMol.MolFromSmarts("[#8H1,#7H1,#7H2,#7H3]"); static ROMol NOCountSmarts = RWMol.MolFromSmarts("[#7,#8]"); @@ -71,6 +72,9 @@ public class Lipinski { public static int getRotatableBondCount(ROMol mol) { return getMatchCount(mol, RotatableBondSmarts); } + public static int getStrictRotatableBondCount(ROMol mol) { + return getMatchCount(mol, StrictRotatableBondSmarts); + } public static int getNHOHCount(ROMol mol) { return getMatchCount(mol, NHOHSmarts); } diff --git a/Code/PgSQL/rdkit/adapter.cpp b/Code/PgSQL/rdkit/adapter.cpp index a75bb394e..c08b62ae6 100644 --- a/Code/PgSQL/rdkit/adapter.cpp +++ b/Code/PgSQL/rdkit/adapter.cpp @@ -435,6 +435,7 @@ MOLDESCR(NumAliphaticCarbocycles,RDKit::Descriptors::calcNumAliphaticCarbocycles MOLDESCR(NumSaturatedCarbocycles,RDKit::Descriptors::calcNumSaturatedCarbocycles,int) MOLDESCR(NumRotatableBonds,RDKit::Descriptors::calcNumRotatableBonds,int) +MOLDESCR(NumStrictRotatableBonds,RDKit::Descriptors::calcNumStrictRotatableBonds,int) MOLDESCR(Chi0v,RDKit::Descriptors::calcChi0v,double) MOLDESCR(Chi1v,RDKit::Descriptors::calcChi1v,double) MOLDESCR(Chi2v,RDKit::Descriptors::calcChi2v,double) diff --git a/Code/PgSQL/rdkit/mol_op.c b/Code/PgSQL/rdkit/mol_op.c index f2e02baa0..7e39ec139 100644 --- a/Code/PgSQL/rdkit/mol_op.c +++ b/Code/PgSQL/rdkit/mol_op.c @@ -190,6 +190,7 @@ MOLDESCR(hbd,MolHBD,INT32) MOLDESCR(numatoms,MolNumAtoms,INT32) MOLDESCR(numheavyatoms,MolNumHeavyAtoms,INT32) MOLDESCR(numrotatablebonds,MolNumRotatableBonds,INT32) +MOLDESCR(numstrictrotatablebonds,MolNumStrictRotatableBonds,INT32) MOLDESCR(numheteroatoms,MolNumHeteroatoms,INT32) MOLDESCR(numrings,MolNumRings,INT32) MOLDESCR(numaromaticrings,MolNumAromaticRings,INT32) diff --git a/Code/PgSQL/rdkit/rdkit.h b/Code/PgSQL/rdkit/rdkit.h index b783a90f8..794479164 100644 --- a/Code/PgSQL/rdkit/rdkit.h +++ b/Code/PgSQL/rdkit/rdkit.h @@ -117,6 +117,7 @@ extern "C" { int MolNumAtoms(CROMol i); int MolNumHeavyAtoms(CROMol i); int MolNumRotatableBonds(CROMol i); + int MolNumStrictRotatableBonds(CROMol i); int MolNumHeteroatoms(CROMol i); int MolNumRings(CROMol i); int MolNumAromaticRings(CROMol i); diff --git a/Code/PgSQL/rdkit/rdkit.sql.in b/Code/PgSQL/rdkit/rdkit.sql.in index ef9a419b3..c093a2c2f 100644 --- a/Code/PgSQL/rdkit/rdkit.sql.in +++ b/Code/PgSQL/rdkit/rdkit.sql.in @@ -300,6 +300,11 @@ RETURNS integer AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; +CREATE OR REPLACE FUNCTION mol_numstrictrotatablebonds(mol) +RETURNS integer +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE; + CREATE OR REPLACE FUNCTION mol_numatoms(mol) RETURNS integer AS 'MODULE_PATHNAME' diff --git a/Code/PgSQL/rdkit/rdkit.sql91.in b/Code/PgSQL/rdkit/rdkit.sql91.in index e0ec04d0f..98effd0c3 100644 --- a/Code/PgSQL/rdkit/rdkit.sql91.in +++ b/Code/PgSQL/rdkit/rdkit.sql91.in @@ -371,6 +371,11 @@ RETURNS integer AS 'MODULE_PATHNAME' LANGUAGE C STRICT IMMUTABLE; +CREATE OR REPLACE FUNCTION mol_numstrictrotatablebonds(mol) +RETURNS integer +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE; + CREATE OR REPLACE FUNCTION mol_numatoms(mol) RETURNS integer AS 'MODULE_PATHNAME' diff --git a/rdkit/Chem/Lipinski.py b/rdkit/Chem/Lipinski.py index 0f5b36cd2..474e471ed 100755 --- a/rdkit/Chem/Lipinski.py +++ b/rdkit/Chem/Lipinski.py @@ -45,6 +45,11 @@ HeteroatomSmarts = Chem.MolFromSmarts('[!#6;!#1]') # from the graph). So the bond in [2H]C([2H])([2H])C([2H])([2H])[2H] *is* considered # rotatable. RotatableBondSmarts = Chem.MolFromSmarts('[!$(*#*)&!D1]-&!@[!$(*#*)&!D1]') +# Under Strict rules a bond is rotatable iff it is a single non-ring bond where neither atom +# is terminal or in a terminal group or where a conjugated system involving amides, esters, +# sulfonamides etc appear. A terminal group is defined as and of the following: C(F)(F)F, +# C(Cl)(Cl)Cl, C(Br)(Br)Br or C([CH3])([CH3])[CH3] +StrictRotatableBondSmarts = Chem.MolFromSmarts('[!$(*#*)&!D1&!$(C(F)(F)F)&!$(C(Cl)(Cl)Cl)&!$(C(Br)(Br)Br)&!$(C([CH3])([CH3])[CH3])&!$([CD3](=[N,O,S])-!@[#7,O,S!D1])&!$([#7,O,S!D1]-!@[CD3]=[N,O,S])&!$([CD3](=[N+])-!@[#7!D1])&!$([#7!D1]-!@[CD3]=[N+])]-!@[!$(*#*)&!D1&!$(C(F)(F)F)&!$(C(Cl)(Cl)Cl)&!$(C(Br)(Br)Br)&!$(C([CH3])([CH3])[CH3])]') NHOHSmarts = Chem.MolFromSmarts('[#8H1,#7H1,#7H2,#7H3]') NOCountSmarts = Chem.MolFromSmarts('[#7,#8]') @@ -68,6 +73,10 @@ NumRotatableBonds = lambda x:rdMolDescriptors.CalcNumRotatableBonds(x) NumRotatableBonds.__doc__="Number of Rotatable Bonds" NumRotatableBonds.version="1.0.0" _RotatableBonds = lambda x,y=RotatableBondSmarts:x.GetSubstructMatches(y,uniquify=1) +NumStrictRotatableBonds = lambda x:rdMolDescriptors.CalcNumStrictRotatableBonds(x) +NumStrictRotatableBonds.__doc__="Stricter count of the number of Rotatable Bonds" +NumStrictRotatableBonds.version="1.0.0" +_StrictRotatableBonds = lambda x,y=StrictRotatableBondSmarts:x.GetSubstructMatches(y,uniquify=1) NOCount = lambda x:rdMolDescriptors.CalcNumLipinskiHBA(x) NOCount.__doc__="Number of Nitrogens and Oxygens" NOCount.version="1.0.0"