libsbgnpy 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. libsbgnpy/__init__.py +16 -0
  2. libsbgnpy/examples/__init__.py +0 -0
  3. libsbgnpy/examples/extension_example.py +103 -0
  4. libsbgnpy/examples/info_example.py +70 -0
  5. libsbgnpy/examples/notes_example.py +66 -0
  6. libsbgnpy/examples/read_example.py +35 -0
  7. libsbgnpy/examples/sbgn/adh.sbgn +61 -0
  8. libsbgnpy/examples/sbgn/glycolysis.sbgn +375 -0
  9. libsbgnpy/examples/sbgn/neuronal_muscle_signalling_color.sbgn +439 -0
  10. libsbgnpy/examples/sbgn/notes.sbgn +13 -0
  11. libsbgnpy/examples/sbgn/test-output-01.sbgn +8 -0
  12. libsbgnpy/examples/sbgn/test-output-02.sbgn +59 -0
  13. libsbgnpy/examples/sbgn/test-output-03.sbgn +16 -0
  14. libsbgnpy/examples/write_example.py +223 -0
  15. libsbgnpy/libsbgn.py +4490 -0
  16. libsbgnpy/libsbgnSubs.py +127 -0
  17. libsbgnpy/libsbgnTypes.py +112 -0
  18. libsbgnpy/render.py +59 -0
  19. libsbgnpy/sbo/__init__.py +0 -0
  20. libsbgnpy/sbo/sbgn_sbo_mapping.txt +1304 -0
  21. libsbgnpy/sbo/sbo2sbgn.py +58 -0
  22. libsbgnpy/sbo/sbo_sbgn_map.txt +38 -0
  23. libsbgnpy/schema/README.md +156 -0
  24. libsbgnpy/schema/SBGN.xsd +1018 -0
  25. libsbgnpy/schema/__init__.py +0 -0
  26. libsbgnpy/utils.py +93 -0
  27. libsbgnpy/validation/__init__.py +0 -0
  28. libsbgnpy/validation/error-test-files/AF/af10101-fail.sbgn +34 -0
  29. libsbgnpy/validation/error-test-files/AF/af10101-pass.sbgn +35 -0
  30. libsbgnpy/validation/error-test-files/AF/af10102-fail-1.sbgn +17 -0
  31. libsbgnpy/validation/error-test-files/AF/af10102-fail-2.sbgn +17 -0
  32. libsbgnpy/validation/error-test-files/AF/af10102-fail-3.sbgn +17 -0
  33. libsbgnpy/validation/error-test-files/AF/af10102-fail-4.sbgn +17 -0
  34. libsbgnpy/validation/error-test-files/AF/af10102-pass.sbgn +17 -0
  35. libsbgnpy/validation/error-test-files/AF/af10103-fail.sbgn +35 -0
  36. libsbgnpy/validation/error-test-files/AF/af10103-pass.sbgn +35 -0
  37. libsbgnpy/validation/error-test-files/AF/af10104-fail.sbgn +34 -0
  38. libsbgnpy/validation/error-test-files/AF/af10104-pass.sbgn +35 -0
  39. libsbgnpy/validation/error-test-files/AF/af10109-fail.sbgn +35 -0
  40. libsbgnpy/validation/error-test-files/AF/af10109-pass.sbgn +35 -0
  41. libsbgnpy/validation/error-test-files/AF/af10110-fail.sbgn +34 -0
  42. libsbgnpy/validation/error-test-files/AF/af10111-fail.sbgn +42 -0
  43. libsbgnpy/validation/error-test-files/AF/af10111-pass.sbgn +26 -0
  44. libsbgnpy/validation/error-test-files/AF/af10112-fail.sbgn +25 -0
  45. libsbgnpy/validation/error-test-files/AF/af10113-fail.sbgn +17 -0
  46. libsbgnpy/validation/error-test-files/ER/er10103-fail.sbgn +29 -0
  47. libsbgnpy/validation/error-test-files/ER/er10103-pass.sbgn +25 -0
  48. libsbgnpy/validation/error-test-files/ER/er10104-fail.sbgn +31 -0
  49. libsbgnpy/validation/error-test-files/ER/er10104-pass.sbgn +27 -0
  50. libsbgnpy/validation/error-test-files/ER/er10106-fail-1.sbgn +26 -0
  51. libsbgnpy/validation/error-test-files/ER/er10106-fail-2.sbgn +26 -0
  52. libsbgnpy/validation/error-test-files/ER/er10106-fail-3.sbgn +26 -0
  53. libsbgnpy/validation/error-test-files/ER/er10106-fail-4.sbgn +26 -0
  54. libsbgnpy/validation/error-test-files/ER/er10106-fail-5.sbgn +26 -0
  55. libsbgnpy/validation/error-test-files/ER/er10106-fail-6.sbgn +26 -0
  56. libsbgnpy/validation/error-test-files/ER/er10106-pass.sbgn +26 -0
  57. libsbgnpy/validation/error-test-files/ER/er10107-fail-1.sbgn +25 -0
  58. libsbgnpy/validation/error-test-files/ER/er10107-fail-2.sbgn +25 -0
  59. libsbgnpy/validation/error-test-files/ER/er10107-fail-3.sbgn +25 -0
  60. libsbgnpy/validation/error-test-files/ER/er10107-fail-4.sbgn +25 -0
  61. libsbgnpy/validation/error-test-files/ER/er10107-fail-5.sbgn +25 -0
  62. libsbgnpy/validation/error-test-files/ER/er10107-fail-6.sbgn +25 -0
  63. libsbgnpy/validation/error-test-files/ER/er10107-pass.sbgn +26 -0
  64. libsbgnpy/validation/error-test-files/ER/er10108-fail-1.sbgn +43 -0
  65. libsbgnpy/validation/error-test-files/ER/er10108-fail-2.sbgn +43 -0
  66. libsbgnpy/validation/error-test-files/ER/er10108-pass.sbgn +35 -0
  67. libsbgnpy/validation/error-test-files/ER/er10109-fail.sbgn +40 -0
  68. libsbgnpy/validation/error-test-files/ER/er10109-pass.sbgn +40 -0
  69. libsbgnpy/validation/error-test-files/ER/er10111-fail.sbgn +53 -0
  70. libsbgnpy/validation/error-test-files/ER/er10111-pass.sbgn +27 -0
  71. libsbgnpy/validation/error-test-files/ER/er20001-fail.sbgn +55 -0
  72. libsbgnpy/validation/error-test-files/ER/er20001-pass.sbgn +57 -0
  73. libsbgnpy/validation/error-test-files/PD/pd10101-fail.sbgn +27 -0
  74. libsbgnpy/validation/error-test-files/PD/pd10101-pass.sbgn +27 -0
  75. libsbgnpy/validation/error-test-files/PD/pd10102-fail.sbgn +55 -0
  76. libsbgnpy/validation/error-test-files/PD/pd10102-pass.sbgn +55 -0
  77. libsbgnpy/validation/error-test-files/PD/pd10103-fail.sbgn +37 -0
  78. libsbgnpy/validation/error-test-files/PD/pd10103-pass.sbgn +45 -0
  79. libsbgnpy/validation/error-test-files/PD/pd10104-fail.sbgn +55 -0
  80. libsbgnpy/validation/error-test-files/PD/pd10104-pass.sbgn +47 -0
  81. libsbgnpy/validation/error-test-files/PD/pd10105-fail.sbgn +27 -0
  82. libsbgnpy/validation/error-test-files/PD/pd10105-pass.sbgn +27 -0
  83. libsbgnpy/validation/error-test-files/PD/pd10106-fail.sbgn +27 -0
  84. libsbgnpy/validation/error-test-files/PD/pd10106-pass.sbgn +27 -0
  85. libsbgnpy/validation/error-test-files/PD/pd10107-fail.sbgn +37 -0
  86. libsbgnpy/validation/error-test-files/PD/pd10107-pass.sbgn +45 -0
  87. libsbgnpy/validation/error-test-files/PD/pd10108-fail.sbgn +42 -0
  88. libsbgnpy/validation/error-test-files/PD/pd10108-pass.sbgn +35 -0
  89. libsbgnpy/validation/error-test-files/PD/pd10109-fail-1.sbgn +51 -0
  90. libsbgnpy/validation/error-test-files/PD/pd10109-fail-2.sbgn +51 -0
  91. libsbgnpy/validation/error-test-files/PD/pd10109-fail-3.sbgn +51 -0
  92. libsbgnpy/validation/error-test-files/PD/pd10109-fail-4.sbgn +51 -0
  93. libsbgnpy/validation/error-test-files/PD/pd10109-fail-5.sbgn +51 -0
  94. libsbgnpy/validation/error-test-files/PD/pd10109-pass.sbgn +35 -0
  95. libsbgnpy/validation/error-test-files/PD/pd10110-fail-1.sbgn +35 -0
  96. libsbgnpy/validation/error-test-files/PD/pd10110-fail-2.sbgn +35 -0
  97. libsbgnpy/validation/error-test-files/PD/pd10110-fail-3.sbgn +35 -0
  98. libsbgnpy/validation/error-test-files/PD/pd10110-fail-4.sbgn +35 -0
  99. libsbgnpy/validation/error-test-files/PD/pd10110-fail-5.sbgn +35 -0
  100. libsbgnpy/validation/error-test-files/PD/pd10110-pass.sbgn +35 -0
  101. libsbgnpy/validation/error-test-files/PD/pd10111-fail-2.sbgn +72 -0
  102. libsbgnpy/validation/error-test-files/PD/pd10111-fail.sbgn +72 -0
  103. libsbgnpy/validation/error-test-files/PD/pd10111-pass.sbgn +68 -0
  104. libsbgnpy/validation/error-test-files/PD/pd10112-fail-1.sbgn +28 -0
  105. libsbgnpy/validation/error-test-files/PD/pd10112-fail-2.sbgn +28 -0
  106. libsbgnpy/validation/error-test-files/PD/pd10112-pass.sbgn +28 -0
  107. libsbgnpy/validation/error-test-files/PD/pd10124-fail.sbgn +67 -0
  108. libsbgnpy/validation/error-test-files/PD/pd10124-pass.sbgn +67 -0
  109. libsbgnpy/validation/error-test-files/PD/pd10125-fail.sbgn +35 -0
  110. libsbgnpy/validation/error-test-files/PD/pd10126-fail.sbgn +53 -0
  111. libsbgnpy/validation/error-test-files/PD/pd10126-pass.sbgn +45 -0
  112. libsbgnpy/validation/error-test-files/PD/pd10127-fail.sbgn +21 -0
  113. libsbgnpy/validation/error-test-files/PD/pd10127-pass.sbgn +17 -0
  114. libsbgnpy/validation/error-test-files/PD/pd10128-fail.sbgn +21 -0
  115. libsbgnpy/validation/error-test-files/PD/pd10128-pass.sbgn +17 -0
  116. libsbgnpy/validation/error-test-files/PD/pd10131-fail.sbgn +9 -0
  117. libsbgnpy/validation/error-test-files/PD/pd10131-pass.sbgn +27 -0
  118. libsbgnpy/validation/error-test-files/PD/pd10132-fail.sbgn +10 -0
  119. libsbgnpy/validation/error-test-files/PD/pd10132-pass.sbgn +27 -0
  120. libsbgnpy/validation/error-test-files/PD/pd10140-fail.sbgn +31 -0
  121. libsbgnpy/validation/error-test-files/PD/pd10140-pass.sbgn +27 -0
  122. libsbgnpy/validation/error-test-files/PD/pd10141-fail.sbgn +11 -0
  123. libsbgnpy/validation/error-test-files/PD/pd10141-pass.sbgn +27 -0
  124. libsbgnpy/validation/error-test-files/PD/pd10142-fail.sbgn +35 -0
  125. libsbgnpy/validation/error-test-files/PD/pd10142-pass.sbgn +53 -0
  126. libsbgnpy/validation/error-test-files/error_notes.txt +7 -0
  127. libsbgnpy/validation/rules/sbgn_af.sch +275 -0
  128. libsbgnpy/validation/rules/sbgn_er.sch +288 -0
  129. libsbgnpy/validation/rules/sbgn_pd.sch +634 -0
  130. libsbgnpy/validation/schematron/ExtractSchFromRNG.xsl +75 -0
  131. libsbgnpy/validation/schematron/ExtractSchFromXSD.xsl +77 -0
  132. libsbgnpy/validation/schematron/iso-schematron-xslt1.zip +0 -0
  133. libsbgnpy/validation/schematron/iso-schematron-xslt2.zip +0 -0
  134. libsbgnpy/validation/schematron/iso_abstract_expand.xsl +297 -0
  135. libsbgnpy/validation/schematron/iso_dsdl_include.xsl +1509 -0
  136. libsbgnpy/validation/schematron/iso_schematron_message.xsl +55 -0
  137. libsbgnpy/validation/schematron/iso_schematron_skeleton_for_xslt1.xsl +1841 -0
  138. libsbgnpy/validation/schematron/iso_svrl_for_xslt1.xsl +604 -0
  139. libsbgnpy/validation/schematron/readme.txt +101 -0
  140. libsbgnpy/validation/schematron/schematron-skeleton-api.htm +723 -0
  141. libsbgnpy/validation/validator.py +141 -0
  142. libsbgnpy-0.3.0.dist-info/METADATA +91 -0
  143. libsbgnpy-0.3.0.dist-info/RECORD +145 -0
  144. libsbgnpy-0.3.0.dist-info/WHEEL +4 -0
  145. libsbgnpy-0.3.0.dist-info/licenses/LICENSE +7 -0
