- Fixed a few glitches which caused the build to fail on Windows

- added a few tests for ResonanceMolSupplier
This commit is contained in:
Paolo Tosco
2015-10-24 01:18:10 +01:00
parent 72de596280
commit 517de5b5d8
6 changed files with 40 additions and 13 deletions

View File

@@ -14,6 +14,6 @@ rdkit_headers(BoundsMatrix.h
TriangleSmooth.h DEST DistGeom)
rdkit_test(testDistGeom testDistGeom.cpp
LINK_LIBRARIES DistGeometry EigenSolvers ForceField Optimizer RDGeneral RDGeometryLib )
LINK_LIBRARIES DistGeometry EigenSolvers ForceField ForceFieldHelpers Optimizer RDGeneral RDGeometryLib )
add_subdirectory(Wrap)

View File

@@ -1,6 +1,6 @@
rdkit_python_extension(DistGeom DistGeom.cpp
DEST DistanceGeometry
LINK_LIBRARIES DistGeometry EigenSolvers ForceField Optimizer RDGeneral RDGeometryLib RDBoost )
LINK_LIBRARIES DistGeometry EigenSolvers ForceField ForceFieldHelpers Optimizer RDGeneral RDGeometryLib RDBoost )
add_pytest(pyDistGeom ${CMAKE_CURRENT_SOURCE_DIR}/rough_test.py)

View File

@@ -157,7 +157,7 @@ void testFilterCatalog() {
void testFilterCatalogEntry() {
SmartsMatcher *sm = new SmartsMatcher("Aromatic carbon chain");
boost::shared_ptr<FilterMatcherBase> matcher(sm);
TEST_ASSERT(not matcher->isValid());
TEST_ASSERT(!matcher->isValid());
const int debugParse = 0;
const bool mergeHs = true;
ROMOL_SPTR pattern(SmartsToMol("c:c:c:c:c", debugParse, mergeHs));

View File

@@ -493,7 +493,7 @@ namespace ForceFields {
Atom const *atom = (angle.dp_pattern.get())->getAtomWithIdx(i);
int num;
if (atom->getPropIfPresent("molAtomMapNumber", num)) {
if(num>0 and num<5) {
if(num>0 && num<5) {
angle.idx[num-1] = i;
}
}

View File

@@ -3147,23 +3147,50 @@ CAS<~>
| Chem.UNCONSTRAINED_ANIONS, 10)
self.assertEqual(len(resMolSuppl), 10)
resMolSuppl = Chem.ResonanceMolSupplier(mol,
Chem.ALLOW_INCOMPLETE_OCTETS \
| Chem.UNCONSTRAINED_CATIONS \
| Chem.UNCONSTRAINED_ANIONS, 0);
self.assertEqual(len(resMolSuppl), 0)
crambinPdb = os.path.join(RDConfig.RDBaseDir,'Code','GraphMol','FileParsers',
'test_data','1CRN.pdb')
mol = Chem.MolFromPDBFile(crambinPdb)
resMolSuppl = Chem.ResonanceMolSupplier(mol)
self.assertEqual(len(resMolSuppl), 1)
resMolSuppl = Chem.ResonanceMolSupplier(mol, Chem.KEKULE_ALL)
self.assertEqual(len(resMolSuppl), 8)
def testSubstructMatchAcetate(self):
mol = Chem.MolFromSmiles('CC(=O)[O-]')
query = Chem.MolFromSmarts('C(=O)[O-]')
resMolSuppl = Chem.ResonanceMolSupplier(mol)
matches = mol.GetSubstructMatches(query,
False, False, False)
matches = mol.GetSubstructMatches(query)
self.assertEqual(len(matches), 1)
matches = resMolSuppl.GetSubstructMatches(query,
False, False, False)
self.assertEqual(matches, ((1, 2, 3),))
matches = mol.GetSubstructMatches(query, uniquify = True)
self.assertEqual(len(matches), 1)
self.assertEqual(matches, ((1, 2, 3),))
matches = mol.GetSubstructMatches(query, uniquify = False)
self.assertEqual(len(matches), 1)
self.assertEqual(matches, ((1, 2, 3),))
matches = resMolSuppl.GetSubstructMatches(query)
self.assertEqual(len(matches), 2)
self.assertEqual(matches, ((1, 2, 3), (1, 3, 2)))
matches = resMolSuppl.GetSubstructMatches(query, uniquify = True)
self.assertEqual(len(matches), 1)
self.assertEqual(matches, ((1, 2, 3),))
matches = resMolSuppl.GetSubstructMatches(query, uniquify = False)
self.assertEqual(len(matches), 2)
self.assertEqual(matches, ((1, 2, 3), (1, 3, 2)))
query = Chem.MolFromSmarts('C(~O)~O')
matches = mol.GetSubstructMatches(query, uniquify = False)
self.assertEqual(len(matches), 2)
self.assertEqual(matches, ((1, 2, 3), (1, 3, 2)))
matches = mol.GetSubstructMatches(query, uniquify = True)
self.assertEqual(len(matches), 1)
self.assertEqual(matches, ((1, 2, 3),))
matches = resMolSuppl.GetSubstructMatches(query, uniquify = False)
self.assertEqual(len(matches), 2)
self.assertEqual(matches, ((1, 2, 3), (1, 3, 2)))
matches = resMolSuppl.GetSubstructMatches(query, uniquify = True)
self.assertEqual(len(matches), 1)
self.assertEqual(matches, ((1, 2, 3),))
def testSubstructMatchDMAP(self):
mol = Chem.MolFromSmiles('C(C)Nc1cc[nH+]cc1')

Binary file not shown.