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
@@ -0,0 +1,127 @@
1
+ """
2
+ Overwritten classes (Notes & Extension)
3
+ """
4
+
5
+ try:
6
+ from lxml import etree as etree_
7
+ except ImportError:
8
+ from xml.etree import ElementTree as etree_
9
+
10
+
11
+ import libsbgnpy.libsbgn as supermod
12
+ from libsbgnpy.libsbgn import showIndent
13
+
14
+
15
+ def _process_xml_input(input):
16
+ """Helper function for input to Notes and Extension.
17
+
18
+ :param input: xml_string
19
+ :return: anytypeobjs_
20
+ """
21
+ anytypeobjs_ = None
22
+ if input is not None:
23
+ anytypeobjs_ = input.strip()
24
+ return anytypeobjs_
25
+
26
+
27
+ class _Information(object):
28
+ def __str__(self):
29
+ if type(self.anytypeobjs_) in (list, tuple):
30
+ return str(self.anytypeobjs_[0])
31
+ else:
32
+ return str(self.anytypeobjs_)
33
+
34
+ def hasContent_(self):
35
+ return self.anytypeobjs_ is not None
36
+
37
+ def export(
38
+ self,
39
+ outfile,
40
+ level,
41
+ namespace_="sbgn:",
42
+ name_=None,
43
+ namespacedef_='xmlns:sbgn="http://sbgn.org/libsbgn/0.2"',
44
+ pretty_print=True,
45
+ ):
46
+ """Custom export function.
47
+
48
+ Necessary to provide handling for the xsd:any.
49
+ """
50
+ name_ = self.__class__.__name__.lower()
51
+ if pretty_print:
52
+ eol_ = "\n"
53
+ else:
54
+ eol_ = ""
55
+
56
+ if self.hasContent_():
57
+ # notes defined as sequence, so handle the normal case of just having string
58
+ notes_items = self.anytypeobjs_
59
+ if type(self.anytypeobjs_) not in [list, tuple]:
60
+ notes_items = [notes_items]
61
+ showIndent(outfile, level, pretty_print)
62
+ outfile.write(
63
+ "<%s%s%s>%s"
64
+ % (namespace_, name_, namespacedef_ and " " + namespacedef_ or "", eol_)
65
+ )
66
+ for obj_ in notes_items:
67
+ showIndent(outfile, level, pretty_print)
68
+ outfile.write("%s%s" % (obj_, eol_))
69
+ showIndent(outfile, level, pretty_print)
70
+ outfile.write(
71
+ "</%s%s%s>%s"
72
+ % (namespace_, name_, namespacedef_ and " " + namespacedef_ or "", eol_)
73
+ )
74
+
75
+ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
76
+ """Custom build function.
77
+
78
+ Necessary to provide handling for the xsd:any.
79
+ """
80
+ # This is the lxml.etree._Element, in first version going via strings
81
+ obj_ = etree_.tostring(child_, pretty_print=False, encoding="unicode")
82
+ # print('obj_', obj_)
83
+ if obj_ is not None:
84
+ self.add_anytypeobjs_(obj_)
85
+
86
+
87
+ class Notes(_Information, supermod.notesType):
88
+ """SBGN Notes class.
89
+
90
+ The optional SBGN element named 'notes', present on every major SBGN
91
+ component type, is intended as a place for storing optional
92
+ information intended to be seen by humans. An example use of the
93
+ 'notes' element would be to contain formatted user comments about the
94
+ model element in which the 'notes' element is enclosed. Every object
95
+ derived directly or indirectly from type SBase can have a separate
96
+ value for 'notes', allowing users considerable freedom when adding
97
+ comments to their models.
98
+
99
+ The format of 'notes' elements must be XHTML 1.0 (http://www.w3.org/1999/xhtml).
100
+ """
101
+
102
+ def __init__(self, xml_string=None):
103
+ super(Notes, self).__init__(
104
+ _process_xml_input(xml_string),
105
+ )
106
+
107
+
108
+ supermod.notesType.subclass = Notes
109
+
110
+
111
+ class Extension(_Information, supermod.extensionType):
112
+ """SBGN Extension class.
113
+
114
+ Any well-formed XML content, and with each top-level element placed in a unique XML namespace; see text.
115
+ Whereas Notes is a container for content to be shown directly to humans, Extension is a container for
116
+ optional software-generated content not meant to be shown to humans. Every SBGN object can
117
+ have its own Extension object instance. In XML, the Extension content type is any, allowing essentially
118
+ arbitrary well-formed XML data content.
119
+ """
120
+
121
+ def __init__(self, xml_string=None):
122
+ super(Extension, self).__init__(
123
+ _process_xml_input(xml_string),
124
+ )
125
+
126
+
127
+ supermod.extensionType.subclass = Extension
@@ -0,0 +1,112 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Definition of Language, GlyphClass and ArcClass types.
4
+ Created manually from schema file.
5
+ """
6
+
7
+ from enum import Enum, unique
8
+
9
+
10
+ @unique
11
+ class Language(Enum):
12
+ """
13
+ Enum representing the three languages of SBGN.
14
+ """
15
+
16
+ AF = "activity flow"
17
+ ER = "entity relationship"
18
+ PD = "process description"
19
+
20
+
21
+ @unique
22
+ class Orientation(Enum):
23
+ HORIZONTAL = "horizontal"
24
+ VERTICAL = "vertical"
25
+ UP = "up"
26
+ DOWN = "down"
27
+ RIGHT = "right"
28
+ LEFT = "left"
29
+
30
+
31
+ @unique
32
+ class GlyphClass(Enum):
33
+ """
34
+ Enumeration with all possible values for the class attribute of Glyphs in SBGN-ML.
35
+ This includes both top-level glyphs and sub-glyphs.
36
+ """
37
+
38
+ # glyphs
39
+ UNSPECIFIED_ENTITY = "unspecified entity"
40
+ SIMPLE_CHEMICAL = "simple chemical"
41
+ MACROMOLECULE = "macromolecule"
42
+ NUCLEIC_ACID_FEATURE = "nucleic acid feature"
43
+ SIMPLE_CHEMICAL_MULTIMER = "simple chemical multimer"
44
+ MACROMOLECULE_MULTIMER = "macromolecule multimer"
45
+ NUCLEIC_ACID_FEATURE_MULTIMER = "nucleic acid feature multimer"
46
+ COMPLEX = "complex"
47
+ COMPLEX_MULTIMER = "complex multimer"
48
+ SOURCE_AND_SINK = "source and sink"
49
+ PERTURBATION = "perturbation"
50
+ BIOLOGICAL_ACTIVITY = "biological activity"
51
+ PERTURBING_AGENT = "perturbing agent"
52
+ COMPARTMENT = "compartment"
53
+ SUBMAP = "submap"
54
+ TAG = "tag"
55
+ TERMINAL = "terminal"
56
+ PROCESS = "process"
57
+ OMITTED_PROCESS = "omitted process"
58
+ UNCERTAIN_PROCESS = "uncertain process"
59
+ ASSOCIATION = "association"
60
+ DISSOCIATION = "dissociation"
61
+ PHENOTYPE = "phenotype"
62
+ AND = "and"
63
+ OR = "or"
64
+ NOT = "not"
65
+ STATE_VARIABLE = "state variable"
66
+ UNIT_OF_INFORMATION = "unit of information"
67
+
68
+ # @deprecated
69
+ # By mistake, we used STOICHIOMETRY in instead of {@link CARDINALITY} in LibSBGN M1.
70
+ # We keep this constant here to support reading old documents.
71
+ # This constant will be removed in LibSBGN M3.
72
+ STOICHIOMETRY = "stoichiometry"
73
+ ENTITY = "entity"
74
+ OUTCOME = "outcome"
75
+
76
+ # @deprecated
77
+ # Observable was used in old versions of SBGN, but has been replaced with {@link PHENOTYPE}.
78
+ # However, because older versions of SBGN are supported by LibSBGN, this constant will never be removed.
79
+ OBSERVABLE = "observable"
80
+ INTERACTION = "interaction"
81
+ ANNOTATION = "annotation"
82
+ VARIABLE_VALUE = "variable value"
83
+ IMPLICIT_XOR = "implicit xor"
84
+ DELAY = "delay"
85
+ EXISTENCE = "existence"
86
+ LOCATION = "location"
87
+ CARDINALITY = "cardinality"
88
+
89
+
90
+ @unique
91
+ class ArcClass(Enum):
92
+ """
93
+ Enumeration with all possible values for the class attribute of Arcs in SBGN-ML.
94
+ """
95
+
96
+ # arcs
97
+ PRODUCTION = "production"
98
+ CONSUMPTION = "consumption"
99
+ CATALYSIS = "catalysis"
100
+ MODULATION = "modulation"
101
+ STIMULATION = "stimulation"
102
+ INHIBITION = "inhibition"
103
+ ASSIGNMENT = "assignment"
104
+ INTERACTION = "interaction"
105
+ ABSOLUTE_INHIBITION = "absolute inhibition"
106
+ ABSOLUTE_STIMULATION = "absolute stimulation"
107
+ POSITIVE_INFLUENCE = "positive influence"
108
+ NEGATIVE_INFLUENCE = "negative influence"
109
+ UNKNOWN_INFLUENCE = "unknown influence"
110
+ EQUIVALENCE_ARC = "equivalence arc"
111
+ NECESSARY_STIMULATION = "necessary stimulation"
112
+ LOGIC_ARC = "logic arc"
libsbgnpy/render.py ADDED
@@ -0,0 +1,59 @@
1
+ """
2
+ Helper functions for rendering SBGN.
3
+
4
+ Currently uses the webservice provided at "http://sysbioapps.dyndns.org/Layout/GenerateImage".
5
+ For documentation see
6
+ http://sysbioapps.dyndns.org/Home/Services
7
+ """
8
+
9
+ import tempfile
10
+ from pathlib import Path
11
+ import requests
12
+
13
+ from libsbgnpy import utils
14
+
15
+
16
+ RENDER_URL = "http://sysbioapps.spdns.org/Layout"
17
+
18
+
19
+ def render_sbgn(sbgn, image_file: Path, file_format: str = "png") -> None:
20
+ """Render given sbgn object to image.
21
+
22
+ Currently supports the following file_formats:
23
+ - "png"
24
+ The image file must end in .file_format, e.g. in '.png'
25
+
26
+ Performs a request analogue to:
27
+ curl -X POST -F file=@".\BorisEJB.xml" http://sysbioapps.spdns.org/Layout/GenerateImage -o out.png
28
+
29
+ :param sbgn: sbgn object
30
+ :param image_file: image to create
31
+ :return: None
32
+ """
33
+ if file_format != "png":
34
+ raise ValueError("Only png rendering supported.")
35
+
36
+ if not str(image_file).endswith(f".{file_format}"):
37
+ raise ValueError(
38
+ "The filename must end in <.file_format>, e.g. for png it must end in <.png>."
39
+ )
40
+
41
+ # Create temporary file for request
42
+ with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp_dir:
43
+ f_in: Path = Path(tmp_dir) / "render.sbgn"
44
+ utils.write_to_file(sbgn, f_in)
45
+
46
+ # Call webservice for rendering
47
+ files = [
48
+ ("file", open(f_in, "rb")),
49
+ ]
50
+ r = requests.post(f"{RENDER_URL}/GenerateImage", files=files)
51
+
52
+ r.raise_for_status()
53
+
54
+ with open(image_file, "wb") as fd:
55
+ for chunk in r.iter_content(chunk_size=128):
56
+ fd.write(chunk)
57
+ fd.close()
58
+
59
+ print("SBGN rendered:", image_file)
File without changes