Skip to content

Commit 49f4af9

Browse files
author
Löffler, Hannes
committed
sync with latest AZ version
1 parent b88b2ba commit 49f4af9

142 files changed

Lines changed: 2038 additions & 1361 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,122 @@ This follows the guideline on [keep a changelog](https://keepachangelog.com/)
1010
- CAZP scoring component
1111

1212

13+
## [4.2.5] 2024-03-20
14+
15+
### Added
16+
17+
- Log network parameters
18+
19+
20+
## [4.2.4] 2024-03-20
21+
22+
### Changed
23+
24+
- Reworked TL code: clean-up, image layout, graph for Reinvent
25+
26+
### Added
27+
28+
- Added options and better statistics for TL: valid SMILES, duplicates
29+
- Disableable standardization
30+
31+
### Removed
32+
33+
- KL divergence in TB output
34+
35+
### Fixed
36+
37+
- Batch size calculation
38+
39+
40+
## [4.2.3] 2024-03-14
41+
42+
### Fixed
43+
44+
- Vocabulary for mol2mol and reinvent is saved as dictionary
45+
46+
47+
## [4.2.2] 2024-03-13
48+
49+
### Fixed
50+
51+
- Sigmoid functions in scoring have now a stable implementation
52+
53+
54+
## [4.2.1] 2024-03-12
55+
56+
### Removed
57+
58+
- Long chain (SMARTS for 5 aliphatic carbons) check
59+
60+
61+
## [4.2.0] 2024-03-08
62+
63+
### Added
64+
65+
- Unified transformer code to faciliate new model designs
66+
67+
68+
## [4.1.16] 2024-03-07
69+
70+
### Fixed
71+
72+
- filters now apply to transformed scores
73+
74+
75+
## [4.1.15] 2024-03-07
76+
77+
### Fixed
78+
79+
- Minor change inception filter: cleaner way of handling internal SMILES store
80+
81+
82+
## [4.1.14] 2024-03-06
83+
84+
### Added
85+
86+
- Updated script for creating an empty classical Reinvent model
87+
88+
### Fixed
89+
90+
- Memory bug in TL related to similarity calculation: made this optional
91+
92+
93+
## [4.1.13] 2024-03-05
94+
95+
### Added
96+
97+
- Allowed runs with only filter/penalty components
98+
99+
100+
## [4.1.12] 2024-03-05
101+
102+
### Added
103+
104+
- Better logging for Reinvent standardizer
105+
106+
107+
## [4.1.11] 2024-02-27
108+
109+
### Fixed
110+
111+
- Inception filters out SMILES containing tokens that are not compatible with the prior
112+
113+
114+
## [4.1.10] 2024-02-26
115+
116+
### Fixed
117+
118+
- Numerically stable double sigmoid implementation
119+
- Number of CPUs for TL (Mol2Mol) is now 1
120+
121+
122+
## [4.1.9] 2024-02-22
123+
124+
### Fixed
125+
126+
- Save models with no metadata
127+
128+
13129
## [4.1.8] 2024-02-20
14130

15131
### Fixed

NEWS.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
New in REINVENT 4.2
2+
===================
3+
4+
For details see CHANGELOG.md.
5+
6+
* Reworked TL code with added options and statistics
7+
* Standardization can be switched off in TL (useful in new prior creation)
8+
* Similarity calculation in TL made optional
9+
* Updated script for empty classical Reinvent model creation
10+
* Allow runs with only filter/penalty components
11+
* Stable sigmoid functions
12+
* Removed long chain check in SMILES processing
13+
* Unified transformer code
14+
* Filter apply to transformed scores
15+
* Better memory handling in inception
16+
* Better logging for Reinvent standardizer
17+
* Inception filters for tokens not compatible with the prior
18+
* Number of CPUs for TL (Mol2Mol pair generation) is 1 by default
19+
* Tensorboard histogram bug fixed again
20+
* Code improvements and fixes
21+
22+
123
New in REINVENT 4.1
224
===================
325

4-
For details, see CHANGELOG.md.
26+
For details see CHANGELOG.md.
527

628
* Scoring component MolVolume
729
* Scoring component for all 210 RDKit descriptors

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ property profile defined as a multi-component score. Transfer Learning (TL)
1313
can be used to create or pre-train a model that generates molecules closer
1414
to a set of input molecules.
1515

16-
A preprint with more details is available on ChemRxiv:
17-
[REINVENT4: Modern AI-Driven Generative Molecule Design](https://chemrxiv.org/engage/chemrxiv/article-details/65463cafc573f893f1cae33a).
16+
A paper describing the software has been published as Open Access in the
17+
Journal of Cheminformatics:
18+
[Reinvent 4: Modern AI–driven generative molecule design](https://link.springer.com/article/10.1186/s13321-024-00812-5?utm_source=rct_congratemailt&utm_medium=email&utm_campaign=oa_20240221&utm_content=10.1186/s13321-024-00812-5).
1819
See AUTHORS.md for references to previous papers.
1920

2021

configs/toml/PARAMS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Run transfer learning on a set of input SMILES.
5959
| num\_epochs | number of epochs to run |
6060
| save\_every\_n\_epochs | save checkpoint file every N epochs |
6161
| batch\_size | batch size, note: affects SGD |
62-
| num\_refs | number of references for similarity |
63-
| sample\_batch\_size | number of samples for similarity |
62+
| sample\_batch\_size | batch size to calculate the sample loss and other statistics |
63+
| num\_refs | number of references for similarity if > 0, DO NOT use with large dataset (> 200 molecules) |
6464
| input\_model\_file | filename of input prior model |
6565
| smiles\_file | SMILES file for Lib/Linkinvent and Molformer |
6666
| output_model\_file | filename of the final model |

configs/toml/transfer_learning.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ num_epochs = 3 # number of steps to run
1616
save_every_n_epochs = 3 # save checkpoint model file very N steps
1717
batch_size = 50
1818
num_refs = 100 # number of reference molecules randomly chosen for similarity
19-
sample_batch_size = 100 # number of sampled molecules chosen for similarity
19+
# set this to zero for large datasets (>200 molecules)!
20+
sample_batch_size = 100 # number of sampled molecules to compute sample loss
2021
# Uncomment one of the comment blocks below. Each generator needs a model
2122
# file and possibly a SMILES file with seed structures.
2223

@@ -44,12 +45,12 @@ pairs.max_cardinality = 199
4445
### the molecule to be optimizable
4546
## LibInvent
4647
#input_model_file = "priors/libinvent.prior"
47-
#smiles_file = "TL_libinvent_100.smi" # read first 2 columns: warheads, linker
48-
#validation_smiles_file = "TL_libinvent_100.smi" # read first 2 columns: warheads, linker
48+
#smiles_file = "TL_libinvent_100.smi" # read first 2 columns: scaffold, R-groups
49+
#validation_smiles_file = "TL_libinvent_100.smi" # read first 2 columns: scaffold, R-groups
4950
#output_model_file = "TL_libinvent.model"
5051
#
5152
## LinkInvent
5253
#input_model_file = "priors/linkinvent.prior"
53-
#smiles_file = "TL_linkinvent_100.smi" # read first 2 columns: scaffold, R-groups
54+
#smiles_file = "TL_linkinvent_100.smi" # read first 2 columns: warheads, linker
5455
#output_model_file = "TL_linkinvent.model"
55-
#validation_smiles_file = "TL_linkinvent_100.smi" # read first 2 columns: scaffold, R-groups
56+
#validation_smiles_file = "TL_linkinvent_100.smi" # read first 2 columns: warheads, linker

reinvent/__init__.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1-
from .logger import *
1+
"""REINVENT4
2+
3+
Namespace setup and backward compatibility
4+
"""
5+
6+
import sys
7+
8+
from .logger import *
9+
from reinvent import models
10+
from reinvent.models.libinvent.models import vocabulary # not sure why needed
11+
12+
13+
# support compatibility with older model files
14+
PATH_MAP = (
15+
# R3
16+
("reinvent_models.reinvent_core", models.reinvent),
17+
("reinvent_models.reinvent_core.models", models.reinvent.models),
18+
("reinvent_models.reinvent_core.models.vocabulary", models.reinvent.models.vocabulary),
19+
("reinvent_models.lib_invent", models.libinvent),
20+
("reinvent_models.lib_invent.models", models.libinvent.models),
21+
("reinvent_models.lib_invent.models.vocabulary", models.libinvent.models.vocabulary),
22+
("reinvent_models.link_invent", models.linkinvent),
23+
("reinvent_models.link_invent.model_vocabulary", models.linkinvent.model_vocabulary),
24+
(
25+
"reinvent_models.link_invent.model_vocabulary.vocabulary",
26+
models.linkinvent.model_vocabulary.vocabulary,
27+
),
28+
(
29+
"reinvent_models.link_invent.model_vocabulary.model_vocabulary",
30+
models.linkinvent.model_vocabulary.model_vocabulary,
31+
),
32+
(
33+
"reinvent_models.link_invent.model_vocabulary.paired_model_vocabulary",
34+
models.linkinvent.model_vocabulary.paired_model_vocabulary,
35+
),
36+
)
37+
38+
for module, path in PATH_MAP:
39+
if path is None:
40+
sys.modules[module] = sys.modules[__name__]
41+
else:
42+
sys.modules[module] = path

reinvent/chemistry/enums/filter_types_enum.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ class FilterTypesEnum:
55
REMOVE_HYDROGENS = "remove_hydrogens"
66
REMOVE_SALTS = "remove_salts"
77
GENERAL_CLEANUP = "general_cleanup"
8-
TOKEN_FILTERS = "token_filters"
8+
UNWANTED_PATTERNS = "unwanted_patterns"
99
VOCABULARY_FILTER = "vocabulary_filter"
1010
VALID_SIZE = "valid_size"
1111
HEAVY_ATOM_FILTER = "heavy_atom_filter"
12-
ALLOWED_ATOM_TYPE = "allowed_atom_type"
13-
ALIPHATIC_CHAIN_FILTER = "aliphatic_chain_filter"
14-
12+
ALLOWED_ELEMENTS = "allowed_elements"
1513

1614
# try to find the internal value and return
1715
def __getattr__(self, name):
1816
if name in self:
1917
return name
18+
2019
raise AttributeError
2120

2221
# prohibit any attempt to set any values

0 commit comments

Comments
 (0)