Skip to content

Commit

Permalink
Merge pull request #184 from bgyori/pysb_flat_annotations
Browse files Browse the repository at this point in the history
Print model annotations and suppress extra newlines in pysb_flat export
  • Loading branch information
jmuhlich committed Dec 8, 2015
2 parents 21c8ae7 + 93fb45d commit 15fac0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pysb/export/pysb_flat.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ def export(self):
output = StringIO()

# Convenience function for writing out a componentset.
def write_cset(cset):
def write_cset(cset):
for c in cset:
output.write(repr(c))
output.write("\n")
output.write("\n")
if cset:
output.write("\n")

if self.docstring:
output.write('"""')
Expand All @@ -61,7 +62,8 @@ def write_cset(cset):
output.write("# exported from PySB model '%s'\n" % self.model.name)
output.write("\n")
output.write("from pysb import Model, Monomer, Parameter, Expression, "
"Compartment, Rule, Observable, Initial, ANY, WILD\n")
"Compartment, Rule, Observable, Initial, Annotation, "
"ANY, WILD\n")
output.write("\n")
output.write("Model()\n")
output.write("\n")
Expand All @@ -75,5 +77,6 @@ def write_cset(cset):
for pattern, value in self.model.initial_conditions:
output.write("Initial(%s, %s)\n" % (repr(pattern), value.name))
output.write("\n")
write_cset(self.model.annotations)

return output.getvalue()

0 comments on commit 15fac0c

Please sign in to comment.