Chemical Data Processing Library C++ API - Version 1.4.0
Chem/ReactionFunctions.hpp
Go to the documentation of this file.
1 /*
2  * ReactionFunctions.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_CHEM_REACTIONFUNCTIONS_HPP
30 #define CDPL_CHEM_REACTIONFUNCTIONS_HPP
31 
32 #include <cstddef>
33 #include <cstdint>
34 #include <ctime>
35 #include <string>
36 
37 #include "CDPL/Chem/APIPrefix.hpp"
38 #include "CDPL/Chem/Molecule.hpp"
47 
48 
49 namespace CDPL
50 {
51 
52  namespace Chem
53  {
54 
55  class Reaction;
56 
62  CDPL_CHEM_API const std::string& getName(const Reaction& rxn);
63 
69  CDPL_CHEM_API void setName(Reaction& rxn, const std::string& name);
70 
76 
82  CDPL_CHEM_API bool hasName(const Reaction& rxn);
83 
84 
90  CDPL_CHEM_API std::time_t getTimestamp(const Reaction& rxn);
91 
97  CDPL_CHEM_API void setTimestamp(Reaction& rxn, std::time_t time);
98 
104 
111 
112 
118  CDPL_CHEM_API const std::string& getComment(const Reaction& rxn);
119 
125  CDPL_CHEM_API void setComment(Reaction& rxn, const std::string& comment);
126 
132 
139 
140 
147 
154 
160 
167 
174 
182 
183 
190 
197 
203 
210 
211 
218 
225 
231 
238 
245 
253 
254 
261 
268 
274 
281 
288 
296 
297 
308  CDPL_CHEM_API bool generateSMILES(const Reaction& rxn, std::string& smiles, bool canonical = false,
309  bool ord_h_deplete = true, unsigned int atom_flags = AtomPropertyFlag::DEFAULT,
310  unsigned int bond_flags = BondPropertyFlag::DEFAULT);
311 
322  CDPL_CHEM_API std::uint64_t calcHashCode(const Reaction& rxn, unsigned int role_mask = ReactionRole::ALL,
323  unsigned int atom_flags = AtomPropertyFlag::DEFAULT,
324  unsigned int bond_flags = BondPropertyFlag::DEFAULT,
325  bool ord_h_deplete = true);
326 
327 
333  CDPL_CHEM_API const std::string& getMDLUserInitials(const Reaction& rxn);
334 
340  CDPL_CHEM_API void setMDLUserInitials(Reaction& rxn, const std::string& initials);
341 
347 
354 
355 
361  CDPL_CHEM_API const std::string& getMDLProgramName(const Reaction& rxn);
362 
368  CDPL_CHEM_API void setMDLProgramName(Reaction& rxn, const std::string& name);
369 
375 
382 
383 
389  CDPL_CHEM_API std::size_t getMDLRegistryNumber(const Reaction& rxn);
390 
396  CDPL_CHEM_API void setMDLRegistryNumber(Reaction& rxn, std::size_t reg_no);
397 
403 
410 
411 
418 
425 
431 
438 
439 
446 
453 
459 
466 
467 
473  CDPL_CHEM_API const std::string& getMDLInternalRegistryNumber(const Reaction& rxn);
474 
480  CDPL_CHEM_API void setMDLInternalRegistryNumber(Reaction& rxn, const std::string& reg_no);
481 
487 
494 
495 
501  CDPL_CHEM_API const std::string& getMDLExternalRegistryNumber(const Reaction& rxn);
502 
508  CDPL_CHEM_API void setMDLExternalRegistryNumber(Reaction& rxn, const std::string& reg_no);
509 
515 
522 
523 
529  CDPL_CHEM_API unsigned int getMDLRXNFileVersion(const Reaction& rxn);
530 
536  CDPL_CHEM_API void setMDLRXNFileVersion(Reaction& rxn, unsigned int version);
537 
543 
550 
551 
558 
564  CDPL_CHEM_API std::size_t getMaxAtomMappingID(const Reaction& rxn);
565 
566 
574 
582 
590 
596  CDPL_CHEM_API void generateMatchExpressions(Reaction& rxn, bool overwrite);
597 
604 
611 
619  CDPL_CHEM_API void calcBasicProperties(Reaction& rxn, bool overwrite);
620 
621  } // namespace Chem
622 } // namespace CDPL
623 
624 #endif // CDPL_CHEM_REACTIONFUNCTIONS_HPP
Definition of the type CDPL::Chem::AtomMapping.
Definition of constants in namespace CDPL::Chem::BondPropertyFlag.
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of constants in namespace CDPL::Chem::AtomPropertyFlag.
Definition of class CDPL::Chem::FragmentList.
Definition of class CDPL::Chem::MatchConstraintList.
Definition of class CDPL::Chem::MatchExpression.
Definition of class CDPL::Chem::Molecule.
Definition of constants in namespace CDPL::Chem::ReactionRole.
Definition of class CDPL::Chem::StringDataBlockItem and the type CDPL::Chem::StringDataBlock.
std::shared_ptr< AtomMapping > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated AtomMapping instances.
Definition: AtomMapping.hpp:60
std::shared_ptr< FragmentList > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated FragmentList instances.
Definition: FragmentList.hpp:55
std::shared_ptr< MatchConstraintList > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MatchConstraintList instances.
Definition: MatchConstraintList.hpp:211
Generic boolean expression interface for the implementation of query/target object equivalence tests ...
Definition: MatchExpression.hpp:75
std::shared_ptr< Molecule > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated Molecule instances.
Definition: Molecule.hpp:59
Abstract base class for chemical reactions composed of role-tagged Chem::Molecule components.
Definition: Reaction.hpp:59
std::shared_ptr< StringDataBlock > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated StringDataBlock instances.
Definition: StringDataBlock.hpp:155
constexpr unsigned int DEFAULT
Represents the default set of atom properties.
Definition: Chem/AtomPropertyFlag.hpp:53
constexpr unsigned int DEFAULT
Represents the default set of bond properties.
Definition: BondPropertyFlag.hpp:53
constexpr unsigned int ALL
Specifies reactants, agents and products of a reaction.
Definition: ReactionRole.hpp:74
CDPL_CHEM_API const Molecule::SharedPointer & getMDLMoleculeRecord(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::MDL_MOLECULE_RECORD property of the reaction rxn.
CDPL_CHEM_API void setMDLUserInitials(MolecularGraph &molgraph, const std::string &initials)
Sets the value of the Chem::MolecularGraphProperty::MDL_USER_INITIALS property of the molecular graph...
CDPL_CHEM_API AtomMapping::SharedPointer perceiveAtomMapping(const Reaction &rxn)
Derives the reactant-to-product atom mapping from the atom mapping IDs of the reaction rxn.
CDPL_CHEM_API const std::string & getComment(const MolecularGraph &molgraph)
Returns the value of the Chem::MolecularGraphProperty::COMMENT property of the molecular graph molgra...
CDPL_CHEM_API void clearMDLExternalRegistryNumber(Reaction &rxn)
Clears the value of the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property of the reaction...
CDPL_CHEM_API void clearMatchExpression(Atom &atom)
Clears the value of the Chem::AtomProperty::MATCH_EXPRESSION property of the atom atom.
CDPL_CHEM_API bool hasTimestamp(const MolecularGraph &molgraph)
Tells whether the Chem::MolecularGraphProperty::TIMESTAMP property of the molecular graph molgraph is...
CDPL_CHEM_API const StringDataBlock::SharedPointer & getReactionData(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::REACTION_DATA property of the reaction rxn.
CDPL_CHEM_API void setTimestamp(MolecularGraph &molgraph, std::time_t time)
Sets the value of the Chem::MolecularGraphProperty::TIMESTAMP property of the molecular graph molgrap...
CDPL_CHEM_API bool hasMDLUserInitials(const MolecularGraph &molgraph)
Tells whether the Chem::MolecularGraphProperty::MDL_USER_INITIALS property of the molecular graph mol...
CDPL_CHEM_API void initSubstructureSearchQuery(MolecularGraph &molgraph, bool overwrite)
Prepares the molecular graph molgraph for use as a substructure search query.
CDPL_CHEM_API const MatchConstraintList::SharedPointer & getMatchConstraints(const Atom &atom)
Returns the value of the Chem::AtomProperty::MATCH_CONSTRAINTS property of the atom atom.
CDPL_CHEM_API void generateMatchExpressions(MolecularGraph &molgraph, bool overwrite)
Generates and stores match expressions for every atom, bond and the molecular graph molgraph itself.
CDPL_CHEM_API void setReactionData(Reaction &rxn, const StringDataBlock::SharedPointer &data)
Sets the value of the Chem::ReactionProperty::REACTION_DATA property of the reaction rxn to data.
CDPL_CHEM_API bool hasReactionData(const Reaction &rxn)
Tells whether the Chem::ReactionProperty::REACTION_DATA property of the reaction rxn is set.
CDPL_CHEM_API bool hasName(const Atom &atom)
Tells whether the Chem::AtomProperty::NAME property of the atom atom is set.
CDPL_CHEM_API const std::string & getMDLUserInitials(const MolecularGraph &molgraph)
Returns the value of the Chem::MolecularGraphProperty::MDL_USER_INITIALS property of the molecular gr...
CDPL_CHEM_API void clearMDLRegistryNumber(MolecularGraph &molgraph)
Clears the value of the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property of the molecular g...
CDPL_CHEM_API const std::string & getName(const Atom &atom)
Returns the value of the Chem::AtomProperty::NAME property of the atom atom.
CDPL_CHEM_API void clearMDLRXNFileVersion(Reaction &rxn)
Clears the value of the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property of the reaction rxn.
CDPL_CHEM_API const AtomMapping::SharedPointer & getAtomMapping(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::ATOM_MAPPING property of the reaction rxn.
CDPL_CHEM_API bool hasMDLInternalRegistryNumber(const Reaction &rxn)
Tells whether the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property of the reaction rxn i...
CDPL_CHEM_API bool hasMDLRXNFileVersion(const Reaction &rxn)
Tells whether the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property of the reaction rxn is set.
CDPL_CHEM_API void setMatchExpression(Atom &atom, const MatchExpression< Atom, MolecularGraph >::SharedPointer &expr)
Sets the value of the Chem::AtomProperty::MATCH_EXPRESSION property of the atom atom to expr.
CDPL_CHEM_API void clearTimestamp(MolecularGraph &molgraph)
Clears the value of the Chem::MolecularGraphProperty::TIMESTAMP property of the molecular graph molgr...
CDPL_CHEM_API bool hasMDLRegistryNumber(const MolecularGraph &molgraph)
Tells whether the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property of the molecular graph m...
CDPL_CHEM_API void setMDLInternalRegistryNumber(Reaction &rxn, const std::string &reg_no)
Sets the value of the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property of the reaction r...
CDPL_CHEM_API MatchExpression< Atom, MolecularGraph >::SharedPointer generateMatchExpression(const Atom &atom, const MolecularGraph &molgraph)
Builds an match expression from the match constraint list attached to the atom atom.
CDPL_CHEM_API const MatchExpression< Atom, MolecularGraph >::SharedPointer & getMatchExpression(const Atom &atom)
Returns the value of the Chem::AtomProperty::MATCH_EXPRESSION property of the atom atom.
CDPL_CHEM_API void setComment(MolecularGraph &molgraph, const std::string &comment)
Sets the value of the Chem::MolecularGraphProperty::COMMENT property of the molecular graph molgraph ...
CDPL_CHEM_API const std::string & getMDLInternalRegistryNumber(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property of the reactio...
CDPL_CHEM_API bool hasMDLExternalRegistryNumber(const Reaction &rxn)
Tells whether the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property of the reaction rxn i...
CDPL_CHEM_API const std::string & getMDLExternalRegistryNumber(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property of the reactio...
CDPL_CHEM_API void setAtomMapping(Reaction &rxn, const AtomMapping::SharedPointer &mapping)
Sets the value of the Chem::ReactionProperty::ATOM_MAPPING property of the reaction rxn to mapping.
CDPL_CHEM_API void setComponentGroups(MolecularGraph &molgraph, const FragmentList::SharedPointer &comp_groups)
Sets the value of the Chem::MolecularGraphProperty::COMPONENT_GROUPS property of the molecular graph ...
CDPL_CHEM_API void clearMDLProgramName(MolecularGraph &molgraph)
Clears the value of the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property of the molecular grap...
CDPL_CHEM_API void clearReactionData(Reaction &rxn)
Clears the value of the Chem::ReactionProperty::REACTION_DATA property of the reaction rxn.
CDPL_CHEM_API void setMDLExternalRegistryNumber(Reaction &rxn, const std::string &reg_no)
Sets the value of the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property of the reaction r...
CDPL_CHEM_API const FragmentList::SharedPointer & getComponentGroups(const MolecularGraph &molgraph)
Returns the value of the Chem::MolecularGraphProperty::COMPONENT_GROUPS property of the molecular gra...
CDPL_CHEM_API void initSubstructureSearchTarget(MolecularGraph &molgraph, bool overwrite)
Prepares the molecular graph molgraph for use as a substructure search target.
CDPL_CHEM_API FragmentList::SharedPointer perceiveComponentGroups(const MolecularGraph &molgraph)
Perceives the component groups of the molecular graph molgraph.
CDPL_CHEM_API void setMDLRXNFileVersion(Reaction &rxn, unsigned int version)
Sets the value of the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property of the reaction rxn to ve...
CDPL_CHEM_API void setMatchConstraints(Atom &atom, const MatchConstraintList::SharedPointer &constr)
Sets the value of the Chem::AtomProperty::MATCH_CONSTRAINTS property of the atom atom to constr.
CDPL_CHEM_API std::time_t getTimestamp(const MolecularGraph &molgraph)
Returns the value of the Chem::MolecularGraphProperty::TIMESTAMP property of the molecular graph molg...
CDPL_CHEM_API std::uint64_t calcHashCode(const MolecularGraph &molgraph, unsigned int atom_flags=AtomPropertyFlag::DEFAULT, unsigned int bond_flags=BondPropertyFlag::DEFAULT, bool ord_h_deplete=true)
Computes a 64-bit hash code for the molecular graph molgraph taking into account the specified atom a...
CDPL_CHEM_API std::size_t getMaxComponentGroupID(const AtomContainer &cntnr)
Returns the largest component-group ID assigned to any atom of cntnr.
CDPL_CHEM_API void clearMDLMoleculeRecord(Reaction &rxn)
Clears the value of the Chem::ReactionProperty::MDL_MOLECULE_RECORD property of the reaction rxn.
CDPL_CHEM_API bool hasMatchExpression(const Atom &atom)
Tells whether the Chem::AtomProperty::MATCH_EXPRESSION property of the atom atom is set.
CDPL_CHEM_API void setComponentMatchConstraints(Reaction &rxn, const MatchConstraintList::SharedPointer &constr, bool overwrite)
Sets the molecular graph-level match constraint list constr on every component of the reaction rxn.
CDPL_CHEM_API void clearComment(MolecularGraph &molgraph)
Clears the value of the Chem::MolecularGraphProperty::COMMENT property of the molecular graph molgrap...
CDPL_CHEM_API void clearComponentGroups(MolecularGraph &molgraph)
Clears the value of the Chem::MolecularGraphProperty::COMPONENT_GROUPS property of the molecular grap...
CDPL_CHEM_API const std::string & getMDLProgramName(const MolecularGraph &molgraph)
Returns the value of the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property of the molecular gra...
CDPL_CHEM_API void clearName(Atom &atom)
Clears the value of the Chem::AtomProperty::NAME property of the atom atom.
CDPL_CHEM_API bool hasComponentGroups(const MolecularGraph &molgraph)
Tells whether the Chem::MolecularGraphProperty::COMPONENT_GROUPS property of the molecular graph molg...
CDPL_CHEM_API void setAtomMatchConstraints(MolecularGraph &molgraph, const MatchConstraintList::SharedPointer &constr, bool overwrite)
Sets the match constraint list constr on every atom of the molecular graph molgraph.
CDPL_CHEM_API void setMDLRegistryNumber(MolecularGraph &molgraph, std::size_t reg_no)
Sets the value of the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property of the molecular gra...
CDPL_CHEM_API void clearAtomMapping(Reaction &rxn)
Clears the value of the Chem::ReactionProperty::ATOM_MAPPING property of the reaction rxn.
CDPL_CHEM_API std::size_t getMDLRegistryNumber(const MolecularGraph &molgraph)
Returns the value of the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property of the molecular ...
CDPL_CHEM_API std::size_t getMaxAtomMappingID(const AtomContainer &cntnr)
Returns the largest atom mapping ID assigned to any atom of cntnr.
CDPL_CHEM_API void clearMatchConstraints(Atom &atom)
Clears the value of the Chem::AtomProperty::MATCH_CONSTRAINTS property of the atom atom.
CDPL_CHEM_API void clearMDLUserInitials(MolecularGraph &molgraph)
Clears the value of the Chem::MolecularGraphProperty::MDL_USER_INITIALS property of the molecular gra...
CDPL_CHEM_API bool hasAtomMapping(const Reaction &rxn)
Tells whether the Chem::ReactionProperty::ATOM_MAPPING property of the reaction rxn is set.
CDPL_CHEM_API bool hasMatchConstraints(const Atom &atom)
Tells whether the Chem::AtomProperty::MATCH_CONSTRAINTS property of the atom atom is set.
CDPL_CHEM_API void calcBasicProperties(MolecularGraph &molgraph, bool overwrite)
Computes basic atom/bond/molecular graph properties (aromaticity, SSSR, etc.) of the molecular graph ...
CDPL_CHEM_API void setMDLMoleculeRecord(Reaction &rxn, const Molecule::SharedPointer &mol_rec)
Sets the value of the Chem::ReactionProperty::MDL_MOLECULE_RECORD property of the reaction rxn to mol...
CDPL_CHEM_API bool hasComment(const MolecularGraph &molgraph)
Tells whether the Chem::MolecularGraphProperty::COMMENT property of the molecular graph molgraph is s...
CDPL_CHEM_API void setMDLProgramName(MolecularGraph &molgraph, const std::string &name)
Sets the value of the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property of the molecular graph ...
CDPL_CHEM_API bool hasMDLMoleculeRecord(const Reaction &rxn)
Tells whether the Chem::ReactionProperty::MDL_MOLECULE_RECORD property of the reaction rxn is set.
CDPL_CHEM_API void setBondMatchConstraints(MolecularGraph &molgraph, const MatchConstraintList::SharedPointer &constr, bool overwrite)
Sets the match constraint list constr on every bond of the molecular graph molgraph.
CDPL_CHEM_API void clearMDLInternalRegistryNumber(Reaction &rxn)
Clears the value of the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property of the reaction...
CDPL_CHEM_API bool generateSMILES(const MolecularGraph &molgraph, std::string &smiles, bool canonical=false, bool ord_h_deplete=true, unsigned int atom_flags=AtomPropertyFlag::DEFAULT, unsigned int bond_flags=BondPropertyFlag::DEFAULT)
Generates a SMILES string for the molecular graph molgraph.
CDPL_CHEM_API unsigned int getMDLRXNFileVersion(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property of the reaction rxn.
CDPL_CHEM_API bool hasMDLProgramName(const MolecularGraph &molgraph)
Tells whether the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property of the molecular graph molg...
CDPL_CHEM_API void setName(Atom &atom, const std::string &name)
Sets the value of the Chem::AtomProperty::NAME property of the atom atom to name.
The namespace of the Chemical Data Processing Library.