Prints the rule, reaction, and event formulas in a given SBML document.
49 def printFunctionDefinition(n, fd):
51 print(
"FunctionDefinition " + str(n) +
", " + fd.getId())
56 if math.getNumChildren() > 1:
57 print(
"(" + (math.getLeftChild()).getName())
59 for n
in range (1, math.getNumChildren()):
60 print(
", " + (math.getChild(n)).getName())
65 if math.getNumChildren() == 0:
66 print(
"(no body defined)")
68 math = math.getChild(math.getNumChildren() - 1)
73 def printRuleMath(n, r):
77 if len(r.getVariable()) > 0:
78 print(
"Rule " + str(n) +
", formula: " 79 + r.getVariable() +
" = " + formula +
"\n")
81 print(
"Rule " + str(n) +
", formula: " 82 + formula +
" = 0" +
"\n")
85 def printReactionMath(n, r):
86 if r.isSetKineticLaw():
87 kl = r.getKineticLaw()
90 print(
"Reaction " + str(n) +
", formula: " + formula +
"\n")
93 def printEventAssignmentMath(n, ea):
95 variable = ea.getVariable()
97 print(
" EventAssignment " + str(n)
98 +
", trigger: " + variable +
" = " + formula +
"\n")
101 def printEventMath(n, e):
104 print(
"Event " + str(n) +
" delay: " + formula +
"\n")
108 print(
"Event " + str(n) +
" trigger: " + formula +
"\n")
110 for i
in range(0,e.getNumEventAssignments()):
111 printEventAssignmentMath(i + 1, e.getEventAssignment(i))
117 for n
in range(0,m.getNumFunctionDefinitions()):
118 printFunctionDefinition(n + 1, m.getFunctionDefinition(n))
120 for n
in range(0,m.getNumRules()):
121 printRuleMath(n + 1, m.getRule(n))
124 for n
in range(0, m.getNumReactions()):
125 printReactionMath(n + 1, m.getReaction(n))
128 for n
in range(0,m.getNumEvents()):
129 printEventMath(n + 1, m.getEvent(n))
133 """Usage: printMath filename 136 print(
"\n" +
"Usage: printMath filename" +
"\n" +
"\n")
142 if document.getNumErrors() > 0:
143 print(
"Encountered the following SBML errors:" +
"\n")
144 document.printErrors()
147 model = document.getModel()
150 print(
"No model present." +
"\n")
158 if __name__ ==
'__main__':