COPASI API  4.16.103
CChemEqInterface.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2015 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 #include <sstream>
16 
17 #include "copasi.h"
18 #include "CChemEqInterface.h"
19 #include "CMetabNameInterface.h"
20 #include "CChemEq.h"
21 #include "CChemEqParser.h"
22 #include "CReaction.h"
23 #include "CModel.h"
24 
26 #include "utilities/utility.h"
27 
29  mpModel(NULL),
30  mSubstrateNames(),
31  mProductNames(),
32  mModifierNames(),
33  mSubstrateMult(),
34  mProductMult(),
35  mModifierMult(),
36  mSubstrateCompartments(),
37  mProductCompartments(),
38  mModifierCompartments(),
39  mSubstrateDisplayNames(),
40  mProductDisplayNames(),
41  mModifierDisplayNames(),
42  mReversibility(false)
43 {}
44 
46  mpModel(pModel),
47  mSubstrateNames(),
48  mProductNames(),
49  mModifierNames(),
50  mSubstrateMult(),
51  mProductMult(),
52  mModifierMult(),
53  mSubstrateCompartments(),
54  mProductCompartments(),
55  mModifierCompartments(),
56  mSubstrateDisplayNames(),
57  mProductDisplayNames(),
58  mModifierDisplayNames(),
59  mReversibility(false)
60 {}
61 
63 {}
64 
65 std::string CChemEqInterface::getChemEqString(bool expanded) const
66 {
67  std::string ChemicalEquation;
68  size_t j;
69 
70  if ((mSubstrateNames.size() == 0) && (mProductNames.size() == 0) && (mModifierNames.size() == 0))
71  return "";
72 
73  for (j = 0; j < mSubstrateNames.size(); j++)
74  {
75  if (j)
76  ChemicalEquation += " + ";
77 
78  ChemicalEquation += writeElement(mSubstrateDisplayNames[j], mSubstrateMult[j], expanded);
79  }
80 
81  if (mReversibility)
82  ChemicalEquation += " = ";
83  else
84  ChemicalEquation += " -> ";
85 
86  for (j = 0; j < mProductNames.size(); j++)
87  {
88  if (j)
89  ChemicalEquation += " + ";
90 
91  ChemicalEquation += writeElement(mProductDisplayNames[j], mProductMult[j], expanded);
92  }
93 
94  if (mModifierNames.size())
95  {
96  ChemicalEquation += "; ";
97 
98  for (j = 0; j < mModifierNames.size(); j++)
99  {
100  ChemicalEquation += " ";
101 
102  ChemicalEquation += mModifierDisplayNames[j];
103  }
104  }
105 
106  return ChemicalEquation;
107 }
108 
109 bool CChemEqInterface::setChemEqString(const std::string & ces)
110 {
111  // parse the description into a linked node tree
112  std::istringstream buffer(ces);
113  CChemEqParser Parser(&buffer);
114 
115  bool success = (Parser.yyparse() == 0);
116 
117  if (success)
118  {
119  mReversibility = Parser.isReversible();
120 
124 
125  mProductNames = Parser.getProductNames();
128 
129  mModifierNames = Parser.getModifierNames();
132  }
133 
135 
137 
138  return success;
139 }
140 
142 {
143  std::string DefaultCompartment;
144 
145  if (mpModel->getCompartments().size() == 0)
146  DefaultCompartment = "compartment";
147  else
148  DefaultCompartment = mpModel->getCompartments()[0]->getObjectName();
149 
150  // We try to find a reaction compartment. Note, it is not possible to use
151  // getCompartment as writeToChemEq may fail;
152  std::string ReactionCompartment = "";
153  bool first = true;
154  bool HaveReactionCompartment = true;
155 
156  std::vector< std::string >::iterator itCompartment, endCompartment;
157 
158  itCompartment = mSubstrateCompartments.begin();
159  endCompartment = mSubstrateCompartments.end();
160 
161  for (; itCompartment != endCompartment && HaveReactionCompartment; ++itCompartment)
162  {
163  if (*itCompartment == "") continue;
164 
165  if (first)
166  {
167  ReactionCompartment = *itCompartment;
168  first = false;
169  }
170  else if (ReactionCompartment != *itCompartment)
171  HaveReactionCompartment = false;
172  }
173 
174  itCompartment = mProductCompartments.begin();
175  endCompartment = mProductCompartments.end();
176 
177  for (; itCompartment != endCompartment && HaveReactionCompartment; ++itCompartment)
178  {
179  if (*itCompartment == "") continue;
180 
181  if (first)
182  {
183  ReactionCompartment = *itCompartment;
184  first = false;
185  }
186  else if (ReactionCompartment != *itCompartment)
187  HaveReactionCompartment = false;
188  }
189 
190  itCompartment = mModifierCompartments.begin();
191  endCompartment = mModifierCompartments.end();
192 
193  for (; itCompartment != endCompartment && HaveReactionCompartment; ++itCompartment)
194  {
195  if (*itCompartment == "") continue;
196 
197  if (first)
198  {
199  ReactionCompartment = *itCompartment;
200  first = false;
201  }
202  else if (ReactionCompartment != *itCompartment)
203  HaveReactionCompartment = false;
204  }
205 
206  if (first)
207  ReactionCompartment = DefaultCompartment;
208 
209  CMetab * pMetab;
210 
211  std::vector< std::string >::iterator itMetab;
212 
213  itMetab = mSubstrateNames.begin();
214  itCompartment = mSubstrateCompartments.begin();
215  endCompartment = mSubstrateCompartments.end();
216 
217  for (; itCompartment != endCompartment; ++itCompartment, ++itMetab)
218  if (*itCompartment == "")
219  {
220  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, "");
221 
222  if (pMetab == NULL)
223  *itCompartment = ReactionCompartment;
224  else if (CMetabNameInterface::isUnique(mpModel, *itMetab))
225  *itCompartment = pMetab->getCompartment()->getObjectName();
226  else // Multiple metabolites with the given name exist.
227  {
228  // 1. Metabolite in the reaction compartment
229  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, ReactionCompartment);
230 
231  // 2. Metabolite in the default compartment if different from reaction compartment
232  if (pMetab == NULL && ReactionCompartment != DefaultCompartment)
233  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, DefaultCompartment);
234 
235  // 3. The first metabolite found
236  if (pMetab == NULL)
237  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, "");
238 
239  *itCompartment = pMetab->getCompartment()->getObjectName();
240  }
241  }
242 
243  itMetab = mProductNames.begin();
244  itCompartment = mProductCompartments.begin();
245  endCompartment = mProductCompartments.end();
246 
247  for (; itCompartment != endCompartment; ++itCompartment, ++itMetab)
248  if (*itCompartment == "")
249  {
250  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, "");
251 
252  if (pMetab == NULL)
253  *itCompartment = ReactionCompartment;
254  else if (CMetabNameInterface::isUnique(mpModel, *itMetab))
255  *itCompartment = pMetab->getCompartment()->getObjectName();
256  else // Multiple metabolites with the given name exist.
257  {
258  // 1. Metabolite in the reaction compartment
259  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, ReactionCompartment);
260 
261  // 2. Metabolite in the default compartment if different from reaction compartment
262  if (pMetab == NULL && ReactionCompartment != DefaultCompartment)
263  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, DefaultCompartment);
264 
265  // 3. The first metabolite found
266  if (pMetab == NULL)
267  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, "");
268 
269  *itCompartment = pMetab->getCompartment()->getObjectName();
270  }
271  }
272 
273  itMetab = mModifierNames.begin();
274  itCompartment = mModifierCompartments.begin();
275  endCompartment = mModifierCompartments.end();
276 
277  for (; itCompartment != endCompartment; ++itCompartment, ++itMetab)
278  if (*itCompartment == "")
279  {
280  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, "");
281 
282  if (pMetab == NULL)
283  *itCompartment = ReactionCompartment;
284  else if (CMetabNameInterface::isUnique(mpModel, *itMetab))
285  *itCompartment = pMetab->getCompartment()->getObjectName();
286  else // Multiple metabolites with the given name exist.
287  {
288  // 1. Metabolite in the reaction compartment
289  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, ReactionCompartment);
290 
291  // 2. Metabolite in the default compartment if different from reaction compartment
292  if (pMetab == NULL && ReactionCompartment != DefaultCompartment)
293  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, DefaultCompartment);
294 
295  // 3. The first metabolite found
296  if (pMetab == NULL)
297  pMetab = CMetabNameInterface::getMetabolite(mpModel, *itMetab, "");
298 
299  *itCompartment = pMetab->getCompartment()->getObjectName();
300  }
301  }
302 }
303 
305 {
306  bool ret = true;
307  const CCopasiVector<CChemEqElement> * elements;
308  size_t i, imax;
309 
310  elements = &ce.getSubstrates();
311  imax = elements->size();
312  mSubstrateNames.resize(imax);
313  mSubstrateMult.resize(imax);
314  mSubstrateCompartments.resize(imax);
315 
316  for (i = 0; i < imax; ++i)
317  {
318  mSubstrateNames[i] = (*elements)[i]->getMetabolite()->getObjectName();
319  mSubstrateMult[i] = (*elements)[i]->getMultiplicity();
320  mSubstrateCompartments[i] = (*elements)[i]->getMetabolite()->getCompartment()->getObjectName();
321  }
322 
323  elements = &ce.getProducts();
324  imax = elements->size();
325  mProductNames.resize(imax);
326  mProductMult.resize(imax);
327  mProductCompartments.resize(imax);
328 
329  for (i = 0; i < imax; ++i)
330  {
331  mProductNames[i] = (*elements)[i]->getMetabolite()->getObjectName();
332  mProductMult[i] = (*elements)[i]->getMultiplicity();
333  mProductCompartments[i] = (*elements)[i]->getMetabolite()->getCompartment()->getObjectName();
334  }
335 
336  elements = &ce.getModifiers();
337  imax = elements->size();
338  mModifierNames.resize(imax);
339  mModifierMult.resize(imax);
340  mModifierCompartments.resize(imax);
341 
342  for (i = 0; i < imax; ++i)
343  {
344  mModifierNames[i] = (*elements)[i]->getMetabolite()->getObjectName();
345  mModifierMult[i] = (*elements)[i]->getMultiplicity();
346  mModifierCompartments[i] = (*elements)[i]->getMetabolite()->getCompartment()->getObjectName();
347  }
348 
350 
352 
353  return ret;
354 }
355 
357 {
358  std::vector< std::string >::const_iterator itName, itCompartment;
359  std::vector< std::string >::iterator it, end;
360 
361  // We need to build the list of display names for the substrates;
363 
364  for (itName = mSubstrateNames.begin(),
365  itCompartment = mSubstrateCompartments.begin(),
366  it = mSubstrateDisplayNames.begin(),
367  end = mSubstrateDisplayNames.end();
368  it != end;
369  ++itName, ++itCompartment, ++it)
370  *it = CMetabNameInterface::getDisplayName(mpModel, *itName, *itCompartment, true);
371 
372  // We need to build the list of display names for the products;
373  mProductDisplayNames.resize(mProductNames.size());
374 
375  for (itName = mProductNames.begin(),
376  itCompartment = mProductCompartments.begin(),
377  it = mProductDisplayNames.begin(),
378  end = mProductDisplayNames.end();
379  it != end;
380  ++itName, ++itCompartment, ++it)
381  *it = CMetabNameInterface::getDisplayName(mpModel, *itName, *itCompartment, true);
382 
383  // We need to build the list of display names for the modifiers;
384  mModifierDisplayNames.resize(mModifierNames.size());
385 
386  for (itName = mModifierNames.begin(),
387  itCompartment = mModifierCompartments.begin(),
388  it = mModifierDisplayNames.begin(),
389  end = mModifierDisplayNames.end();
390  it != end;
391  ++itName, ++itCompartment, ++it)
392  *it = CMetabNameInterface::getDisplayName(mpModel, *itName, *itCompartment, true);
393 
394  return;
395 }
396 
398 {
399  bool ret = true;
400  std::string metabkey;
401  size_t i, imax;
402 
403  ce.cleanup();
404 
405  imax = mSubstrateNames.size();
406 
407  for (i = 0; i < imax; ++i)
408  {
410 
411  if (metabkey.empty())
412  ret = false;
413  else
415  }
416 
417  imax = mProductNames.size();
418 
419  for (i = 0; i < imax; ++i)
420  {
422 
423  if (metabkey.empty())
424  ret = false;
425  else
426  ce.addMetabolite(metabkey, mProductMult[i], CChemEq::PRODUCT);
427  }
428 
429  imax = mModifierNames.size();
430 
431  for (i = 0; i < imax; ++i)
432  {
434 
435  if (metabkey.empty())
436  ret = false;
437  else
439  }
440 
442 
443  return ret; //TODO: really check
444 }
445 
446 const std::vector<C_FLOAT64> & CChemEqInterface::getListOfMultiplicities(CFunctionParameter::Role role) const
447 {
448  if (role == CFunctionParameter::SUBSTRATE) return mSubstrateMult;
449  else if (role == CFunctionParameter::PRODUCT) return mProductMult;
450  else if (role == CFunctionParameter::MODIFIER) return mModifierMult;
451  else fatalError();
452 
453  return mSubstrateMult; //never reached
454 }
455 
456 const std::vector<std::string> & CChemEqInterface::getListOfDisplayNames(CFunctionParameter::Role role) const
457 {
459  else if (role == CFunctionParameter::PRODUCT) return mProductDisplayNames;
460  else if (role == CFunctionParameter::MODIFIER) return mModifierDisplayNames;
461  else fatalError();
462 
463  return mSubstrateDisplayNames; //never reached
464 }
465 
466 void CChemEqInterface::addModifier(const std::string & name)
467 {
468  std::pair< std::string, std::string > Modifier =
470 
471  //is the name already in the list
472  std::vector< std::string >::const_iterator it, itEnd = mModifierNames.end();
473  std::vector< std::string >::const_iterator itComp = mModifierCompartments.begin();
474 
475  for (it = mModifierNames.begin(); it != itEnd; ++it, ++itComp)
476  if (Modifier.first == *it &&
477  Modifier.second == *itComp) break;
478 
479  if (it == itEnd)
480  {
481  mModifierNames.push_back(Modifier.first);
482  mModifierMult.push_back(1.0);
483  mModifierCompartments.push_back(Modifier.second);
484  mModifierDisplayNames.push_back(quote(name));
485  }
486 }
487 
489 {
490  mModifierNames.clear();
491  mModifierMult.clear();
492  mModifierCompartments.clear();
493  mModifierDisplayNames.clear();
494 }
495 
496 std::string CChemEqInterface::writeElement(const std::string & name, C_FLOAT64 mult, bool expanded)
497 {
498  std::ostringstream Element;
499  Element.imbue(std::locale::classic());
500  Element.precision(6);
501 
502  std::string Metabolite = name;
503 
504  // The last character must not be a ';' in a reaction.
505  if (Metabolite[Metabolite.length() - 1] == ';')
506  Metabolite = "\"" + Metabolite + "\"";
507 
508  if (isNumber(Metabolite))
509  Metabolite = "\"" + Metabolite + "\"";
510 
511  if (expanded)
512  {
513  C_INT32 i, imax = (C_INT32) mult;
514 
515  for (i = 0; i < imax; ++i)
516  {
517  if (i) Element << " + ";
518 
519  Element << Metabolite;
520  }
521  }
522  else
523  {
524  if (mult == 1.0)
525  {
526  Element << Metabolite;
527  }
528  else
529  {
530  Element << mult << " * " << Metabolite;
531  }
532  }
533 
534  return Element.str();
535 }
536 
538 {
539  const std::vector<C_FLOAT64> * tmpVector = NULL;
540 
541  if (role == CFunctionParameter::SUBSTRATE)
542  tmpVector = &mSubstrateMult;
543  else if (role == CFunctionParameter::PRODUCT)
544  tmpVector = &mProductMult;
545  else if (role == CFunctionParameter::MODIFIER)
546  tmpVector = &mModifierMult;
547  else fatalError();
548 
549  size_t ccc, i, imax = tmpVector->size();
550  ccc = 0;
551 
552  for (i = 0; i < imax; ++i)
553  {
554  if ((*tmpVector)[i] != floor((*tmpVector)[i] + 0.5))
555  return C_INVALID_INDEX;
556 
557  ccc += (size_t) floor((*tmpVector)[i]);
558  }
559 
560  return ccc;
561 }
562 
564 {
565  std::vector<std::string> dummyNames;
566  std::vector<C_FLOAT64> dummyMults;
567  std::vector<std::string> dummyCompartments;
568 
569  dummyNames = mSubstrateNames;
570  dummyMults = mSubstrateMult;
571  dummyCompartments = mSubstrateCompartments;
572 
576 
577  mProductNames = dummyNames;
578  mProductMult = dummyMults;
579  mProductCompartments = dummyCompartments;
580 }
581 
582 std::set<std::string> CChemEqInterface::listOfNonUniqueMetabNames() const
583 {
584  std::set<std::string> ret;
585 
586  std::vector<std::string>::const_iterator it, itEnd;
587 
588  itEnd = mSubstrateNames.end();
589 
590  for (it = mSubstrateNames.begin(); it != itEnd; ++it)
592  ret.insert(*it);
593 
594  itEnd = mProductNames.end();
595 
596  for (it = mProductNames.begin(); it != itEnd; ++it)
598  ret.insert(*it);
599 
600  itEnd = mModifierNames.end();
601 
602  for (it = mModifierNames.begin(); it != itEnd; ++it)
604  ret.insert(*it);
605 
606  return ret;
607 }
608 
609 std::set< std::pair< std::string, std::string > > CChemEqInterface::listOfNonExistingMetabNames() const
610 {
611  std::set< std::pair< std::string, std::string > > ret;
612  std::pair< std::string, std::string > Insert;
613 
614  std::vector<std::string>::const_iterator it, itComp, itEnd;
615 
616  itEnd = mSubstrateNames.end();
617 
618  for (it = mSubstrateNames.begin(), itComp = mSubstrateCompartments.begin(); it != itEnd; ++it, ++itComp)
619  if (!CMetabNameInterface::doesExist(mpModel, *it, *itComp))
620  {
621  Insert.first = *it;
622  Insert.second = *itComp;
623  ret.insert(Insert);
624  }
625 
626  itEnd = mProductNames.end();
627 
628  for (it = mProductNames.begin(), itComp = mProductCompartments.begin(); it != itEnd; ++it, ++itComp)
629  if (!CMetabNameInterface::doesExist(mpModel, *it, *itComp))
630  {
631  Insert.first = *it;
632  Insert.second = *itComp;
633  ret.insert(Insert);
634  }
635 
636  itEnd = mModifierNames.end();
637 
638  for (it = mModifierNames.begin(), itComp = mModifierCompartments.begin(); it != itEnd; ++it, ++itComp)
639  if (!CMetabNameInterface::doesExist(mpModel, *it, *itComp))
640  {
641  Insert.first = *it;
642  Insert.second = *itComp;
643  ret.insert(Insert);
644  }
645 
646  return ret;
647 }
648 
650 {
651  std::set< std::pair< std::string, std::string > > metabs = listOfNonExistingMetabNames();
652  bool ret;
653  if (metabs.size() == 0) ret = false; else ret = true;
654 
655  std::set< std::pair< std::string, std::string > >::const_iterator it, itEnd;
656 
657  itEnd = metabs.end();
658 
659  for (it = metabs.begin(); it != itEnd; ++it)
660  {
661  if (mpModel->getCompartments().getIndex(it->second) == C_INVALID_INDEX)
662  mpModel->createCompartment(it->second, 1);
663 
664  mpModel->createMetabolite(it->first,
665  it->second,
667  }
668 
669  // Due to the creation of metabolites the display names may have changed.
671 
672  return ret;
673 }
674 
676 {
677  bool Initialize = true;
678  std::string Compartment = "";
679 
680  std::vector< std::string >::const_iterator it;
681  std::vector< std::string >::const_iterator end;
682 
683  for (it = mSubstrateCompartments.begin(), end = mSubstrateCompartments.end();
684  it != end; ++it)
685  if (Initialize)
686  {
687  Compartment = *it;
688  Initialize = false;
689  }
690  else if (Compartment != *it)
691  return true;
692 
693  for (it = mProductCompartments.begin(), end = mProductCompartments.end();
694  it != end; ++it)
695  if (Initialize)
696  {
697  Compartment = *it;
698  Initialize = false;
699  }
700  else if (Compartment != *it)
701  return true;
702 
703  for (it = mModifierCompartments.begin(), end = mModifierCompartments.end();
704  it != end; ++it)
705  if (Initialize)
706  {
707  Compartment = *it;
708  Initialize = false;
709  }
710  else if (Compartment != *it)
711  return true;
712 
713  return false;
714 }
715 
717 {
718  CChemEq ce;
719  writeToChemEq(ce);
720 
721  if (ce.getCompartmentNumber() > 1)
722  return NULL;
723  else
724  {
725  const CMetab * metab = NULL;
726 
727  if (ce.getSubstrates().size())
728  metab = ce.getSubstrates()[0]->getMetabolite();
729  else if (ce.getProducts().size())
730  metab = ce.getProducts()[0]->getMetabolite();
731 
732  if (metab)
733  return metab->getCompartment();
734  else
735  return NULL;
736  }
737 }
738 
739 /*static*/
740 std::string CChemEqInterface::getChemEqString(CModel * model, const CReaction & rea, bool expanded)
741 {
742  CChemEqInterface cei(model);
743  cei.loadFromChemEq(rea.getChemEq());
744  return cei.getChemEqString(expanded);
745 }
746 
747 /*static*/
748 void CChemEqInterface::setChemEqFromString(CModel * model, CReaction & rea, const std::string & ces)
749 {
750  CChemEqInterface cei(model);
751  cei.setChemEqString(ces);
752  cei.writeToChemEq(rea.getChemEq());
753 }
754 
755 /*static*/
756 bool CChemEqInterface::isValidEq(const std::string & eq)
757 {
758  if (eq.empty()) return false;
759 
760  // parse the description into a linked node tree
761  std::istringstream buffer(eq);
762  CChemEqParser Parser(&buffer);
763 
764  return (Parser.yyparse() == 0);
765 }
size_t getMolecularity(CFunctionParameter::Role role) const
bool loadFromChemEq(const CChemEq &ce)
size_t getCompartmentNumber() const
Definition: CChemEq.cpp:110
static std::string getMetaboliteKey(const CModel *model, const std::string &metabolite, const std::string &compartment)
bool isNumber(const std::string &str)
Definition: utility.cpp:75
std::vector< std::string > mModifierCompartments
static void setChemEqFromString(CModel *model, CReaction &rea, const std::string &ces)
const std::string & getObjectName() const
const std::vector< std::string > & getModifierCompartments() const
static CMetab * getMetabolite(const CModel *model, const std::string &metabolite, const std::string &compartment)
virtual size_t size() const
std::vector< C_FLOAT64 > mSubstrateMult
const std::vector< std::string > & getSubstrateCompartments() const
std::vector< std::string > mModifierNames
#define fatalError()
const CCompartment * getCompartment() const
#define C_INVALID_INDEX
Definition: copasi.h:222
virtual size_t getIndex(const std::string &name) const
std::vector< C_FLOAT64 > mModifierMult
#define C_INT32
Definition: copasi.h:90
static std::string getDisplayName(const CModel *model, const std::string &key, const bool &quoted)
Definition: CMetab.h:178
const bool & isReversible() const
std::set< std::string > listOfNonUniqueMetabNames() const
static bool isValidEq(const std::string &eq)
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
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)
const bool & getReversibility() const
Definition: CChemEq.cpp:77
void cleanup()
Definition: CChemEq.cpp:52
std::string getChemEqString(bool expanded) const
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
const std::vector< C_FLOAT64 > & getListOfMultiplicities(CFunctionParameter::Role role) const
static std::string writeElement(const std::string &name, C_FLOAT64 mult, bool expanded)
bool addMetabolite(const std::string &key, const C_FLOAT64 multiplicity, const MetaboliteRole &role)
Definition: CChemEq.cpp:80
std::string quote(const std::string &name, const std::string &additionalEscapes)
Definition: utility.cpp:144
bool writeToChemEq(CChemEq &ce) const
const std::vector< C_FLOAT64 > & getModifierMulitplicities() const
CCopasiVectorNS< CCompartment > & getCompartments()
Definition: CModel.cpp:1145
const std::vector< C_FLOAT64 > & getSubstrateMulitplicities() const
static std::pair< std::string, std::string > splitDisplayName(const std::string &name)
static bool isUnique(const CModel *model, const std::string &name)
const std::vector< std::string > & getSubstrateNames() const
#define C_FLOAT64
Definition: copasi.h:92
const CCopasiVector< CChemEqElement > & getModifiers() const
Definition: CChemEq.cpp:66
const std::vector< std::string > & getProductCompartments() const
static bool doesExist(const CModel *model, const std::string &metabolite, const std::string &compartment)
void addModifier(const std::string &name)
Definition: CModel.h:50
bool isMulticompartment() const
std::vector< std::string > mModifierDisplayNames
const std::vector< std::string > & getProductNames() const
const std::vector< std::string > & getModifierNames() const
std::vector< std::string > mProductDisplayNames
const CCompartment * getCompartment() const
Definition: CMetab.cpp:222
std::set< std::pair< std::string, std::string > > listOfNonExistingMetabNames() const
void setReversibility(const bool &reversible)
Definition: CChemEq.cpp:72
const CChemEq & getChemEq() const
Definition: CReaction.cpp:223
std::vector< std::string > mSubstrateCompartments
const std::vector< C_FLOAT64 > & getProductMulitplicities() const
CCompartment * createCompartment(const std::string &name, const C_FLOAT64 &volume=1.0)
Definition: CModel.cpp:2698
std::vector< std::string > mSubstrateNames
std::vector< std::string > mProductCompartments
CMetab * createMetabolite(const std::string &name, const std::string &compartment, const C_FLOAT64 &iconc=1.0, const CModelEntity::Status &status=CModelEntity::REACTIONS)
Definition: CModel.cpp:2622