Exemple #1
0
 def test_ApplyMoves(self):
     csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]"
     csmile_2 = "[H][O][C]([H])([H])[C]([H])([O][H])[C]([H])([H])[H]"
     compound = Compound(csmile)
     compound_2 = Compound(csmile_2)
     known_result_state = ChemicalCompoundState([compound_2],
                                                organism=Test_organism_H)
     state_apply_move = ChemicalCompoundState([compound],
                                              organism=Test_organism_H)
     moves = state_apply_move.GetMoves(top_x=2)
     # move = moves[list(moves.keys())[0]]
     for move in moves:
         if move.rid == "MNXR94682_MNXM821":
             i = moves.index(move)
     move = moves[i]
     state_apply_move.ApplyMove(move)
     assert state_apply_move == known_result_state
 def test_proper_child_addition_821_rule_94682_moves_state(self):
     # random.seed(42)
     csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]"
     csmile_2 = "[H][O][C]([H])([H])[C]([H])([O][H])[C]([H])([H])[H]"
     compound = Compound(csmile, "821")
     compound_2 = Compound(csmile_2, "90191")
     known_result_state = ChemicalCompoundState([compound_2],
                                                organism=Test_organism_H)
     state_apply_move = ChemicalCompoundState(compound,
                                              organism=Test_organism_H)
     moves = state_apply_move.GetMoves(top_x=2)
     for move in moves:
         print(move.rid)
         if move.rid == "MNXR94682_MNXM821":
             i = moves.index(move)
     # print(moves)
     move_94682 = moves[i]
     state_apply_move.ApplyMove(move_94682)
     assert state_apply_move == known_result_state
 def test_proper_child_addition_821_rule_117465_moves(self):
     # random.seed(42)
     csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]"
     csmile_2 = "[H][O][C]([H])([H])[C]([H])([O][H])[C]([H])([H])[H]"
     compound = Compound(csmile, "821")
     compound_1 = Compound("[H+]", name="1")
     compound_6 = Compound(
         "[H][N]=[C]([O][H])[C]1=[C]([H])[N]([C]2([H])[O][C]([H])([C]([H])([H])[O][P](=[O])([O][H])[O][P](=[O])([O][H])[O][C]([H])([H])[C]3([H])[O][C]([H])([n]4[c]([H])[n][c]5[c]([N]([H])[H])[n][c]([H])[n][c]54)[C]([H])([O][P](=[O])([O][H])[O][H])[C]3([H])[O][H])[C]([H])([O][H])[C]2([H])[O][H])[C]([H])=[C]([H])[C]1([H])[H]",
         name='6')
     compound_2345 = Compound("[H][C](=[O])[C]([H])=[C]([H])[H]",
                              name="2345")
     known_result_state = ChemicalCompoundState(
         [compound_1, compound_6, compound_2345], organism=Test_organism_H)
     state_apply_move = ChemicalCompoundState(compound,
                                              organism=Test_organism_H)
     moves = state_apply_move.GetMoves(top_x=2)
     for move in moves:
         print(move.rid)
         if move.rid == "MNXR117465_MNXM821":
             i = moves.index(move)
     move_117465 = moves[i]
     state_apply_move.ApplyMove(move_117465)
     assert state_apply_move == known_result_state