def test_template_occurence_scorer_tree_one_node(): rt = ReactionTree() rt.root = Molecule(smiles="CCCCOc1ccc(CC(=O)N(C)O)cc1") rt.graph.add_node(rt.root) scorer = AverageTemplateOccurenceScorer() assert scorer(rt) == 0.0
def to_dict(self) -> StrDict: """ Returns the graph as a dictionary in a pre-defined format. :return: the combined reaction trees """ rtree = ReactionTree() rtree.root = self.root rtree.graph = self.graph return rtree.to_dict()
def test_scorers_tree_one_node_route(default_config): tree = ReactionTree() tree.root = UniqueMolecule(smiles="CCCCOc1ccc(CC(=O)N(C)O)cc1") tree.graph.add_node(tree.root) assert pytest.approx(StateScorer(default_config)(tree), abs=1e-3) == 0.0497 assert NumberOfReactionsScorer(default_config)(tree) == 0 assert NumberOfPrecursorsScorer(default_config)(tree) == 1 assert NumberOfPrecursorsInStockScorer(default_config)(tree) == 0 assert PriceSumScorer(default_config)(tree) == 10 assert RouteCostScorer(default_config)(tree) == 10