Package: rxnfp
RXNFP - chemical reaction fingerprintsThis library generates chemical reaction fingerprints from reaction SMILESInstallFor all installations, we recommend usingcondato get the necessaryrdkitandtmapdependencies:From pypiconda create -n rxnfp python=3.6 -yconda activate rxnfpconda install -c rdkit rdkit=2020.03.3 -yconda install -c tmap tmap -ypip install rxnfpFrom githubconda create -n rxnfp python=3.6 -yconda activate rxnfpconda install -c rdkit rdkit=2020.03.3 -yconda install -c tmap tmap -ygit clone git@github.com:rxn4chemistry/rxnfp.gitcd rxnfppip install -e .How to useCompute a fingerprint from a reaction SMILES</code></pre><prelang="python"><code>fromrxnfp.transformer_fingerprintsimport(RXNBERTFingerprintGenerator,get_default_model_and_tokenizer,generate_fingerprints)model,tokenizer=get_default_model_and_tokenizer()rxnfp_generator=RXNBERTFingerprintGenerator(model,tokenizer)example_rxn="Nc1cccc2cnccc12.O=C(O)c1cc([N+](=O)[O-])c(Sc2c(Cl)cncc2Cl)s1>>O=C(Nc1cccc2cnccc12)c1cc([N+](=O)[O-])c(Sc2c(Cl)cncc2Cl)s1"fp=rxnfp_generator.convert(example_rxn)print(len(fp))print(fp[:5])256
[-2.0174953937530518, 1.7602033615112305, -1.3323537111282349, -1.1095019578933716, 1.2254549264907837]Or for a list of reactions:rxns=[example_rxn,example_rxn]fps=rxnfp_generator.convert_batch(rxns)print(len(fps),len(fps[0]))2 256Reaction AtlasPistachioThe fingerprints can be used to map the space of chemical reactions:Figure:Annotated Atlas of the Pistachio test set generated withTMAP.Schneider 50k set - tutorialIn the notebooks, we show how to generate an interative reaction atlas for the Schneider 50k set. The end result is similar to thisinteractive Reaction Atlas.Where you will find different reaction properties highlighted in the different layers:Figure:Reaction atlas of 50k data set with different properties highlighted.USPTO 1k TPL (reaction classification data set)We introduce a new data set for chemical reaction classification called USPTO 1k TPL. USPTO 1k TPL is derived from theUSPTO data baseby Lowe. It consists of 445k reactions divided into 1000 template labels. The data set was randomly split into train/valid 90% and test 10%. The labels were obtained by atom-mapping the USPTO data set withRXNMapper, then applying thetemplate extraction workflowby Thakkar et al. and finally, selecting reactions belonging to the 1000 most frequent template hashes. Those template hashes were taken as class labels. Similarly to the Pistachio data set, USPTO 1k TPL is strongly imbalanced.The data set can be downloaded from:MappingChemicalReactions.CitationOur work was first presented in the NeurIPS 2019 workshop forMachine Learning and the Physical Sciences. And has been published after multiple updates in 2021 inNature Machine Intelligence (free access link).@article{schwaller2021mapping,
  title={Mapping the space of chemical reactions using attention-based neural networks},
  author={Schwaller, Philippe and Probst, Daniel and Vaucher, Alain C and Nair, Vishnu H and Kreutter, David and Laino, Teodoro and Reymond, Jean-Louis},
  journal={Nature Machine Intelligence},
  volume={3},
  number={2},
  pages={144--152},
  year={2021},
  publisher={Nature Publishing Group}
}RXNFP has been developed in a collaboration between IBM Research Europe and theReymond groupat the University of Bern. The classification models are used on theRXN for Chemistryplatform.Our publication is part of the Nature Portfolio"Synthesis and enabling technologies" collectionand was featured in a News & Views onTransformers for future medicinal chemists.Moreover, therxnfpcode was reused to train new models on different data as described inReusability report: Learning the language of synthetic methods used in medicinal chemistry.