Skip to content

Latest commit

 

History

History
72 lines (43 loc) · 2.8 KB

reaction.i.md

File metadata and controls

72 lines (43 loc) · 2.8 KB

Reactions

Reactions are fundamental events in chemistry, biochemistry, and thus in life. As such, a cheminformatics toolkit cannot do without a reaction framework. This chapter will outline the reaction data model present in the CDK. It will first outline the core data interfaces, and how they can be used.

A single reaction

A single reaction consists of reacting chemical and the products of the reaction. Optionally, a reaction can be catalyzed. This idea is captured in the IReaction interface, which directly extends the IChemObject interface. Let's consider the following reaction:

2 H3COH H3O+ H3COCH3 + H2O

This reaction between two methanol molecules is catalyzed by acid and results in methoxymethane and water. To encode this into a CDK data model, we need to set the reaction coefficient, the reactants, products, and catalyst. The latter is called an agent in the data model. We know how to create molecules and that will not be repeated here. Given these atom containers, we create this reaction with:

MethanolReaction

This example shows we can set the reaction direction too. We can list the balance directions that are available by the Direction enum:

ReactionDirections

which returns us these current options:

ReactionDirections

There are matching get methods to access all reactants and products:

ReactionGetters

This scripts takes advantage of the MolecularFormulaManipulator class (see Section molecularFormula) and outputs the molecular formula of the reactants and products:

ReactionGetters

Reaction from File

There are a few file formats that can store reaction. This short paragraph will give some quick pointers which these are, and how files in that format can be read into a data model. The full IO details are presented in Chapter io.

MDL RXN files

The first, and likely more common format, is the MDL RXN file format. This format basically consists of a special concatenation of MDL molfiles. The MDLRXNReader will read the content from such files into a IReaction class:

ReactionMDLRXN

From there on, we can easily extract the reaction details:

ReactionMDLRXN

CMLReact files

There is also a CML extension for reactions [Q27162658]. But because CML files can contain a lot of information, we read an IChemFile from this file, and extract the IReaction from that:

ReactionCMLReact

But once down to the IReaction, we are back in business:

ReactionCMLReact

References