def create_graph(self):
self.g.open(self.path + mirbasegraph_name, create=True)
data = self.parse_mirbase(self.path)
#g = ConjunctiveGraph(store="SPARQLUpdateStore")
# g.bind()
mirna_class = URIRef("http://purl.obolibrary.org/obo/SO_0000276")
for mid in data:
mirna_instance = URIRef(MIRBASE + data[mid]["acc"])
self.g.add((mirna_instance, RDF.type, mirna_class))
label = Literal(data[mid]["name"])
self.g.add((mirna_instance, RDFS.label, label))
description = Literal(data[mid]["description"])
self.g.add((mirna_instance, RDFS.comment, description))
for p in data[mid]["previous_names"]:
if p.strip():
previous_name = Literal(p)
self.g.add((mirna_instance, MIRBASE["previous_acc"], previous_name))
for mature in data[mid]["mature"]:
mature_instance = URIRef(MIRBASE + data[mid]["mature"][mature]["acc"])
self.g.add((mature_instance, RDF.type, mirna_class))
mature_label = Literal(data[mid]["mature"][mature]["name"])
self.g.add((mature_instance, RDFS.label, mature_label))
for mature_p in data[mid]["mature"][mature]["previous_names"]:
if mature_p.strip():
mature_previous_name = Literal(mature_p)
self.g.add((mature_instance, MIRBASE["previous_acc"], mature_previous_name))
self.g.add((mirna_instance, MIRBASE["stemloopOf"], mature_instance))
self.get_label_to_acc()
self.choices = self.labels.keys()
goa_data = self.parse_goa_gaf("data/goa_human_rna.gaf")
for label in self.labels:
if label in goa_data:
for go_id in goa_data[label]:
mirna_instance = self.labels[label]
self.g.add((mirna_instance, MIRBASE["goa"], Literal(go_id)))
评论列表
文章目录