Molecular Generation by Fast Assembly of SMILES Fragments
  • OCaml 49.6%
  • Shell 26.2%
  • Python 23.4%
  • Makefile 0.7%
Find a file
Francois C. M. Berenger 2f5f06024d updated opam file
2024-10-25 10:42:28 +01:00
bin I recommend using GA rather than TS 2024-09-24 17:32:51 +09:00
data new file: data/repr_Vs_FragW_chembl_100k.txt 2022-11-01 11:53:02 +09:00
src Fasmifra: raising Too_many_rings is just an error log now 2024-09-05 15:48:36 +09:00
dune-project new file: dune-project 2021-07-28 15:14:15 +09:00
fasmifra new file: fasmifra 2021-08-20 12:21:16 +09:00
fasmifra.opam updated opam file 2024-10-25 10:42:28 +01:00
install.sh install.sh: should also work on Mac OS 2023-05-16 09:45:00 +09:00
LICENSE new file: LICENSE 2021-07-28 15:15:57 +09:00
Makefile Makefile: dune build in release mode 2024-08-28 16:14:41 +09:00
README.md more biblio refs 2024-09-02 11:23:25 +09:00
test.sh test.sh: go back to developper mode 2024-09-05 15:20:17 +09:00
test_fragment.sh test_fragment.sh: sort results 2022-10-31 18:08:06 +09:00
test_gauss.sh test_gauss.sh: also test Welford 2024-09-04 17:09:50 +09:00
TOC.png new file: TOC.png 2021-07-28 15:33:15 +09:00

FASMIFRA

Reference implementation for the article "Molecular Generation by Fast Assembly of (Deep)SMILES Fragments". Generate molecules fast from a molecular training set while also doing training-set distribution matching.

logo

Installing the software

run ./install.sh It should install FASMIFRA with all its dependencies automatically without requiring any user interaction.

For OCaml programmers, you can clone this repository then type 'make && make install'. Note that you need to have opam installed and configured.

install.sh does something like this:

(test -e /usr/local/bin/brew && brew install opam) || sudo apt install -y opam
opam init -y
pip3 install rdkit
eval `opam config env`
opam install --fake conf-rdkit
opam install -y fasmifra
which fasmifra_fragment.py
which fasmifra

Fragmenting molecules

Those molecules are your "molecular training set".

fasmifra_fragment.py -i my_molecules.smi -o my_molecules_frags.smi

If you fragment rather small molecules, you might want to use the -w option and pass a smaller recommended fragment weight than the default (150 Da).

usage: fasmifra_fragment.py [-h] [-i input.smi] [-o output.smi] [--seed SEED]
                            [-n NB_PASSES] [-w FRAG_WEIGHT]

fragment molecules (tag cleaved bonds)

optional arguments:
  -h, --help      show this help message and exit
  -i input.smi    molecules input file
  -o output.smi   fragments output file
  --seed SEED     RNG seed
  -n NB_PASSES    number of fragmentation passes
  -w FRAG_WEIGHT  fragment weight (default=150Da)

Generating molecules from fragments

fasmifra -n 100000 -i my_molecules_frags.smi -o my_molecules_gen.smi
usage:
  fasmifra
  -n <int>: how many molecules to generate
  -i <filename>: smiles fragments input file
  -o <filenams>: output file
  [--seed <int>]: RNG seed
  [--deep-smiles]: input/output molecules in DeepSMILES no-rings format

FASMIFRA in the GuacaMol benchmark

Benchmark Random sampler SMILES LSTM Graph MCTS AAE ORGAN VAE FASMIFRA Negative control
Validity 1.000 0.959 1.000 0.822 0.379 0.870 1.000 1.000
Uniqueness 0.997 1.000 1.000 1.000 0.841 0.999 0.994 0.959
Novelty 0.000 0.912 0.994 0.998 0.687 0.974 0.702 0.947
KL_divergence 0.998 0.991 0.522 0.886 0.267 0.982 0.959 0.855
FCD 0.929 0.913 0.015 0.529 0.000 0.863 0.814 0.397

Bibliography

[1] Berenger, F., Tsuda, K. Molecular generation by Fast Assembly of (Deep)SMILES fragments. J Cheminform 13, 88 (2021). https://doi.org/10.1186/s13321-021-00566-4

[2] O'Boyle, N., & Dalke, A. (2018). "DeepSMILES: an adaptation of SMILES for use in machine-learning of chemical structures". chemrxiv.org

[3] Weininger, D. (1988). SMILES, a chemical language and information system. "1. Introduction to methodology and encoding rules". Journal of chemical information and computer sciences, 28(1), 31-36. https://doi.org/10.1021/ci00057a005

[4] Klarich, K., Goldman, B., Kramer, T., Riley, P., & Walters, W. P. (2024). Thompson Sampling-An Efficient Method for Searching Ultralarge Synthesis on Demand Databases. Journal of Chemical Information and Modeling, 64(4), 1158-1171. https://doi.org/10.1021/acs.jcim.3c01790

[5] Welford, B. P. (1962). Note on a method for calculating corrected sums of squares and products. Technometrics, 4(3), 419-420. https://doi.org/10.1080/00401706.1962.10490022