binghong-ml / retro_star

Retro*: Learning Retrosynthetic Planning with Neural Guided A* Search
MIT License
134 stars 32 forks source link

How to visualize the obtained results (predicted synthetic routes) #21

Open MachineGUN001 opened 1 year ago

MachineGUN001 commented 1 year ago

hi, thank you to provide such a good method to predict the synthetic routes.

after running the codes provide in git,

from retro_star.api import RSPlanner

planner = RSPlanner(
    gpu=-1,
    use_value_fn=True,
    iterations=100,
    expansion_topk=50
)

result = planner.plan('CCCC[C@@H](C(=O)N1CCC[C@H]1C(=O)O)[C@@H](F)C(=O)OC')

thus we can got a dict, result, with the contents ({'succ': True, 'time': 40.51955580711365, 'iter': 42, 'routes': 'CC(C)c1ccc(-n2nc(O)c3c(=O)c4ccc(Cl)cc4[nH]c3c2=O)cc1>0.9978> CC(C)c1ccc(NN2C(=O)c3[nH]c4cc(Cl)ccc4c(=O)c3C2=O)cc1|CC(C)c1ccc(NN2C(=O)c3[nH]c4cc(Cl)ccc4c(=O)c3C2=O)cc1>0.5820>C=C(C)c1ccc(NN2C(=O)c3[nH]c4cc(Cl)ccc4c(=O)c3C2=O)cc1|C=C(C)c1ccc(NN2C(=O)c3[nH]c4cc(Cl)ccc4c(=O)c3C2=O)cc1>0.0841>O=C1c2[nH]c3cc(Cl)ccc3c(=O)c2C(=O)N1Nc1ccc(Br)cc1.C=C(C)B1OC(C)(C)C(C)(C)O1|O=C1c2[nH]c3cc(Cl)ccc3c(=O)c2C(=O)N1Nc1ccc(Br)cc1>0.4156>O=C1OC(=O)c2c1[nH]c1cc(Cl)ccc1c2=O.NNc1ccc(Br)cc1|O=C1OC(=O)c2c1[nH]c1cc(Cl)ccc1c2=O>0.1934>O=C(O)c1[nH]c2cc(Cl)ccc2c(=O)c1C(=O)O|O=C(O)c1[nH]c2cc(Cl)ccc2c(=O)c1C(=O)O>0.0010>O=C(O)c1cc(=O)c2ccc(Cl)cc2[nH]1.O=C=O', 'route_cost': 12.44783463616222, 'route_len': 6})

but How to visualize the obtained result? I have very little knowledge of coding, so I'm not quite sure how to use the moltree approach. Can you provide an illustration of how to do the visualization of the predicted routes?

many thanks,

Shengyang