Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@YamLyubov
Copy link
Collaborator

@YamLyubov YamLyubov commented Apr 17, 2023

Implementation of an example for goal directed molecule generation based on EvoMol https://jcheminf.biomedcentral.com/counter/pdf/10.1186/s13321-020-00458-z.pdf

Structure:

  • mol_graph.py
    Class MolGraph representing molecular graph (not based on OptGraph and needs adapter)
  • mol_adapter.py
    Adapter between MolGraph and OptGraph. MolAdapter firstly transformes MolGraph into networkx graph. Edges params are stored in node params. Then BaseNetworkxAdapter is used.
  • mol_mutations.py
    Custom mutations for MolGraphs. Primary mutations (simple): add_atom, delete_atom, replace_atom, replace_bond, delete_bond. Secondary mutations (more complex): cut_atom, insert_carbon, remove_group, move_group
  • mol_advisor.py
    Class to define possible actions for mutations. Not all atoms/bonds can be removed/added/replaced and to avoid faulty mutations we allow only actions that will lead to feasible structures.
  • mol_graph_parameters.py
    Extension of Graphrequirements
  • mol_metrics.py
    Custom metrics for molecule search
  • experiment.py
    Experiment setup for molecule generations by optimising a specified metric
  • guacamol_benchmark.py
    Class for evaluating Golem on GuacaMol benchmark https://pubs.acs.org/doi/10.1021/acs.jcim.8b00839

Results for GOLEM with bandit (results for 10 launches):
image

Some molecules found by Golem
Osimertinib MPO_results

Corresponding OptGraphs visualization:
final_merged

Ranolazine MPO_results

Amlodipine MPO_results

Issues found while implementation:

  • GOLEM accumulate a lot of identical individuals, so to get required number of unique individuals I had to collect them from the entire optimisation history

@YamLyubov YamLyubov added the examples Update of cases or examples label Apr 17, 2023
@aim-pep8-bot
Copy link
Collaborator

aim-pep8-bot commented Apr 17, 2023

Hello @YamLyubov! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 19:1: E402 module level import not at top of file

Line 1:1: F401 'copy.deepcopy' imported but unused

Comment last updated at 2023-06-08 13:43:13 UTC

@codecov-commenter
Copy link

codecov-commenter commented Apr 17, 2023

Codecov Report

Merging #83 (a154bf6) into main (e231edf) will decrease coverage by 0.02%.
The diff coverage is 89.47%.

@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
- Coverage   74.62%   74.60%   -0.02%     
==========================================
  Files         123      123              
  Lines        6923     6920       -3     
==========================================
- Hits         5166     5163       -3     
  Misses       1757     1757              
Impacted Files Coverage Δ
...ore/optimisers/genetic/operators/base_mutations.py 89.01% <ø> (ø)
...ore/optimisers/genetic/operators/regularization.py 56.81% <0.00%> (ø)
golem/core/optimisers/genetic/gp_optimizer.py 96.59% <80.00%> (ø)
golem/core/adapter/nx_adapter.py 97.72% <100.00%> (ø)
golem/core/dag/linked_graph_node.py 97.61% <100.00%> (-0.06%) ⬇️
golem/core/optimisers/advisor.py 88.88% <100.00%> (ø)
golem/core/optimisers/initial_graphs_generator.py 95.65% <100.00%> (-0.19%) ⬇️
golem/core/optimisers/populational_optimizer.py 89.41% <100.00%> (ø)

@gkirgizov
Copy link
Collaborator

GOLEM accumulate a lot of identical individuals, so to get required number of unique individuals I had to collect them from the entire optimisation history

Linked to #89

@gkirgizov
Copy link
Collaborator

gkirgizov commented May 10, 2023

Первые мысли насчет экспериментов:

  • после фикса Fix lack of diversity in population (same individuals) #89 (в процессе) нужно будет запустить эксперименты еще раз
  • на нескольких экспериментах построить графики изменения вероятностей мутаций (функция plot_action_values, пример построения графика в examples/adaptive_optimizer/experiment_setup.py)
  • сравнить получающиеся вероятности мутаций с baseline из EvoMol (они приводят свои вероятности мутаций, кажется, я видел)
  • плюс запустить GOLEM без бандита: (а) с равновероятными мутациями (б) со статичными вероятностями, равными таковым у EvoMol, добавить эти результаты в табличку

Пример графика:
ucb1_edges100_iter150_2min_actions

@gkirgizov
Copy link
Collaborator

...to get required number of unique individuals I had to collect them from the entire optimisation history

Я правильно понимаю, что на каком-то шаге нутри оптимизации приходится пробегать по истории оптимизации?

@gkirgizov gkirgizov mentioned this pull request May 10, 2023
8 tasks
@YamLyubov YamLyubov requested a review from gkirgizov May 12, 2023 13:57
@gkirgizov
Copy link
Collaborator

Кстати, а почему на Големовских графах в узлах не названия молекул, а номера?

@gkirgizov
Copy link
Collaborator

Ах да, и добавь, пожалуйста, интеграционный тест на этот пример.

@YamLyubov
Copy link
Collaborator Author

YamLyubov commented Jun 8, 2023

Ах да, и добавь, пожалуйста, интеграционный тест на этот пример.

Добавила тут

И еще сделала так, чтобы в графах голема названиями нод были символы элементов

@YamLyubov YamLyubov requested a review from gkirgizov June 8, 2023 14:31
@YamLyubov YamLyubov merged commit 3cc87ea into main Jun 9, 2023
@YamLyubov YamLyubov deleted the molecule-search branch June 9, 2023 10:07
YamLyubov added a commit that referenced this pull request Jun 14, 2023
* Add molecular graph, adapter and some metrics

* Fix imports

* Add CL score

* Add draft add_atom mutation

* Add draft delete_atom, replace_bond mutation

* Add draft delete_bond, replace_atom mutation

* Add experiment draft

* Fix adapter

* Fix experiment, add metrics description

* Small mutations fix

* Minor changes

* Add cut_atom mutation

* Refactor MolAdvisor

* Add insert_carbon

* Add remove_group

* Add move_group

* Move utils to separate file

* PEP 8 and docstrings

* Add zinc normalized logp

* Minor

* Fix extending initial population

* Add guacomol benchmark

* Refactror guacamol experiment

* Add statistics and visualization for guacamol

* pep

* Add mutations list

* Add CLScorer

* Add download from github

* Review fixes

* Add integration test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples Update of cases or examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants