def test_rescore_collection_for_trees(default_config, setup_linear_reaction_tree): rt = setup_linear_reaction_tree() routes = RouteCollection(reaction_trees=[rt]) routes.compute_scores(StateScorer(default_config)) routes.rescore(NumberOfReactionsScorer()) assert routes.scores[0] == 2 assert np.round(routes.all_scores[0]["state score"], 3) == 0.994 assert routes.all_scores[0]["number of reactions"] == 2
def test_rescore_collection_for_trees(default_config, mock_stock, load_reaction_tree): mock_stock(default_config, "N#Cc1cccc(N)c1F", "O=C(Cl)c1ccc(F)cc1", "CN1CCC(Cl)CC1", "O") rt = ReactionTree.from_dict(load_reaction_tree("sample_reaction.json")) routes = RouteCollection(reaction_trees=[rt]) routes.compute_scores(StateScorer(default_config)) routes.rescore(NumberOfReactionsScorer()) assert routes.scores[0] == 2 assert np.round(routes.all_scores[0]["state score"], 3) == 0.994 assert routes.all_scores[0]["number of reactions"] == 2