Chemical Data Processing Library Python API - Version 1.2.0
Public Member Functions | List of all members
CDPL.Chem.JMEReactionReader Class Reference

A reader for reaction data in the native I/O format of the JME Molecular Editor [JME] java applet. More...

+ Inheritance diagram for CDPL.Chem.JMEReactionReader:

Public Member Functions

None __init__ (Base.IStream is)
 Constructs a JMEReactionReader instance that will read the reaction data from the input stream is. More...
 
- Public Member Functions inherited from CDPL.Chem.ReactionReaderBase
None __init__ ()
 Initializes the ReactionReaderBase instance.
 
ReactionReaderBase read (Reaction rxn, bool overwrite=True)
 Reads the data record at the current record index and stores the read data in rxn. More...
 
ReactionReaderBase read (int idx, Reaction rxn, bool overwrite=True)
 Reads the data record at index idx and stores the read data in rxn. More...
 
ReactionReaderBase skip ()
 Skips the data record at the current record index. More...
 
bool hasMoreData ()
 Tells if there are any data records left to read. More...
 
int getRecordIndex ()
 Returns the index of the current data record. More...
 
None setRecordIndex (int idx)
 Sets the index of the current data record to idx. More...
 
int getNumRecords ()
 Returns the total number of available data records. More...
 
None close ()
 Performs a reader specific shutdown operation (if required). More...
 
bool __nonzero__ ()
 
bool __bool__ ()
 
- Public Member Functions inherited from CDPL.Base.DataIOBase
int registerIOCallback (VoidDataIOBaseFunctor func)
 Registers an I/O callback target function. More...
 
None unregisterIOCallback (int id)
 Unregisters the I/O callback function specified by id. More...
 
None invokeIOCallbacks (float progress)
 Invokes all registered I/O callback functions with the argument self. More...
 
None clearIOCallbacks ()
 Clears all registered I/O callback functions.
 
- Public Member Functions inherited from CDPL.Base.ControlParameterContainer
None setParameter (LookupKey key, Any value)
 
bool removeParameter (LookupKey key)
 Removes the entry for the control-parameter specified by key. More...
 
Any getParameter (LookupKey key, bool throw_=False, bool local=False)
 Returns the value of the control-parameter specified by key. More...
 
Any getParameterOrDefault (LookupKey key, Any def_value, bool local=False)
 
bool isParameterSet (LookupKey key, bool local=False)
 Tells whether or not a value has been assigned to the control-parameter specified by key. More...
 
None clearParameters ()
 Erases all container entries. More...
 
None addParameters (ControlParameterContainer cntnr)
 Adds the control-parameter value entries in the ControlParameterContainer instance cntnr. More...
 
None copyParameters (ControlParameterContainer cntnr)
 Replaces the current set of properties by a copy of the entries in cntnr. More...
 
int getNumParameters ()
 Returns the number of container entries. More...
 
int registerParameterChangedCallback (VoidLookupKeyAnyFunctor func)
 Registers a callback target function that gets invoked when the value of a control-parameter has changed. More...
 
None unregisterParameterChangedCallback (int id)
 Unregisters the callback specified by id. More...
 
int registerParameterRemovedCallback (VoidLookupKeyFunctor func)
 Registers a callback target function that gets invoked when a control-parameter entry has been removed. More...
 
None unregisterParameterRemovedCallback (int id)
 Unregisters the callback specified by id. More...
 
int registerParentChangedCallback (VoidFunctor func)
 Registers a callback target function that gets invoked when the parent container has been changed or was detached. More...
 
None unregisterParentChangedCallback (int id)
 Unregisters the callback specified by id. More...
 
ControlParameterContainer getParent ()
 Returns a reference to the parent control-parameter container. More...
 
None setParent (ControlParameterContainer cntnr)
 Sets or removes the parent control-parameter container used to resolve requests for missing entries. More...
 
list getParameterKeys ()
 
list getParameterValues ()
 
list getParameters ()
 Returns a reference to itself. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
Any __getitem__ (LookupKey key)
 
None __setitem__ (LookupKey key, Any value)
 
bool __delitem__ (LookupKey self)
 
bool __contains__ (LookupKey self, bool key)
 Returns the result of the membership test operation self in arg1. More...
 
int __len__ ()
 

Additional Inherited Members

- Properties inherited from CDPL.Chem.ReactionReaderBase
 numRecords = property(getNumRecords)
 
- Properties inherited from CDPL.Base.ControlParameterContainer
 objectID = property(getObjectID)
 
 parent = property(getParent, setParent)
 
 parameterKeys = property(getParameterKeys)
 
 parameterValues = property(getParameterValues)
 
 parameters = property(getParameters)
 
 numParameters = property(getNumParameters)
 

