COPASI API  4.16.103
CChemEq.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /**
16  * CChemEq class.
17  * Describing a chemical equation.
18  * The CChemEq class handles everything a reaction has to do with metabolites.
19  *
20  * Created for COPASI by Stefan Hoops 2001
21  */
22 
23 #ifndef COPASI_CChemEq
24 #define COPASI_CChemEq
25 
26 #include <string>
27 
28 #include "model/CChemEqElement.h"
30 
31 class CCompartment;
32 
33 class CChemEq : public CCopasiContainer
34 {
35 public:
37  {
38  PRODUCT = 0,
42  };
43 
44  // Operations
45 public:
46  /**
47  * Default constructor
48  * @param const std::string & name (default: "NoName")
49  * @param const CCopasiContainer * pParent (default: NULL)
50  */
51  CChemEq(const std::string & name = "NoName",
52  const CCopasiContainer * pParent = NULL);
53 
54  /**
55  * Copy constructor
56  * @param "const CChemEq &" src
57  * @param const CCopasiContainer * pParent (default: NULL)
58  */
59  CChemEq(const CChemEq & src,
60  const CCopasiContainer * pParent = NULL);
61 
62  /**
63  * Destructor
64  */
65  virtual ~CChemEq();
66 
67  /**
68  * Cleanup
69  */
70  void cleanup();
71 
72  /**
73  * Set the reversibility of the of the equation
74  * @param const bool & const bool & reversible
75  */
76  void setReversibility(const bool & reversible);
77 
78  /**
79  * Retrieve the reversibility of the equation
80  * @return const bool & reversible
81  */
82  const bool & getReversibility() const;
83 
84  /**
85  * Add a species to the equation
86  * @param const std::string & speciesKey
87  * @param const C_FLOAT64 & multiplicity
88  * @param const MetaboliteRole & role
89  * @return bool success
90  */
91  bool addMetabolite(const std::string & key, const C_FLOAT64 multiplicity, const MetaboliteRole & role);
92 
93  /**
94  * Retrieves the vector of substrates and their multiplicity
95  * in the chemical reaction.
96  * @return "vector < CChemEqElement * > &" substrates
97  */
99 
100  /**
101  * Retrieves the vector of products and their multiplicity
102  * in the chemical reaction.
103  * @return "vector < CChemEqElement * > &" products
104  */
106 
107  /**
108  * Retrieves the vector of Modifiers and their multiplicity
109  */
111 
112  /**
113  * Retrieves the vector of metabolites and their total balance
114  * in the chemical reaction.
115  * @return "vector < CChemEqElement * > &" balances
116  */
118 
119  /**
120  * Returns the number of compartments the chemical equation is associated
121  * with.
122  */
123  size_t getCompartmentNumber() const;
124 
125  /**
126  * Retrieves a set of the compartments.
127  */
128  std::set< const CCompartment * > getCompartments() const;
129 
130  /**
131  * Retrieve the largest compartment that the reaction touches.
132  * This is time dependent it can only be called after update initial values
133  * has been called. Note for an empty reaction a NULL pointer is returned.
134  * @return const CCompartment * pCompartment
135  */
136  const CCompartment * getLargestCompartment() const;
137 
138  /**
139  * Checks if it is possible to figure out a compartment from the
140  * information in the chemical equation. If there are substrates and if
141  * all the substrates are in the same compartment this compartment will be
142  * returned. If there are no substrates and there are Products and all Products are in the
143  * same compartment this compartment will be returned, else an exception
144  * will be thrown.
145  */
146  //const CCompartment* CheckAndGetFunctionCompartment() const;
147 
148  /**
149  * This returns the sum of the multiplicities
150  */
151  size_t getMolecularity(const MetaboliteRole role) const;
152 
153  /**
154  * Sets the stoichiometry of the chemical element that corresponds to the
155  * given metabolite and role to the new value.
156  * The role has to be either CChemEqElement::SUBSTRATE or
157  * CChemEqElement::PRODUCT.
158  * If the role is invalid, the multiplicity is negative or zero or if the element for
159  * the metabolite and role can not be found in the chemical equation, false is returned and
160  * nothing is changed.
161  */
162  bool setMultiplicity(const CMetab* pMetab, C_FLOAT64 newMult, MetaboliteRole role);
163 
164 private:
165 
166  /**
167  * Adds an element to the vector given by structure. The element is
168  * either SUBSTRATE or PRODUCT.
169  * @param "CCopasiVector < CChemEqElement > &" structure
170  * @param "const CChemEqElement &" element
171  * @param "CChemEq::MetaboliteRole" role (
172  */
174  const CChemEqElement & element,
176 
177  /**
178  * Friend declaration for ostream operator
179  * @param std::ostream & os
180  * @param const CChemEq & d
181  * @return std::ostream & os
182  */
183  friend std::ostream & operator<<(std::ostream & os, const CChemEq & d);
184 
185  // Attributes
186 private:
187  /**
188  * Indicates whether the chemical equation is reversible
189  */
191 
192  /**
193  * A vector of substrates and their multiplicity in the chemical reaction
194  * @supplierCardinality 0..*
195  * @label Substrates
196  */
198 
199  /**
200  * A vector of products and their multiplicity in the chemical reaction
201  * @supplierCardinality 0..*
202  * @label Products
203  */
205 
206  /**
207  * A vector of modifiers in the chemical reaction.
208  */
210 
211  /**
212  * A vector of metabolites and their total balance in the chemical reaction
213  * @supplierCardinality 0..*
214  * @label Stoichiometry
215  */
217 };
218 
219 #endif // COPASI_CChemEq
size_t getCompartmentNumber() const
Definition: CChemEq.cpp:110
CCopasiVector< CChemEqElement > mModifiers
Definition: CChemEq.h:209
bool setMultiplicity(const CMetab *pMetab, C_FLOAT64 newMult, MetaboliteRole role)
Definition: CChemEq.cpp:268
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
const CCopasiVector< CChemEqElement > & getBalances() const
Definition: CChemEq.cpp:69
friend std::ostream & operator<<(std::ostream &os, const CChemEq &d)
Definition: CChemEq.cpp:242
Definition: CMetab.h:178
void addElement(CCopasiVector< CChemEqElement > &structure, const CChemEqElement &element, CChemEq::MetaboliteRole role=CChemEq::PRODUCT)
Definition: CChemEq.cpp:180
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
std::set< const CCompartment * > getCompartments() const
Definition: CChemEq.cpp:115
CChemEq(const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
Definition: CChemEq.cpp:30
const bool & getReversibility() const
Definition: CChemEq.cpp:77
void cleanup()
Definition: CChemEq.cpp:52
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
bool addMetabolite(const std::string &key, const C_FLOAT64 multiplicity, const MetaboliteRole &role)
Definition: CChemEq.cpp:80
MetaboliteRole
Definition: CChemEq.h:36
virtual ~CChemEq()
Definition: CChemEq.cpp:50
#define C_FLOAT64
Definition: copasi.h:92
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
const CCopasiVector< CChemEqElement > & getModifiers() const
Definition: CChemEq.cpp:66
bool mReversible
Definition: CChemEq.h:190
size_t getMolecularity(const MetaboliteRole role) const
Definition: CChemEq.cpp:210
const CCompartment * getLargestCompartment() const
Definition: CChemEq.cpp:137
void setReversibility(const bool &reversible)
Definition: CChemEq.cpp:72