Adds evidence codes to a species in a model.
46 """usage: addingEvidenceCodes_2 <input-filename> <output-filename> 47 Adds controlled vocabulary term to a species 54 errors = d.getNumErrors()
57 print(
"Read Error(s):\n")
60 print(
"Correct the above and re-run.\n")
62 n = d.getModel().getNumSpecies()
64 print(
"Model has no species.\n Cannot add CV terms\n")
66 s = d.getModel().getSpecies(0)
71 if not s.isSetMetaId():
72 s.setMetaId(
"metaid_0000052")
74 cv1 = CVTerm(BIOLOGICAL_QUALIFIER)
75 cv1.setBiologicalQualifierType(BQB_OCCURS_IN)
76 cv1.addResource(
"urn:miriam:obo.go:GO%3A0005764")
95 blank_att = XMLAttributes()
97 resource_att = XMLAttributes()
100 statement_triple = XMLTriple(
"Statement",
101 "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
104 statement_token = XMLToken(statement_triple, blank_att)
106 statement = XMLNode(statement_token)
109 subject_triple = XMLTriple(
"subject",
110 "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
114 resource_att.add(
"rdf:resource",
"#" + s.getMetaId())
116 subject_token = XMLToken(subject_triple, resource_att)
118 subject = XMLNode(subject_token)
121 predicate_triple = XMLTriple(
"predicate",
122 "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
126 resource_att.add(
"rdf:resource",
127 "http://biomodels.net/biology-qualifiers/occursIn")
129 predicate_token = XMLToken(predicate_triple, resource_att)
131 predicate = XMLNode(predicate_token)
134 object_triple = XMLTriple(
"object",
135 "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
139 resource_att.add(
"rdf:resource",
"urn:miriam:obo.go:GO%3A0005764")
141 object_token = XMLToken(object_triple, resource_att)
143 object_ = XMLNode(object_token)
146 bqbiol_triple = XMLTriple(
"isDescribedBy",
147 "http://biomodels.net/biology-qualifiers/",
150 bqbiol_token = XMLToken(bqbiol_triple, blank_att)
152 bqbiol = XMLNode(bqbiol_token)
155 bag_triple = XMLTriple(
"Bag",
156 "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
159 bag_token = XMLToken(bag_triple, blank_att)
161 bag = XMLNode(bag_token)
164 li_triple = XMLTriple(
"li",
165 "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
169 resource_att.add(
"rdf:resource",
"urn:miriam:obo.eco:ECO%3A0000004")
171 li_token = XMLToken(li_triple, resource_att)
174 li = XMLNode(li_token)
179 resource_att.add(
"rdf:resource",
"urn:miriam:pubmed:7017716")
180 li_token = XMLToken(li_triple, resource_att)
182 li = XMLNode(li_token)
190 statement.addChild(subject)
191 statement.addChild(predicate)
192 statement.addChild(object_)
193 statement.addChild(bqbiol)
199 xmlns = XMLNamespaces()
200 xmlns.add(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdf")
201 xmlns.add(
"http://purl.org/dc/elements/1.1/",
"dc")
202 xmlns.add(
"http://purl.org/dc/terms/",
"dcterms")
203 xmlns.add(
"http://www.w3.org/2001/vcard-rdf/3.0#",
"vCard")
204 xmlns.add(
"http://biomodels.net/biology-qualifiers/",
"bqbiol")
205 xmlns.add(
"http://biomodels.net/model-qualifiers/",
"bqmodel")
207 RDF_triple = XMLTriple(
"RDF",
208 "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
211 RDF_token = XMLToken(RDF_triple, blank_att, xmlns)
213 annotation = XMLNode(RDF_token)
216 annotation.addChild(statement)
218 s.appendAnnotation(annotation)
225 if __name__ ==
'__main__':