brsynth / RetroPathRL

Reinforcement Learning based bioretrosynthesis tool
MIT License
47 stars 17 forks source link

python calculate_rule_sets_similarity.py #14

Closed muchlia closed 1 year ago

muchlia commented 1 year ago

Hello,

I am not sure what to do at this step: python calculate_rule_sets_similarity.py --rule_address_with_H your_rule_address --rule_address_without_H your_rule_address

Error code: By default, logs are saved in /Users/armk/Documents/Firmenich/retropathrl/RetroPathRL/data/rules/logs_rules_set_up.log. Please use --terminal to redirect to sys.stderr Traceback (most recent call last): File "calculate_rule_sets_similarity.py", line 632, in run(rule_address_with_H = args.rule_address_with_H, rule_address_without_H = args.rule_address_without_H, rm_stereo = not args.stereo) File "calculate_rule_sets_similarity.py", line 153, in run with open(rule_address_with_H, "r") as csv_file: FileNotFoundError: [Errno 2] No such file or directory: 'your_rule_address'

tduigou commented 1 year ago

Hello @muchlia,

The your_rule_address should be replaced by the path to the file containing the rules to be parsed. Such files are available for download at https://retrorules.org/dl.

muchlia commented 1 year ago

Yes that fixed in thank you. Just had to point it to the .tsv file. Now when I run pytest -v I get this:

image
tduigou commented 1 year ago

Hi @muchlia, it looks like rp3_dcache has not been set up. Did you follow this part: https://github.com/brsynth/RetroPathRL/tree/stable#db-cache ?

muchlia commented 1 year ago

Yes it should be setup correctly. I tried a test run with the example code and menthol for an easy test but it found zero results. That seems a bit odd since there are enzymes known to make this. I will play around with it thank you.

tduigou commented 1 year ago

The cache system of RetroPathRL then necessitate to install and set up a MongoDB. The installation instructions are provided in the README of the rp3_dcache repository (https://github.com/brsynth/rp3_dcache). Did you also follow this?

Alternatively, the cache system could be deactivated, so that it will not rely on this database.

muchlia commented 1 year ago

How would I deactivate it?Thank you!On Apr 4, 2023, at 2:52 AM, Thomas Duigou @.***> wrote: The cache system of RetroPathRL then necessitate to install and set up a MongoDB. The installation instructions are provided in the README of the rp3_dcache repository (https://github.com/brsynth/rp3_dcache). Did you also follow this? Alternatively, the cache system could be deactivated, so that it will not rely on this database.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>

tduigou commented 1 year ago

The dcache can be desactivated using the change_config.py script:

python change_config.py --use_cache False
muchlia commented 1 year ago

OK I set as false and selected a molecule to test (menthol and amboxide). Each gave zero results. Not sure if it just cant find anything or it is not working properly. It seems the test ran fine.

python Tree.py --log_file tree.log --itermax 1000 --expansion_width 10 --time_budget 7200 --max_depth 7 --UCT_policy Biochemical_UCT_1 --UCTK 20 --bias_k 0 --k_rave 0 --Rollout_policy Rollout_policy_random_uniform_on_biochemical_multiplication_score --max_rollout 3 --chemical_scoring SubandprodChemicalScorer --virtual_visits 0 --progressive_bias_strategy 0 --diameter 10 12 14 16 --c_name ambrox --c_inchi "InChI=1S/C16H28O/c1-14(2)8-5-9-15(3)12(14)6-10-16(4)13(15)7-11-17-16/h12-13H,5-11H2,1-4H3/t12-,13+,15-,16+/m0/s1" --folder_to_save ambrox --biological_score_cut_off 0.1 --substrate_only_score_cut_off 0.7 --chemical_score_cut_off 0.7 --minimal_visit_counts 1

0_results pickles ambrox_best.json results.csv ambrox_full_scope.json tree.log ambrox_full_tree_for_MCTS.json

tduigou commented 1 year ago

Hello @muchlia,

I would suggest to try with the example provided in the README.md to check whether the code is working properly:

python Tree.py \
    --log_file tree.log \
    --itermax 1000 \
    --expansion_width 10 \
    --time_budget 7200 \
    --max_depth 7 \
    --UCT_policy Biochemical_UCT_1 \
    --UCTK 20 \
    --bias_k 0 \
    --k_rave 0 \
    --Rollout_policy Rollout_policy_random_uniform_on_biochemical_multiplication_score \
    --max_rollout 3 \
    --chemical_scoring SubandprodChemicalScorer \
    --virtual_visits 0 \
    --progressive_bias_strategy 0 \
    --diameter 10 12 14 16 \
    --c_name deoxiviolacein \
    --c_inchi "InChI=1S/C20H13N3O2/c24-19-13(18-12-6-2-4-8-16(12)22-20(18)25)9-17(23-19)14-10-21-15-7-3-1-5-11(14)15/h1-10,21H,(H,22,25)(H,23,24)/b18-13+" \
    --folder_to_save deoxi_07_no_H\
    --biological_score_cut_off 0.1 \
    --substrate_only_score_cut_off 0.7 \
    --chemical_score_cut_off 0.7 \
    --minimal_visit_counts 1
muchlia commented 1 year ago
Screen Shot 2023-04-13 at 12 13 13 PM

Here is what I see in the deoxi_07_no_H folder

tduigou commented 1 year ago

That's not a the exected results. I would advise to double check the rule dataset used. What are the logs (tree.log file)?

jozhang97 commented 10 months ago

I ran into this problem as well. I found my laptop's multiprocessing Pool was timing out.

For me, the fix was simple:

Screenshot 2023-11-04 at 12 20 38 PM
tduigou commented 10 months ago

Hi @jozhang97, I see, we got previous issues with multiprocessing.Pool, thanks.