Skip to content

Commit

Permalink
use addXHTMLMarkup option on setNotes() to reduce dependence on str_t…
Browse files Browse the repository at this point in the history
…o_xmlstr
  • Loading branch information
artgoldberg committed Nov 10, 2017
1 parent a4c5c48 commit 5f4fa1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wc_lang/core.py
Expand Up @@ -964,7 +964,7 @@ def add_to_sbml_doc(self, sbml_document):
wrap_libsbml(sbml_compartment.setSize, self.initial_volume)
wrap_libsbml(sbml_compartment.setConstant, False)
if self.comments:
wrap_libsbml(sbml_compartment.appendNotes, str_to_xmlstr(self.comments))
wrap_libsbml(sbml_compartment.setNotes, self.comments, True)
return sbml_compartment


Expand Down Expand Up @@ -1175,7 +1175,7 @@ def add_to_sbml_doc(self, sbml_document):
# add some SpeciesType data
wrap_libsbml(sbml_species.setName, self.species_type.name)
if self.species_type.comments:
wrap_libsbml(sbml_species.appendNotes, str_to_xmlstr(self.species_type.comments))
wrap_libsbml(sbml_species.setNotes, self.species_type.comments, True)

# set Compartment, which must already be in the SBML document
wrap_libsbml(sbml_species.setCompartment, self.compartment.id)
Expand Down Expand Up @@ -1290,7 +1290,7 @@ def add_to_sbml_doc(self, sbml_document):
wrap_libsbml(sbml_reaction.setFast, False)
wrap_libsbml(sbml_reaction.setCompartment, self.submodel.compartment.id)
if self.comments:
wrap_libsbml(sbml_reaction.appendNotes, str_to_xmlstr(self.comments))
wrap_libsbml(sbml_reaction.setNotes, self.comments, True)

# write reaction participants to SBML document
for participant in self.participants:
Expand Down Expand Up @@ -1680,7 +1680,7 @@ def add_to_sbml_doc(self, sbml_document):
wrap_libsbml(sbml_reaction.setReversible, False)
wrap_libsbml(sbml_reaction.setFast, False)
if self.comments:
wrap_libsbml(sbml_reaction.appendNotes, str_to_xmlstr(self.comments))
wrap_libsbml(sbml_reaction.setNotes, self.comments, True)

# write biomass reaction participants to SBML document
for biomass_component in self.biomass_components:
Expand Down
2 changes: 2 additions & 0 deletions wc_lang/sbml/util.py
Expand Up @@ -206,9 +206,11 @@ def wrap_libsbml(method, *args, **kwargs):
returns_int = False
if 'returns_int' in kwargs:
returns_int = kwargs['returns_int']
del kwargs['returns_int']
debug = False
if 'debug' in kwargs:
debug = kwargs['debug']
del kwargs['debug']

# warn about unused kwargs
for k in kwargs.keys():
Expand Down

0 comments on commit 5f4fa1d

Please sign in to comment.