diff --git a/Code/GraphMol/Descriptors/Lipinski.cpp b/Code/GraphMol/Descriptors/Lipinski.cpp index f28672514..fc8d48dee 100644 --- a/Code/GraphMol/Descriptors/Lipinski.cpp +++ b/Code/GraphMol/Descriptors/Lipinski.cpp @@ -104,7 +104,7 @@ const NumRotatableBondsOptions DefaultStrictDefinition = NonStrict; #endif } // namespace -const std::string NumRotatableBondsVersion = "3.1.0"; +const std::string NumRotatableBondsVersion = "3.2.0"; unsigned int calcNumRotatableBonds(const ROMol &mol, NumRotatableBondsOptions strict) { if (strict == Default) { @@ -118,10 +118,10 @@ unsigned int calcNumRotatableBonds(const ROMol &mol, } else if (strict == Strict) { std::string strict_pattern = "[!$(*#*)&!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]=" + "[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])]"; + "CH3])[CH3])&!$([CH3])]"; pattern_flyweight m(strict_pattern); return m.get().countMatches(mol); } else { diff --git a/Code/GraphMol/Descriptors/catch_tests.cpp b/Code/GraphMol/Descriptors/catch_tests.cpp index 1fb04697f..ba6a7fecd 100644 --- a/Code/GraphMol/Descriptors/catch_tests.cpp +++ b/Code/GraphMol/Descriptors/catch_tests.cpp @@ -195,6 +195,8 @@ TEST_CASE( "molecule") { SECTION("basics") { auto m1 = "c1ccccc1c1ccc(CCC)cc1"_smiles; + auto m2 = "CCCC"_smiles; + MolOps::addHs(*m2); CHECK(Descriptors::calcNumRotatableBonds( *m1, Descriptors::NumRotatableBondsOptions::NonStrict) == 3); CHECK(Descriptors::calcNumRotatableBonds( @@ -208,6 +210,8 @@ TEST_CASE( *m1, Descriptors::NumRotatableBondsOptions::Strict) == 3); CHECK(Descriptors::calcNumRotatableBonds( *m1, Descriptors::NumRotatableBondsOptions::StrictLinkages) == 2); + CHECK(Descriptors::calcNumRotatableBonds( + *m2, Descriptors::NumRotatableBondsOptions::Strict) == 1); } SECTION("as reported") { SmilesParserParams ps; @@ -731,4 +735,4 @@ TEST_CASE("Github #7264: GETAWAY descriptors are non-deterministic") { } } } -#endif \ No newline at end of file +#endif diff --git a/rdkit/Chem/UnitTestDescriptors.py b/rdkit/Chem/UnitTestDescriptors.py index e16e8afab..c1e18b357 100644 --- a/rdkit/Chem/UnitTestDescriptors.py +++ b/rdkit/Chem/UnitTestDescriptors.py @@ -81,13 +81,8 @@ class TestCase(unittest.TestCase): self.assertEqual(actual, expected) def testMQNDetails(self): + # assuming the strict definition of rotatable bonds (default) refFile = os.path.join(os.path.dirname(__file__), 'test_data', 'MQNs_regress.pkl') - refFile2 = os.path.join(os.path.dirname(__file__), 'test_data', 'MQNs_non_strict_regress.pkl') - # figure out which definition we are currently using - m = Chem.MolFromSmiles("CC(C)(C)c1cc(O)c(cc1O)C(C)(C)C") - if Lipinski.NumRotatableBonds(m) == 2: - refFile = refFile2 - with open(refFile, 'rb') as intf: refData = pickle.load(intf) fn = os.path.join(os.path.dirname(__file__), 'test_data', 'aromat_regress.txt') @@ -104,17 +99,10 @@ class TestCase(unittest.TestCase): self.assertEqual(mqns, refData[i][1]) def testMQN(self): - m = Chem.MolFromSmiles("CC(C)(C)c1cc(O)c(cc1O)C(C)(C)C") - if Lipinski.NumRotatableBonds(m) == 2: - tgt = [ - 42917, 274, 870, 621, 135, 1582, 29, 3147, 5463, 6999, 470, 62588, 19055, 4424, 309, 24061, - 17820, 1, 9303, 24146, 16076, 5560, 4262, 646, 746, 13725, 5430, 2629, 362, 24211, 15939, - 292, 41, 20, 1852, 5642, 31, 9, 1, 2, 3060, 1750 - ] - else: - tgt = [ + # assuming the strict definition of rotatable bonds (default) + tgt = [ 42917, 274, 870, 621, 135, 1582, 29, 3147, 5463, 6999, 470, 62588, 19055, 4424, 309, 24059, - 17822, 1, 8314, 24146, 16076, 5560, 4262, 646, 746, 13725, 5430, 2629, 362, 24211, 15939, + 17822, 1, 8313, 24146, 16076, 5560, 4262, 646, 746, 13725, 5430, 2629, 362, 24211, 15939, 292, 41, 20, 1852, 5642, 31, 9, 1, 2, 3060, 1750 ] fn = os.path.join(os.path.dirname(__file__), 'test_data', 'aromat_regress.txt') diff --git a/rdkit/Chem/test_data/MQNs_regress.pkl b/rdkit/Chem/test_data/MQNs_regress.pkl index c2060b187..4bd693b2c 100644 Binary files a/rdkit/Chem/test_data/MQNs_regress.pkl and b/rdkit/Chem/test_data/MQNs_regress.pkl differ