COPASI API  4.16.103
CMetabNameInterface.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) 2003 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 //
16 //
17 // C++ Interface: $MODULE$
18 //
19 // Description:
20 //
21 //
22 // Author: sven <sven@ares>, (C) 2003
23 //
24 // Copyright: See COPYING file that comes with this distribution
25 //
26 //
27 #ifndef COPASI_CMetabNameInterface
28 #define COPASI_CMetabNameInterface
29 
30 #include <string>
31 
32 class CModel;
33 class CMetab;
34 
35 /**
36  * This class handles the display names of metabolites. It converts "Species" to
37  * "Species {Compartment}" if the metabolite name is not unique. If it is unique
38  * (that means it occurs in only one compartment) then the "{Compartment}" is not added.
39  */
40 /** @dia:pos 51.5,-17.9 */
42 {
43 public:
45 
47 
48  /**
49  * This returns a name to use for display in the GUI. If the name of the
50  * metabolite is unique it is used unaltered. If it is not then the compartment
51  * is added to the name to make it unique.
52  */
53  static std::string getDisplayName(const CModel* model, const std::string & key, const bool & quoted);
54 
55  /**
56  * This returns a name to use for display in the GUI. If the name of the
57  * metabolite is unique it is used unaltered. If it is not then the compartment
58  * is added to the name to make it unique.
59  */
60  static std::string getDisplayName(const CModel* model, const CMetab & metab, const bool & quoted);
61 
62  /**
63  * This returns a name to use for display in the GUI. If the name of the
64  * metabolite is unique it is used unaltered. If it is not then the compartment
65  * is added to the name to make it unique.
66  */
67  static std::string getDisplayName(const CModel* model,
68  const std::string & metabolite,
69  const std::string & compartment,
70  const bool & quoted);
71 
72  /**
73  * This tries to find the metabolite with the given name. If the name is not unique and
74  * is given without a compartment then the first occurrence of a metabolite with this name
75  * is returned.
76  */
77  static std::string getMetaboliteKey(const CModel* model,
78  const std::string & metabolite,
79  const std::string & compartment);
80 
81  static CMetab * getMetabolite(const CModel* model,
82  const std::string & metabolite,
83  const std::string & compartment);
84 
85  /**
86  * This returns whether the metabolite name is unique.
87  */
88  static bool isUnique(const CModel* model, const std::string & name);
89 
90  /**
91  * This returns whether a metabolite with the given name does exist. If a compartment is
92  * also given (as an appendix to the name) then it only returns true if the metabolite
93  * exists in the specified compartment.
94  */
95  static bool doesExist(const CModel* model,
96  const std::string & metabolite,
97  const std::string & compartment);
98 
99  static std::pair< std::string, std::string > splitDisplayName(const std::string & name);
100 
101  static std::string unQuote(const std::string & displayName);
102 
103 #ifdef XXXX
104  /**
105  * This extracts the compartment name from the given metabolite display name. If no compartment name is
106  * present in the given metabolite name then the name of the (first) compartment the metabolite is really
107  * in is given. If the metabolite does not exist and the name does not contain a compartment
108  * then the name of the first compartment in the model is returned.
109  */
110  static std::string extractCompartmentName(const std::string & name);
111 
112  /**
113  * This extracts the metabolite name from the given metabolite display name.
114  */
115  static std::string extractMetabName(const std::string & name);
116 
117  /**
118  * This checks if the metabolite name (possibly including the compartment) is valid.
119  * A valid name must be in the format of "species" or "species{compartment}"
120  * and does not contain white spaces. (Other special characters are not considered yet.)
121  * Neither metabolite nor compartment can be an empty string.
122  */
123  static bool isValidMetabDisplayName(const std::string & name);
124 #endif // XXXX
125 };
126 
127 #endif
static std::string getMetaboliteKey(const CModel *model, const std::string &metabolite, const std::string &compartment)
static std::string unQuote(const std::string &displayName)
static CMetab * getMetabolite(const CModel *model, const std::string &metabolite, const std::string &compartment)
static std::string getDisplayName(const CModel *model, const std::string &key, const bool &quoted)
Definition: CMetab.h:178
static std::pair< std::string, std::string > splitDisplayName(const std::string &name)
static bool isUnique(const CModel *model, const std::string &name)
static bool doesExist(const CModel *model, const std::string &metabolite, const std::string &compartment)
Definition: CModel.h:50