def test_08_removeHydrogens(self): mol2file = os.path.join(self.dataDir, 'benzamidine.mol2') sm = SmallMol(mol2file) sm_c = sm.copy() b = Builder(sm_c) b.removeHydrogens() sm_b = b.getSmallMol() sm_b_element = sm_b.element.tolist() self.assertListEqual(sm_b_element, BENZAMIDINE_ELEMENTS_NOHS) sm_c = sm.copy() b = Builder(sm_c) b.removeHydrogens(removeNonPolars=False) sm_b = b.getSmallMol() sm_b_element = sm_b.element.tolist() self.assertListEqual(sm_b_element, BENZAMIDINE_ELEMENTS_NO_POLARHS) sm_c = sm.copy() b = Builder(sm_c) b.removeHydrogens(removePolars=False) sm_b = b.getSmallMol() sm_b_element = sm_b.element.tolist() self.assertListEqual(sm_b_element, BENZAMIDINE_ELEMENTS_NO_NONPOLARHS)
def test_06_getSmallMol(self): sm = SmallMol(ETANOLAMMINE_SMILE, removeHs=True, fixHs=False) sm_c = sm.copy() b = Builder(sm_c) sm_b = b.getSmallMol() self.assertIsInstance(sm_b, SmallMol, msg="The molecule was not loaded correctly")
def test_07_addHydrogens(self): sm = SmallMol(ETANOLAMMINE_SMILE, removeHs=True, fixHs=False) sm_c = sm.copy() b = Builder(sm_c) b.addHydrogens() sm_b = b.getSmallMol() sm_b_elements = sm_b.element.tolist() self.assertListEqual(sm_b_elements, ETANOLAMMINE_ELEMENTS_ALL) sm_c = sm.copy() b = Builder(sm_c) b.addHydrogens(onlyExplicit=True) sm_b = b.getSmallMol() sm_b_elements = sm_b.element.tolist() self.assertListEqual(sm_b_elements, ETANOLAMMINE_ELEMENTS_POLARHS)
def test_05_Builder_load(self): sm = SmallMol(ETANOLAMMINE_SMILE, removeHs=True, fixHs=False) sm_c = sm.copy() b = Builder() b.loadMol(sm_c) sm_b = b.getSmallMol() expectedFalse = np.array_equal(sm_b.coords, sm.coords) self.assertIsInstance(b, Builder, msg="The molecule was not creted in the Builder") self.assertFalse(expectedFalse, msg="A initial conformation was not created")