Home

Awesome

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.

<img src="TOC.png" alt="logo" width="400"/>

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

BenchmarkRandom samplerSMILES LSTMGraph MCTSAAEORGANVAEFASMIFRANegative control
Validity1.0000.9591.0000.8220.3790.8701.0001.000
Uniqueness0.9971.0001.0001.0000.8410.9990.9940.959
Novelty0.0000.9120.9940.9980.6870.9740.7020.947
KL_divergence0.9980.9910.5220.8860.2670.9820.9590.855
FCD0.9290.9130.0150.5290.0000.8630.8140.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