feat: add synthesis pathway visualization utility#195
Conversation
| return root | ||
|
|
||
|
|
||
| def node_height(node: Node) -> int: |
There was a problem hiding this comment.
Please docstrings, unit tests, fix linting and type annotations
ARY2260
left a comment
There was a problem hiding this comment.
docstrings and lint needed
| return root | ||
|
|
||
|
|
||
| def node_height(node: Node) -> int: |
riya-singh28
left a comment
There was a problem hiding this comment.
@redrodeo03 I have left a few comments regarding doctests and suggested some changes in pytests.
| "product_metadata": {"chemical_formula": "C2H6O", "mass": 46.07}, | ||
| }) | ||
| assert formula == "C2H6O" | ||
| assert "46" in mass_str |
There was a problem hiding this comment.
@redrodeo03
assert "46" in mass_str is too loose a check. This may pass for incorrect values; consider asserting an exact value or using approximate float comparison.
| assert "46" in mass_str | ||
|
|
||
|
|
||
| def test_mol_metadata_falls_back_to_rdkit() -> None: |
There was a problem hiding this comment.
@redrodeo03 Can you add a docstring explaining the test here?
| assert img.mode == "RGB" | ||
|
|
||
|
|
||
| def test_visualize_pathway_smoke() -> None: |
There was a problem hiding this comment.
@redrodeo03, consider adding a test comparing the rendered image to a baseline image (preferably with tolerance to avoid brittle failures)
| @@ -0,0 +1,523 @@ | |||
| """Synthesis pathway visualization. | |||
|
|
|||
| Renders retrosynthesis output from :class:`~deepretro.algorithms.autosolve.AutoSolver` | |||
There was a problem hiding this comment.
Please shift these doctrings to rst docs.
| Node or None | ||
| Root node of the tree, or ``None`` if *result* has no steps. | ||
|
|
||
| Examples |
There was a problem hiding this comment.
@redrodeo03 Please run doctests locally; the current examples are missing required import statements
| is_target=True, | ||
| ) | ||
|
|
||
| def recurse(step_id: str) -> Node: |
There was a problem hiding this comment.
Please add docstrings
|
|
||
| Examples | ||
| -------- | ||
| >>> leaf = Node(label="Step 1", molecules=[{"smiles": "CCO"}]) |
There was a problem hiding this comment.
missing required import statements
|
|
||
| Examples | ||
| -------- | ||
| >>> root = Node(label="Step 0", molecules=[], is_target=True) |
There was a problem hiding this comment.
Missing import statements
|
|
||
| Examples | ||
| -------- | ||
| >>> img = render_mol("CCO", 200) # doctest: +SKIP |
There was a problem hiding this comment.
missing required import statements
Description
Fix #(issue)
This PR adds a function to generate images of pathways generated by DeepRetro
todo: add SVG
Checklist