Molecular and Reaction Representations
Graphs, fingerprints and chemically valid feature construction
Lesson 4366 of 4,500 · Reaction Networks and Data-Driven Chemistry
Learning objectives
- Compare molecular strings, graphs and fingerprints
- Construct reaction features that respect reactant-product differences
- Identify information lost through representation choices
Introduction
A model needs numbers or tokens, but chemistry consists of atoms, bonds, charges, phases and conditions. The representation determines which distinctions a model can learn. A molecular string, graph or fingerprint can encode connectivity; none automatically supplies a reaction mechanism, solvent effect or reliable stereochemical outcome.
Core explanation
SMILES represents molecular connectivity as a string. Multiple valid strings can describe one molecular graph, so a model treating the characters alone may learn spelling choices. Canonicalization or randomized augmentation can help, but protonation state, salts, tautomers and stereochemistry require explicit policy. A molecular graph labels atoms by element and other attributes, and bonds by order or aromatic status. Graph neural networks can learn local patterns from neighborhoods, yet finite receptive fields may miss distant or three-dimensional effects unless additional information is supplied.
Fingerprints encode structural fragments or paths into fixed-length vectors. They are useful for similarity search and simple baselines, but collisions and limited radius can make different environments look alike. For reactions, a difference between product and reactant descriptors highlights changes but may lose which atoms correspond. Atom mapping enables a reaction center: bonds broken, formed or changed among mapped atoms. Primary work on condensed reaction graphs represents reactant and product bond information together for property learning.
Feature validity starts with chemical consistency. Preserve formal charge, isotopes and stereochemical tags when relevant; distinguish reactants from catalysts, solvents and products. A reaction record with only product structure is not enough to infer conditions. A model predicting products from reactants should not receive a feature computed from the true product at inference time: that would leak the answer. Conversely, a model predicting reaction yield may legitimately use known product identity if the use case states it in advance. The intended question decides which information is available.
Representations have boundaries. Two conformers share a connectivity graph but can have different reaction barriers. A chiral product may require stereochemical or three-dimensional information. Surface reactions need site identity and coverage, not just molecular SMILES. A predictor should compare against simple chemically informed baselines and test whether more complex features actually improve independent performance. The original Molecular Transformer paper used text representations of reactants and reagents for product prediction, illustrating one useful but task-specific encoding.
Step-by-step reasoning
1. Define the target and which structures and conditions are known at prediction time. 2. Standardize valence, charge, tautomer and stereochemical policies. 3. Encode molecules as strings, graphs or fingerprints with mapped reaction changes when needed. 4. Check atom balance and reject impossible or leaked features. 5. Compare representations on an independent split with a meaningful baseline.
Visual explanation
Draw ethanol as a molecular graph, then two valid strings that encode the same connectivity. Below, show a binary fingerprint indicating selected fragments. For a reaction, highlight the bond broken and bond formed in different colors across mapped reactant and product graphs. A crossed-out arrow from the true product into a product-prediction input illustrates target leakage.
Real-world analogy
A city can be represented by a street map, a written list of turn instructions or a checklist of landmarks. Each preserves different information. A landmark checklist helps find similar cities but cannot reconstruct every route. Chemical fingerprints are similarly compact and useful, while atom-level graphs retain explicit connectivity.
Real-world example
A model predicts whether a nucleophilic substitution will occur. A fingerprint capturing nearby carbon environment helps classify candidate substrates. If the task needs inversion at a stereocenter, a fingerprint lacking chirality cannot distinguish enantiomeric outcomes. Adding stereochemical encoding and experimental conditions may improve the prediction, but only if the training data report stereochemistry reliably.
Why?
Why does atom mapping help reaction prediction? It connects each product atom to an input atom and makes bond changes explicit. Without mapping, a model may see reactant and product structures but not know which oxygen moved or which C–N bond formed. Mapping is itself fallible, especially in symmetric molecules, so its uncertainty should be checked rather than treated as unquestioned ground truth.
Common misconception
“One SMILES string is a unique chemical substance” overlooks alternate valid strings and state conventions. “A fingerprint contains every structural detail” overlooks collisions and omitted stereochemistry. “More model layers guarantee better chemistry” ignores data quality. “A predicted product graph establishes a mechanism” confuses endpoint connectivity with a sequence of elementary steps.
Worked example
Suppose a reactant contains C–Br and a product contains C–N at the same mapped carbon. A mapped reaction feature can mark loss of the C–Br bond and formation of C–N. A simple molecular formula difference might indicate Br leaves and N enters, but cannot locate the reacting carbon if several sites exist. If two candidate substrates differ only by stereochemistry at that carbon, a representation that drops chiral tags makes their inputs identical. No deterministic model using only those inputs can reliably output different stereospecific results. The remedy is to preserve relevant stereochemical and condition information, then check whether the data support the distinction.
Quick check
1. Why should a product-prediction model not use a descriptor calculated from the true product as input? Answer: The descriptor would leak the answer and be unavailable for a genuinely new prediction.
Exam focus
Compare one strength and one limitation of strings, graphs and fingerprints. Explain atom mapping and reaction centers with a bond-change example. Identify a target-leakage feature and a chemical distinction lost by an oversimplified representation.
Advanced insight
Invariant representations aim to give the same prediction after renumbering equivalent atoms, yet must still distinguish chemically different stereoisomers and sites. This balance between invariance and discrimination is central to molecular ML. Three-dimensional or quantum descriptors can add information, but their calculated geometry may be uncertain or unavailable under experimental conditions; those assumptions need validation.
Summary
Chemical representations translate structures and transformations into model inputs. Graphs, strings and fingerprints preserve different aspects of connectivity; mapped reaction features expose bond changes. The right choice depends on the prediction task, available information and distinctions that the data can support.
Practice questions
1. Can two valid SMILES strings represent the same molecular graph? Answer: Yes. SMILES ordering can vary even when connectivity is identical. 2. What does a reaction center describe? Answer: The atoms and bonds directly changed between mapped reactants and products. 3. Why may a non-chiral fingerprint fail on stereospecific reactions? Answer: It can encode stereoisomers identically and cannot distinguish their different outcomes. 4. Does a product structure reveal every elementary step used to make it? Answer: No. Multiple mechanisms can lead to the same product connectivity.