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 
175 
185 
186 
193 
200 
206 
213 
214 
221 
228 
234 
241 
248 
258 
259 
266 
273 
279 
286 
294 
304 
305 
316  CDPL_CHEM_API bool generateSMILES(const Reaction& rxn, std::string& smiles, bool canonical = false,
317  bool ord_h_deplete = true, unsigned int atom_flags = AtomPropertyFlag::DEFAULT,
318  unsigned int bond_flags = BondPropertyFlag::DEFAULT);
319 
330  CDPL_CHEM_API std::uint64_t calcHashCode(const Reaction& rxn, unsigned int role_mask = ReactionRole::ALL,
331  unsigned int atom_flags = AtomPropertyFlag::DEFAULT,
332  unsigned int bond_flags = BondPropertyFlag::DEFAULT,
333  bool ord_h_deplete = true);
334 
335 
341  CDPL_CHEM_API const std::string& getMDLUserInitials(const Reaction& rxn);
342 
348  CDPL_CHEM_API void setMDLUserInitials(Reaction& rxn, const std::string& initials);
349 
355 
362 
363 
369  CDPL_CHEM_API const std::string& getMDLProgramName(const Reaction& rxn);
370 
376  CDPL_CHEM_API void setMDLProgramName(Reaction& rxn, const std::string& name);
377 
383 
390 
391 
397  CDPL_CHEM_API std::size_t getMDLRegistryNumber(const Reaction& rxn);
398 
404  CDPL_CHEM_API void setMDLRegistryNumber(Reaction& rxn, std::size_t reg_no);
405 
411 
418 
419 
426 
433 
439 
446 
447 
454 
461 
467 
474 
475 
481  CDPL_CHEM_API const std::string& getMDLInternalRegistryNumber(const Reaction& rxn);
482 
488  CDPL_CHEM_API void setMDLInternalRegistryNumber(Reaction& rxn, const std::string& reg_no);
489 
495 
502 
503 
509  CDPL_CHEM_API const std::string& getMDLExternalRegistryNumber(const Reaction& rxn);
510 
516  CDPL_CHEM_API void setMDLExternalRegistryNumber(Reaction& rxn, const std::string& reg_no);
517 
523 
530 
531 
537  CDPL_CHEM_API unsigned int getMDLRXNFileVersion(const Reaction& rxn);
538 
544  CDPL_CHEM_API void setMDLRXNFileVersion(Reaction& rxn, unsigned int version);
545 
551 
558 
559 
566 
572  CDPL_CHEM_API std::size_t getMaxAtomMappingID(const Reaction& rxn);
573 
574 
583 
592 
601 
608  CDPL_CHEM_API void generateMatchExpressions(Reaction& rxn, bool overwrite);
609 
617 
625 
633  CDPL_CHEM_API void calcBasicProperties(Reaction& rxn, bool overwrite);
634 
635  } // namespace Chem
636 } // namespace CDPL
637 
638 #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:58
std::shared_ptr< FragmentList > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated FragmentList instances.
Definition: FragmentList.hpp:53
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:153
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 rxn.
CDPL_CHEM_API void setMDLUserInitials(MolecularGraph &molgraph, const std::string &initials)
Sets the Chem::MolecularGraphProperty::MDL_USER_INITIALS property of molgraph to initials.
CDPL_CHEM_API AtomMapping::SharedPointer perceiveAtomMapping(const Reaction &rxn)
Derives the reactant-to-product atom mapping from the atom mapping IDs of rxn without modifying it.
CDPL_CHEM_API const std::string & getComment(const MolecularGraph &molgraph)
Returns the Chem::MolecularGraphProperty::COMMENT property of molgraph.
CDPL_CHEM_API void clearMDLExternalRegistryNumber(Reaction &rxn)
Removes the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property from rxn.
CDPL_CHEM_API void clearMatchExpression(Atom &atom)
Removes the Chem::AtomProperty::MATCH_EXPRESSION property from atom.
CDPL_CHEM_API bool hasTimestamp(const MolecularGraph &molgraph)
Tells whether molgraph carries the Chem::MolecularGraphProperty::TIMESTAMP property.
CDPL_CHEM_API const StringDataBlock::SharedPointer & getReactionData(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::REACTION_DATA property of rxn.
CDPL_CHEM_API void setTimestamp(MolecularGraph &molgraph, std::time_t time)
Sets the Chem::MolecularGraphProperty::TIMESTAMP property of molgraph to time.
CDPL_CHEM_API bool hasMDLUserInitials(const MolecularGraph &molgraph)
Tells whether molgraph carries the Chem::MolecularGraphProperty::MDL_USER_INITIALS property.
CDPL_CHEM_API void initSubstructureSearchQuery(MolecularGraph &molgraph, bool overwrite)
Prepares molgraph for use as a substructure search query (precomputes match expressions and required ...
CDPL_CHEM_API const MatchConstraintList::SharedPointer & getMatchConstraints(const Atom &atom)
Returns the Chem::AtomProperty::MATCH_CONSTRAINTS property of atom.
CDPL_CHEM_API void generateMatchExpressions(MolecularGraph &molgraph, bool overwrite)
Generates and stores match expressions for every atom, bond and the molecular graph itself.
CDPL_CHEM_API void setReactionData(Reaction &rxn, const StringDataBlock::SharedPointer &data)
Sets the Chem::ReactionProperty::REACTION_DATA property of rxn to data.
CDPL_CHEM_API bool hasReactionData(const Reaction &rxn)
Tells whether rxn carries the Chem::ReactionProperty::REACTION_DATA property.
CDPL_CHEM_API bool hasName(const Atom &atom)
Tells whether atom carries the Chem::AtomProperty::NAME property.
CDPL_CHEM_API const std::string & getMDLUserInitials(const MolecularGraph &molgraph)
Returns the Chem::MolecularGraphProperty::MDL_USER_INITIALS property of molgraph.
CDPL_CHEM_API void clearMDLRegistryNumber(MolecularGraph &molgraph)
Removes the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property from molgraph.
CDPL_CHEM_API const std::string & getName(const Atom &atom)
Returns the Chem::AtomProperty::NAME property of atom.
CDPL_CHEM_API void clearMDLRXNFileVersion(Reaction &rxn)
Removes the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property from rxn.
CDPL_CHEM_API const AtomMapping::SharedPointer & getAtomMapping(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::ATOM_MAPPING property of rxn.
CDPL_CHEM_API bool hasMDLInternalRegistryNumber(const Reaction &rxn)
Tells whether rxn carries the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property.
CDPL_CHEM_API bool hasMDLRXNFileVersion(const Reaction &rxn)
Tells whether rxn carries the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property.
CDPL_CHEM_API void setMatchExpression(Atom &atom, const MatchExpression< Atom, MolecularGraph >::SharedPointer &expr)
Sets the Chem::AtomProperty::MATCH_EXPRESSION property of atom to expr.
CDPL_CHEM_API void clearTimestamp(MolecularGraph &molgraph)
Removes the Chem::MolecularGraphProperty::TIMESTAMP property from molgraph.
CDPL_CHEM_API bool hasMDLRegistryNumber(const MolecularGraph &molgraph)
Tells whether molgraph carries the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property.
CDPL_CHEM_API void setMDLInternalRegistryNumber(Reaction &rxn, const std::string &reg_no)
Sets the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property of rxn to reg_no.
CDPL_CHEM_API MatchExpression< Atom, MolecularGraph >::SharedPointer generateMatchExpression(const Atom &atom, const MolecularGraph &molgraph)
Builds an atom-level match expression from the match-constraint list attached to atom.
CDPL_CHEM_API const MatchExpression< Atom, MolecularGraph >::SharedPointer & getMatchExpression(const Atom &atom)
Returns the Chem::AtomProperty::MATCH_EXPRESSION property of atom.
CDPL_CHEM_API void setComment(MolecularGraph &molgraph, const std::string &comment)
Sets the Chem::MolecularGraphProperty::COMMENT property of molgraph to comment.
CDPL_CHEM_API const std::string & getMDLInternalRegistryNumber(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property of rxn.
CDPL_CHEM_API bool hasMDLExternalRegistryNumber(const Reaction &rxn)
Tells whether rxn carries the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property.
CDPL_CHEM_API const std::string & getMDLExternalRegistryNumber(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property of rxn.
CDPL_CHEM_API void setAtomMapping(Reaction &rxn, const AtomMapping::SharedPointer &mapping)
Sets the Chem::ReactionProperty::ATOM_MAPPING property of rxn to mapping.
CDPL_CHEM_API void setComponentGroups(MolecularGraph &molgraph, const FragmentList::SharedPointer &comp_groups)
Sets the Chem::MolecularGraphProperty::COMPONENT_GROUPS property of molgraph to comp_groups.
CDPL_CHEM_API void clearMDLProgramName(MolecularGraph &molgraph)
Removes the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property from molgraph.
CDPL_CHEM_API void clearReactionData(Reaction &rxn)
Removes the Chem::ReactionProperty::REACTION_DATA property from rxn.
CDPL_CHEM_API void setMDLExternalRegistryNumber(Reaction &rxn, const std::string &reg_no)
Sets the Chem::ReactionProperty::MDL_EXTERNAL_REGISTRY_NUMBER property of rxn to reg_no.
CDPL_CHEM_API const FragmentList::SharedPointer & getComponentGroups(const MolecularGraph &molgraph)
Returns the Chem::MolecularGraphProperty::COMPONENT_GROUPS property of molgraph.
CDPL_CHEM_API void initSubstructureSearchTarget(MolecularGraph &molgraph, bool overwrite)
Prepares molgraph for use as a substructure search target (precomputes required cached properties).
CDPL_CHEM_API FragmentList::SharedPointer perceiveComponentGroups(const MolecularGraph &molgraph)
Perceives the component groups of molgraph (from atom-level Chem::AtomProperty::COMPONENT_GROUP_ID va...
CDPL_CHEM_API void setMDLRXNFileVersion(Reaction &rxn, unsigned int version)
Sets the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property of rxn to version.
CDPL_CHEM_API void setMatchConstraints(Atom &atom, const MatchConstraintList::SharedPointer &constr)
Sets the Chem::AtomProperty::MATCH_CONSTRAINTS property of atom to constr.
CDPL_CHEM_API std::time_t getTimestamp(const MolecularGraph &molgraph)
Returns the Chem::MolecularGraphProperty::TIMESTAMP property of molgraph.
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 molgraph taking into account the specified atom and bond properties.
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)
Removes the Chem::ReactionProperty::MDL_MOLECULE_RECORD property from rxn.
CDPL_CHEM_API bool hasMatchExpression(const Atom &atom)
Tells whether atom carries the Chem::AtomProperty::MATCH_EXPRESSION property.
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 rxn.
CDPL_CHEM_API void clearComment(MolecularGraph &molgraph)
Removes the Chem::MolecularGraphProperty::COMMENT property from molgraph.
CDPL_CHEM_API void clearComponentGroups(MolecularGraph &molgraph)
Removes the Chem::MolecularGraphProperty::COMPONENT_GROUPS property from molgraph.
CDPL_CHEM_API const std::string & getMDLProgramName(const MolecularGraph &molgraph)
Returns the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property of molgraph.
CDPL_CHEM_API void clearName(Atom &atom)
Removes the Chem::AtomProperty::NAME property from atom.
CDPL_CHEM_API bool hasComponentGroups(const MolecularGraph &molgraph)
Tells whether molgraph carries the Chem::MolecularGraphProperty::COMPONENT_GROUPS property.
CDPL_CHEM_API void setAtomMatchConstraints(MolecularGraph &molgraph, const MatchConstraintList::SharedPointer &constr, bool overwrite)
Sets the atom-level match-constraint list constr on every atom of molgraph.
CDPL_CHEM_API void setMDLRegistryNumber(MolecularGraph &molgraph, std::size_t reg_no)
Sets the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property of molgraph to reg_no.
CDPL_CHEM_API void clearAtomMapping(Reaction &rxn)
Removes the Chem::ReactionProperty::ATOM_MAPPING property from rxn.
CDPL_CHEM_API std::size_t getMDLRegistryNumber(const MolecularGraph &molgraph)
Returns the Chem::MolecularGraphProperty::MDL_REGISTRY_NUMBER property of molgraph.
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)
Removes the Chem::AtomProperty::MATCH_CONSTRAINTS property from atom.
CDPL_CHEM_API void clearMDLUserInitials(MolecularGraph &molgraph)
Removes the Chem::MolecularGraphProperty::MDL_USER_INITIALS property from molgraph.
CDPL_CHEM_API bool hasAtomMapping(const Reaction &rxn)
Tells whether rxn carries the Chem::ReactionProperty::ATOM_MAPPING property.
CDPL_CHEM_API bool hasMatchConstraints(const Atom &atom)
Tells whether atom carries the Chem::AtomProperty::MATCH_CONSTRAINTS property.
CDPL_CHEM_API void calcBasicProperties(MolecularGraph &molgraph, bool overwrite)
Computes the basic per-atom/per-bond properties (aromaticity, ring info, etc.) of molgraph.
CDPL_CHEM_API void setMDLMoleculeRecord(Reaction &rxn, const Molecule::SharedPointer &mol_rec)
Sets the Chem::ReactionProperty::MDL_MOLECULE_RECORD property of rxn to mol_rec.
CDPL_CHEM_API bool hasComment(const MolecularGraph &molgraph)
Tells whether molgraph carries the Chem::MolecularGraphProperty::COMMENT property.
CDPL_CHEM_API void setMDLProgramName(MolecularGraph &molgraph, const std::string &name)
Sets the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property of molgraph to name.
CDPL_CHEM_API bool hasMDLMoleculeRecord(const Reaction &rxn)
Tells whether rxn carries the Chem::ReactionProperty::MDL_MOLECULE_RECORD property.
CDPL_CHEM_API void setBondMatchConstraints(MolecularGraph &molgraph, const MatchConstraintList::SharedPointer &constr, bool overwrite)
Sets the bond-level match-constraint list constr on every bond of molgraph.
CDPL_CHEM_API void clearMDLInternalRegistryNumber(Reaction &rxn)
Removes the Chem::ReactionProperty::MDL_INTERNAL_REGISTRY_NUMBER property from rxn.
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 molgraph.
CDPL_CHEM_API unsigned int getMDLRXNFileVersion(const Reaction &rxn)
Returns the value of the Chem::ReactionProperty::MDL_RXN_FILE_VERSION property of rxn.
CDPL_CHEM_API bool hasMDLProgramName(const MolecularGraph &molgraph)
Tells whether molgraph carries the Chem::MolecularGraphProperty::MDL_PROGRAM_NAME property.
CDPL_CHEM_API void setName(Atom &atom, const std::string &name)
Sets the Chem::AtomProperty::NAME property of atom to name.
The namespace of the Chemical Data Processing Library.