Detailed Description

A reader for reaction data in the native I/O format of the JME Molecular Editor [JME] java applet.

JMEReactionReader implements the reading of Chem.Reaction objects from a std::istream instance that provides the reaction data in the native I/O format used by the JME Molecular Editor applet.

Atom and bond attributes of a read reaction component are stored as properties of allocated Chem.Atom and Chem.Bond objects. The affected properties are summarized in the tables below:

Chem.Atom PropertyDescriptionNotes
Chem.AtomProperty.MATCH_CONSTRAINTSSpecifies atom matching constraintsOnly set if constraints have been specified
Chem.AtomProperty.COORDINATES_2DSpecifies the 2D position of the atom-
Chem.AtomProperty.TYPESpecifies the type of the atom (see Chem.AtomType)Only set if the atom is a query atom and the specified type is not a member of an atom list
Chem.AtomProperty.SYMBOLSpecifies the atom symbol (e.g. element symbol)Only set if the atom is not a query atom, or the symbol cannot be mapped to a valid atom type and is not a member of an atom list
Chem.AtomProperty.FORMAL_CHARGESpecifies the formal charge of the atomOnly set if the charge has been specified outside of an atom list
Chem.AtomProperty.REACTION_ATOM_MAPPING_IDSpecifies the reactant to product atom mapping classOnly set if a mapping number has been specified that is greater than zero
Chem.Bond PropertyDescription
Chem.BondProperty.ORDERSpecifies the order of the bond
Chem.BondProperty.STEREO_2D_FLAGSpecifies the 2D stereo bond type (see Chem.BondStereoFlag)

Beside the editing of conventional chemical structures, the JME applet allows to some extent the specification of atom matching constraints for the definition of substructure search queries. If such constraints are encountered during the processing of an atom specification, the constraint primitives are converted to corresponding Chem.MatchConstraint objects and stored as the value of the Chem.Atom property Chem.AtomProperty.MATCH_CONSTRAINTS in a Chem.MatchConstraintList data structure.

The following table lists all of the supported JME atom matching constraints and specifies how they are represented by Chem.MatchConstraint instances (in the table <n> denotes a positive integer value and the symbol of a chemical element):

Expression PrimitiveDescriptionMapped Chem.MatchConstraint object
Constraint IDOperatorValue
cAromatic carbonChem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.C
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALTrue
nAromatic nitrogenChem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.N
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALTrue
oAromatic oxygenChem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.O
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALTrue
sAromatic sulfurChem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.S
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALTrue
pAromatic phosphorusChem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.P
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALTrue
aAny aromatic atomChem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.ANY
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALTrue
AAny non-aromatic atomChem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.ANY
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALFalse
A non-aromatic atom of element Chem.AtomMatchConstraint.CONSTRAINT_LISTChem.MatchConstraint.EQUALA reference to a Chem.MatchConstraintList object
The sub-constraint list has the logical type Chem.MatchConstraintList.AND_LIST and contains the elements:
Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALAtom type associated with the element
Chem.AtomMatchConstraint.AROMATICITYChem.MatchConstraint.EQUALFalse
#<n>An atom with atomic number <n>Chem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUAL<n>
!#6Any atom except carbonChem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.QH
*Any atomChem.AtomMatchConstraint.TYPEChem.MatchConstraint.EQUALChem.AtomType.ANY
RAny ring atomChem.AtomMatchConstraint.RING_TOPOLOGYChem.MatchConstraint.EQUALTrue
!RAny non-ring atomChem.AtomMatchConstraint.RING_TOPOLOGYChem.MatchConstraint.EQUALFalse
+<n>Positive chargeChem.AtomMatchConstraint.CHARGEChem.MatchConstraint.EQUAL+<n>
-<n>Negative chargeChem.AtomMatchConstraint.CHARGEChem.MatchConstraint.EQUAL-<n>
H<n>Hydrogen countChem.AtomMatchConstraint.H_COUNTChem.MatchConstraint.EQUAL<n>
D<n>Heavy bond countChem.AtomMatchConstraint.HEAVY_BOND_COUNTChem.MatchConstraint.EQUAL<n>

The error handling behaviour of a JMEReactionReader instance can be configured with the following control-parameter:

Control-ParameterDefault Value (see Chem.ControlParameterDefault)Description
Chem.ControlParameter.STRICT_ERROR_CHECKINGFalseSpecifies whether non-fatal recoverable errors should be ignored or cause a read operation to fail
Chem.ControlParameter.COORDINATES_DIMENSION2Specifies the dimension of atom coordinates

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.JMEReactionReader.__init__ ( Base.IStream  is)

Constructs a JMEReactionReader instance that will read the reaction data from the input stream is.

Parameters
isThe input stream to read from.