def test_calculate_desc_feat_multiple(self): self.defineConfig() tempFilePath=curDir+"/output/tmp/ecfp_feat_multiple.npy" with open(self.referenceFilePath,"r") as h: smiles=[line.strip() for line in h.readlines()] ecfps=chem_utils.run_fingerprint(smiles,1) desc=chem_utils.make_desc_dict(ecfps) #np.save("unit_test/output/test_calculate_desc.npy",desc) #write reference fingperprints np.save(tempFilePath,desc) #write reference fingperprints result=filecmp.cmp("unit_test/output/test_calculate_desc.npy",tempFilePath, shallow=False) self.assertEqual(result, True)
def test_calculate_desc_val_single(self): self.defineConfig() tempFilePath=curDir+"/output/tmp/ecfp_val.npy" ecfp=chem_utils.run_fingerprint(["Cc1ccc(S(=O)(=O)Nc2ccc(-c3nc4cc(NS(=O)(=O)c5ccc(C)cc5)ccc4[nH]3)cc2)cc1"],1) ecfp_feat, ecfp_val=chem_utils.make_desc_dict(ecfp) #np.save("unit_test/output/test_calculate_desc_val.npy",ecfp_val) #write reference fingperprints np.save(tempFilePath,ecfp_val) #write reference fingperprints result=filecmp.cmp("unit_test/output/test_calculate_desc_val.npy",tempFilePath, shallow=False) self.assertEqual(result, True)
def test_scramble_desc_multiple_key(self): """test if scrambling is depending on the input key""" self.defineConfigNewSecret() tempFilePathFeat=curDir+"/output/tmp/ecfp_feat_scrambled.npy" tempFilePathVal=curDir+"/output/tmp/ecfp_val_scrambled.npy" with open(self.referenceFilePath,"r") as h: smiles=[line.strip() for line in h.readlines()] ecfps=chem_utils.run_fingerprint(smiles,1) ecfp_feat, ecfp_val = chem_utils.make_desc_dict(ecfps) ecfp_feat_scrambled,ecfp_val_scrambled=chem_utils.make_fp_lists(ecfp_feat,ecfp_val) np.save(tempFilePathFeat,ecfp_feat_scrambled) np.save(tempFilePathVal,ecfp_val_scrambled) resultFeat=filecmp.cmp("unit_test/output/test_calculate_desc_feat_scr.npy",tempFilePathFeat, shallow=False) resultVal=filecmp.cmp("unit_test/output/test_calculate_desc_val_scr.npy",tempFilePathVal, shallow=False) self.assertEqual(resultFeat & resultVal, False)
def test_scramble_desc_multiple(self): """test if scrambling input fp's is working compared to a reference""" self.defineConfig() tempFilePathFeat=curDir+"/output/tmp/ecfp_feat_scrambled.npy" tempFilePathVal=curDir+"/output/tmp/ecfp_val_scrambled.npy" with open(self.referenceFilePath,"r") as h: smiles=[line.strip() for line in h.readlines()] ecfps=chem_utils.run_fingerprint(smiles,1) ecfp_feat, ecfp_val = chem_utils.make_desc_dict(ecfps) ecfp_feat_scrambled,ecfp_val_scrambled=chem_utils.make_fp_lists(ecfp_feat,ecfp_val) #np.save("unit_test/output/test_calculate_desc_feat_scr.npy",ecfp_feat_scrambled) #write reference fingperprints #np.save("unit_test/output/test_calculate_desc_val_scr.npy",ecfp_val_scrambled) #write reference fingperprints np.save(tempFilePathFeat,ecfp_feat_scrambled) np.save(tempFilePathVal,ecfp_val_scrambled) resultFeat=filecmp.cmp("unit_test/output/test_calculate_desc_feat_scr.npy",tempFilePathFeat, shallow=False) resultVal=filecmp.cmp("unit_test/output/test_calculate_desc_val_scr.npy",tempFilePathVal, shallow=False) self.assertEqual(resultFeat & resultVal, True)