def test_GetResults_from_InChI_Key_fraction(self): csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]" chassis_2_smile = "[H][O][C](=[O])[C](=[O])[C]([H])([H])[C]([H])([O][H])[C]([H])([O][H])[C]([H])([H])[H]" outside_compound = Compound(csmile) chassis_2 = Compound(chassis_2_smile) state_chassis = ChemicalCompoundState([chassis_2, outside_compound], organism=Test_organism_H) assert state_chassis.GetResults_from_InChI_Keys( rewarding=Basic_Rollout_Reward) == 1 / 2
def test_GetResultsForBiosensors_absent(self): chassis_1_smile = "[H+]" chassis_1 = Compound(chassis_1_smile) benzoate_chassis = ChemicalCompoundState([chassis_1], organism=detectable_cmpds_H) retrosynthesis = benzoate_chassis.GetResults_from_InChI_Keys( rewarding=Basic_Rollout_Reward) biosensor = benzoate_chassis.GetResultsForBiosensors( rewarding=Basic_Rollout_Reward) assert retrosynthesis == -1 and biosensor == -1
def test_GetResults_from_InChI_Key_reward(self): chassis_1_smile = "[H+]" chassis_2_smile = "[H][O][C](=[O])[C](=[O])[C]([H])([H])[C]([H])([O][H])[C]([H])([O][H])[C]([H])([H])[H]" chassis_1 = Compound(chassis_1_smile) chassis_2 = Compound(chassis_2_smile) state_chassis = ChemicalCompoundState([chassis_1, chassis_2], organism=Test_organism_H) assert state_chassis.GetResults_from_InChI_Keys( rewarding=Basic_Rollout_Reward ) == Basic_Rollout_Reward.full_state_reward
def test_GetResultsForBiosensors_present(self): chassis_1_smile = "[H+]" chassis_1 = Compound(chassis_1_smile) benzoate = Compound( InChI="InChI=1S/C7H6O2/c8-7(9)6-4-2-1-3-5-6/h1-5H,(H,8,9)/p-1") benzoate_chassis = ChemicalCompoundState([benzoate, chassis_1], organism=detectable_cmpds_H) retrosynthesis = benzoate_chassis.GetResults_from_InChI_Keys( rewarding=Basic_Rollout_Reward) biosensor = benzoate_chassis.GetResultsForBiosensors( rewarding=Basic_Rollout_Reward) assert retrosynthesis == 0.5 and biosensor == 2
def test_GetResults_from_InChI_Key_penalty(self): csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]" compound = Compound(csmile) state = ChemicalCompoundState([compound], organism=Test_organism_H) assert state.GetResults_from_InChI_Keys( rewarding=Basic_Rollout_Reward) == -1