Prints the annotation strings for each element in a given model.
47 def printAnnotation(sb, id=""):
48 if not sb.isSetAnnotation():
55 print(
"----- " + sb.getElementName() +
" (" + pid
56 +
") annotation -----" +
"\n")
57 print(sb.getAnnotationString() +
"\n")
62 """Usage: printAnnotation filename 72 errors = document.getNumErrors()
74 print(
"filename: " + filename +
"\n")
77 document.printErrors()
82 m = document.getModel()
85 for i
in range(0, m.getNumReactions()):
91 for j
in range(0, re.getNumReactants()):
92 rt = re.getReactant(j)
93 if rt.isSetAnnotation():
95 printAnnotation(rt, rt.getSpecies())
99 for j
in range(0, re.getNumProducts()):
100 rt = re.getProduct(j)
101 if rt.isSetAnnotation():
103 printAnnotation(rt, rt.getSpecies())
107 for j
in range(0, re.getNumModifiers()):
108 md = re.getModifier(j)
109 if md.isSetAnnotation():
111 printAnnotation(md, md.getSpecies())
115 if re.isSetKineticLaw():
116 kl = re.getKineticLaw()
117 if kl.isSetAnnotation():
122 for j
in range(0, kl.getNumParameters()):
123 pa = kl.getParameter(j)
124 if pa.isSetAnnotation():
129 for i
in range(0, m.getNumSpecies()):
134 for i
in range(0, m.getNumCompartments()):
135 sp = m.getCompartment(i)
139 for i
in range (0, m.getNumFunctionDefinitions()):
140 sp = m.getFunctionDefinition(i)
144 for i
in range (0, m.getNumUnitDefinitions()):
145 sp = m.getUnitDefinition(i)
149 for i
in range(0, m.getNumParameters()):
150 sp = m.getParameter(i)
154 for i
in range(0, m.getNumRules()):
159 for i
in range(0, m.getNumInitialAssignments()):
160 sp = m.getInitialAssignment(i)
164 for i
in range(0,m.getNumEvents()):
169 if sp.isSetTrigger():
171 if tg.isSetAnnotation():
178 if dl.isSetAnnotation():
183 for j
in range(0,sp.getNumEventAssignments()):
184 ea = sp.getEventAssignment(j)
185 if ea.isSetAnnotation():
190 for i
in range(0,m.getNumSpeciesTypes()):
191 sp = m.getSpeciesType(i)
195 for i
in range(0,m.getNumConstraints()):
196 sp = m.getConstraint(i)
202 if __name__ ==
'__main__':