Gregory Landrum presented on open-source tools for querying and organizing large reaction databases using the RDKit. He discussed public reaction data sources extracted from patents, handling reactions with RDKit, using fingerprints to analyze reactions, and applying machine learning and clustering to reaction fingerprints to validate their ability to distinguish reactions and group similar ones together. He also explored analyzing functional group changes between reactants and products of reactions.
2. Outline
2
§ Public data sources and reactions
§ Handling reactions with the RDKit
§ Fingerprints for reactions
§ Validation:
• Machine learning
• Clustering
§ Application: Identifying interesting clusters of reactions
7. What about how we made those molecules?
7
Public reaction data?
§ The literature:
§ Plenty of data locked up in large commercial databases,
very very little in the open
Yan, L. et al. SAR studies of 3-arylpropionic acids as potent and selective agonists of sphingosine-1-phosphate
receptor-1 (S1P1) with enhanced pharmacokinetic properties. Bioorganic & Medicinal Chemistry Letters 17, 828–
831 (2007).
8. An emerging area: chemical reactions
8
Not just what we made, but how we made it
§ Text-mining applied to open patent data to extract chemical reactions :
1.12 million reactions[1]
§ Reactions classified using namerxn, when possible, into 318 standard
types : >599000 classified reactions[2]
[1] Lowe DM: “Extraction of chemical structures and reactions from the literature.” PhD
thesis. University of Cambridge: Cambridge, UK; 2012.
[2] Reaction classification from Roger Sayle and Daniel Lowe (NextMove Software)
http://nextmovesoftware.com/blog/2014/02/27/unleashing-over-a-million-reactions-into-the-
wild/
Lots of reactions,
lots of repeats
10. RDKit: What is it?
§ Open-source C++ toolkit for cheminformatics
§ Wrappers for Python (2.x), Java, C#
§ Functionality:
• 2D and 3D molecular operations
• Descriptor generation for machine learning
• PostgreSQL database cartridge for substructure and similarity searching
• Knime nodes
• IPython integration
• Lucene integration (experimental)
• Supports Mac/Windows/Linux
§ Releases every 6 months
§ business-friendly BSD license
§ Code: https://github.com/rdkit
§ http://www.rdkit.org
11. RDKit: Some features
§ Input/Output: SMILES/SMARTS, SDF, TDT, PDB,
SLN [1], Corina mol2 [1]
§ “Cheminformatics”:
• Substructure searching
• Canonical SMILES
• Chirality support (i.e. R/S or E/Z labeling)
• Chemical transformations (e.g. remove matching
substructures)
• Chemical reactions
§ 2D depiction, including constrained depiction
§ 2D->3D conversion/conformational analysis via
distance geometry
§ UFF and MMFF94 implementation for cleaning up
structures
§ Fingerprinting: Daylight-like, atom pairs, topological
torsions, Morgan algorithm, “MACCS keys”, etc.
§ Similarity/diversity picking
§ 2D pharmacophores [1]
§ Gasteiger-Marsili charges
§ Hierarchical subgraph/fragment analysis
§ Bemis and Murcko scaffold determination
§ RECAP and BRICS implementations
§ Multi-molecule maximum common substructure
§ Feature maps
§ Shape-based similarity
§ Fraggle similarity (from GSK)
§ Molecule-molecule alignment
§ Open3DAlign implementation
§ Integration with PyMOL for 3D visualization
§ Functional group filtering
§ Salt stripping
§ Molecular descriptor library:
Topological (κ3, Balaban J, etc.), Compositional (Number
of Rings, Number of Aromatic Heterocycles, etc.),
EState, SlogP/SMR (Wildman and Crippen approach),
“MOE like” VSA descriptors, Feature-map vectors
§ Machine Learning:
• Clustering (hierarchical)
• Information theory (Shannon entropy, information
gain, etc.)
§ Tight integration with the IPython notebook and
pandas
§ Integration with the InChI library
[1] These implementations are functional but are not necessarily
the best, fastest, or most complete.
15. Another approach for tuning specificity
and now the solution
Thanks to Holger Claussen (BioSolveIT) for the idea to use atom values for this
Query definitions added as atom values
16. Got the reactions, what about reaction fingerprints?
16
Criteria for them to be useful
§ Question 1: do they contain bits that are helpful in
distinguishing reactions from another?
Test: can we use them with a machine-learning approach to build a
reaction classifier?
§ Question 2: are similar reactions similar with the
fingerprints
Test: do related reactions cluster together?
17. Similarity applied to reactions
17
What are we talking about?
§ These two reactions are both type: “1.2.5 Ketone reductive amination”
It’s obvious that these are the same, right?
18. Got the reactions, what about reaction fingerprints?
18
Start simple: use difference fingerprints:
Similar idea here:
1) Ridder, L. & Wagener, M. SyGMa: Combining Expert Knowledge and Empirical Scoring in the Prediction of
Metabolites. ChemMedChem 3, 821–832 (2008).
2) Patel, H., Bodkin, M. J., Chen, B. & Gillet, V. J. Knowledge-Based Approach to de NovoDesign Using Reaction
Vectors. J. Chem. Inf. Model. 49, 1163–1184 (2009).
FPReacts = FPi
i∈Reactants
∑
FPProducts = FPi
i∈Products
∑
FPRxn = FPProds − FPReacts
19. Refine the fingerprints a bit
19
Text-mined reactions often include reagents or
solvents in the reactants
Explore two options for handling this:
1. Decrease the weight of reactant molecules where too many
of the bits are not present in the product fingerprint
2. Decrease the weight of reactant molecules where too many
atoms are unmapped
20. Another reaction analysis scheme
20
Looking at functional group changes
§ Similar idea to the fingerprint analysis: count the numbers
of common functional groups in the reactants and
products and subtract the one from the other:
rfp=None
for
ri
in
range(rxn.GetNumReactantTemplates()):
m
=
rxn.GetReactantTemplate(ri)
fp
=
np.array(FunctionalGroups.CreateMolFingerprint(m,fgh))
if
rfp
is
None:
rfp
=
fp
else:
rfp
+=
fp
pfp=None
for
ri
in
range(rxn.GetNumProductTemplates()):
m
=
rxn.GetProductTemplate(ri)
fp
=
np.array(FunctionalGroups.CreateMolFingerprint(m,fgh))
if
pfp
is
None:
pfp
=
fp
else:
pfp
+=
fp
fp
=
pfp-‐rfp
23. Are the fingerprints useful?
23
§ Question 1: do they contain bits that are helpful in
distinguishing reactions from another?
Test: can we use them with a machine-learning approach to build a
reaction classifier?
§ Question 2: are similar reactions similar with the
fingerprints
Test: do related reactions cluster together?
24. Machine learning and chemical reactions
24
§ Validation set:
• The 68 reaction types with at least 2000 instances from the patent
data set
- “Resolution” reaction types removed (e.g. 11.9 Separation and 11.1 Chiral
separation)
- Final: 66 reaction types
§ Process:
• Training set is 200 random instances of each reaction type
• Test set is 800 random instances of each reaction type
• Learning: random forest (scikit-learn)
25. Learning reaction classes
25
Results for test data
Overall:
• Recall: 0.94
• Precision: 0.94
• Accuracy: 0.94
For a 66-class classifier, this looks pretty good!
26. Learning reaction classes
26
~94% accuracy
much of the
confusion is
between related
types
Confusion matrix for test data
Bromo Suzuki coupling
Bromo Suzuki-type coupling
Bromo N-arylation
27. Are the fingerprints useful?
27
§ Question 1: do they contain bits that are helpful in
distinguishing reactions from another?
Test: can we use them with a machine-learning approach to build a
reaction classifier?
§ Question 2: are similar reactions similar with the
fingerprints
Test: do related reactions cluster together?
28. Clustering reactions
28
§ Reaction similarity validation set:
• The 66 most common reaction types from the patent data set
• Look at the homogeneity of clusters with at least 10 members
1.2.5 Ketone reductive
amination
1.2.5 Ketone reductive
amination
1.2.5 Ketone reductive
amination
Integration
Interpretation: <30% of clusters are <90% homogeneous
Interpretation: <40% of clusters are <80% homogeneous
29. Similarity applied to reactions
29
Can we help classify the remaining 600K reactions?
§ Starting point: we have a similarity measure that clusters related
reactions together
§ We can apply the machine-learning model to the unclassified
reactions and see if the original assignment missed any instances
§ We can then look for big clusters of unclassified molecules and
(manually) assign classes to them.
30. Finding related unclassified reactions
30
§ Process:
1. Pick 10K random unclassified reactions
2. Cluster using the same fingerprint described above
3. Characterize clusters by average functional-group profile
4. Pick clusters where there is a clear signal
§ An example:
Cluster
12
amine
-‐0.68
amine_secondary
-‐0.35
amine_secondary_aliphatic
-‐0.35
amine_aliphatic
-‐0.61
aldehyde
-‐0.58
aldehyde_aromatic
-‐0.58
31. Example reactions from cluster 12
31
• Clearly related reactions
• Using this approach we’ve identified a number of reaction classes
32. Wrapping up
32
§ Dataset: 1+ million reactions text mined from patents
(publically available) with reaction classes assigned
§ Fingerprint: weighted atom-pair delta fingerprints
implemented using the RDKit
§ Fingerprint Validation:
• Multiclass random-forest classifier ~94% accurate
• Similarity measure works: similar reactions cluster together
§ Combination of clustering + functional group analysis
clustering allows identification of new reaction classes
34. Advertising
34
3rd RDKit User Group Meeting
22-24 October 2014
Merck KGaA, Darmstadt, Germany
Talks, “talktorials”, lightning talks, social activities, and a hackathon on
the 24th.
Registration: http://goo.gl/z6QzwD
Full announcement: http://goo.gl/ZUm2wm
We’re looking for speakers. Please contact greg.landrum@gmail.com