1 /**
2  * Filename    : TestLayoutWriting.cpp
3  * Description : Unit tests for writing layout in the context of a complete model.
4  * Organization: European Media Laboratories Research gGmbH
5  * Created     : 2007-02-23
6  *
7  * <!--------------------------------------------------------------------------
8  * This file is part of libSBML.  Please visit http://sbml.org for more
9  * information about SBML, and the latest version of libSBML.
10  *
11  * Copyright (C) 2020 jointly by the following organizations:
12  *     1. California Institute of Technology, Pasadena, CA, USA
13  *     2. University of Heidelberg, Heidelberg, Germany
14  *     3. University College London, London, UK
15  *
16  * Copyright (C) 2019 jointly by the following organizations:
17  *     1. California Institute of Technology, Pasadena, CA, USA
18  *     2. University of Heidelberg, Heidelberg, Germany
19  *
20  * Copyright (C) 2013-2018 jointly by the following organizations:
21  *     1. California Institute of Technology, Pasadena, CA, USA
22  *     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
23  *     3. University of Heidelberg, Heidelberg, Germany
24  *
25  * Copyright (C) 2009-2013 jointly by the following organizations:
26  *     1. California Institute of Technology, Pasadena, CA, USA
27  *     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
28  *
29  * Copyright (C) 2004-2008 by European Media Laboratories Research gGmbH,
30  *     Heidelberg, Germany
31  *
32  * This library is free software; you can redistribute it and/or modify it
33  * under the terms of the GNU Lesser General Public License as published by
34  * the Free Software Foundation.  A copy of the license agreement is provided
35  * in the file named "LICENSE.txt" included with this software distribution
36  * and also available online as http://sbml.org/software/libsbml/license.html
37  * ------------------------------------------------------------------------ -->
38  */
39 
40 #include <iostream>
41 #include <string>
42 
43 #include <locale.h>
44 
45 #include <sbml/common/common.h>
46 
47 #include <sbml/packages/layout/extension/LayoutModelPlugin.h>
48 #include <sbml/packages/layout/sbml/Layout.h>
49 #include <sbml/packages/layout/sbml/GraphicalObject.h>
50 #include <sbml/packages/layout/sbml/CompartmentGlyph.h>
51 #include <sbml/packages/layout/sbml/SpeciesGlyph.h>
52 #include <sbml/packages/layout/sbml/ReactionGlyph.h>
53 #include <sbml/packages/layout/sbml/TextGlyph.h>
54 #include <sbml/packages/layout/sbml/SpeciesReferenceGlyph.h>
55 #include <sbml/packages/layout/sbml/LineSegment.h>
56 #include <sbml/packages/layout/sbml/CubicBezier.h>
57 #include <sbml/packages/layout/sbml/Curve.h>
58 #include <sbml/packages/layout/sbml/Point.h>
59 #include <sbml/packages/layout/sbml/Dimensions.h>
60 #include <sbml/Reaction.h>
61 #include <sbml/Species.h>
62 #include <sbml/Compartment.h>
63 #include <sbml/Model.h>
64 #include <sbml/SBMLDocument.h>
65 #include <sbml/SBMLWriter.h>
66 #include <sbml/SBMLTypes.h>
67 
68 #include <check.h>
69 
70 
71 #include <sbml/xml/XMLInputStream.h>
72 #include <sbml/xml/XMLNode.h>
73 #include "utility.h"
74 
75 
76 using namespace std;
77 LIBSBML_CPP_NAMESPACE_USE
78 
79 BEGIN_C_DECLS
80 
81 static LayoutPkgNamespaces* LN;
82 
83 void
LayoutWritingTest_setup(void)84 LayoutWritingTest_setup (void)
85 {
86   LN = new LayoutPkgNamespaces(2,1);
87 }
88 
89 void
LayoutWritingTest_teardown(void)90 LayoutWritingTest_teardown (void)
91 {
92   delete LN;
93 }
94 
95 
START_TEST(test_LayoutWriting)96 START_TEST (test_LayoutWriting)
97 {
98   std::string s =
99   "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
100   "<sbml xmlns=\"http://www.sbml.org/sbml/level2\" level=\"2\" version=\"1\">"
101   "  <model id=\"TestModel\">"
102   "          <annotation>"
103   "  <listOfLayouts xmlns=\"http://projects.eml.org/bcb/sbml/level2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
104   "    <layout id=\"Layout_1\">"
105   "      <dimensions width=\"2320\" height=\"1000\"/>"
106   "      <listOfCompartmentGlyphs>"
107   "        <compartmentGlyph id=\"CompartmentGlyph_1\" compartment=\"Hepatocyte\">"
108   "          <boundingBox id=\"bb_compartment\">"
109   "            <position x=\"10\" y=\"10\"/>"
110   "            <dimensions width=\"2300\" height=\"980\"/>"
111   "          </boundingBox>"
112   "        </compartmentGlyph>"
113   "        <compartmentGlyph id=\"Mito1_Glyph\" compartment=\"Mito_1\">"
114   "          <boundingBox id=\"bb_mito1\">"
115   "            <position x=\"100\" y=\"100\"/>"
116   "            <dimensions width=\"300\" height=\"100\"/>"
117   "          </boundingBox>"
118   "        </compartmentGlyph>"
119   "        <compartmentGlyph id=\"Mito2_Glyph\" compartment=\"Mito_2\">"
120   "          <boundingBox id=\"bb_mito2\">"
121   "            <position x=\"200\" y=\"650\"/>"
122   "            <dimensions width=\"300\" height=\"100\"/>"
123   "          </boundingBox>"
124   "        </compartmentGlyph>"
125   "        <compartmentGlyph id=\"Mito3_Glyph_2\" compartment=\"Mito_3\">"
126   "          <boundingBox id=\"bb_mito3_2\">"
127   "            <position x=\"1470\" y=\"30\"/>"
128   "            <dimensions width=\"820\" height=\"536\"/>"
129   "          </boundingBox>"
130   "        </compartmentGlyph>"
131   "      </listOfCompartmentGlyphs>"
132   "      <listOfSpeciesGlyphs>"
133   "        <speciesGlyph id=\"SpeciesGlyph_malate_cyt\" species=\"malate_cyt\">"
134   "          <boundingBox id=\"bb_sg_malate_cyt\">"
135   "            <position x=\"580\" y=\"280\"/>"
136   "            <dimensions width=\"240\" height=\"36\"/>"
137   "          </boundingBox>"
138   "        </speciesGlyph>"
139   "        <speciesGlyph id=\"SpeciesGlyph_oxaloacetate_cyt\" species=\"oxaloacetate_cyt\">"
140   "          <boundingBox id=\"bb_sg_oxaloacetate_cyt\">"
141   "            <position x=\"580\" y=\"480\"/>"
142   "            <dimensions width=\"240\" height=\"36\"/>"
143   "          </boundingBox>"
144   "        </speciesGlyph>"
145   "        <speciesGlyph id=\"SpeciesGlyph_aspartate_cyt\" species=\"aspartate_cyt\">"
146   "          <boundingBox id=\"bb_sg_aspartate_cyt\">"
147   "            <position x=\"580\" y=\"680\"/>"
148   "            <dimensions width=\"240\" height=\"36\"/>"
149   "          </boundingBox>"
150   "        </speciesGlyph>"
151   "        <speciesGlyph id=\"SpeciesGlyph_glutamate_cyt\" species=\"glutamate_cyt\">"
152   "          <boundingBox id=\"bb_sg_glutamate_cyt\">"
153   "            <position x=\"800\" y=\"610\"/>"
154   "            <dimensions width=\"240\" height=\"36\"/>"
155   "          </boundingBox>"
156   "        </speciesGlyph>"
157   "        <speciesGlyph id=\"SpeciesGlyph_aKetoglutarate_cyt\" species=\"aKetoglutarate_cyt\">"
158   "          <boundingBox id=\"bb_sg_aKetoglutarate_cyt\">"
159   "            <position x=\"860\" y=\"500\"/>"
160   "            <dimensions width=\"280\" height=\"36\"/>"
161   "          </boundingBox>"
162   "        </speciesGlyph>"
163   "        <speciesGlyph id=\"SpeciesGlyph_nad_cyt\" species=\"nad_cyt\">"
164   "          <boundingBox id=\"bb_sg_nad_cyt\">"
165   "            <position x=\"520\" y=\"350\"/>"
166   "            <dimensions width=\"100\" height=\"24\"/>"
167   "          </boundingBox>"
168   "        </speciesGlyph>"
169   "        <speciesGlyph id=\"SpeciesGlyph_nadh_cyt\" species=\"nadh_cyt\">"
170   "          <boundingBox id=\"bb_sg_nadh_cyt\">"
171   "            <position x=\"520\" y=\"430\"/>"
172   "            <dimensions width=\"100\" height=\"24\"/>"
173   "          </boundingBox>"
174   "        </speciesGlyph>"
175   "        <speciesGlyph id=\"SpeciesGlyph_h_cyt\" species=\"h_cyt\">"
176   "          <boundingBox id=\"bb_sg_h_cyt\">"
177   "            <position x=\"430\" y=\"430\"/>"
178   "            <dimensions width=\"40\" height=\"24\"/>"
179   "          </boundingBox>"
180   "        </speciesGlyph>"
181   "        <speciesGlyph id=\"SpeciesGlyph_malate_mito3\" species=\"malate_mito3\">"
182   "          <boundingBox id=\"bb_sg_malate_mito3\">"
183   "            <position x=\"1850\" y=\"80\"/>"
184   "            <dimensions width=\"240\" height=\"36\"/>"
185   "          </boundingBox>"
186   "        </speciesGlyph>"
187   "        <speciesGlyph id=\"SpeciesGlyph_oxaloacetate_mito3\" species=\"oxaloacetate_mito3\">"
188   "          <boundingBox id=\"bb_sg_oxaloacetate_mito3\">"
189   "            <position x=\"1850\" y=\"280\"/>"
190   "            <dimensions width=\"240\" height=\"36\"/>"
191   "          </boundingBox>"
192   "        </speciesGlyph>"
193   "        <speciesGlyph id=\"SpeciesGlyph_aspartate_mito3\" species=\"aspartate_mito3\">"
194   "          <boundingBox id=\"bb_sg_aspartate_mito3\">"
195   "            <position x=\"1850\" y=\"480\"/>"
196   "            <dimensions width=\"240\" height=\"36\"/>"
197   "          </boundingBox>"
198   "        </speciesGlyph>"
199   "        <speciesGlyph id=\"SpeciesGlyph_glutamate_mito3\" species=\"glutamate_mito3\">"
200   "          <boundingBox id=\"bb_sg_glutamate_mito3\">"
201   "            <position x=\"1550\" y=\"430\"/>"
202   "            <dimensions width=\"240\" height=\"36\"/>"
203   "          </boundingBox>"
204   "        </speciesGlyph>"
205   "        <speciesGlyph id=\"SpeciesGlyph_aKetoglutarate_mito3\" species=\"aKetoglutarate_mito3\">"
206   "          <boundingBox id=\"bb_sg_aKetoglutarate_mito3\">"
207   "            <position x=\"1530\" y=\"300\"/>"
208   "            <dimensions width=\"280\" height=\"36\"/>"
209   "          </boundingBox>"
210   "        </speciesGlyph>"
211   "        <speciesGlyph id=\"SpeciesGlyph_nad_mito3\" species=\"nad_mito3\">"
212   "          <boundingBox id=\"bb_sg_nad_mito3\">"
213   "            <position x=\"2050\" y=\"150\"/>"
214   "            <dimensions width=\"100\" height=\"24\"/>"
215   "          </boundingBox>"
216   "        </speciesGlyph>"
217   "        <speciesGlyph id=\"SpeciesGlyph_nadh_mito3\" species=\"nadh_mito3\">"
218   "          <boundingBox id=\"bb_sg_nadh_mito3\">"
219   "            <position x=\"2050\" y=\"230\"/>"
220   "            <dimensions width=\"100\" height=\"24\"/>"
221   "          </boundingBox>"
222   "        </speciesGlyph>"
223   "        <speciesGlyph id=\"SpeciesGlyph_h_mito3\" species=\"h_mito3\">"
224   "          <boundingBox id=\"bb_sg_h_mito3\">"
225   "            <position x=\"2200\" y=\"230\"/>"
226   "            <dimensions width=\"40\" height=\"24\"/>"
227   "          </boundingBox>"
228   "        </speciesGlyph>"
229   "      </listOfSpeciesGlyphs>"
230   "      <listOfReactionGlyphs>"
231   "        <reactionGlyph id=\"rg_malatedh_cyt\" reaction=\"reaction_malatedh_cyt\">"
232   "          <curve>"
233   "            <listOfCurveSegments>"
234   "              <curveSegment xsi:type=\"LineSegment\">"
235   "                <start x=\"700\" y=\"381\"/>"
236   "                <end x=\"700\" y=\"415\"/>"
237   "              </curveSegment>"
238   "            </listOfCurveSegments>"
239   "          </curve>"
240   "          <listOfSpeciesReferenceGlyphs>"
241   "            <speciesReferenceGlyph id=\"srg_malate_cyt_1\" speciesReference=\"sr_malate_cyt\" speciesGlyph=\"SpeciesGlyph_malate_cyt\" role=\"substrate\">"
242   "              <curve>"
243   "                <listOfCurveSegments>"
244   "                  <curveSegment xsi:type=\"LineSegment\">"
245   "                    <start x=\"700\" y=\"381\"/>"
246   "                    <end x=\"700\" y=\"316\"/>"
247   "                  </curveSegment>"
248   "                </listOfCurveSegments>"
249   "              </curve>"
250   "            </speciesReferenceGlyph>"
251   "            <speciesReferenceGlyph id=\"srg_nad_cyt\" speciesReference=\"sr_nad_cyt\" speciesGlyph=\"SpeciesGlyph_nad_cyt\" role=\"substrate\">"
252   "              <curve>"
253   "                <listOfCurveSegments>"
254   "                  <curveSegment xsi:type=\"CubicBezier\">"
255   "                    <start x=\"700\" y=\"381\"/>"
256   "                    <end x=\"620\" y=\"362\"/>"
257   "                    <basePoint1 x=\"700\" y=\"362\"/>"
258   "                    <basePoint2 x=\"700\" y=\"362\"/>"
259   "                  </curveSegment>"
260   "                </listOfCurveSegments>"
261   "              </curve>"
262   "            </speciesReferenceGlyph>"
263   "            <speciesReferenceGlyph id=\"srg_oxaloacetate_cyt_1\" speciesReference=\"sr_oxaloacetate_cyt_1\" speciesGlyph=\"SpeciesGlyph_oxaloacetate_cyt\" role=\"product\">"
264   "              <curve>"
265   "                <listOfCurveSegments>"
266   "                  <curveSegment xsi:type=\"LineSegment\">"
267   "                    <start x=\"700\" y=\"415\"/>"
268   "                    <end x=\"700\" y=\"480\"/>"
269   "                  </curveSegment>"
270   "                </listOfCurveSegments>"
271   "              </curve>"
272   "            </speciesReferenceGlyph>"
273   "            <speciesReferenceGlyph id=\"srg_nadh_cyt\" speciesReference=\"sr_nadh_cyt\" speciesGlyph=\"SpeciesGlyph_nadh_cyt\" role=\"product\">"
274   "              <curve>"
275   "                <listOfCurveSegments>"
276   "                  <curveSegment xsi:type=\"CubicBezier\">"
277   "                    <start x=\"700\" y=\"415\"/>"
278   "                    <end x=\"620\" y=\"442\"/>"
279   "                    <basePoint1 x=\"700\" y=\"442\"/>"
280   "                    <basePoint2 x=\"700\" y=\"442\"/>"
281   "                  </curveSegment>"
282   "                </listOfCurveSegments>"
283   "              </curve>"
284   "            </speciesReferenceGlyph>"
285   "            <speciesReferenceGlyph id=\"srg_h_cyt\" speciesReference=\"sr_h_cyt\" speciesGlyph=\"SpeciesGlyph_h_cyt\" role=\"product\">"
286   "              <curve>"
287   "                <listOfCurveSegments>"
288   "                  <curveSegment xsi:type=\"CubicBezier\">"
289   "                    <start x=\"700\" y=\"415\"/>"
290   "                    <end x=\"470\" y=\"430\"/>"
291   "                    <basePoint1 x=\"570\" y=\"415\"/>"
292   "                    <basePoint2 x=\"570\" y=\"415\"/>"
293   "                  </curveSegment>"
294   "                </listOfCurveSegments>"
295   "              </curve>"
296   "            </speciesReferenceGlyph>"
297   "          </listOfSpeciesReferenceGlyphs>"
298   "        </reactionGlyph>"
299   "        <reactionGlyph id=\"rg_aspartateat_cyt\" reaction=\"reaction_aspartateat_cyt\">"
300   "          <curve>"
301   "            <listOfCurveSegments>"
302   "              <curveSegment xsi:type=\"LineSegment\">"
303   "                <start x=\"700\" y=\"581\"/>"
304   "                <end x=\"700\" y=\"615\"/>"
305   "              </curveSegment>"
306   "            </listOfCurveSegments>"
307   "          </curve>"
308   "          <listOfSpeciesReferenceGlyphs>"
309   "            <speciesReferenceGlyph id=\"srg_oxaloacetate_cyt_2\" speciesReference=\"sr_oxaloacetate_cyt_2\" speciesGlyph=\"SpeciesGlyph_oxaloacetate_cyt\" role=\"substrate\">"
310   "              <curve>"
311   "                <listOfCurveSegments>"
312   "                  <curveSegment xsi:type=\"LineSegment\">"
313   "                    <start x=\"700\" y=\"581\"/>"
314   "                    <end x=\"700\" y=\"516\"/>"
315   "                  </curveSegment>"
316   "                </listOfCurveSegments>"
317   "              </curve>"
318   "            </speciesReferenceGlyph>"
319   "            <speciesReferenceGlyph id=\"srg_glutamate_cyt_1\" speciesReference=\"sr_glutamate_cyt_1\" speciesGlyph=\"SpeciesGlyph_glutamate_cyt\" role=\"substrate\">"
320   "              <curve>"
321   "                <listOfCurveSegments>"
322   "                  <curveSegment xsi:type=\"CubicBezier\">"
323   "                    <start x=\"700\" y=\"581\"/>"
324   "                    <end x=\"800\" y=\"628\"/>"
325   "                    <basePoint1 x=\"750\" y=\"581\"/>"
326   "                    <basePoint2 x=\"750\" y=\"628\"/>"
327   "                  </curveSegment>"
328   "                </listOfCurveSegments>"
329   "              </curve>"
330   "            </speciesReferenceGlyph>"
331   "            <speciesReferenceGlyph id=\"srg_aspartate_cyt_1\" speciesReference=\"sr_aspartate_cyt_1\" speciesGlyph=\"SpeciesGlyph_aspartate_cyt\" role=\"product\">"
332   "              <curve>"
333   "                <listOfCurveSegments>"
334   "                  <curveSegment xsi:type=\"LineSegment\">"
335   "                    <start x=\"700\" y=\"615\"/>"
336   "                    <end x=\"700\" y=\"680\"/>"
337   "                  </curveSegment>"
338   "                </listOfCurveSegments>"
339   "              </curve>"
340   "            </speciesReferenceGlyph>"
341   "            <speciesReferenceGlyph id=\"srg_aKetoglutaratecyt_1\" speciesReference=\"sr_aKetoglutarate_cyt_1\" speciesGlyph=\"SpeciesGlyph_aKetoglutarate_cyt\" role=\"product\">"
342   "              <curve>"
343   "                <listOfCurveSegments>"
344   "                  <curveSegment xsi:type=\"CubicBezier\">"
345   "                    <start x=\"700\" y=\"615\"/>"
346   "                    <end x=\"860\" y=\"515\"/>"
347   "                    <basePoint1 x=\"790\" y=\"615\"/>"
348   "                    <basePoint2 x=\"790\" y=\"515\"/>"
349   "                  </curveSegment>"
350   "                </listOfCurveSegments>"
351   "              </curve>"
352   "            </speciesReferenceGlyph>"
353   "          </listOfSpeciesReferenceGlyphs>"
354   "        </reactionGlyph>"
355   "        <reactionGlyph id=\"rg_malatedh_mito3\" reaction=\"reaction_malatedh_mito3\">"
356   "          <curve>"
357   "            <listOfCurveSegments>"
358   "              <curveSegment xsi:type=\"LineSegment\">"
359   "                <start x=\"1970\" y=\"181\"/>"
360   "                <end x=\"1970\" y=\"215\"/>"
361   "              </curveSegment>"
362   "            </listOfCurveSegments>"
363   "          </curve>"
364   "          <listOfSpeciesReferenceGlyphs>"
365   "            <speciesReferenceGlyph id=\"srg_malate_mito3_1\" speciesReference=\"sr_malate_mito3\" speciesGlyph=\"SpeciesGlyph_malate_mito3\" role=\"substrate\">"
366   "              <curve>"
367   "                <listOfCurveSegments>"
368   "                  <curveSegment xsi:type=\"LineSegment\">"
369   "                    <start x=\"1970\" y=\"181\"/>"
370   "                    <end x=\"1970\" y=\"116\"/>"
371   "                  </curveSegment>"
372   "                </listOfCurveSegments>"
373   "              </curve>"
374   "            </speciesReferenceGlyph>"
375   "            <speciesReferenceGlyph id=\"srg_nad_mito3\" speciesReference=\"sr_nad_mito3\" speciesGlyph=\"SpeciesGlyph_nad_mito3\" role=\"substrate\">"
376   "              <curve>"
377   "                <listOfCurveSegments>"
378   "                  <curveSegment xsi:type=\"CubicBezier\">"
379   "                    <start x=\"1970\" y=\"181\"/>"
380   "                    <end x=\"2050\" y=\"162\"/>"
381   "                    <basePoint1 x=\"1970\" y=\"162\"/>"
382   "                    <basePoint2 x=\"1970\" y=\"162\"/>"
383   "                  </curveSegment>"
384   "                </listOfCurveSegments>"
385   "              </curve>"
386   "            </speciesReferenceGlyph>"
387   "            <speciesReferenceGlyph id=\"srg_oxaloacetate_mito3_1\" speciesReference=\"sr_oxaloacetate_mito3_1\" speciesGlyph=\"SpeciesGlyph_oxaloacetate_mito3\" role=\"product\">"
388   "              <curve>"
389   "                <listOfCurveSegments>"
390   "                  <curveSegment xsi:type=\"LineSegment\">"
391   "                    <start x=\"1970\" y=\"215\"/>"
392   "                    <end x=\"1970\" y=\"280\"/>"
393   "                  </curveSegment>"
394   "                </listOfCurveSegments>"
395   "              </curve>"
396   "            </speciesReferenceGlyph>"
397   "            <speciesReferenceGlyph id=\"srg_nadh_mito3\" speciesReference=\"sr_nadh_mito3\" speciesGlyph=\"SpeciesGlyph_nadh_mito3\" role=\"product\">"
398   "              <curve>"
399   "                <listOfCurveSegments>"
400   "                  <curveSegment xsi:type=\"CubicBezier\">"
401   "                    <start x=\"1970\" y=\"215\"/>"
402   "                    <end x=\"2050\" y=\"242\"/>"
403   "                    <basePoint1 x=\"1970\" y=\"242\"/>"
404   "                    <basePoint2 x=\"1970\" y=\"242\"/>"
405   "                  </curveSegment>"
406   "                </listOfCurveSegments>"
407   "              </curve>"
408   "            </speciesReferenceGlyph>"
409   "            <speciesReferenceGlyph id=\"srg_h_mito3\" speciesReference=\"sr_h_mito3\" speciesGlyph=\"SpeciesGlyph_h_mito3\" role=\"product\">"
410   "              <curve>"
411   "                <listOfCurveSegments>"
412   "                  <curveSegment xsi:type=\"CubicBezier\">"
413   "                    <start x=\"1970\" y=\"215\"/>"
414   "                    <end x=\"2200\" y=\"230\"/>"
415   "                    <basePoint1 x=\"2100\" y=\"215\"/>"
416   "                    <basePoint2 x=\"2100\" y=\"215\"/>"
417   "                  </curveSegment>"
418   "                </listOfCurveSegments>"
419   "              </curve>"
420   "            </speciesReferenceGlyph>"
421   "          </listOfSpeciesReferenceGlyphs>"
422   "        </reactionGlyph>"
423   "        <reactionGlyph id=\"rg_aspartateat_mito3\" reaction=\"reaction_aspartateat_mito3\">"
424   "          <curve>"
425   "            <listOfCurveSegments>"
426   "              <curveSegment xsi:type=\"LineSegment\">"
427   "                <start x=\"1970\" y=\"381\"/>"
428   "                <end x=\"1970\" y=\"415\"/>"
429   "              </curveSegment>"
430   "            </listOfCurveSegments>"
431   "          </curve>"
432   "          <listOfSpeciesReferenceGlyphs>"
433   "            <speciesReferenceGlyph id=\"srg_oxaloacetate_mito3_2\" speciesReference=\"sr_oxaloacetate_mito3_2\" speciesGlyph=\"SpeciesGlyph_oxaloacetate_mito3\" role=\"substrate\">"
434   "              <curve>"
435   "                <listOfCurveSegments>"
436   "                  <curveSegment xsi:type=\"LineSegment\">"
437   "                    <start x=\"1970\" y=\"381\"/>"
438   "                    <end x=\"1970\" y=\"316\"/>"
439   "                  </curveSegment>"
440   "                </listOfCurveSegments>"
441   "              </curve>"
442   "            </speciesReferenceGlyph>"
443   "            <speciesReferenceGlyph id=\"srg_glutamate_mito3_1\" speciesReference=\"sr_glutamate_mito3_1\" speciesGlyph=\"SpeciesGlyph_glutamate_mito3\" role=\"substrate\">"
444   "              <curve>"
445   "                <listOfCurveSegments>"
446   "                  <curveSegment xsi:type=\"CubicBezier\">"
447   "                    <start x=\"1970\" y=\"381\"/>"
448   "                    <end x=\"1790\" y=\"448\"/>"
449   "                    <basePoint1 x=\"1880\" y=\"381\"/>"
450   "                    <basePoint2 x=\"1880\" y=\"448\"/>"
451   "                  </curveSegment>"
452   "                </listOfCurveSegments>"
453   "              </curve>"
454   "            </speciesReferenceGlyph>"
455   "            <speciesReferenceGlyph id=\"srg_aspartate_mito3_1\" speciesReference=\"sr_aspartate_mito3_1\" speciesGlyph=\"SpeciesGlyph_aspartate_mito3\" role=\"product\">"
456   "              <curve>"
457   "                <listOfCurveSegments>"
458   "                  <curveSegment xsi:type=\"LineSegment\">"
459   "                    <start x=\"1970\" y=\"415\"/>"
460   "                    <end x=\"1970\" y=\"480\"/>"
461   "                  </curveSegment>"
462   "                </listOfCurveSegments>"
463   "              </curve>"
464   "            </speciesReferenceGlyph>"
465   "            <speciesReferenceGlyph id=\"srg_aKetoglutaratemito3_1\" speciesReference=\"sr_aKetoglutarate_mito3_1\" speciesGlyph=\"SpeciesGlyph_aKetoglutarate_mito3\" role=\"product\">"
466   "              <curve>"
467   "                <listOfCurveSegments>"
468   "                  <curveSegment xsi:type=\"CubicBezier\">"
469   "                    <start x=\"1970\" y=\"415\"/>"
470   "                    <end x=\"1810\" y=\"315\"/>"
471   "                    <basePoint1 x=\"1880\" y=\"415\"/>"
472   "                    <basePoint2 x=\"1880\" y=\"315\"/>"
473   "                  </curveSegment>"
474   "                </listOfCurveSegments>"
475   "              </curve>"
476   "            </speciesReferenceGlyph>"
477   "          </listOfSpeciesReferenceGlyphs>"
478   "        </reactionGlyph>"
479   "        <reactionGlyph id=\"rg_aspartateCarrier\" reaction=\"aspartateCarrier\">"
480   "          <curve>"
481   "            <listOfCurveSegments>"
482   "              <curveSegment xsi:type=\"LineSegment\">"
483   "                <start x=\"1420\" y=\"530\"/>"
484   "                <end x=\"1360\" y=\"550\"/>"
485   "              </curveSegment>"
486   "            </listOfCurveSegments>"
487   "          </curve>"
488   "          <listOfSpeciesReferenceGlyphs>"
489   "            <speciesReferenceGlyph id=\"srg_aspartate_mito3_2\" speciesReference=\"sr_aspartate_mito3_2\" speciesGlyph=\"SpeciesGlyph_aspartate_mito3\" role=\"substrate\">"
490   "              <curve>"
491   "                <listOfCurveSegments>"
492   "                  <curveSegment xsi:type=\"LineSegment\">"
493   "                    <start x=\"1420\" y=\"530\"/>"
494   "                    <end x=\"1850\" y=\"498\"/>"
495   "                  </curveSegment>"
496   "                </listOfCurveSegments>"
497   "              </curve>"
498   "            </speciesReferenceGlyph>"
499   "            <speciesReferenceGlyph id=\"srg_aspartate_cyt_2\" speciesReference=\"sr_aspartate_cyt_2\" speciesGlyph=\"SpeciesGlyph_aspartate_cyt\" role=\"product\">"
500   "              <curve>"
501   "                <listOfCurveSegments>"
502   "                  <curveSegment xsi:type=\"CubicBezier\">"
503   "                    <start x=\"1360\" y=\"550\"/>"
504   "                    <end x=\"820\" y=\"698\"/>"
505   "                    <basePoint1 x=\"1390\" y=\"698\"/>"
506   "                    <basePoint2 x=\"1390\" y=\"698\"/>"
507   "                  </curveSegment>"
508   "                </listOfCurveSegments>"
509   "              </curve>"
510   "            </speciesReferenceGlyph>"
511   "            <speciesReferenceGlyph id=\"srg_glutamate_cyt_2\" speciesReference=\"sr_glutamate_cyt_2\" speciesGlyph=\"SpeciesGlyph_glutamate_cyt\" role=\"substrate\">"
512   "              <curve>"
513   "                <listOfCurveSegments>"
514   "                  <curveSegment xsi:type=\"CubicBezier\">"
515   "                    <start x=\"1420\" y=\"530\"/>"
516   "                    <end x=\"1050\" y=\"628\"/>"
517   "                    <basePoint1 x=\"1390\" y=\"648\"/>"
518   "                    <basePoint2 x=\"1390\" y=\"648\"/>"
519   "                  </curveSegment>"
520   "                </listOfCurveSegments>"
521   "              </curve>"
522   "            </speciesReferenceGlyph>"
523   "            <speciesReferenceGlyph id=\"srg_glutamate_mito3_2\" speciesReference=\"sr_glutamate_mito3_2\" speciesGlyph=\"SpeciesGlyph_glutamate_mito3\" role=\"product\">"
524   "              <curve>"
525   "                <listOfCurveSegments>"
526   "                  <curveSegment xsi:type=\"CubicBezier\">"
527   "                    <start x=\"1360\" y=\"550\"/>"
528   "                    <end x=\"1550\" y=\"448\"/>"
529   "                    <basePoint1 x=\"1390\" y=\"448\"/>"
530   "                    <basePoint2 x=\"1390\" y=\"448\"/>"
531   "                  </curveSegment>"
532   "                </listOfCurveSegments>"
533   "              </curve>"
534   "            </speciesReferenceGlyph>"
535   "          </listOfSpeciesReferenceGlyphs>"
536   "        </reactionGlyph>"
537   "        <reactionGlyph id=\"rg_malateCarrier\" reaction=\"malateCarrier\">"
538   "          <curve>"
539   "            <listOfCurveSegments>"
540   "              <curveSegment xsi:type=\"LineSegment\">"
541   "                <start x=\"1420\" y=\"320\"/>"
542   "                <end x=\"1360\" y=\"340\"/>"
543   "              </curveSegment>"
544   "            </listOfCurveSegments>"
545   "          </curve>"
546   "          <listOfSpeciesReferenceGlyphs>"
547   "            <speciesReferenceGlyph id=\"srg_aKetoglutarate_mito3_2\" speciesReference=\"sr_aKetoglutarate_mito3_2\" speciesGlyph=\"SpeciesGlyph_aKetoglutarate_mito3\" role=\"substrate\">"
548   "              <curve>"
549   "                <listOfCurveSegments>"
550   "                  <curveSegment xsi:type=\"LineSegment\">"
551   "                    <start x=\"1420\" y=\"320\"/>"
552   "                    <end x=\"1530\" y=\"318\"/>"
553   "                  </curveSegment>"
554   "                </listOfCurveSegments>"
555   "              </curve>"
556   "            </speciesReferenceGlyph>"
557   "            <speciesReferenceGlyph id=\"srg_aKetoglutarate_cyt_2\" speciesReference=\"sr_aKetoglutarate_cyt_2\" speciesGlyph=\"SpeciesGlyph_aKetoglutarate_cyt\" role=\"product\">"
558   "              <curve>"
559   "                <listOfCurveSegments>"
560   "                  <curveSegment xsi:type=\"LineSegment\">"
561   "                    <start x=\"1360\" y=\"340\"/>"
562   "                    <end x=\"1140\" y=\"518\"/>"
563   "                  </curveSegment>"
564   "                </listOfCurveSegments>"
565   "              </curve>"
566   "            </speciesReferenceGlyph>"
567   "            <speciesReferenceGlyph id=\"srg_malate_cyt_2\" speciesReference=\"sr_malate_cyt_2\" speciesGlyph=\"SpeciesGlyph_malate_cyt\" role=\"substrate\">"
568   "              <curve>"
569   "                <listOfCurveSegments>"
570   "                  <curveSegment xsi:type=\"CubicBezier\">"
571   "                    <start x=\"1420\" y=\"320\"/>"
572   "                    <end x=\"820\" y=\"298\"/>"
573   "                    <basePoint1 x=\"1390\" y=\"250\"/>"
574   "                    <basePoint2 x=\"1390\" y=\"250\"/>"
575   "                  </curveSegment>"
576   "                </listOfCurveSegments>"
577   "              </curve>"
578   "            </speciesReferenceGlyph>"
579   "            <speciesReferenceGlyph id=\"srg_malate_mito3_2\" speciesReference=\"sr_malate_mito3_2\" speciesGlyph=\"SpeciesGlyph_malate_mito3\" role=\"product\">"
580   "              <curve>"
581   "                <listOfCurveSegments>"
582   "                  <curveSegment xsi:type=\"CubicBezier\">"
583   "                    <start x=\"1360\" y=\"340\"/>"
584   "                    <end x=\"1850\" y=\"98\"/>"
585   "                    <basePoint1 x=\"1390\" y=\"150\"/>"
586   "                    <basePoint2 x=\"1390\" y=\"150\"/>"
587   "                  </curveSegment>"
588   "                </listOfCurveSegments>"
589   "              </curve>"
590   "            </speciesReferenceGlyph>"
591   "          </listOfSpeciesReferenceGlyphs>"
592   "        </reactionGlyph>"
593   "      </listOfReactionGlyphs>"
594   "      <listOfTextGlyphs>"
595   "        <textGlyph id=\"TextGlyph_Hepatocyte\" graphicalObject=\"CompartmentGlyph_1\" originOfText=\"Hepatocyte\">"
596   "          <boundingBox id=\"bb_tg_compartment\">"
597   "            <position x=\"50\" y=\"870\"/>"
598   "            <dimensions width=\"300\" height=\"72\"/>"
599   "          </boundingBox>"
600   "        </textGlyph>"
601   "        <textGlyph id=\"TextGlyph_mito1\" graphicalObject=\"Mito1_Glyph\" originOfText=\"Mito_1\">"
602   "          <boundingBox id=\"bb_tg_mito1\">"
603   "            <position x=\"110\" y=\"110\"/>"
604   "            <dimensions width=\"280\" height=\"72\"/>"
605   "          </boundingBox>"
606   "        </textGlyph>"
607   "        <textGlyph id=\"TextGlyph_mito2\" graphicalObject=\"Mito2_Glyph\" originOfText=\"Mito_2\">"
608   "          <boundingBox id=\"bb_tg_mito2\">"
609   "            <position x=\"210\" y=\"660\"/>"
610   "            <dimensions width=\"280\" height=\"72\"/>"
611   "          </boundingBox>"
612   "        </textGlyph>"
613   "        <textGlyph id=\"TextGlyph_mito3_2\" graphicalObject=\"Mito3_Glyph_2\" originOfText=\"Mito_3\">"
614   "          <boundingBox id=\"bb_tg_mito3_2\">"
615   "            <position x=\"1475\" y=\"35\"/>"
616   "            <dimensions width=\"200\" height=\"72\"/>"
617   "          </boundingBox>"
618   "        </textGlyph>"
619   "        <textGlyph id=\"TextGlyph_malate_cyt\" graphicalObject=\"SpeciesGlyph_malate_cyt\" originOfText=\"malate_cyt\">"
620   "          <boundingBox id=\"bb_tg_malatate_cyt\">"
621   "            <position x=\"590\" y=\"280\"/>"
622   "            <dimensions width=\"220\" height=\"36\"/>"
623   "          </boundingBox>"
624   "        </textGlyph>"
625   "        <textGlyph id=\"TextGlyph_oxaloacetate_cyt\" graphicalObject=\"SpeciesGlyph_oxaloacetate_cyt\" originOfText=\"oxaloacetate_cyt\">"
626   "          <boundingBox id=\"bb_tg_oxaloacetate_cyt\">"
627   "            <position x=\"590\" y=\"480\"/>"
628   "            <dimensions width=\"220\" height=\"36\"/>"
629   "          </boundingBox>"
630   "        </textGlyph>"
631   "        <textGlyph id=\"TextGlyph_aspartate_cyt\" graphicalObject=\"SpeciesGlyph_aspartate_cyt\" originOfText=\"aspartate_cyt\">"
632   "          <boundingBox id=\"bb_tg_aspartate_cyt\">"
633   "            <position x=\"590\" y=\"680\"/>"
634   "            <dimensions width=\"220\" height=\"36\"/>"
635   "          </boundingBox>"
636   "        </textGlyph>"
637   "        <textGlyph id=\"TextGlyph_glutamate_cyt\" graphicalObject=\"SpeciesGlyph_glutamate_cyt\" originOfText=\"glutamate_cyt\">"
638   "          <boundingBox id=\"bb_tg_glutamate_cyt\">"
639   "            <position x=\"810\" y=\"610\"/>"
640   "            <dimensions width=\"220\" height=\"36\"/>"
641   "          </boundingBox>"
642   "        </textGlyph>"
643   "        <textGlyph id=\"TextGlyph_aKetoglutarate_cyt\" graphicalObject=\"SpeciesGlyph_aKetoglutarate_cyt\" originOfText=\"aKetoglutarate_cyt\">"
644   "          <boundingBox id=\"bb_tg_aKetoglutarate_cyt\">"
645   "            <position x=\"870\" y=\"500\"/>"
646   "            <dimensions width=\"260\" height=\"36\"/>"
647   "          </boundingBox>"
648   "        </textGlyph>"
649   "        <textGlyph id=\"TextGlyph_nad_cyt\" graphicalObject=\"SpeciesGlyph_nad_cyt\" originOfText=\"nad_cyt\">"
650   "          <boundingBox id=\"bb_tg_nad_cyt\">"
651   "            <position x=\"525\" y=\"350\"/>"
652   "            <dimensions width=\"80\" height=\"24\"/>"
653   "          </boundingBox>"
654   "        </textGlyph>"
655   "        <textGlyph id=\"TextGlyph_nadh_cyt\" graphicalObject=\"SpeciesGlyph_nadh_cyt\" originOfText=\"nadh_cyt\">"
656   "          <boundingBox id=\"bb_tg_nadh_cyt\">"
657   "            <position x=\"525\" y=\"430\"/>"
658   "            <dimensions width=\"80\" height=\"24\"/>"
659   "          </boundingBox>"
660   "        </textGlyph>"
661   "        <textGlyph id=\"TextGlyph_h_cyt\" graphicalObject=\"SpeciesGlyph_h_cyt\" originOfText=\"h_cyt\">"
662   "          <boundingBox id=\"bb_tg_h_cyt\">"
663   "            <position x=\"435\" y=\"430\"/>"
664   "            <dimensions width=\"30\" height=\"24\"/>"
665   "          </boundingBox>"
666   "        </textGlyph>"
667   "        <textGlyph id=\"tg_rg_malaltedh_cyt\" graphicalObject=\"rg_malatedh_cyt\" originOfText=\"reaction_malatedh_cyt\">"
668   "          <boundingBox id=\"bb_tg_rg_malaltedh_cyt\">"
669   "            <position x=\"700\" y=\"385\"/>"
670   "            <dimensions width=\"210\" height=\"24\"/>"
671   "          </boundingBox>"
672   "        </textGlyph>"
673   "        <textGlyph id=\"tg_rg_aspartateat_cyt\" graphicalObject=\"rg_aspartateat_cyt\" originOfText=\"reaction_aspartateat_cyt\">"
674   "          <boundingBox id=\"bb_tg_rg_aspartateat_cyt\">"
675   "            <position x=\"440\" y=\"585\"/>"
676   "            <dimensions width=\"260\" height=\"24\"/>"
677   "          </boundingBox>"
678   "        </textGlyph>"
679   "        <textGlyph id=\"TextGlyph_malate_mito3\" graphicalObject=\"SpeciesGlyph_malate_mito3\" originOfText=\"malate_mito3\">"
680   "          <boundingBox id=\"bb_tg_malatate_mito3\">"
681   "            <position x=\"1860\" y=\"80\"/>"
682   "            <dimensions width=\"220\" height=\"36\"/>"
683   "          </boundingBox>"
684   "        </textGlyph>"
685   "        <textGlyph id=\"TextGlyph_oxaloacetate_mito3\" graphicalObject=\"SpeciesGlyph_oxaloacetate_mito3\" originOfText=\"oxaloacetate_mito3\">"
686   "          <boundingBox id=\"bb_tg_oxaloacetate_mito3\">"
687   "            <position x=\"1860\" y=\"280\"/>"
688   "            <dimensions width=\"220\" height=\"36\"/>"
689   "          </boundingBox>"
690   "        </textGlyph>"
691   "        <textGlyph id=\"TextGlyph_aspartate_mito3\" graphicalObject=\"SpeciesGlyph_aspartate_mito3\" originOfText=\"aspartate_mito3\">"
692   "          <boundingBox id=\"bb_tg_aspartate_mito3\">"
693   "            <position x=\"1860\" y=\"480\"/>"
694   "            <dimensions width=\"220\" height=\"36\"/>"
695   "          </boundingBox>"
696   "        </textGlyph>"
697   "        <textGlyph id=\"TextGlyph_glutamate_mito3\" graphicalObject=\"SpeciesGlyph_glutamate_mito3\" originOfText=\"glutamate_mito3\">"
698   "          <boundingBox id=\"bb_tg_glutamate_mito3\">"
699   "            <position x=\"1560\" y=\"430\"/>"
700   "            <dimensions width=\"220\" height=\"36\"/>"
701   "          </boundingBox>"
702   "        </textGlyph>"
703   "        <textGlyph id=\"TextGlyph_aKetoglutarate_mito3\" graphicalObject=\"SpeciesGlyph_aKetoglutarate_mito3\" originOfText=\"aKetoglutarate_mito3\">"
704   "          <boundingBox id=\"bb_tg_aKetoglutarate_mito3\">"
705   "            <position x=\"1540\" y=\"300\"/>"
706   "            <dimensions width=\"260\" height=\"36\"/>"
707   "          </boundingBox>"
708   "        </textGlyph>"
709   "        <textGlyph id=\"TextGlyph_nad_mito3\" graphicalObject=\"SpeciesGlyph_nad_mito3\" originOfText=\"nad_mito3\">"
710   "          <boundingBox id=\"bb_tg_nad_mito3\">"
711   "            <position x=\"2055\" y=\"150\"/>"
712   "            <dimensions width=\"80\" height=\"24\"/>"
713   "          </boundingBox>"
714   "        </textGlyph>"
715   "        <textGlyph id=\"TextGlyph_nadh_mito3\" graphicalObject=\"SpeciesGlyph_nadh_mito3\" originOfText=\"nadh_mito3\">"
716   "          <boundingBox id=\"bb_tg_nadh_mito3\">"
717   "            <position x=\"2055\" y=\"230\"/>"
718   "            <dimensions width=\"80\" height=\"24\"/>"
719   "          </boundingBox>"
720   "        </textGlyph>"
721   "        <textGlyph id=\"TextGlyph_h_mito3\" graphicalObject=\"SpeciesGlyph_h_mito3\" originOfText=\"h_mito3\">"
722   "          <boundingBox id=\"bb_tg_h_mito3\">"
723   "            <position x=\"2205\" y=\"230\"/>"
724   "            <dimensions width=\"30\" height=\"24\"/>"
725   "          </boundingBox>"
726   "        </textGlyph>"
727   "        <textGlyph id=\"tg_rg_malatedh_mito3\" graphicalObject=\"rg_malatedh_mito3\" originOfText=\"reaction_malatedh_mito3\">"
728   "          <boundingBox id=\"bb_tg_rg_malatedh_mito3\">"
729   "            <position x=\"1740\" y=\"185\"/>"
730   "            <dimensions width=\"220\" height=\"24\"/>"
731   "          </boundingBox>"
732   "        </textGlyph>"
733   "        <textGlyph id=\"tg_rg_aspartateat_mito3\" graphicalObject=\"rg_aspartateat_mito3\" originOfText=\"reaction_aspartateat_mito3\">"
734   "          <boundingBox id=\"bb_tg_rg_aspartateat_mito3\">"
735   "            <position x=\"1970\" y=\"385\"/>"
736   "            <dimensions width=\"260\" height=\"24\"/>"
737   "          </boundingBox>"
738   "        </textGlyph>"
739   "        <textGlyph id=\"tg_rg_aspartateCarrier\" graphicalObject=\"rg_aspartateCarrier\" originOfText=\"aspartateCarrier\">"
740   "          <boundingBox id=\"bb_tg_rg_aspartateCarrier\">"
741   "            <position x=\"1380\" y=\"500\"/>"
742   "            <dimensions width=\"160\" height=\"24\"/>"
743   "          </boundingBox>"
744   "        </textGlyph>"
745   "        <textGlyph id=\"tg_rg_malateCarrier\" graphicalObject=\"rg_malateCarrier\" originOfText=\"malateCarrier\">"
746   "          <boundingBox id=\"bb_tg_rg_malateCarrier\">"
747   "            <position x=\"1360\" y=\"330\"/>"
748   "            <dimensions width=\"140\" height=\"24\"/>"
749   "          </boundingBox>"
750   "        </textGlyph>"
751   "      </listOfTextGlyphs>"
752   "    </layout>"
753   "  </listOfLayouts>"
754   "            </annotation>"
755   "    <listOfCompartments>"
756   "      <compartment id=\"Hepatocyte\" name=\"Hepatocyte\"/>"
757   "      <compartment id=\"Mito_1\" name=\"Mito 1\" outside=\"Hepatocyte\"/>"
758   "      <compartment id=\"Mito_2\" name=\"Mito 2\" outside=\"Hepatocyte\"/>"
759   "      <compartment id=\"Mito_3\" name=\"Mito 3\" outside=\"Hepatocyte\"/>"
760   "    </listOfCompartments>"
761   "    <listOfSpecies>"
762   "      <species id=\"malate_cyt\" name=\"Malate\" compartment=\"Hepatocyte\"/>"
763   "      <species id=\"malate_mito1\" name=\"Malate\" compartment=\"Mito_1\"/>"
764   "      <species id=\"malate_mito2\" name=\"Malate\" compartment=\"Mito_2\"/>"
765   "      <species id=\"malate_mito3\" name=\"Malate\" compartment=\"Mito_3\"/>"
766   "      <species id=\"oxaloacetate_cyt\" name=\"Oxaloacetate\" compartment=\"Hepatocyte\"/>"
767   "      <species id=\"oxaloacetate_mito1\" name=\"Oxaloacetate\" compartment=\"Mito_1\"/>"
768   "      <species id=\"oxaloacetate_mito2\" name=\"Oxaloacetate\" compartment=\"Mito_2\"/>"
769   "      <species id=\"oxaloacetate_mito3\" name=\"Oxaloacetate\" compartment=\"Mito_3\"/>"
770   "      <species id=\"aspartate_cyt\" name=\"Aspartate\" compartment=\"Hepatocyte\"/>"
771   "      <species id=\"aspartate_mito1\" name=\"Aspartate\" compartment=\"Mito_1\"/>"
772   "      <species id=\"aspartate_mito2\" name=\"Aspartate\" compartment=\"Mito_2\"/>"
773   "      <species id=\"aspartate_mito3\" name=\"Aspartate\" compartment=\"Mito_3\"/>"
774   "      <species id=\"glutamate_cyt\" name=\"Glutamate\" compartment=\"Hepatocyte\"/>"
775   "      <species id=\"glutamate_mito1\" name=\"Glutamate\" compartment=\"Mito_1\"/>"
776   "      <species id=\"glutamate_mito2\" name=\"Glutamate\" compartment=\"Mito_2\"/>"
777   "      <species id=\"glutamate_mito3\" name=\"Glutamate\" compartment=\"Mito_3\"/>"
778   "      <species id=\"aKetoglutarate_cyt\" name=\"alpha-Ketoglutarate\" compartment=\"Hepatocyte\"/>"
779   "      <species id=\"aKetoglutarate_mito1\" name=\"alpha-Ketoglutarate\" compartment=\"Mito_1\"/>"
780   "      <species id=\"aKetoglutarate_mito2\" name=\"alpha-Ketoglutarate\" compartment=\"Mito_2\"/>"
781   "      <species id=\"aKetoglutarate_mito3\" name=\"alpha-Ketoglutarate\" compartment=\"Mito_3\"/>"
782   "      <species id=\"h_cyt\" name=\"H+\" compartment=\"Hepatocyte\"/>"
783   "      <species id=\"h_mito1\" name=\"H+\" compartment=\"Mito_1\"/>"
784   "      <species id=\"h_mito2\" name=\"H+\" compartment=\"Mito_2\"/>"
785   "      <species id=\"h_mito3\" name=\"H+\" compartment=\"Mito_3\"/>"
786   "      <species id=\"nad_cyt\" name=\"NAD+\" compartment=\"Hepatocyte\"/>"
787   "      <species id=\"nad_mito1\" name=\"NAD+\" compartment=\"Mito_1\"/>"
788   "      <species id=\"nad_mito2\" name=\"NAD+\" compartment=\"Mito_2\"/>"
789   "      <species id=\"nad_mito3\" name=\"NAD+\" compartment=\"Mito_3\"/>"
790   "      <species id=\"nadh_cyt\" name=\"NADH\" compartment=\"Hepatocyte\"/>"
791   "      <species id=\"nadh_mito1\" name=\"NADH\" compartment=\"Mito_1\"/>"
792   "      <species id=\"nadh_mito2\" name=\"NADH\" compartment=\"Mito_2\"/>"
793   "      <species id=\"nadh_mito3\" name=\"NADH\" compartment=\"Mito_3\"/>"
794   "    </listOfSpecies>"
795   "    <listOfReactions>"
796   "      <reaction id=\"reaction_malatedh_cyt\" name=\"malate dehydrogenase\" reversible=\"false\">"
797   "        <listOfReactants>"
798   "          <speciesReference species=\"malate_cyt\">"
799   "            <annotation>"
800   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_malate_cyt\"/>"
801   "</annotation>"
802   "          </speciesReference>"
803   "          <speciesReference species=\"nad_cyt\">"
804   "            <annotation>"
805   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nad_cyt\"/>"
806   "</annotation>"
807   "          </speciesReference>"
808   "        </listOfReactants>"
809   "        <listOfProducts>"
810   "          <speciesReference species=\"nadh_cyt\">"
811   "            <annotation>"
812   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nadh_cyt\"/>"
813   "</annotation>"
814   "          </speciesReference>"
815   "          <speciesReference species=\"h_cyt\">"
816   "            <annotation>"
817   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_h_cyt\"/>"
818   "</annotation>"
819   "          </speciesReference>"
820   "          <speciesReference species=\"oxaloacetate_cyt\">"
821   "            <annotation>"
822   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_cyt_1\"/>"
823   "</annotation>"
824   "          </speciesReference>"
825   "        </listOfProducts>"
826   "      </reaction>"
827   "      <reaction id=\"reaction_aspartateat_cyt\" name=\"aspartate aminotransferase\" reversible=\"false\">"
828   "        <listOfReactants>"
829   "          <speciesReference species=\"oxaloacetate_cyt\">"
830   "            <annotation>"
831   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_cyt_2\"/>"
832   "</annotation>"
833   "          </speciesReference>"
834   "          <speciesReference species=\"glutamate_cyt\">"
835   "            <annotation>"
836   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_glutamate_cyt_1\"/>"
837   "</annotation>"
838   "          </speciesReference>"
839   "        </listOfReactants>"
840   "        <listOfProducts>"
841   "          <speciesReference species=\"aspartate_cyt\">"
842   "            <annotation>"
843   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aspartate_cyt_1\"/>"
844   "</annotation>"
845   "          </speciesReference>"
846   "          <speciesReference species=\"aKetoglutarate_cyt\">"
847   "            <annotation>"
848   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aKetoglutarate_cyt_1\"/>"
849   "</annotation>"
850   "          </speciesReference>"
851   "        </listOfProducts>"
852   "      </reaction>"
853   "      <reaction id=\"reaction_malatedh_mito1\" name=\"malate dehydrogenase\" reversible=\"false\">"
854   "        <listOfReactants>"
855   "          <speciesReference species=\"malate_mito1\">"
856   "            <annotation>"
857   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_malate_mito1\"/>"
858   "</annotation>"
859   "          </speciesReference>"
860   "          <speciesReference species=\"nad_mito1\">"
861   "            <annotation>"
862   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nad_mito1\"/>"
863   "</annotation>"
864   "          </speciesReference>"
865   "        </listOfReactants>"
866   "        <listOfProducts>"
867   "          <speciesReference species=\"nadh_mito1\">"
868   "            <annotation>"
869   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nadh_mito1\"/>"
870   "</annotation>"
871   "          </speciesReference>"
872   "          <speciesReference species=\"h_mito1\">"
873   "            <annotation>"
874   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_h_mito1\"/>"
875   "</annotation>"
876   "          </speciesReference>"
877   "          <speciesReference species=\"oxaloacetate_mito1\">"
878   "            <annotation>"
879   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_mito1_1\"/>"
880   "</annotation>"
881   "          </speciesReference>"
882   "        </listOfProducts>"
883   "      </reaction>"
884   "      <reaction id=\"reaction_aspartateat_mito1\" name=\"aspartate aminotransferase\" reversible=\"false\">"
885   "        <listOfReactants>"
886   "          <speciesReference species=\"oxaloacetate_mito1\">"
887   "            <annotation>"
888   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_mito1_2\"/>"
889   "</annotation>"
890   "          </speciesReference>"
891   "          <speciesReference species=\"glutamate_mito1\">"
892   "            <annotation>"
893   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_glutamate_mito1\"/>"
894   "</annotation>"
895   "          </speciesReference>"
896   "        </listOfReactants>"
897   "        <listOfProducts>"
898   "          <speciesReference species=\"aspartate_mito1\">"
899   "            <annotation>"
900   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aspartate_mito1\"/>"
901   "</annotation>"
902   "          </speciesReference>"
903   "          <speciesReference species=\"aKetoglutarate_mito1\">"
904   "            <annotation>"
905   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aKetoglutarate_mito1\"/>"
906   "</annotation>"
907   "          </speciesReference>"
908   "        </listOfProducts>"
909   "      </reaction>"
910   "      <reaction id=\"reaction_malatedh_mito2\" name=\"malate dehydrogenase\" reversible=\"false\">"
911   "        <listOfReactants>"
912   "          <speciesReference species=\"malate_mito2\">"
913   "            <annotation>"
914   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_malate_mito2\"/>"
915   "</annotation>"
916   "          </speciesReference>"
917   "          <speciesReference species=\"nad_mito2\">"
918   "            <annotation>"
919   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nad_mito2\"/>"
920   "</annotation>"
921   "          </speciesReference>"
922   "        </listOfReactants>"
923   "        <listOfProducts>"
924   "          <speciesReference species=\"nadh_mito2\">"
925   "            <annotation>"
926   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nadh_mito2\"/>"
927   "</annotation>"
928   "          </speciesReference>"
929   "          <speciesReference species=\"h_mito2\">"
930   "            <annotation>"
931   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_h_mito2\"/>"
932   "</annotation>"
933   "          </speciesReference>"
934   "          <speciesReference species=\"oxaloacetate_mito2\">"
935   "            <annotation>"
936   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_mito2_1\"/>"
937   "</annotation>"
938   "          </speciesReference>"
939   "        </listOfProducts>"
940   "      </reaction>"
941   "      <reaction id=\"reaction_aspartateat_mito2\" name=\"aspartate aminotransferase\" reversible=\"false\">"
942   "        <listOfReactants>"
943   "          <speciesReference species=\"oxaloacetate_mito2\">"
944   "            <annotation>"
945   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_mito2_2\"/>"
946   "</annotation>"
947   "          </speciesReference>"
948   "          <speciesReference species=\"glutamate_mito2\">"
949   "            <annotation>"
950   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_glutamate_mito2\"/>"
951   "</annotation>"
952   "          </speciesReference>"
953   "        </listOfReactants>"
954   "        <listOfProducts>"
955   "          <speciesReference species=\"aspartate_mito2\">"
956   "            <annotation>"
957   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aspartate_mito2\"/>"
958   "</annotation>"
959   "          </speciesReference>"
960   "          <speciesReference species=\"aKetoglutarate_mito2\">"
961   "            <annotation>"
962   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aKetoglutarate_mito2\"/>"
963   "</annotation>"
964   "          </speciesReference>"
965   "        </listOfProducts>"
966   "      </reaction>"
967   "      <reaction id=\"reaction_malatedh_mito3\" name=\"malate dehydrogenase\" reversible=\"false\">"
968   "        <listOfReactants>"
969   "          <speciesReference species=\"malate_mito3\">"
970   "            <annotation>"
971   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_malate_mito3\"/>"
972   "</annotation>"
973   "          </speciesReference>"
974   "          <speciesReference species=\"nad_mito3\">"
975   "            <annotation>"
976   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nad_mito3\"/>"
977   "</annotation>"
978   "          </speciesReference>"
979   "        </listOfReactants>"
980   "        <listOfProducts>"
981   "          <speciesReference species=\"nadh_mito3\">"
982   "            <annotation>"
983   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_nadh_mito3\"/>"
984   "</annotation>"
985   "          </speciesReference>"
986   "          <speciesReference species=\"h_mito3\">"
987   "            <annotation>"
988   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_h_mito3\"/>"
989   "</annotation>"
990   "          </speciesReference>"
991   "          <speciesReference species=\"oxaloacetate_mito3\">"
992   "            <annotation>"
993   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_mito3_1\"/>"
994   "</annotation>"
995   "          </speciesReference>"
996   "        </listOfProducts>"
997   "      </reaction>"
998   "      <reaction id=\"reaction_aspartateat_mito3\" name=\"aspartate aminotransferase\" reversible=\"false\">"
999   "        <listOfReactants>"
1000   "          <speciesReference species=\"oxaloacetate_mito3\">"
1001   "            <annotation>"
1002   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_oxaloacetate_mito3_2\"/>"
1003   "</annotation>"
1004   "          </speciesReference>"
1005   "          <speciesReference species=\"glutamate_mito3\">"
1006   "            <annotation>"
1007   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_glutamate_mito3_1\"/>"
1008   "</annotation>"
1009   "          </speciesReference>"
1010   "        </listOfReactants>"
1011   "        <listOfProducts>"
1012   "          <speciesReference species=\"aspartate_mito3\">"
1013   "            <annotation>"
1014   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aspartate_mito3_1\"/>"
1015   "</annotation>"
1016   "          </speciesReference>"
1017   "          <speciesReference species=\"aKetoglutarate_mito3\">"
1018   "            <annotation>"
1019   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aKetoglutarate_mito3_1\"/>"
1020   "</annotation>"
1021   "          </speciesReference>"
1022   "        </listOfProducts>"
1023   "      </reaction>"
1024   "      <reaction id=\"aspartateCarrier\" name=\"aspartate carrier\">"
1025   "        <listOfReactants>"
1026   "          <speciesReference species=\"glutamate_mito3\">"
1027   "            <annotation>"
1028   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_glutamate_mito3_2\"/>"
1029   "</annotation>"
1030   "          </speciesReference>"
1031   "          <speciesReference species=\"aspartate_cyt\">"
1032   "            <annotation>"
1033   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aspartate_cyt_2\"/>"
1034   "</annotation>"
1035   "          </speciesReference>"
1036   "        </listOfReactants>"
1037   "        <listOfProducts>"
1038   "          <speciesReference species=\"glutamate_cyt\">"
1039   "            <annotation>"
1040   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_glutamate_cyt_2\"/>"
1041   "</annotation>"
1042   "          </speciesReference>"
1043   "          <speciesReference species=\"aspartate_mito3\">"
1044   "            <annotation>"
1045   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aspartate_mito3_2\"/>"
1046   "</annotation>"
1047   "          </speciesReference>"
1048   "        </listOfProducts>"
1049   "      </reaction>"
1050   "      <reaction id=\"malateCarrier\" name=\"malate carrier\">"
1051   "        <listOfReactants>"
1052   "          <speciesReference species=\"aKetoglutarate_mito3\">"
1053   "            <annotation>"
1054   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aKetoglutarate_mito3_2\"/>"
1055   "</annotation>"
1056   "          </speciesReference>"
1057   "          <speciesReference species=\"malate_cyt\">"
1058   "            <annotation>"
1059   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_malate_cyt_2\"/>"
1060   "</annotation>"
1061   "          </speciesReference>"
1062   "        </listOfReactants>"
1063   "        <listOfProducts>"
1064   "          <speciesReference species=\"aKetoglutarate_cyt\">"
1065   "            <annotation>"
1066   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_aKetoglutarate_cyt_2\"/>"
1067   "</annotation>"
1068   "          </speciesReference>"
1069   "          <speciesReference species=\"malate_mito3\">"
1070   "            <annotation>"
1071   "  <layoutId xmlns=\"http://projects.eml.org/bcb/sbml/level2\" id=\"sr_malate_mito3_2\"/>"
1072   "</annotation>"
1073   "          </speciesReference>"
1074   "        </listOfProducts>"
1075   "      </reaction>"
1076   "    </listOfReactions>"
1077   "  </model>"
1078   "</sbml> "
1079   ;
1080 
1081   XMLInputStream *stream = new XMLInputStream (s.c_str(),false);
1082   XMLNode *node = new XMLNode(*stream);
1083 
1084   fail_unless(node != NULL);
1085 
1086   // create the document
1087   fail_unless(LN != NULL);
1088   SBMLDocument *document=new SBMLDocument(LN);
1089   fail_unless(document != NULL);
1090   // create the Model
1091 
1092   Model* model=document->createModel();
1093   model->setId("TestModel");
1094   document->setModel(model);
1095 
1096   // create the Compartment
1097 
1098   Compartment* compartment=model->createCompartment();
1099   compartment->setId("Hepatocyte");
1100   compartment->setName("Hepatocyte");
1101 
1102   Compartment* mito1=model->createCompartment();
1103   mito1->setId("Mito_1");
1104   mito1->setName("Mito 1");
1105   mito1->setOutside(compartment->getId());
1106 
1107   Compartment* mito2=model->createCompartment();
1108   mito2->setId("Mito_2");
1109   mito2->setName("Mito 2");
1110   mito2->setOutside(compartment->getId());
1111 
1112   Compartment* mito3=model->createCompartment();
1113   mito3->setId("Mito_3");
1114   mito3->setName("Mito 3");
1115   mito3->setOutside(compartment->getId());
1116 
1117 
1118   // create the Species
1119 
1120   // Malate
1121   Species* malate_cyt=model->createSpecies();
1122   malate_cyt->setId("malate_cyt");
1123   malate_cyt->setName("Malate");
1124   malate_cyt->setCompartment(compartment->getId());
1125 
1126   Species* malate_mito1=model->createSpecies();
1127   malate_mito1->setId("malate_mito1");
1128   malate_mito1->setCompartment(mito1->getId());
1129   malate_mito1->setName("Malate");
1130 
1131   Species* malate_mito2=model->createSpecies();
1132   malate_mito2->setId("malate_mito2");
1133   malate_mito2->setCompartment(mito2->getId());
1134   malate_mito2->setName("Malate");
1135 
1136   Species* malate_mito3=model->createSpecies();
1137   malate_mito3->setId("malate_mito3");
1138   malate_mito3->setCompartment(mito3->getId());
1139   malate_mito3->setName("Malate");
1140 
1141 
1142   // Oxaloacetate
1143   Species* oxaloacetate_cyt=model->createSpecies();
1144   oxaloacetate_cyt->setId("oxaloacetate_cyt");
1145   oxaloacetate_cyt->setName("Oxaloacetate");
1146   oxaloacetate_cyt->setCompartment(compartment->getId());
1147 
1148   Species* oxaloacetate_mito1=model->createSpecies();
1149   oxaloacetate_mito1->setId("oxaloacetate_mito1");
1150   oxaloacetate_mito1->setCompartment(mito1->getId());
1151   oxaloacetate_mito1->setName("Oxaloacetate");
1152 
1153   Species* oxaloacetate_mito2=model->createSpecies();
1154   oxaloacetate_mito2->setId("oxaloacetate_mito2");
1155   oxaloacetate_mito2->setCompartment(mito2->getId());
1156   oxaloacetate_mito2->setName("Oxaloacetate");
1157 
1158   Species* oxaloacetate_mito3=model->createSpecies();
1159   oxaloacetate_mito3->setId("oxaloacetate_mito3");
1160   oxaloacetate_mito3->setCompartment(mito3->getId());
1161   oxaloacetate_mito3->setName("Oxaloacetate");
1162 
1163 
1164   // Aspartate
1165   Species* aspartate_cyt=model->createSpecies();
1166   aspartate_cyt->setId("aspartate_cyt");
1167   aspartate_cyt->setName("Aspartate");
1168   aspartate_cyt->setCompartment(compartment->getId());
1169 
1170   Species* aspartate_mito1=model->createSpecies();
1171   aspartate_mito1->setId("aspartate_mito1");
1172   aspartate_mito1->setCompartment(mito1->getId());
1173   aspartate_mito1->setName("Aspartate");
1174 
1175   Species* aspartate_mito2=model->createSpecies();
1176   aspartate_mito2->setId("aspartate_mito2");
1177   aspartate_mito2->setCompartment(mito2->getId());
1178   aspartate_mito2->setName("Aspartate");
1179 
1180   Species* aspartate_mito3=model->createSpecies();
1181   aspartate_mito3->setId("aspartate_mito3");
1182   aspartate_mito3->setCompartment(mito3->getId());
1183   aspartate_mito3->setName("Aspartate");
1184 
1185 
1186   // Glutamate
1187   Species* glutamate_cyt=model->createSpecies();
1188   glutamate_cyt->setId("glutamate_cyt");
1189   glutamate_cyt->setName("Glutamate");
1190   glutamate_cyt->setCompartment(compartment->getId());
1191 
1192   Species* glutamate_mito1=model->createSpecies();
1193   glutamate_mito1->setId("glutamate_mito1");
1194   glutamate_mito1->setCompartment(mito1->getId());
1195   glutamate_mito1->setName("Glutamate");
1196 
1197   Species* glutamate_mito2=model->createSpecies();
1198   glutamate_mito2->setId("glutamate_mito2");
1199   glutamate_mito2->setCompartment(mito2->getId());
1200   glutamate_mito2->setName("Glutamate");
1201 
1202   Species* glutamate_mito3=model->createSpecies();
1203   glutamate_mito3->setId("glutamate_mito3");
1204   glutamate_mito3->setCompartment(mito3->getId());
1205   glutamate_mito3->setName("Glutamate");
1206 
1207 
1208   // alpha-Ketoglutarate
1209   Species* aKetoglutarate_cyt=model->createSpecies();
1210   aKetoglutarate_cyt->setId("aKetoglutarate_cyt");
1211   aKetoglutarate_cyt->setName("alpha-Ketoglutarate");
1212   aKetoglutarate_cyt->setCompartment(compartment->getId());
1213 
1214   Species* aKetoglutarate_mito1=model->createSpecies();
1215   aKetoglutarate_mito1->setId("aKetoglutarate_mito1");
1216   aKetoglutarate_mito1->setCompartment(mito1->getId());
1217   aKetoglutarate_mito1->setName("alpha-Ketoglutarate");
1218 
1219   Species* aKetoglutarate_mito2=model->createSpecies();
1220   aKetoglutarate_mito2->setId("aKetoglutarate_mito2");
1221   aKetoglutarate_mito2->setCompartment(mito2->getId());
1222   aKetoglutarate_mito2->setName("alpha-Ketoglutarate");
1223 
1224   Species* aKetoglutarate_mito3=model->createSpecies();
1225   aKetoglutarate_mito3->setId("aKetoglutarate_mito3");
1226   aKetoglutarate_mito3->setCompartment(mito3->getId());
1227   aKetoglutarate_mito3->setName("alpha-Ketoglutarate");
1228 
1229 
1230   // protons
1231   Species* h_cyt=model->createSpecies();
1232   h_cyt->setId("h_cyt");
1233   h_cyt->setName("H+");
1234   h_cyt->setCompartment(compartment->getId());
1235 
1236   Species* h_mito1=model->createSpecies();
1237   h_mito1->setId("h_mito1");
1238   h_mito1->setCompartment(mito1->getId());
1239   h_mito1->setName("H+");
1240 
1241   Species* h_mito2=model->createSpecies();
1242   h_mito2->setId("h_mito2");
1243   h_mito2->setCompartment(mito2->getId());
1244   h_mito2->setName("H+");
1245 
1246   Species* h_mito3=model->createSpecies();
1247   h_mito3->setId("h_mito3");
1248   h_mito3->setCompartment(mito3->getId());
1249   h_mito3->setName("H+");
1250 
1251 
1252   // NAD+
1253   Species* nad_cyt=model->createSpecies();
1254   nad_cyt->setId("nad_cyt");
1255   nad_cyt->setName("NAD+");
1256   nad_cyt->setCompartment(compartment->getId());
1257 
1258   Species* nad_mito1=model->createSpecies();
1259   nad_mito1->setId("nad_mito1");
1260   nad_mito1->setCompartment(mito1->getId());
1261   nad_mito1->setName("NAD+");
1262 
1263   Species* nad_mito2=model->createSpecies();
1264   nad_mito2->setId("nad_mito2");
1265   nad_mito2->setCompartment(mito2->getId());
1266   nad_mito2->setName("NAD+");
1267 
1268   Species* nad_mito3=model->createSpecies();
1269   nad_mito3->setId("nad_mito3");
1270   nad_mito3->setCompartment(mito3->getId());
1271   nad_mito3->setName("NAD+");
1272 
1273 
1274   // NADH
1275   Species* nadh_cyt=model->createSpecies();
1276   nadh_cyt->setId("nadh_cyt");
1277   nadh_cyt->setName("NADH");
1278   nadh_cyt->setCompartment(compartment->getId());
1279 
1280   Species* nadh_mito1=model->createSpecies();
1281   nadh_mito1->setId("nadh_mito1");
1282   nadh_mito1->setCompartment(mito1->getId());
1283   nadh_mito1->setName("NADH");
1284 
1285   Species* nadh_mito2=model->createSpecies();
1286   nadh_mito2->setId("nadh_mito2");
1287   nadh_mito2->setCompartment(mito2->getId());
1288   nadh_mito2->setName("NADH");
1289 
1290   Species* nadh_mito3=model->createSpecies();
1291   nadh_mito3->setId("nadh_mito3");
1292   nadh_mito3->setCompartment(mito3->getId());
1293   nadh_mito3->setName("NADH");
1294 
1295 
1296 
1297 
1298   // create the Reactions
1299 
1300   // Cytosol
1301 
1302   // Malate Dehydrogenase
1303   Reaction* malatedh_cyt=model->createReaction();
1304   malatedh_cyt->setId("reaction_malatedh_cyt");
1305   malatedh_cyt->setName("malate dehydrogenase");
1306   malatedh_cyt->setReversible(false);
1307 
1308   SpeciesReference* sr_malate_cyt=malatedh_cyt->createReactant();
1309   sr_malate_cyt->setSpecies(malate_cyt->getId());
1310   sr_malate_cyt->setId("sr_malate_cyt");
1311 
1312   SpeciesReference* sr_nad_cyt=malatedh_cyt->createReactant();
1313   sr_nad_cyt->setSpecies(nad_cyt->getId());
1314   sr_nad_cyt->setId("sr_nad_cyt");
1315 
1316   SpeciesReference* sr_nadh_cyt=malatedh_cyt->createProduct();
1317   sr_nadh_cyt->setSpecies(nadh_cyt->getId());
1318   sr_nadh_cyt->setId("sr_nadh_cyt");
1319 
1320   SpeciesReference* sr_h_cyt=malatedh_cyt->createProduct();
1321   sr_h_cyt->setSpecies(h_cyt->getId());
1322   sr_h_cyt->setId("sr_h_cyt");
1323 
1324   SpeciesReference* sr_oxaloacetate_cyt_1=malatedh_cyt->createProduct();
1325   sr_oxaloacetate_cyt_1->setSpecies(oxaloacetate_cyt->getId());
1326   sr_oxaloacetate_cyt_1->setId("sr_oxaloacetate_cyt_1");
1327 
1328   //Aspartate Aminotransferase
1329   Reaction* aspartateat_cyt=model->createReaction();
1330   aspartateat_cyt->setId("reaction_aspartateat_cyt");
1331   aspartateat_cyt->setName("aspartate aminotransferase");
1332   aspartateat_cyt->setReversible(false);
1333 
1334   SpeciesReference* sr_oxaloacetate_cyt_2=aspartateat_cyt->createReactant();
1335   sr_oxaloacetate_cyt_2->setSpecies(oxaloacetate_cyt->getId());
1336   sr_oxaloacetate_cyt_2->setId("sr_oxaloacetate_cyt_2");
1337 
1338   SpeciesReference* sr_glutamate_cyt_1=aspartateat_cyt->createReactant();
1339   sr_glutamate_cyt_1->setSpecies(glutamate_cyt->getId());
1340   sr_glutamate_cyt_1->setId("sr_glutamate_cyt_1");
1341 
1342   SpeciesReference* sr_aspartate_cyt_1=aspartateat_cyt->createProduct();
1343   sr_aspartate_cyt_1->setSpecies(aspartate_cyt->getId());
1344   sr_aspartate_cyt_1->setId("sr_aspartate_cyt_1");
1345 
1346   SpeciesReference* sr_aKetoglutarate_cyt_1=aspartateat_cyt->createProduct();
1347   sr_aKetoglutarate_cyt_1->setSpecies(aKetoglutarate_cyt->getId());
1348   sr_aKetoglutarate_cyt_1->setId("sr_aKetoglutarate_cyt_1");
1349 
1350 
1351   // Mito 1
1352 
1353   // Malate Dehydrogenase
1354   Reaction* malatedh_mito1=model->createReaction();
1355   malatedh_mito1->setId("reaction_malatedh_mito1");
1356   malatedh_mito1->setName("malate dehydrogenase");
1357   malatedh_mito1->setReversible(false);
1358 
1359   SpeciesReference* sr_malate_mito1=malatedh_mito1->createReactant();
1360   sr_malate_mito1->setSpecies(malate_mito1->getId());
1361   sr_malate_mito1->setId("sr_malate_mito1");
1362 
1363   SpeciesReference* sr_nad_mito1=malatedh_mito1->createReactant();
1364   sr_nad_mito1->setSpecies(nad_mito1->getId());
1365   sr_nad_mito1->setId("sr_nad_mito1");
1366 
1367   SpeciesReference* sr_nadh_mito1=malatedh_mito1->createProduct();
1368   sr_nadh_mito1->setSpecies(nadh_mito1->getId());
1369   sr_nadh_mito1->setId("sr_nadh_mito1");
1370 
1371   SpeciesReference* sr_h_mito1=malatedh_mito1->createProduct();
1372   sr_h_mito1->setSpecies(h_mito1->getId());
1373   sr_h_mito1->setId("sr_h_mito1");
1374 
1375   SpeciesReference* sr_oxaloacetate_mito1_1=malatedh_mito1->createProduct();
1376   sr_oxaloacetate_mito1_1->setSpecies(oxaloacetate_mito1->getId());
1377   sr_oxaloacetate_mito1_1->setId("sr_oxaloacetate_mito1_1");
1378 
1379   //Aspartate Aminotransferase
1380   Reaction* aspartateat_mito1=model->createReaction();
1381   aspartateat_mito1->setId("reaction_aspartateat_mito1");
1382   aspartateat_mito1->setName("aspartate aminotransferase");
1383   aspartateat_mito1->setReversible(false);
1384 
1385   SpeciesReference* sr_oxaloacetate_mito1_2=aspartateat_mito1->createReactant();
1386   sr_oxaloacetate_mito1_2->setSpecies(oxaloacetate_mito1->getId());
1387   sr_oxaloacetate_mito1_2->setId("sr_oxaloacetate_mito1_2");
1388 
1389   SpeciesReference* sr_glutamate_mito1=aspartateat_mito1->createReactant();
1390   sr_glutamate_mito1->setSpecies(glutamate_mito1->getId());
1391   sr_glutamate_mito1->setId("sr_glutamate_mito1");
1392 
1393   SpeciesReference* sr_aspartate_mito1=aspartateat_mito1->createProduct();
1394   sr_aspartate_mito1->setSpecies(aspartate_mito1->getId());
1395   sr_aspartate_mito1->setId("sr_aspartate_mito1");
1396 
1397   SpeciesReference* sr_aKetoglutarate_mito1=aspartateat_mito1->createProduct();
1398   sr_aKetoglutarate_mito1->setSpecies(aKetoglutarate_mito1->getId());
1399   sr_aKetoglutarate_mito1->setId("sr_aKetoglutarate_mito1");
1400 
1401 
1402   // Mito 2
1403 
1404   // Malate Dehydrogenase
1405   Reaction* malatedh_mito2=model->createReaction();
1406   malatedh_mito2->setId("reaction_malatedh_mito2");
1407   malatedh_mito2->setName("malate dehydrogenase");
1408   malatedh_mito2->setReversible(false);
1409 
1410   SpeciesReference* sr_malate_mito2=malatedh_mito2->createReactant();
1411   sr_malate_mito2->setSpecies(malate_mito2->getId());
1412   sr_malate_mito2->setId("sr_malate_mito2");
1413 
1414   SpeciesReference* sr_nad_mito2=malatedh_mito2->createReactant();
1415   sr_nad_mito2->setSpecies(nad_mito2->getId());
1416   sr_nad_mito2->setId("sr_nad_mito2");
1417 
1418   SpeciesReference* sr_nadh_mito2=malatedh_mito2->createProduct();
1419   sr_nadh_mito2->setSpecies(nadh_mito2->getId());
1420   sr_nadh_mito2->setId("sr_nadh_mito2");
1421 
1422   SpeciesReference* sr_h_mito2=malatedh_mito2->createProduct();
1423   sr_h_mito2->setSpecies(h_mito2->getId());
1424   sr_h_mito2->setId("sr_h_mito2");
1425 
1426   SpeciesReference* sr_oxaloacetate_mito2_1=malatedh_mito2->createProduct();
1427   sr_oxaloacetate_mito2_1->setSpecies(oxaloacetate_mito2->getId());
1428   sr_oxaloacetate_mito2_1->setId("sr_oxaloacetate_mito2_1");
1429 
1430   //Aspartate Aminotransferase
1431   Reaction* aspartateat_mito2=model->createReaction();
1432   aspartateat_mito2->setId("reaction_aspartateat_mito2");
1433   aspartateat_mito2->setName("aspartate aminotransferase");
1434   aspartateat_mito2->setReversible(false);
1435 
1436   SpeciesReference* sr_oxaloacetate_mito2_2=aspartateat_mito2->createReactant();
1437   sr_oxaloacetate_mito2_2->setSpecies(oxaloacetate_mito2->getId());
1438   sr_oxaloacetate_mito2_2->setId("sr_oxaloacetate_mito2_2");
1439 
1440   SpeciesReference* sr_glutamate_mito2=aspartateat_mito2->createReactant();
1441   sr_glutamate_mito2->setSpecies(glutamate_mito2->getId());
1442   sr_glutamate_mito2->setId("sr_glutamate_mito2");
1443 
1444   SpeciesReference* sr_aspartate_mito2=aspartateat_mito2->createProduct();
1445   sr_aspartate_mito2->setSpecies(aspartate_mito2->getId());
1446   sr_aspartate_mito2->setId("sr_aspartate_mito2");
1447 
1448   SpeciesReference* sr_aKetoglutarate_mito2=aspartateat_mito2->createProduct();
1449   sr_aKetoglutarate_mito2->setSpecies(aKetoglutarate_mito2->getId());
1450   sr_aKetoglutarate_mito2->setId("sr_aKetoglutarate_mito2");
1451 
1452 
1453   // Mito 3
1454 
1455   // Malate Dehydrogenase
1456   Reaction* malatedh_mito3=model->createReaction();
1457   malatedh_mito3->setId("reaction_malatedh_mito3");
1458   malatedh_mito3->setName("malate dehydrogenase");
1459   malatedh_mito3->setReversible(false);
1460 
1461   SpeciesReference* sr_malate_mito3=malatedh_mito3->createReactant();
1462   sr_malate_mito3->setSpecies(malate_mito3->getId());
1463   sr_malate_mito3->setId("sr_malate_mito3");
1464 
1465   SpeciesReference* sr_nad_mito3=malatedh_mito3->createReactant();
1466   sr_nad_mito3->setSpecies(nad_mito3->getId());
1467   sr_nad_mito3->setId("sr_nad_mito3");
1468 
1469   SpeciesReference* sr_nadh_mito3=malatedh_mito3->createProduct();
1470   sr_nadh_mito3->setSpecies(nadh_mito3->getId());
1471   sr_nadh_mito3->setId("sr_nadh_mito3");
1472 
1473   SpeciesReference* sr_h_mito3=malatedh_mito3->createProduct();
1474   sr_h_mito3->setSpecies(h_mito3->getId());
1475   sr_h_mito3->setId("sr_h_mito3");
1476 
1477   SpeciesReference* sr_oxaloacetate_mito3_1=malatedh_mito3->createProduct();
1478   sr_oxaloacetate_mito3_1->setSpecies(oxaloacetate_mito3->getId());
1479   sr_oxaloacetate_mito3_1->setId("sr_oxaloacetate_mito3_1");
1480 
1481   //Aspartate Aminotransferase
1482   Reaction* aspartateat_mito3=model->createReaction();
1483   aspartateat_mito3->setId("reaction_aspartateat_mito3");
1484   aspartateat_mito3->setName("aspartate aminotransferase");
1485   aspartateat_mito3->setReversible(false);
1486 
1487   SpeciesReference* sr_oxaloacetate_mito3_2=aspartateat_mito3->createReactant();
1488   sr_oxaloacetate_mito3_2->setSpecies(oxaloacetate_mito3->getId());
1489   sr_oxaloacetate_mito3_2->setId("sr_oxaloacetate_mito3_2");
1490 
1491 
1492   SpeciesReference* sr_glutamate_mito3_1=aspartateat_mito3->createReactant();
1493   sr_glutamate_mito3_1->setSpecies(glutamate_mito3->getId());
1494   sr_glutamate_mito3_1->setId("sr_glutamate_mito3_1");
1495 
1496 
1497   SpeciesReference* sr_aspartate_mito3_1=aspartateat_mito3->createProduct();
1498   sr_aspartate_mito3_1->setSpecies(aspartate_mito3->getId());
1499   sr_aspartate_mito3_1->setId("sr_aspartate_mito3_1");
1500 
1501 
1502   SpeciesReference* sr_aKetoglutarate_mito3_1=aspartateat_mito3->createProduct();
1503   sr_aKetoglutarate_mito3_1->setSpecies(aKetoglutarate_mito3->getId());
1504   sr_aKetoglutarate_mito3_1->setId("sr_aKetoglutarate_mito3_1");
1505 
1506 
1507   // aspartate carrier
1508 
1509   Reaction* aspartateCarrier=model->createReaction();
1510   aspartateCarrier->setId("aspartateCarrier");
1511   aspartateCarrier->setName("aspartate carrier");
1512   aspartateCarrier->setReversible(true);
1513 
1514   SpeciesReference* sr_glutamate_mito3_2=aspartateCarrier->createReactant();
1515   sr_glutamate_mito3_2->setSpecies(glutamate_mito3->getId());
1516   sr_glutamate_mito3_2->setId("sr_glutamate_mito3_2");
1517 
1518   SpeciesReference* sr_aspartate_cyt_2=aspartateCarrier->createReactant();
1519   sr_aspartate_cyt_2->setSpecies(aspartate_cyt->getId());
1520   sr_aspartate_cyt_2->setId("sr_aspartate_cyt_2");
1521 
1522   SpeciesReference* sr_glutamate_cyt_2=aspartateCarrier->createProduct();
1523   sr_glutamate_cyt_2->setSpecies(glutamate_cyt->getId());
1524   sr_glutamate_cyt_2->setId("sr_glutamate_cyt_2");
1525 
1526   SpeciesReference* sr_aspartate_mito3_2=aspartateCarrier->createProduct();
1527   sr_aspartate_mito3_2->setSpecies(aspartate_mito3->getId());
1528   sr_aspartate_mito3_2->setId("sr_aspartate_mito3_2");
1529 
1530   // malate carrier
1531 
1532   Reaction* malateCarrier=model->createReaction();
1533   malateCarrier->setId("malateCarrier");
1534   malateCarrier->setName("malate carrier");
1535   malateCarrier->setReversible(true);
1536 
1537   SpeciesReference* sr_aKetoglutarate_mito3_2=malateCarrier->createReactant();
1538   sr_aKetoglutarate_mito3_2->setSpecies(aKetoglutarate_mito3->getId());
1539   sr_aKetoglutarate_mito3_2->setId("sr_aKetoglutarate_mito3_2");
1540 
1541   SpeciesReference* sr_malate_cyt_2=malateCarrier->createReactant();
1542   sr_malate_cyt_2->setSpecies(malate_cyt->getId());
1543   sr_malate_cyt_2->setId("sr_malate_cyt_2");
1544 
1545   SpeciesReference* sr_aKetoglutarate_cyt_2=malateCarrier->createProduct();
1546   sr_aKetoglutarate_cyt_2->setSpecies(aKetoglutarate_cyt->getId());
1547   sr_aKetoglutarate_cyt_2->setId("sr_aKetoglutarate_cyt_2");
1548 
1549   SpeciesReference* sr_malate_mito3_2=malateCarrier->createProduct();
1550   sr_malate_mito3_2->setSpecies(malate_mito3->getId());
1551   sr_malate_mito3_2->setId("sr_malate_mito3_2");
1552 
1553 
1554   /////////// create the Layout
1555 
1556   LayoutModelPlugin* mplugin = static_cast<LayoutModelPlugin*>(model->getPlugin("layout"));
1557   fail_unless(mplugin != NULL);
1558   Layout* layout=mplugin->createLayout();
1559 
1560   layout->setId("Layout_1");
1561   Dimensions dim(LN,2320.0,1000.0);
1562   layout->setDimensions(&dim);
1563 
1564 
1565   // create the CompartmentGlyph
1566 
1567   CompartmentGlyph* compartmentGlyph=layout->createCompartmentGlyph();
1568   compartmentGlyph->setId("CompartmentGlyph_1");
1569   compartmentGlyph->setCompartmentId(compartment->getId());
1570   BoundingBox bb=BoundingBox(LN,"bb_compartment",10,10,2300,980);
1571   compartmentGlyph->setBoundingBox(&bb);
1572 
1573   TextGlyph* tg=layout->createTextGlyph();
1574   tg->setId("TextGlyph_Hepatocyte");
1575   tg->setOriginOfTextId(compartment->getId());
1576   bb=BoundingBox(LN,"bb_tg_compartment",50,870,300,72);
1577   tg->setBoundingBox(&bb);
1578   tg->setGraphicalObjectId(compartmentGlyph->getId());
1579 
1580   CompartmentGlyph* mito1Glyph=layout->createCompartmentGlyph();
1581   mito1Glyph->setId("Mito1_Glyph");
1582   mito1Glyph->setCompartmentId(mito1->getId());
1583   bb=BoundingBox(LN,"bb_mito1",100,100,300,100);
1584   mito1Glyph->setBoundingBox(&bb);
1585 
1586   tg=layout->createTextGlyph();
1587   tg->setId("TextGlyph_mito1");
1588   tg->setOriginOfTextId(mito1->getId());
1589   bb=BoundingBox(LN,"bb_tg_mito1",110,110,280,72);
1590   tg->setBoundingBox(&bb);
1591   tg->setGraphicalObjectId(mito1Glyph->getId());
1592 
1593 
1594   CompartmentGlyph* mito2Glyph=layout->createCompartmentGlyph();
1595   mito2Glyph->setId("Mito2_Glyph");
1596   mito2Glyph->setCompartmentId(mito2->getId());
1597   bb=BoundingBox(LN,"bb_mito2",200,650,300,100);
1598   mito2Glyph->setBoundingBox(&bb);
1599 
1600   tg=layout->createTextGlyph();
1601   tg->setId("TextGlyph_mito2");
1602   tg->setOriginOfTextId(mito2->getId());
1603   bb=BoundingBox(LN,"bb_tg_mito2",210,660,280,72);
1604   tg->setBoundingBox(&bb);
1605   tg->setGraphicalObjectId(mito2Glyph->getId());
1606 
1607   CompartmentGlyph* mito3Glyph_2=layout->createCompartmentGlyph();
1608   mito3Glyph_2->setId("Mito3_Glyph_2");
1609   mito3Glyph_2->setCompartmentId(mito3->getId());
1610   bb=BoundingBox(LN,"bb_mito3_2",1470,30,820,536);
1611   mito3Glyph_2->setBoundingBox(&bb);
1612 
1613   tg=layout->createTextGlyph();
1614   tg->setId("TextGlyph_mito3_2");
1615   tg->setOriginOfTextId(mito3->getId());
1616   bb=BoundingBox(LN,"bb_tg_mito3_2",1475,35,200,72);
1617   tg->setBoundingBox(&bb);
1618   tg->setGraphicalObjectId(mito3Glyph_2->getId());
1619 
1620 
1621 
1622 
1623   // create the SpeciesGlyphs
1624 
1625   // Cytosol
1626 
1627   // Malate cyt
1628   SpeciesGlyph* speciesGlyph_malate_cyt=layout->createSpeciesGlyph();
1629   speciesGlyph_malate_cyt->setId("SpeciesGlyph_malate_cyt");
1630   speciesGlyph_malate_cyt->setSpeciesId(malate_cyt->getId());
1631   bb=BoundingBox(LN,"bb_sg_malate_cyt",580,280,240,36);
1632   speciesGlyph_malate_cyt->setBoundingBox(&bb);
1633 
1634   tg=layout->createTextGlyph();
1635   tg->setId("TextGlyph_malate_cyt");
1636   bb=BoundingBox(LN,"bb_tg_malatate_cyt",590,280,220,36);
1637   tg->setBoundingBox(&bb);
1638   tg->setOriginOfTextId(malate_cyt->getId());
1639   tg->setGraphicalObjectId(speciesGlyph_malate_cyt->getId());
1640 
1641   // Oxaloacetate cyt
1642   SpeciesGlyph* speciesGlyph_oxaloacetate_cyt=layout->createSpeciesGlyph();
1643   speciesGlyph_oxaloacetate_cyt->setId("SpeciesGlyph_oxaloacetate_cyt");
1644   speciesGlyph_oxaloacetate_cyt->setSpeciesId(oxaloacetate_cyt->getId());
1645   bb=BoundingBox(LN,"bb_sg_oxaloacetate_cyt",580,480,240,36);
1646   speciesGlyph_oxaloacetate_cyt->setBoundingBox(&bb);
1647 
1648   tg=layout->createTextGlyph();
1649   tg->setId("TextGlyph_oxaloacetate_cyt");
1650   bb=BoundingBox(LN,"bb_tg_oxaloacetate_cyt",590,480,220,36);
1651   tg->setBoundingBox(&bb);
1652   tg->setOriginOfTextId(oxaloacetate_cyt->getId());
1653   tg->setGraphicalObjectId(speciesGlyph_oxaloacetate_cyt->getId());
1654 
1655   // Aspartate cyt
1656   SpeciesGlyph* speciesGlyph_aspartate_cyt=layout->createSpeciesGlyph();
1657   speciesGlyph_aspartate_cyt->setId("SpeciesGlyph_aspartate_cyt");
1658   speciesGlyph_aspartate_cyt->setSpeciesId(aspartate_cyt->getId());
1659   bb=BoundingBox(LN,"bb_sg_aspartate_cyt",580,680,240,36);
1660   speciesGlyph_aspartate_cyt->setBoundingBox(&bb);
1661 
1662   tg=layout->createTextGlyph();
1663   tg->setId("TextGlyph_aspartate_cyt");
1664   bb=BoundingBox(LN,"bb_tg_aspartate_cyt",590,680,220,36);
1665   tg->setBoundingBox(&bb);
1666   tg->setOriginOfTextId(aspartate_cyt->getId());
1667   tg->setGraphicalObjectId(speciesGlyph_aspartate_cyt->getId());
1668 
1669   // Glutamate cyt
1670   SpeciesGlyph* speciesGlyph_glutamate_cyt=layout->createSpeciesGlyph();
1671   speciesGlyph_glutamate_cyt->setId("SpeciesGlyph_glutamate_cyt");
1672   speciesGlyph_glutamate_cyt->setSpeciesId(glutamate_cyt->getId());
1673   bb=BoundingBox(LN,"bb_sg_glutamate_cyt",800,610,240,36);
1674   speciesGlyph_glutamate_cyt->setBoundingBox(&bb);
1675 
1676   tg=layout->createTextGlyph();
1677   tg->setId("TextGlyph_glutamate_cyt");
1678   bb=BoundingBox(LN,"bb_tg_glutamate_cyt",810,610,220,36);
1679   tg->setBoundingBox(&bb);
1680   tg->setOriginOfTextId(glutamate_cyt->getId());
1681   tg->setGraphicalObjectId(speciesGlyph_glutamate_cyt->getId());
1682 
1683   // alpha-Ketoglutarate cyt
1684   SpeciesGlyph* speciesGlyph_aKetoglutarate_cyt=layout->createSpeciesGlyph();
1685   speciesGlyph_aKetoglutarate_cyt->setId("SpeciesGlyph_aKetoglutarate_cyt");
1686   speciesGlyph_aKetoglutarate_cyt->setSpeciesId(aKetoglutarate_cyt->getId());
1687   bb=BoundingBox(LN,"bb_sg_aKetoglutarate_cyt",860,500,280,36);
1688   speciesGlyph_aKetoglutarate_cyt->setBoundingBox(&bb);
1689 
1690   tg=layout->createTextGlyph();
1691   tg->setId("TextGlyph_aKetoglutarate_cyt");
1692   bb=BoundingBox(LN,"bb_tg_aKetoglutarate_cyt",870,500,260,36);
1693   tg->setBoundingBox(&bb);
1694   tg->setOriginOfTextId(aKetoglutarate_cyt->getId());
1695   tg->setGraphicalObjectId(speciesGlyph_aKetoglutarate_cyt->getId());
1696 
1697   // NAD+ cyt
1698   SpeciesGlyph* speciesGlyph_nad_cyt=layout->createSpeciesGlyph();
1699   speciesGlyph_nad_cyt->setId("SpeciesGlyph_nad_cyt");
1700   speciesGlyph_nad_cyt->setSpeciesId(nad_cyt->getId());
1701   bb=BoundingBox(LN,"bb_sg_nad_cyt",520,350,100,24);
1702   speciesGlyph_nad_cyt->setBoundingBox(&bb);
1703 
1704   tg=layout->createTextGlyph();
1705   tg->setId("TextGlyph_nad_cyt");
1706   bb=BoundingBox(LN,"bb_tg_nad_cyt",525,350,80,24);
1707   tg->setBoundingBox(&bb);
1708   tg->setOriginOfTextId(nad_cyt->getId());
1709   tg->setGraphicalObjectId(speciesGlyph_nad_cyt->getId());
1710 
1711   // NADH cyt
1712   SpeciesGlyph* speciesGlyph_nadh_cyt=layout->createSpeciesGlyph();
1713   speciesGlyph_nadh_cyt->setId("SpeciesGlyph_nadh_cyt");
1714   speciesGlyph_nadh_cyt->setSpeciesId(nadh_cyt->getId());
1715   bb=BoundingBox(LN,"bb_sg_nadh_cyt",520,430,100,24);
1716   speciesGlyph_nadh_cyt->setBoundingBox(&bb);
1717 
1718   tg=layout->createTextGlyph();
1719   tg->setId("TextGlyph_nadh_cyt");
1720   bb=BoundingBox(LN,"bb_tg_nadh_cyt",525,430,80,24);
1721   tg->setBoundingBox(&bb);
1722   tg->setOriginOfTextId(nadh_cyt->getId());
1723   tg->setGraphicalObjectId(speciesGlyph_nadh_cyt->getId());
1724 
1725   // H+ cyt
1726   SpeciesGlyph* speciesGlyph_h_cyt=layout->createSpeciesGlyph();
1727   speciesGlyph_h_cyt->setId("SpeciesGlyph_h_cyt");
1728   speciesGlyph_h_cyt->setSpeciesId(h_cyt->getId());
1729   bb=BoundingBox(LN,"bb_sg_h_cyt",430,430,40,24);
1730   speciesGlyph_h_cyt->setBoundingBox(&bb);
1731 
1732   tg=layout->createTextGlyph();
1733   tg->setId("TextGlyph_h_cyt");
1734   bb=BoundingBox(LN,"bb_tg_h_cyt",435,430,30,24);
1735   tg->setBoundingBox(&bb);
1736   tg->setOriginOfTextId(h_cyt->getId());
1737   tg->setGraphicalObjectId(speciesGlyph_h_cyt->getId());
1738 
1739 
1740   // create the ReactionGlyphs
1741 
1742   ReactionGlyph* rg_malatedh_cyt=layout->createReactionGlyph();
1743   rg_malatedh_cyt->setId("rg_malatedh_cyt");
1744   rg_malatedh_cyt->setReactionId(malatedh_cyt->getId());
1745 
1746   Curve* curve=rg_malatedh_cyt->getCurve();
1747   LineSegment* ls=curve->createLineSegment();
1748   Point p(LN,700,381);
1749   ls->setStart(&p);
1750   p=Point(LN,700,415);
1751   ls->setEnd(&p);
1752 
1753   tg=layout->createTextGlyph();
1754   tg->setId("tg_rg_malaltedh_cyt");
1755   bb=BoundingBox(LN,"bb_tg_rg_malaltedh_cyt",700,385,210,24);
1756   tg->setBoundingBox(&bb);
1757   tg->setOriginOfTextId(malatedh_cyt->getId());
1758   tg->setGraphicalObjectId(rg_malatedh_cyt->getId());
1759 
1760 
1761   ReactionGlyph* rg_aspartateat_cyt=layout->createReactionGlyph();
1762   rg_aspartateat_cyt->setId("rg_aspartateat_cyt");
1763   rg_aspartateat_cyt->setReactionId(aspartateat_cyt->getId());
1764 
1765   curve=rg_aspartateat_cyt->getCurve();
1766   ls=curve->createLineSegment();
1767   p=Point(LN,700,581);
1768   ls->setStart(&p);
1769   p=Point(LN,700,615);
1770   ls->setEnd(&p);
1771 
1772   tg=layout->createTextGlyph();
1773   tg->setId("tg_rg_aspartateat_cyt");
1774   bb=BoundingBox(LN,"bb_tg_rg_aspartateat_cyt",440,585,260,24);
1775   tg->setBoundingBox(&bb);
1776   tg->setOriginOfTextId(aspartateat_cyt->getId());
1777   tg->setGraphicalObjectId(rg_aspartateat_cyt->getId());
1778 
1779 
1780 
1781   // add the SpeciesReferenceGlyphs
1782 
1783   SpeciesReferenceGlyph* srg_malate_cyt_1=rg_malatedh_cyt->createSpeciesReferenceGlyph();
1784   srg_malate_cyt_1->setId("srg_malate_cyt_1");
1785   srg_malate_cyt_1->setSpeciesGlyphId(speciesGlyph_malate_cyt->getId());
1786   srg_malate_cyt_1->setSpeciesReferenceId(sr_malate_cyt->getId());
1787   srg_malate_cyt_1->setRole(SPECIES_ROLE_SUBSTRATE);
1788 
1789   ls=srg_malate_cyt_1->createLineSegment();
1790   p=Point(LN,700,381);
1791   ls->setStart(&p);
1792   p=Point(LN,700,316);
1793   ls->setEnd(&p);
1794 
1795   SpeciesReferenceGlyph* srg_nad_cyt=rg_malatedh_cyt->createSpeciesReferenceGlyph();
1796   srg_nad_cyt->setId("srg_nad_cyt");
1797   srg_nad_cyt->setSpeciesGlyphId(speciesGlyph_nad_cyt->getId());
1798   srg_nad_cyt->setSpeciesReferenceId(sr_nad_cyt->getId());
1799   srg_nad_cyt->setRole(SPECIES_ROLE_SUBSTRATE);
1800 
1801   CubicBezier* cb=srg_nad_cyt->createCubicBezier();
1802   p=Point(LN,700,381);
1803   cb->setStart(&p);
1804   p=Point(LN,700,362);
1805   cb->setBasePoint1(&p);
1806   p=Point(LN,700,362);
1807   cb->setBasePoint2(&p);
1808   p=Point(LN,620,362);
1809   cb->setEnd(&p);
1810 
1811   SpeciesReferenceGlyph* srg_oxaloacetate_cyt_1=rg_malatedh_cyt->createSpeciesReferenceGlyph();
1812   srg_oxaloacetate_cyt_1->setId("srg_oxaloacetate_cyt_1");
1813   srg_oxaloacetate_cyt_1->setSpeciesGlyphId(speciesGlyph_oxaloacetate_cyt->getId());
1814   srg_oxaloacetate_cyt_1->setSpeciesReferenceId(sr_oxaloacetate_cyt_1->getId());
1815   srg_oxaloacetate_cyt_1->setRole(SPECIES_ROLE_PRODUCT);
1816 
1817   curve=srg_oxaloacetate_cyt_1->getCurve();
1818   ls=curve->createLineSegment();
1819   p=Point(LN,700,415);
1820   ls->setStart(&p);
1821   p=Point(LN,700,480);
1822   ls->setEnd(&p);
1823 
1824   SpeciesReferenceGlyph* srg_nadh_cyt=rg_malatedh_cyt->createSpeciesReferenceGlyph();
1825   srg_nadh_cyt->setId("srg_nadh_cyt");
1826   srg_nadh_cyt->setSpeciesGlyphId(speciesGlyph_nadh_cyt->getId());
1827   srg_nadh_cyt->setSpeciesReferenceId(sr_nadh_cyt->getId());
1828   srg_nadh_cyt->setRole(SPECIES_ROLE_PRODUCT);
1829 
1830   cb=srg_nadh_cyt->createCubicBezier();
1831   p=Point(LN,700,415);
1832   cb->setStart(&p);
1833   p=Point(LN,700,442);
1834   cb->setBasePoint1(&p);
1835   p=Point(LN,700,442);
1836   cb->setBasePoint2(&p);
1837   p=Point(LN,620,442);
1838   cb->setEnd(&p);
1839 
1840   SpeciesReferenceGlyph* srg_h_cyt=rg_malatedh_cyt->createSpeciesReferenceGlyph();
1841   srg_h_cyt->setId("srg_h_cyt");
1842   srg_h_cyt->setSpeciesGlyphId(speciesGlyph_h_cyt->getId());
1843   srg_h_cyt->setSpeciesReferenceId(sr_h_cyt->getId());
1844   srg_h_cyt->setRole(SPECIES_ROLE_PRODUCT);
1845 
1846   cb=srg_h_cyt->createCubicBezier();
1847   p=Point(LN,700,415);
1848   cb->setStart(&p);
1849   p=Point(LN,570,415);
1850   cb->setBasePoint1(&p);
1851   p=Point(LN,570,415);
1852   cb->setBasePoint2(&p);
1853   p=Point(LN,470,430);
1854   cb->setEnd(&p);
1855 
1856   SpeciesReferenceGlyph* srg_oxaloacetate_cyt_2=rg_aspartateat_cyt->createSpeciesReferenceGlyph();
1857   srg_oxaloacetate_cyt_2->setId("srg_oxaloacetate_cyt_2");
1858   srg_oxaloacetate_cyt_2->setSpeciesGlyphId(speciesGlyph_oxaloacetate_cyt->getId());
1859   srg_oxaloacetate_cyt_2->setSpeciesReferenceId(sr_oxaloacetate_cyt_2->getId());
1860   srg_oxaloacetate_cyt_2->setRole(SPECIES_ROLE_SUBSTRATE);
1861 
1862   curve=srg_oxaloacetate_cyt_2->getCurve();
1863   ls=curve->createLineSegment();
1864   p=Point(LN,700,581);
1865   ls->setStart(&p);
1866   p=Point(LN,700,516);
1867   ls->setEnd(&p);
1868 
1869   SpeciesReferenceGlyph* srg_glutamate_cyt_1=rg_aspartateat_cyt->createSpeciesReferenceGlyph();
1870   srg_glutamate_cyt_1->setId("srg_glutamate_cyt_1");
1871   srg_glutamate_cyt_1->setSpeciesGlyphId(speciesGlyph_glutamate_cyt->getId());
1872   srg_glutamate_cyt_1->setSpeciesReferenceId(sr_glutamate_cyt_1->getId());
1873   srg_glutamate_cyt_1->setRole(SPECIES_ROLE_SUBSTRATE);
1874 
1875   curve=srg_glutamate_cyt_1->getCurve();
1876   cb=curve->createCubicBezier();
1877   p=Point(LN,700,581);
1878   cb->setStart(&p);
1879   p=Point(LN,750,581);
1880   cb->setBasePoint1(&p);
1881   p=Point(LN,750,628);
1882   cb->setBasePoint2(&p);
1883   p=Point(LN,800,628);
1884   cb->setEnd(&p);
1885 
1886   SpeciesReferenceGlyph* srg_aspartate_cyt_1=rg_aspartateat_cyt->createSpeciesReferenceGlyph();
1887   srg_aspartate_cyt_1->setId("srg_aspartate_cyt_1");
1888   srg_aspartate_cyt_1->setSpeciesGlyphId(speciesGlyph_aspartate_cyt->getId());
1889   srg_aspartate_cyt_1->setSpeciesReferenceId(sr_aspartate_cyt_1->getId());
1890   srg_aspartate_cyt_1->setRole(SPECIES_ROLE_PRODUCT);
1891 
1892   curve=srg_aspartate_cyt_1->getCurve();
1893   ls=curve->createLineSegment();
1894   p=Point(LN,700,615);
1895   ls->setStart(&p);
1896   p=Point(LN,700,680);
1897   ls->setEnd(&p);
1898 
1899   SpeciesReferenceGlyph* srg_aKetoglutarate_cyt_1=rg_aspartateat_cyt->createSpeciesReferenceGlyph();
1900   srg_aKetoglutarate_cyt_1->setId("srg_aKetoglutaratecyt_1");
1901   srg_aKetoglutarate_cyt_1->setSpeciesGlyphId(speciesGlyph_aKetoglutarate_cyt->getId());
1902   srg_aKetoglutarate_cyt_1->setSpeciesReferenceId(sr_aKetoglutarate_cyt_1->getId());
1903   srg_aKetoglutarate_cyt_1->setRole(SPECIES_ROLE_PRODUCT);
1904 
1905   curve=srg_aKetoglutarate_cyt_1->getCurve();
1906   cb=curve->createCubicBezier();
1907   p=Point(LN,700,615);
1908   cb->setStart(&p);
1909   p=Point(LN,790,615);
1910   cb->setBasePoint1(&p);
1911   p=Point(LN,790,515);
1912   cb->setBasePoint2(&p);
1913   p=Point(LN,860,515);
1914   cb->setEnd(&p);
1915 
1916 
1917   // Malate mito3
1918   SpeciesGlyph* speciesGlyph_malate_mito3=layout->createSpeciesGlyph();
1919   speciesGlyph_malate_mito3->setId("SpeciesGlyph_malate_mito3");
1920   speciesGlyph_malate_mito3->setSpeciesId(malate_mito3->getId());
1921   bb=BoundingBox(LN,"bb_sg_malate_mito3",1850,80,240,36);
1922   speciesGlyph_malate_mito3->setBoundingBox(&bb);
1923 
1924   tg=layout->createTextGlyph();
1925   tg->setId("TextGlyph_malate_mito3");
1926   bb=BoundingBox(LN,"bb_tg_malatate_mito3",1860,80,220,36);
1927   tg->setBoundingBox(&bb);
1928   tg->setOriginOfTextId(malate_mito3->getId());
1929   tg->setGraphicalObjectId(speciesGlyph_malate_mito3->getId());
1930 
1931   // Oxaloacetate mito3
1932   SpeciesGlyph* speciesGlyph_oxaloacetate_mito3=layout->createSpeciesGlyph();
1933   speciesGlyph_oxaloacetate_mito3->setId("SpeciesGlyph_oxaloacetate_mito3");
1934   speciesGlyph_oxaloacetate_mito3->setSpeciesId(oxaloacetate_mito3->getId());
1935   bb=BoundingBox(LN,"bb_sg_oxaloacetate_mito3",1850,280,240,36);
1936   speciesGlyph_oxaloacetate_mito3->setBoundingBox(&bb);
1937 
1938   tg=layout->createTextGlyph();
1939   tg->setId("TextGlyph_oxaloacetate_mito3");
1940   bb=BoundingBox(LN,"bb_tg_oxaloacetate_mito3",1860,280,220,36);
1941   tg->setBoundingBox(&bb);
1942   tg->setOriginOfTextId(oxaloacetate_mito3->getId());
1943   tg->setGraphicalObjectId(speciesGlyph_oxaloacetate_mito3->getId());
1944 
1945   // Aspartate mito3
1946   SpeciesGlyph* speciesGlyph_aspartate_mito3=layout->createSpeciesGlyph();
1947   speciesGlyph_aspartate_mito3->setId("SpeciesGlyph_aspartate_mito3");
1948   speciesGlyph_aspartate_mito3->setSpeciesId(aspartate_mito3->getId());
1949   bb=BoundingBox(LN,"bb_sg_aspartate_mito3",1850,480,240,36);
1950   speciesGlyph_aspartate_mito3->setBoundingBox(&bb);
1951 
1952   tg=layout->createTextGlyph();
1953   tg->setId("TextGlyph_aspartate_mito3");
1954   bb=BoundingBox(LN,"bb_tg_aspartate_mito3",1860,480,220,36);
1955   tg->setBoundingBox(&bb);
1956   tg->setOriginOfTextId(aspartate_mito3->getId());
1957   tg->setGraphicalObjectId(speciesGlyph_aspartate_mito3->getId());
1958 
1959   // Glutamate mito3
1960   SpeciesGlyph* speciesGlyph_glutamate_mito3=layout->createSpeciesGlyph();
1961   speciesGlyph_glutamate_mito3->setId("SpeciesGlyph_glutamate_mito3");
1962   speciesGlyph_glutamate_mito3->setSpeciesId(glutamate_mito3->getId());
1963   bb=BoundingBox(LN,"bb_sg_glutamate_mito3",1550,430,240,36);
1964   speciesGlyph_glutamate_mito3->setBoundingBox(&bb);
1965 
1966   tg=layout->createTextGlyph();
1967   tg->setId("TextGlyph_glutamate_mito3");
1968   bb=BoundingBox(LN,"bb_tg_glutamate_mito3",1560,430,220,36);
1969   tg->setBoundingBox(&bb);
1970   tg->setOriginOfTextId(glutamate_mito3->getId());
1971   tg->setGraphicalObjectId(speciesGlyph_glutamate_mito3->getId());
1972 
1973   // alpha-Ketoglutarate mito3
1974   SpeciesGlyph* speciesGlyph_aKetoglutarate_mito3=layout->createSpeciesGlyph();
1975   speciesGlyph_aKetoglutarate_mito3->setId("SpeciesGlyph_aKetoglutarate_mito3");
1976   speciesGlyph_aKetoglutarate_mito3->setSpeciesId(aKetoglutarate_mito3->getId());
1977   bb=BoundingBox(LN,"bb_sg_aKetoglutarate_mito3",1530,300,280,36);
1978   speciesGlyph_aKetoglutarate_mito3->setBoundingBox(&bb);
1979 
1980   tg=layout->createTextGlyph();
1981   tg->setId("TextGlyph_aKetoglutarate_mito3");
1982   bb=BoundingBox(LN,"bb_tg_aKetoglutarate_mito3",1540,300,260,36);
1983   tg->setBoundingBox(&bb);
1984   tg->setOriginOfTextId(aKetoglutarate_mito3->getId());
1985   tg->setGraphicalObjectId(speciesGlyph_aKetoglutarate_mito3->getId());
1986 
1987   // NAD+ mito3
1988   SpeciesGlyph* speciesGlyph_nad_mito3=layout->createSpeciesGlyph();
1989   speciesGlyph_nad_mito3->setId("SpeciesGlyph_nad_mito3");
1990   speciesGlyph_nad_mito3->setSpeciesId(nad_mito3->getId());
1991   bb=BoundingBox(LN,"bb_sg_nad_mito3",2050,150,100,24);
1992   speciesGlyph_nad_mito3->setBoundingBox(&bb);
1993 
1994   tg=layout->createTextGlyph();
1995   tg->setId("TextGlyph_nad_mito3");
1996   bb=BoundingBox(LN,"bb_tg_nad_mito3",2055,150,80,24);
1997   tg->setBoundingBox(&bb);
1998   tg->setOriginOfTextId(nad_mito3->getId());
1999   tg->setGraphicalObjectId(speciesGlyph_nad_mito3->getId());
2000 
2001   // NADH mito3
2002   SpeciesGlyph* speciesGlyph_nadh_mito3=layout->createSpeciesGlyph();
2003   speciesGlyph_nadh_mito3->setId("SpeciesGlyph_nadh_mito3");
2004   speciesGlyph_nadh_mito3->setSpeciesId(nadh_mito3->getId());
2005   bb=BoundingBox(LN,"bb_sg_nadh_mito3",2050,230,100,24);
2006   speciesGlyph_nadh_mito3->setBoundingBox(&bb);
2007 
2008   tg=layout->createTextGlyph();
2009   tg->setId("TextGlyph_nadh_mito3");
2010   bb=BoundingBox(LN,"bb_tg_nadh_mito3",2055,230,80,24);
2011   tg->setBoundingBox(&bb);
2012   tg->setOriginOfTextId(nadh_mito3->getId());
2013   tg->setGraphicalObjectId(speciesGlyph_nadh_mito3->getId());
2014 
2015   // H+ mito3
2016   SpeciesGlyph* speciesGlyph_h_mito3=layout->createSpeciesGlyph();
2017   speciesGlyph_h_mito3->setId("SpeciesGlyph_h_mito3");
2018   speciesGlyph_h_mito3->setSpeciesId(h_mito3->getId());
2019   bb=BoundingBox(LN,"bb_sg_h_mito3",2200,230,40,24);
2020   speciesGlyph_h_mito3->setBoundingBox(&bb);
2021 
2022   tg=layout->createTextGlyph();
2023   tg->setId("TextGlyph_h_mito3");
2024   bb=BoundingBox(LN,"bb_tg_h_mito3",2205,230,30,24);
2025   tg->setBoundingBox(&bb);
2026   tg->setOriginOfTextId(h_mito3->getId());
2027   tg->setGraphicalObjectId(speciesGlyph_h_mito3->getId());
2028 
2029 
2030   // create the ReactionGlyphs
2031 
2032   ReactionGlyph* rg_malatedh_mito3=layout->createReactionGlyph();
2033   rg_malatedh_mito3->setId("rg_malatedh_mito3");
2034   rg_malatedh_mito3->setReactionId(malatedh_mito3->getId());
2035 
2036   curve=rg_malatedh_mito3->getCurve();
2037   ls=curve->createLineSegment();
2038   p=Point(LN,1970,181);
2039   ls->setStart(&p);
2040   p=Point(LN,1970,215);
2041   ls->setEnd(&p);
2042 
2043   tg=layout->createTextGlyph();
2044   tg->setId("tg_rg_malatedh_mito3");
2045   bb=BoundingBox(LN,"bb_tg_rg_malatedh_mito3",1740,185,220,24);
2046   tg->setBoundingBox(&bb);
2047   tg->setOriginOfTextId(malatedh_mito3->getId());
2048   tg->setGraphicalObjectId(rg_malatedh_mito3->getId());
2049 
2050   ReactionGlyph* rg_aspartateat_mito3=layout->createReactionGlyph();
2051   rg_aspartateat_mito3->setId("rg_aspartateat_mito3");
2052   rg_aspartateat_mito3->setReactionId(aspartateat_mito3->getId());
2053 
2054   curve=rg_aspartateat_mito3->getCurve();
2055   ls=curve->createLineSegment();
2056   p=Point(LN,1970,381);
2057   ls->setStart(&p);
2058   p=Point(LN,1970,415);
2059   ls->setEnd(&p);
2060 
2061   tg=layout->createTextGlyph();
2062   tg->setId("tg_rg_aspartateat_mito3");
2063   bb=BoundingBox(LN,"bb_tg_rg_aspartateat_mito3",1970,385,260,24);
2064   tg->setBoundingBox(&bb);
2065   tg->setOriginOfTextId(aspartateat_mito3->getId());
2066   tg->setGraphicalObjectId(rg_aspartateat_mito3->getId());
2067 
2068 
2069   // add the SpeciesReferenceGlyphs
2070 
2071   SpeciesReferenceGlyph* srg_malate_mito3_1=rg_malatedh_mito3->createSpeciesReferenceGlyph();
2072   srg_malate_mito3_1->setId("srg_malate_mito3_1");
2073   srg_malate_mito3_1->setSpeciesGlyphId(speciesGlyph_malate_mito3->getId());
2074   srg_malate_mito3_1->setSpeciesReferenceId(sr_malate_mito3->getId());
2075   srg_malate_mito3_1->setRole(SPECIES_ROLE_SUBSTRATE);
2076 
2077   ls=srg_malate_mito3_1->createLineSegment();
2078   p=Point(LN,1970,181);
2079   ls->setStart(&p);
2080   p=Point(LN,1970,116);
2081   ls->setEnd(&p);
2082 
2083   SpeciesReferenceGlyph* srg_nad_mito3=rg_malatedh_mito3->createSpeciesReferenceGlyph();
2084   srg_nad_mito3->setId("srg_nad_mito3");
2085   srg_nad_mito3->setSpeciesGlyphId(speciesGlyph_nad_mito3->getId());
2086   srg_nad_mito3->setSpeciesReferenceId(sr_nad_mito3->getId());
2087   srg_nad_mito3->setRole(SPECIES_ROLE_SUBSTRATE);
2088 
2089   cb=srg_nad_mito3->createCubicBezier();
2090   p=Point(LN,1970,181);
2091   cb->setStart(&p);
2092   p=Point(LN,1970,162);
2093   cb->setBasePoint1(&p);
2094   p=Point(LN,1970,162);
2095   cb->setBasePoint2(&p);
2096   p=Point(LN,2050,162);
2097   cb->setEnd(&p);
2098 
2099   SpeciesReferenceGlyph* srg_oxaloacetate_mito3_1=rg_malatedh_mito3->createSpeciesReferenceGlyph();
2100   srg_oxaloacetate_mito3_1->setId("srg_oxaloacetate_mito3_1");
2101   srg_oxaloacetate_mito3_1->setSpeciesGlyphId(speciesGlyph_oxaloacetate_mito3->getId());
2102   srg_oxaloacetate_mito3_1->setSpeciesReferenceId(sr_oxaloacetate_mito3_1->getId());
2103   srg_oxaloacetate_mito3_1->setRole(SPECIES_ROLE_PRODUCT);
2104 
2105   curve=srg_oxaloacetate_mito3_1->getCurve();
2106   ls=curve->createLineSegment();
2107   p=Point(LN,1970,215);
2108   ls->setStart(&p);
2109   p=Point(LN,1970,280);
2110   ls->setEnd(&p);
2111 
2112   SpeciesReferenceGlyph* srg_nadh_mito3=rg_malatedh_mito3->createSpeciesReferenceGlyph();
2113   srg_nadh_mito3->setId("srg_nadh_mito3");
2114   srg_nadh_mito3->setSpeciesGlyphId(speciesGlyph_nadh_mito3->getId());
2115   srg_nadh_mito3->setSpeciesReferenceId(sr_nadh_mito3->getId());
2116   srg_nadh_mito3->setRole(SPECIES_ROLE_PRODUCT);
2117 
2118   cb=srg_nadh_mito3->createCubicBezier();
2119   p=Point(LN,1970,215);
2120   cb->setStart(&p);
2121   p=Point(LN,1970,242);
2122   cb->setBasePoint1(&p);
2123   p=Point(LN,1970,242);
2124   cb->setBasePoint2(&p);
2125   p=Point(LN,2050,242);
2126   cb->setEnd(&p);
2127 
2128   SpeciesReferenceGlyph* srg_h_mito3=rg_malatedh_mito3->createSpeciesReferenceGlyph();
2129   srg_h_mito3->setId("srg_h_mito3");
2130   srg_h_mito3->setSpeciesGlyphId(speciesGlyph_h_mito3->getId());
2131   srg_h_mito3->setSpeciesReferenceId(sr_h_mito3->getId());
2132   srg_h_mito3->setRole(SPECIES_ROLE_PRODUCT);
2133 
2134   cb=srg_h_mito3->createCubicBezier();
2135   p=Point(LN,1970,215);
2136   cb->setStart(&p);
2137   p=Point(LN,2100,215);
2138   cb->setBasePoint1(&p);
2139   p=Point(LN,2100,215);
2140   cb->setBasePoint2(&p);
2141   p=Point(LN,2200,230);
2142   cb->setEnd(&p);
2143 
2144   SpeciesReferenceGlyph* srg_oxaloacetate_mito3_2=rg_aspartateat_mito3->createSpeciesReferenceGlyph();
2145   srg_oxaloacetate_mito3_2->setId("srg_oxaloacetate_mito3_2");
2146   srg_oxaloacetate_mito3_2->setSpeciesGlyphId(speciesGlyph_oxaloacetate_mito3->getId());
2147   srg_oxaloacetate_mito3_2->setSpeciesReferenceId(sr_oxaloacetate_mito3_2->getId());
2148   srg_oxaloacetate_mito3_2->setRole(SPECIES_ROLE_SUBSTRATE);
2149 
2150   curve=srg_oxaloacetate_mito3_2->getCurve();
2151   ls=curve->createLineSegment();
2152   p=Point(LN,1970,381);
2153   ls->setStart(&p);
2154   p=Point(LN,1970,316);
2155   ls->setEnd(&p);
2156 
2157   SpeciesReferenceGlyph* srg_glutamate_mito3_1=rg_aspartateat_mito3->createSpeciesReferenceGlyph();
2158   srg_glutamate_mito3_1->setId("srg_glutamate_mito3_1");
2159   srg_glutamate_mito3_1->setSpeciesGlyphId(speciesGlyph_glutamate_mito3->getId());
2160   srg_glutamate_mito3_1->setSpeciesReferenceId(sr_glutamate_mito3_1->getId());
2161   srg_glutamate_mito3_1->setRole(SPECIES_ROLE_SUBSTRATE);
2162 
2163   curve=srg_glutamate_mito3_1->getCurve();
2164   cb=curve->createCubicBezier();
2165   p=Point(LN,1970,381);
2166   cb->setStart(&p);
2167   p=Point(LN,1880,381);
2168   cb->setBasePoint1(&p);
2169   p=Point(LN,1880,448);
2170   cb->setBasePoint2(&p);
2171   p=Point(LN,1790,448);
2172   cb->setEnd(&p);
2173 
2174   SpeciesReferenceGlyph* srg_aspartate_mito3_1=rg_aspartateat_mito3->createSpeciesReferenceGlyph();
2175   srg_aspartate_mito3_1->setId("srg_aspartate_mito3_1");
2176   srg_aspartate_mito3_1->setSpeciesGlyphId(speciesGlyph_aspartate_mito3->getId());
2177   srg_aspartate_mito3_1->setSpeciesReferenceId(sr_aspartate_mito3_1->getId());
2178   srg_aspartate_mito3_1->setRole(SPECIES_ROLE_PRODUCT);
2179 
2180   curve=srg_aspartate_mito3_1->getCurve();
2181   ls=curve->createLineSegment();
2182   p=Point(LN,1970,415);
2183   ls->setStart(&p);
2184   p=Point(LN,1970,480);
2185   ls->setEnd(&p);
2186 
2187   SpeciesReferenceGlyph* srg_aKetoglutarate_mito3_1=rg_aspartateat_mito3->createSpeciesReferenceGlyph();
2188   srg_aKetoglutarate_mito3_1->setId("srg_aKetoglutaratemito3_1");
2189   srg_aKetoglutarate_mito3_1->setSpeciesGlyphId(speciesGlyph_aKetoglutarate_mito3->getId());
2190   srg_aKetoglutarate_mito3_1->setSpeciesReferenceId(sr_aKetoglutarate_mito3_1->getId());
2191   srg_aKetoglutarate_mito3_1->setRole(SPECIES_ROLE_PRODUCT);
2192 
2193   curve=srg_aKetoglutarate_mito3_1->getCurve();
2194   cb=curve->createCubicBezier();
2195   p=Point(LN,1970,415);
2196   cb->setStart(&p);
2197   p=Point(LN,1880,415);
2198   cb->setBasePoint1(&p);
2199   p=Point(LN,1880,315);
2200   cb->setBasePoint2(&p);
2201   p=Point(LN,1810,315);
2202   cb->setEnd(&p);
2203 
2204   // add the transport reaction glyphs
2205 
2206   ReactionGlyph* rg_aspartateCarrier=layout->createReactionGlyph();
2207   rg_aspartateCarrier->setId("rg_aspartateCarrier");
2208   rg_aspartateCarrier->setReactionId(aspartateCarrier->getId());
2209 
2210   curve=rg_aspartateCarrier->getCurve();
2211   ls=curve->createLineSegment();
2212   p=Point(LN,1420,530);
2213   ls->setStart(&p);
2214   p=Point(LN,1360,550);
2215   ls->setEnd(&p);
2216 
2217   tg=layout->createTextGlyph();
2218   tg->setId("tg_rg_aspartateCarrier");
2219   bb=BoundingBox(LN,"bb_tg_rg_aspartateCarrier",1380,500,160,24);
2220   tg->setBoundingBox(&bb);
2221   tg->setOriginOfTextId(aspartateCarrier->getId());
2222   tg->setGraphicalObjectId(rg_aspartateCarrier->getId());
2223 
2224 
2225   ReactionGlyph* rg_malateCarrier=layout->createReactionGlyph();
2226   rg_malateCarrier->setId("rg_malateCarrier");
2227   rg_malateCarrier->setReactionId(malateCarrier->getId());
2228 
2229   curve=rg_malateCarrier->getCurve();
2230   ls=curve->createLineSegment();
2231   p=Point(LN,1420,320);
2232   ls->setStart(&p);
2233   p=Point(LN,1360,340);
2234   ls->setEnd(&p);
2235 
2236   tg=layout->createTextGlyph();
2237   tg->setId("tg_rg_malateCarrier");
2238   bb=BoundingBox(LN,"bb_tg_rg_malateCarrier",1360,330,140,24);
2239   tg->setBoundingBox(&bb);
2240   tg->setOriginOfTextId(malateCarrier->getId());
2241   tg->setGraphicalObjectId(rg_malateCarrier->getId());
2242 
2243 
2244 
2245   // add the SpeciesReferenceGlyphs for the transporters
2246 
2247   SpeciesReferenceGlyph* srg_aKetoglutarate_mito3_2=rg_malateCarrier->createSpeciesReferenceGlyph();
2248   srg_aKetoglutarate_mito3_2->setId("srg_aKetoglutarate_mito3_2");
2249   srg_aKetoglutarate_mito3_2->setSpeciesGlyphId(speciesGlyph_aKetoglutarate_mito3->getId());
2250   srg_aKetoglutarate_mito3_2->setSpeciesReferenceId(sr_aKetoglutarate_mito3_2->getId());
2251   srg_aKetoglutarate_mito3_2->setRole(SPECIES_ROLE_SUBSTRATE);
2252 
2253   curve=srg_aKetoglutarate_mito3_2->getCurve();
2254   ls=curve->createLineSegment();
2255   p=Point(LN,1420,320);
2256   ls->setStart(&p);
2257   p=Point(LN,1530,318);
2258   ls->setEnd(&p);
2259 
2260 
2261   SpeciesReferenceGlyph* srg_aKetoglutarate_cyt_2=rg_malateCarrier->createSpeciesReferenceGlyph();
2262   srg_aKetoglutarate_cyt_2->setId("srg_aKetoglutarate_cyt_2");
2263   srg_aKetoglutarate_cyt_2->setSpeciesGlyphId(speciesGlyph_aKetoglutarate_cyt->getId());
2264   srg_aKetoglutarate_cyt_2->setSpeciesReferenceId(sr_aKetoglutarate_cyt_2->getId());
2265   srg_aKetoglutarate_cyt_2->setRole(SPECIES_ROLE_PRODUCT);
2266 
2267   curve=srg_aKetoglutarate_cyt_2->getCurve();
2268   ls=curve->createLineSegment();
2269   p=Point(LN,1360,340);
2270   ls->setStart(&p);
2271   p=Point(LN,1140,518);
2272   ls->setEnd(&p);
2273 
2274 
2275   SpeciesReferenceGlyph* srg_malate_cyt_2=rg_malateCarrier->createSpeciesReferenceGlyph();
2276   srg_malate_cyt_2->setId("srg_malate_cyt_2");
2277   srg_malate_cyt_2->setSpeciesGlyphId(speciesGlyph_malate_cyt->getId());
2278   srg_malate_cyt_2->setSpeciesReferenceId(sr_malate_cyt_2->getId());
2279   srg_malate_cyt_2->setRole(SPECIES_ROLE_SUBSTRATE);
2280 
2281   curve=srg_malate_cyt_2->getCurve();
2282   cb=curve->createCubicBezier();
2283   p=Point(LN,1420,320);
2284   cb->setStart(&p);
2285   p=Point(LN,1390,250);
2286   cb->setBasePoint1(&p);
2287   p=Point(LN,1390,250);
2288   cb->setBasePoint2(&p);
2289   p=Point(LN,820,298);
2290   cb->setEnd(&p);
2291 
2292 
2293   SpeciesReferenceGlyph* srg_malate_mito3_2=rg_malateCarrier->createSpeciesReferenceGlyph();
2294   srg_malate_mito3_2->setId("srg_malate_mito3_2");
2295   srg_malate_mito3_2->setSpeciesGlyphId(speciesGlyph_malate_mito3->getId());
2296   srg_malate_mito3_2->setSpeciesReferenceId(sr_malate_mito3_2->getId());
2297   srg_malate_mito3_2->setRole(SPECIES_ROLE_PRODUCT);
2298 
2299   curve=srg_malate_mito3_2->getCurve();
2300   cb=curve->createCubicBezier();
2301   p=Point(LN,1360,340);
2302   cb->setStart(&p);
2303   p=Point(LN,1390,150);
2304   cb->setBasePoint1(&p);
2305   p=Point(LN,1390,150);
2306   cb->setBasePoint2(&p);
2307   p=Point(LN,1850,98);
2308   cb->setEnd(&p);
2309 
2310 
2311 
2312 
2313 
2314 
2315   SpeciesReferenceGlyph* srg_aspartate_mito3_2=rg_aspartateCarrier->createSpeciesReferenceGlyph();
2316   srg_aspartate_mito3_2->setId("srg_aspartate_mito3_2");
2317   srg_aspartate_mito3_2->setSpeciesGlyphId(speciesGlyph_aspartate_mito3->getId());
2318   srg_aspartate_mito3_2->setSpeciesReferenceId(sr_aspartate_mito3_2->getId());
2319   srg_aspartate_mito3_2->setRole(SPECIES_ROLE_SUBSTRATE);
2320 
2321   curve=srg_aspartate_mito3_2->getCurve();
2322   ls=curve->createLineSegment();
2323   p=Point(LN,1420,530);
2324   ls->setStart(&p);
2325   p=Point(LN,1850,498);
2326   ls->setEnd(&p);
2327 
2328 
2329   SpeciesReferenceGlyph* srg_aspartate_cyt_2=rg_aspartateCarrier->createSpeciesReferenceGlyph();
2330   srg_aspartate_cyt_2->setId("srg_aspartate_cyt_2");
2331   srg_aspartate_cyt_2->setSpeciesGlyphId(speciesGlyph_aspartate_cyt->getId());
2332   srg_aspartate_cyt_2->setSpeciesReferenceId(sr_aspartate_cyt_2->getId());
2333   srg_aspartate_cyt_2->setRole(SPECIES_ROLE_PRODUCT);
2334 
2335   curve=srg_aspartate_cyt_2->getCurve();
2336   cb=curve->createCubicBezier();
2337   p=Point(LN,1360,550);
2338   cb->setStart(&p);
2339   p=Point(LN,1390,698);
2340   cb->setBasePoint1(&p);
2341   p=Point(LN,1390,698);
2342   cb->setBasePoint2(&p);
2343   p=Point(LN,820,698);
2344   cb->setEnd(&p);
2345 
2346 
2347   SpeciesReferenceGlyph* srg_glutamate_cyt_2=rg_aspartateCarrier->createSpeciesReferenceGlyph();
2348   srg_glutamate_cyt_2->setId("srg_glutamate_cyt_2");
2349   srg_glutamate_cyt_2->setSpeciesGlyphId(speciesGlyph_glutamate_cyt->getId());
2350   srg_glutamate_cyt_2->setSpeciesReferenceId(sr_glutamate_cyt_2->getId());
2351   srg_glutamate_cyt_2->setRole(SPECIES_ROLE_SUBSTRATE);
2352 
2353   curve=srg_glutamate_cyt_2->getCurve();
2354   cb=curve->createCubicBezier();
2355   p=Point(LN,1420,530);
2356   cb->setStart(&p);
2357   p=Point(LN,1390,648);
2358   cb->setBasePoint1(&p);
2359   p=Point(LN,1390,648);
2360   cb->setBasePoint2(&p);
2361   p=Point(LN,1050,628);
2362   cb->setEnd(&p);
2363 
2364 
2365   SpeciesReferenceGlyph* srg_glutamate_mito3_2=rg_aspartateCarrier->createSpeciesReferenceGlyph();
2366   srg_glutamate_mito3_2->setId("srg_glutamate_mito3_2");
2367   srg_glutamate_mito3_2->setSpeciesGlyphId(speciesGlyph_glutamate_mito3->getId());
2368   srg_glutamate_mito3_2->setSpeciesReferenceId(sr_glutamate_mito3_2->getId());
2369   srg_glutamate_mito3_2->setRole(SPECIES_ROLE_PRODUCT);
2370 
2371   curve=srg_glutamate_mito3_2->getCurve();
2372   cb=curve->createCubicBezier();
2373   p=Point(LN,1360,550);
2374   cb->setStart(&p);
2375   p=Point(LN,1390,448);
2376   cb->setBasePoint1(&p);
2377   p=Point(LN,1390,448);
2378   cb->setBasePoint2(&p);
2379   p=Point(LN,1550,448);
2380   cb->setEnd(&p);
2381 
2382   fail_unless(LN != NULL);
2383 
2384   SBMLWriter writer;
2385   //bool result=writer.write(document,"example6.xml");
2386   //std::cout << "result of writing: " << result << std::endl;
2387   char* writtenContent=writer.writeToString(document);
2388   //std::cout << writtenContent << std::endl;
2389 
2390   XMLInputStream *stream2 = new XMLInputStream(writtenContent,false);
2391   XMLNode *node2 = new XMLNode(*stream2);
2392   fail_unless(node->getName()=="sbml");
2393   fail_unless(node->getChild("model").getName()=="model");
2394   fail_unless(node->getChild("model").getChild("annotation").getName()=="annotation");
2395   fail_unless(node->getChild("model").getChild("annotation").getChild("listOfLayouts").getName()=="listOfLayouts");
2396   XMLNode& listOfLayouts1 = node->getChild("model").getChild("annotation").getChild("listOfLayouts");
2397   fail_unless(listOfLayouts1.getName()=="listOfLayouts");
2398 
2399   fail_unless(node2->getName()=="sbml");
2400   fail_unless(node2->getChild("model").getName()=="model");
2401   fail_unless(node2->getChild("model").getChild("annotation").getName()=="annotation");
2402   XMLNode& listOfLayouts2= node2->getChild("model").getChild("annotation").getChild("listOfLayouts");
2403   fail_unless(listOfLayouts2.getName()=="listOfLayouts");
2404 
2405   // until the sbml element gets a namespace, we only compare the listOfLayouts element and all its children.
2406   fail_unless(listOfLayouts1.equals(listOfLayouts2));
2407 
2408   free(writtenContent);
2409   delete document;
2410   delete node;
2411   delete node2;
2412   delete stream2;
2413   delete stream;
2414 }
2415 END_TEST
2416 
START_TEST(test_LayoutWriting_multipleTimes)2417 START_TEST(test_LayoutWriting_multipleTimes)
2418 {
2419   LayoutPkgNamespaces ns (2,1);
2420   SBMLDocument doc(&ns);
2421   int rv = doc.setPkgRequired("layout", false);
2422   fail_unless(rv==LIBSBML_UNEXPECTED_ATTRIBUTE);
2423 
2424   Model* model = doc.createModel();
2425   model->setId("test1");
2426 
2427   LayoutModelPlugin* lPlugin = (LayoutModelPlugin*) model->getPlugin("layout");
2428   fail_unless(lPlugin != NULL);
2429 
2430   Layout* layout = lPlugin->createLayout();
2431   layout->setId("layout1");
2432 
2433   // whenever getannotation is called, the layout will be synchronized
2434   string model1 = writeSBMLToStdString(&doc);
2435 
2436   // writing should create that annotation ...
2437   XMLNode* annot = model->getAnnotation();
2438   int numAnnotation = annot->getNumChildren();
2439 
2440   // however, writing it again should not create multiple annotation
2441   string model2 = writeSBMLToStdString(&doc);
2442   annot = model->getAnnotation();
2443   fail_unless(numAnnotation == (int)annot->getNumChildren());
2444 }
2445 END_TEST
2446 
2447 
2448 Suite *
create_suite_LayoutWriting(void)2449 create_suite_LayoutWriting (void)
2450 {
2451   Suite *suite = suite_create("LayoutWriting");
2452   TCase *tcase = tcase_create("LayoutWriting");
2453 
2454   tcase_add_checked_fixture( tcase,
2455                             LayoutWritingTest_setup,
2456                             LayoutWritingTest_teardown );
2457 
2458   tcase_add_test( tcase, test_LayoutWriting_multipleTimes              );
2459   tcase_add_test( tcase, test_LayoutWriting                            );
2460   suite_add_tcase(suite, tcase);
2461 
2462   return suite;
2463 }
2464 
2465 
2466 
2467 END_C_DECLS
2468