Package: drfp
DRFPAn NLP-inspired chemical reaction fingerprint based on basic set arithmetic.Read the associatedopen access articleDescriptionPredicting the nature and outcome of reactions using computational methods is an important tool to accelerate chemical research. The recent application of deep learning-based learned fingerprints to reaction classification and reaction yield prediction has shown an impressive increase in performance compared to previous methods such as DFT- and structure-based fingerprints. However, learned fingerprints require large training data sets, are inherently biased, and are based on complex deep learning architectures. Here we present the differential reaction fingerprintDRFP. TheDRFPalgorithm takes a reaction SMILES as an input and creates a binary fingerprint based on the symmetric difference of two sets containing the circular molecular n-grams generated from the molecules listed left and right from the reaction arrow, respectively, without the need for distinguishing between reactants and reagents. We show thatDRFPoutperforms DFT-based fingerprints in reaction yield prediction and other structure-based fingerprints in reaction classification, and reaching the performance of state-of-the-art learned fingerprints in both tasks while being data-independent.Getting StartedThe best way to start exploring DRFP is on binder.
A notebook that gets you started on creating and using DRFP:A notbook that explains how you can use SHAP to analyse and interpret your machine learning models when using DRFP:Installation and UsageDRFPcan be installed from pypi usingpip install drfp. However, it depends onRDKitwhich is bestinstalled using conda.Once DRFP is installed, there are two ways you can use it. You can use the cli appdrfpor the library provided by the package.CLIdrfpmy_rxn_smiles.txtmy_rxn_fps.pkl-d512This will create a pickle dump containing an numpy ndarray containing DRFP fingerprints with a dimensionality of 512. To also export the mapping, use the flag--mapping. This will create the additional filemy_rxn_fps.map.pkl. You can calldrfp --helpto show all available flags and options.LibraryFollowing is a basic exmple of how to use DRFP in a Python script.fromdrfpimportDrfpEncoderrxn_smiles=["CO.O[C@@H]1CCNC1.[C-]#[N+]CC(=O)OC>>[C-]#[N+]CC(=O)N1CC[C@@H](O)C1","CCOC(=O)C(CC)c1cccnc1.Cl.O>>CCC(C(=O)O)c1cccnc1",]fps=DrfpEncoder.encode(rxn_smiles)The variablefpsnow points to a list containing the fingerprints for the two reaction SMILES as numpy arrays.DocumentationThe library contains the classDrfpEncoderwith one public methodencode.DrfpEncoder.encode()DescriptionTypeDefaultXAn iterable (e.g. a list) of reaction SMILES or a single reaction SMILES to be encodedIterableorstrn_folded_lengthThe folded length of the fingerprint (the parameter for the modulo hashing)int2048min_radiusThe minimum radius of a substructure (0 includes single atoms)int0radiusThe maximum radius of a substructureint3ringsWhether to include full rings as substructuresboolTruemappingReturn a feature to substructure mapping in addition to the fingerprints. If true, the return signature of this method isTuple[List[np.ndarray], Dict[int, Set[str]]]boolFalseatom_index_mappingReturn the atom indices of mapped substructures for each reactionboolFalseroot_central_atomWhether to root the central atom of substructures when generating SMILESboolTrueinclude_hydrogensWhether to explicitly include hydrogens in the molecular graphboolFalseshow_progress_barWhether to show a progress bar when encoding reactionsboolFalseReproduceWant to reproduce the results in our paper? You can find all the data in thedatafolder and encoding and training scripts in thescriptsfolder.Cite Us@article{probst2022reaction,
  title={Reaction Classification and Yield Prediction using the Differential Reaction Fingerprint DRFP},
  author={Probst, Daniel and Schwaller, Philippe and Reymond, Jean-Louis},
  journal={Digital Discovery},
  year={2022},
  publisher={Royal Society of Chemistry}
}