COPASI API  4.16.103
CChemEqInterface.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/model/CChemEqInterface.h,v $
3 // $Revision: 1.21 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/03/07 19:30:49 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 #ifndef CCHEMEQINTERFACE_H
24 #define CCHEMEQINTERFACE_H
25 
26 #include <string>
27 #include <vector>
28 #include <set>
29 
31 
32 class CChemEq;
33 class CModel;
34 class CReaction;
35 class CCompartment;
36 
37 /**
38  * This class describes a chemical equation based on metabolite names
39  * It supports parsing and generating string representations.
40  * Note that this class handles only metab names without caring about whether
41  * these metabs exist in the model. There is however a method to create
42  * the missing metabs.
43  */
45 {
46 private:
48 
49  std::vector< std::string > mSubstrateNames;
50  std::vector< std::string > mProductNames;
51  std::vector< std::string > mModifierNames;
52 
53  std::vector< C_FLOAT64 > mSubstrateMult;
54  std::vector< C_FLOAT64 > mProductMult;
55  std::vector< C_FLOAT64 > mModifierMult;
56 
57  std::vector< std::string > mSubstrateCompartments;
58  std::vector< std::string > mProductCompartments;
59  std::vector< std::string > mModifierCompartments;
60 
61  std::vector< std::string > mSubstrateDisplayNames;
62  std::vector< std::string > mProductDisplayNames;
63  std::vector< std::string > mModifierDisplayNames;
64 
66 
67 private:
69 
70 public:
71  CChemEqInterface(CModel * pModel);
72 
74 
75  std::string getChemEqString(bool expanded) const;
76  bool setChemEqString(const std::string & ces);
77 
78  bool loadFromChemEq(const CChemEq & ce);
79  bool writeToChemEq(CChemEq & ce) const;
80 
81  const std::vector<C_FLOAT64> & getListOfMultiplicities(CFunctionParameter::Role role) const;
82  const std::vector<std::string> & getListOfDisplayNames(CFunctionParameter::Role role) const;
83 
84  /**
85  * add a modifier to the chemical equation. It is only added if it is not alreay in there.
86  */
87  void addModifier(const std::string & name);
88  void clearModifiers();
89 
90  bool getReversibility() const {return mReversibility;};
91  void setReversibility(bool rev) {mReversibility = rev;};
92 
93  /**
94  * this method tries to find out if the chemical equation involves several compartments
95  * in a given model. It only takes into account the metabs that
96  * actually exist in the model. A non existing metabolite is assumed
97  * not to be in a different compartment
98  */
99  bool isMulticompartment() const;
100 
101  /**
102  * convenience method. If the reaction is single compartment the
103  * compartment is returned, else NULL.
104  */
105  const CCompartment * getCompartment() const;
106 
107  void reverse();
108 
109  size_t getMolecularity(CFunctionParameter::Role role) const;
110 
111  std::set<std::string> listOfNonUniqueMetabNames() const;
112  std::set< std::pair< std::string, std::string > > listOfNonExistingMetabNames() const;
113 
115 
116  //convenience methods:
117  static std::string getChemEqString(CModel * model, const CReaction & rea, bool expanded);
118  static void setChemEqFromString(CModel * model, CReaction & rea, const std::string & ces);
119  static bool isValidEq(const std::string & eq);
120 
121 private:
122  void buildDisplayNames();
123  void completeCompartments();
124  static std::string writeElement(const std::string & name, C_FLOAT64 mult, bool expanded);
125 };
126 
127 #endif
size_t getMolecularity(CFunctionParameter::Role role) const
bool loadFromChemEq(const CChemEq &ce)
void setReversibility(bool rev)
std::vector< std::string > mModifierCompartments
static void setChemEqFromString(CModel *model, CReaction &rea, const std::string &ces)
std::vector< C_FLOAT64 > mSubstrateMult
std::vector< std::string > mModifierNames
const CCompartment * getCompartment() const
std::vector< C_FLOAT64 > mModifierMult
std::set< std::string > listOfNonUniqueMetabNames() const
static bool isValidEq(const std::string &eq)
std::vector< std::string > mSubstrateDisplayNames
std::vector< C_FLOAT64 > mProductMult
std::vector< std::string > mProductNames
const std::vector< std::string > & getListOfDisplayNames(CFunctionParameter::Role role) const
bool setChemEqString(const std::string &ces)
std::string getChemEqString(bool expanded) const
const std::vector< C_FLOAT64 > & getListOfMultiplicities(CFunctionParameter::Role role) const
static std::string writeElement(const std::string &name, C_FLOAT64 mult, bool expanded)
bool writeToChemEq(CChemEq &ce) const
#define C_FLOAT64
Definition: copasi.h:92
void addModifier(const std::string &name)
Definition: CModel.h:50
bool isMulticompartment() const
std::vector< std::string > mModifierDisplayNames
bool getReversibility() const
std::vector< std::string > mProductDisplayNames
std::set< std::pair< std::string, std::string > > listOfNonExistingMetabNames() const
std::vector< std::string > mSubstrateCompartments
std::vector< std::string > mSubstrateNames
std::vector< std::string > mProductCompartments