libsbgnpy/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ __version__ = "0.3.0"
2
+
3
+ from pathlib import Path
4
+ from libsbgnpy.libsbgnSubs import Notes, Extension
5
+ from libsbgnpy.libsbgnTypes import Language, GlyphClass, ArcClass
6
+
7
+ sbgn_examples_dir = Path(__file__).parent / "examples" / "sbgn"
8
+
9
+ __all__ = [
10
+ "Notes",
11
+ "Extension",
12
+ "Language",
13
+ "GlyphClass",
14
+ "ArcClass",
15
+ "sbgn_examples_dir",
16
+ ]
File without changes
@@ -0,0 +1,103 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Write and read extension information.
4
+ see https://github.com/sbgn/sbgn/wiki/SBGN-ML_Extensions
5
+ """
6
+
7
+ from pathlib import Path
8
+
9
+ from libsbgnpy import Extension, Language, libsbgn, utils
10
+
11
+
12
+ def write_map_extension(f):
13
+ """Write extension information on map.
14
+
15
+ :param f: file input
16
+ :return: None
17
+ """
18
+ sbgn = libsbgn.sbgn()
19
+ map = libsbgn.map()
20
+ map.set_language(Language.PD)
21
+ sbgn.set_map(map)
22
+
23
+ extension = Extension(
24
+ """<renderInformation id="example" programName="SBML Layout" programVersion="3.0"
25
+ xmlns="http://projects.eml.org/bcb/sbml/render/level2">
26
+ <listOfColorDefinitions>
27
+ <colorDefinition id="yelloComp" value="#ffffccff" />
28
+ <colorDefinition id="grayComp" value="#e0e0e0ff" />
29
+ <colorDefinition id="orange" value="#fa9e2fff" />
30
+ <colorDefinition id="blue" value="#2958acff" />
31
+ <colorDefinition id="green" value="#378f5cff" />
32
+ <colorDefinition id="Color_0" value="#969696" />
33
+ <colorDefinition id="Color_1" value="#ff9900" />
34
+ <colorDefinition id="Color_2" value="#000000" />
35
+ </listOfColorDefinitions>
36
+ <listOfGradientDefinitions>
37
+ <linearGradient x1="0%" y1="0%" z1="0%" x2="100%" y2="0%" z2="100%" id="LinearGradient_0" spreadMethod="reflect">
38
+ <stop offset="0%" stop-color="#ccffff" />
39
+ <stop offset="100%" stop-color="#ffffff" />
40
+ </linearGradient>
41
+ <linearGradient x1="0%" y1="0%" z1="0%" x2="100%" y2="0%" z2="100%" id="OrangeGradient_0" spreadMethod="reflect">
42
+ <stop offset="0%" stop-color="#ffffff" />
43
+ <stop offset="100%" stop-color="#fa9e2fff" />
44
+ </linearGradient>
45
+ <linearGradient x1="0%" y1="0%" z1="0%" x2="100%" y2="0%" z2="100%" id="BlueGradient_0" spreadMethod="reflect">
46
+ <stop offset="0%" stop-color="#ffffff" />
47
+ <stop offset="100%" stop-color="#2958acff" />
48
+ </linearGradient>
49
+ <linearGradient x1="0%" y1="0%" z1="0%" x2="100%" y2="0%" z2="100%" id="GreenGradient_0" spreadMethod="reflect">
50
+ <stop offset="0%" stop-color="#ffffff" />
51
+ <stop offset="100%" stop-color="#378f5cff" />
52
+ </linearGradient>
53
+ </listOfGradientDefinitions>
54
+ <listOfStyles>
55
+ <style idList="glyph0 glyph2 glyph14 glyph34 ">
56
+ <g stroke="Color_2" stroke-width="5" fill="yelloComp" />
57
+ </style>
58
+ <style idList="glyph1">
59
+ <g stroke="Color_2" stroke-width="5" fill="grayComp" />
60
+ </style>
61
+ <style idList="glyph8 glyph23 glyph5 glyph12 glyph21 glyph13 glyph4 glyph6 glyph7 glyph20 glyph22">
62
+ <g stroke="orange" stroke-width="2" fill="OrangeGradient_0" />
63
+ </style>
64
+ <style idList="glyph3 glyph47 glyph10 glyph11">
65
+ <g stroke="blue" stroke-width="2" fill="BlueGradient_0" />
66
+ </style>
67
+ <style idList="glyph32 glyph37 glyph37a glyph31 glyph39 glyph40 glyph36 glyph28 glyph35 glyph27 glyph25 glyph26 glyph9 glyph38 glyph38a glyph29 glyph30 glyph46 glyph33">
68
+ <g stroke="green" stroke-width="2" fill="GreenGradient_0" />
69
+ </style>
70
+ <style idList="a38">
71
+ <g stroke="blue" stroke-width="2" />
72
+ </style>
73
+ </listOfStyles>
74
+ </renderInformation>"""
75
+ )
76
+ map.set_extension(extension)
77
+
78
+ # print(utils.write_to_string(sbgn))
79
+ utils.write_to_file(sbgn=sbgn, f=f)
80
+
81
+
82
+ def read_map_extension(f: Path) -> None:
83
+ """Read notes from glyphs.
84
+
85
+ :param f: file input
86
+ :return: None
87
+ """
88
+ sbgn = utils.read_from_file(f=f)
89
+
90
+ # map is a container for the glyphs and arcs
91
+ map = sbgn.get_map()
92
+
93
+ extension = map.get_extension()
94
+ if extension:
95
+ print(extension)
96
+ print(str(extension))
97
+
98
+
99
+ if __name__ == "__main__":
100
+ f = "sbgn/notes.sbgn"
101
+ write_map_extension(f)
102
+ print("_" * 80, "\n")
103
+ read_map_extension(f)
@@ -0,0 +1,70 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Display information from SBGN files.
4
+ """
5
+
6
+ from pathlib import Path
7
+
8
+ import libsbgnpy.libsbgn as libsbgn # import the bindings
9
+ from libsbgnpy.utils import print_bbox # some additional helpers
10
+
11
+
12
+ def info_example() -> None:
13
+ """Example demonstrating how to print information from SBGN."""
14
+ print(libsbgn.__all__)
15
+
16
+ # file to process
17
+ f_sgbn: Path = Path(__file__).parent / "sbgn/adh.sbgn"
18
+
19
+ # sbgn and map
20
+ sbgn = libsbgn.parse(f_sgbn)
21
+ map = sbgn.get_map()
22
+ print("Language:", map.get_language())
23
+
24
+ # get bbox for map
25
+ """<bbox x="0" y="0" w="363" h="253"/>"""
26
+ box = map.get_bbox()
27
+ print("x, y, w, h : ", box.get_x(), box.get_y(), box.get_w(), box.get_h())
28
+
29
+ # glyphs
30
+ """
31
+ <glyph class="simple chemical" id="glyph1">
32
+ <label text="Ethanol"/> <!-- fontsize="" etc -->
33
+ <!-- Line breaks are allowed in the text attribute -->
34
+ <bbox x="40" y="120" w="60" h="60"/>
35
+ </glyph>
36
+ """
37
+ glyphs = map.get_glyph()
38
+ for g in glyphs:
39
+ cls = g.get_class()
40
+ print(cls, g.get_id())
41
+ label = g.get_label()
42
+ if cls == "simple chemical":
43
+ print("label: ", label.get_text())
44
+
45
+ if cls == "process":
46
+ for p in g.get_port():
47
+ print("port ", p.get_id(), p.get_x(), p.get_y())
48
+
49
+ box = g.get_bbox()
50
+ print_bbox(box)
51
+ print
52
+
53
+ # arcs
54
+ """
55
+ <arc class="consumption" source="glyph_nad" target="pn1.1" id="a06">
56
+ <start x="95" y="202" />
57
+ <end x="136" y="180" />
58
+ </arc>
59
+ """
60
+ arcs = map.get_arc()
61
+ for a in arcs:
62
+ print(a.get_class(), a.get_source(), a.get_target(), a.get_id())
63
+ start = a.get_start()
64
+ print(start.x, start.y)
65
+ end = a.get_end()
66
+ print(end.x, end.y)
67
+
68
+
69
+ if __name__ == "__main__":
70
+ info_example()
@@ -0,0 +1,66 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Write and read notes information.
4
+ Notes must be XML elements in a <notes>Tag</notes>
5
+ """
6
+
7
+ from libsbgnpy import Language, Notes, libsbgn, utils
8
+
9
+
10
+ def write_glyph_notes(f):
11
+ """Set notes on element.
12
+
13
+ :return: None
14
+ """
15
+ sbgn = libsbgn.sbgn()
16
+ map = libsbgn.map()
17
+ map.set_language(Language.PD)
18
+ sbgn.set_map(map)
19
+
20
+ # create a glyph with an id and class "macromolecule"
21
+ g = libsbgn.glyph()
22
+ g.set_id("g1")
23
+
24
+ # define a label for this glyph
25
+ label = libsbgn.label()
26
+ label.set_text("INSR")
27
+
28
+ bbox = libsbgn.bbox(x=100, y=100, w=80, h=40)
29
+ g.set_bbox(bbox)
30
+ map.add_glyph(g)
31
+
32
+ notes = Notes(
33
+ """
34
+ <body xmlns="http://www.w3.org/1999/xhtml">
35
+ This is an example note describing the INSR glyph.
36
+ </body>"""
37
+ )
38
+ g.set_notes(notes)
39
+
40
+ print(utils.write_to_string(sbgn))
41
+ utils.write_to_file(sbgn=sbgn, f=f)
42
+
43
+
44
+ def read_glyph_notes(f):
45
+ """Read notes from glyphs.
46
+
47
+ :return: None
48
+ """
49
+ sbgn = utils.read_from_file(f=f)
50
+
51
+ # map is a container for the glyphs and arcs
52
+ map = sbgn.get_map()
53
+
54
+ glyphs = map.get_glyph()
55
+ for g in glyphs:
56
+ notes = g.get_notes()
57
+ if notes:
58
+ print(g.get_id())
59
+ print(notes)
60
+
61
+
62
+ if __name__ == "__main__":
63
+ f = "sbgn/notes.sbgn"
64
+ write_glyph_notes(f)
65
+ print("_" * 80, "\n")
66
+ read_glyph_notes(f)
@@ -0,0 +1,35 @@
1
+ import libsbgnpy.libsbgn as libsbgn
2
+
3
+
4
+ def read_sbgn_01(f):
5
+ """Read example file and display content.
6
+
7
+ :param f: SBGN file to read
8
+ :return: sbgn
9
+ """
10
+ sbgn = libsbgn.parse(f)
11
+
12
+ # map is a container for the glyphs and arcs
13
+ map = sbgn.get_map()
14
+
15
+ # we can get a list of glyphs (nodes) in this map with getGlyph()
16
+ for g in map.get_glyph():
17
+ # print the sbgn class of this glyph
18
+ print(" Glyph with class", g.get_id())
19
+
20
+ # if there is a label, print it as well
21
+ if g.get_label():
22
+ print(", and label ", g.get_label().get_text())
23
+ else:
24
+ print(", without label")
25
+
26
+ # we can get a list of arcs (edges) in this map with getArc()
27
+ for a in map.get_arc():
28
+ # print the class of this arc
29
+ print(" Arc with class ", a.get_class())
30
+
31
+ return sbgn
32
+
33
+
34
+ if __name__ == "__main__":
35
+ read_sbgn_01("sbgn/adh.sbgn")
@@ -0,0 +1,61 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <sbgn xmlns="http://sbgn.org/libsbgn/0.2">
3
+ <map language="process description">
4
+ <bbox x="0" y="0" w="363" h="253"/>
5
+ <glyph class="simple chemical" id="glyph1">
6
+ <label text="Ethanol"/> <!-- fontsize="" etc -->
7
+ <!-- Line breaks are allowed in the text attribute -->
8
+ <bbox x="40" y="120" w="60" h="60"/>
9
+ </glyph>
10
+ <glyph class="simple chemical" id="glyph_ethanal">
11
+ <label text="Ethanal" />
12
+ <bbox x="220" y="110" w="60" h="60"/>
13
+ </glyph>
14
+ <glyph class="macromolecule" id="glyph_adh1">
15
+ <label text="ADH1" />
16
+ <bbox x="106" y="20" w="108" h="60"/>
17
+ </glyph>
18
+ <glyph class="simple chemical" id="glyph_h">
19
+ <label text="H+" />
20
+ <bbox x="220" y="190" w="60" h="60"/>
21
+ </glyph>
22
+ <glyph class="simple chemical" id="glyph_nad">
23
+ <label text="NAD+" />
24
+ <bbox x="40" y="190" w="60" h="60"/>
25
+ </glyph>
26
+ <glyph class="simple chemical" id="glyph_nadh">
27
+ <label text="NADH" />
28
+ <bbox x="300" y="150" w="60" h="60"/>
29
+ </glyph>
30
+ <glyph class="process" orientation="horizontal" id="pn1">
31
+ <bbox x="148" y="168" w="24" h="24"/>
32
+ <port x="136" y="180" id="pn1.1"/>
33
+ <port x="184" y="180" id="pn1.2"/>
34
+ </glyph>
35
+
36
+ <arc class="consumption" source="glyph1" target="pn1.1" id="a01">
37
+ <start x="98" y="160" />
38
+ <end x="136" y="180" />
39
+ </arc>
40
+ <arc class="production" source="pn1.2" target="glyph_nadh" id="a02">
41
+ <start x="184" y="180" />
42
+ <end x="300" y="180" />
43
+ </arc>
44
+ <arc class="catalysis" source="glyph_adh1" target="pn1" id="a03">
45
+ <start x="160" y="80" />
46
+ <end x="160" y="168" />
47
+ </arc>
48
+ <arc class="production" source="pn1.2" target="glyph_h" id="a04">
49
+ <start x="184" y="180" />
50
+ <end x="224" y="202" />
51
+ </arc>
52
+ <arc class="production" source="pn1.2" target="glyph_ethanal" id="a05">
53
+ <start x="184" y="180" />
54
+ <end x="224" y="154" />
55
+ </arc>
56
+ <arc class="consumption" source="glyph_nad" target="pn1.1" id="a06">
57
+ <start x="95" y="202" />
58
+ <end x="136" y="180" />
59
+ </arc>
60
+ </map>
61
+ </sbgn>