Skip to content

Commit dc19769

Browse files
author
Richard Boyce
committed
add predicate omopconceptid to active ingredient graph
1 parent 869d879 commit dc19769

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

linkedSPLs/LinkedSPLs-activeMoiety/createActiveMoietySubInRDF.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@
2929
DRUGBANK_BIO2RDF = "http://bio2rdf.org/drugbank:"
3030
NDFRT_BASE = "http://purl.bioontology.org/ontology/NDFRT/"
3131
DRON_BASE = "http://purl.obolibrary.org/obo/"
32-
#OHDSI_BASE = "http://purl.org/net/ohdsi#"
32+
OHDSI_BASE = "http://purl.org/net/ohdsi#"
3333

3434

3535
class DictItem:
3636

37-
def __init__(self, pt, db_uri1, db_uri2, rxcui, chebi, nui, dron, nameAndRole):
37+
def __init__(self, pt, db_uri1, db_uri2, rxcui, chebi, nui, dron, omopid, nameAndRole):
3838
self.pt = str(pt)
3939
self.db_uri1 = str(db_uri1)
4040
self.db_uri2 = str(db_uri2)
4141
self.rxcui = str(rxcui)
4242
self.chebi = str(chebi)
4343
self.dron = str(dron)
44+
self.omopid = str(omopid)
4445

4546
if nui and nameAndRole:
4647
self.drugClass = Set([str(nui)+'|'+str(nameAndRole)])
@@ -56,7 +57,7 @@ def __init__(self, pt, db_uri1, db_uri2, rxcui, chebi, nui, dron, nameAndRole):
5657
for item in data_set:
5758

5859
if item["unii"] not in dict_moieties:
59-
moiety = DictItem(item["pt"], item["db_uri1"], item["db_uri2"], item["rxcui"], item["chebi"], item["nui"], item["dron"] ,item["nameAndRole"])
60+
moiety = DictItem(item["pt"], item["db_uri1"], item["db_uri2"], item["rxcui"], item["chebi"], item["nui"], item["dron"], item["omopid"] ,item["nameAndRole"])
6061
dict_moieties[item["unii"]]=moiety
6162

6263
else:
@@ -72,7 +73,8 @@ def __init__(self, pt, db_uri1, db_uri2, rxcui, chebi, nui, dron, nameAndRole):
7273
dict_moieties[item["unii"]].dron = item["dron"]
7374
if not dict_moieties[item["unii"]].chebi:
7475
dict_moieties[item["unii"]].chebi = item["chebi"]
75-
#print item['nui']+'|'+item['nameAndRole']
76+
if not dict_moieties[item["unii"]].omopid:
77+
dict_moieties[item["unii"]].omopid = item["omopid"]
7678

7779
if item['nui'] and item['nameAndRole']:
7880
if dict_moieties[item["unii"]].drugClass:
@@ -159,8 +161,8 @@ def __init__(self, pt, db_uri1, db_uri2, rxcui, chebi, nui, dron, nameAndRole):
159161
if v.dron:
160162
graph.add((URIRef(ACTIVEMOIETY_BASE + str(k)), linkedspls_vocabulary["DrOnId"], URIRef(DRON_BASE + v.dron)))
161163

162-
# if v.omopid:
163-
# graph.add((URIRef(ACTIVEMOIETY_BASE + str(k)), linkedspls_vocabulary["OMOPConceptId"], Literal(OHDSI_BASE + str(int(float(v.omopid))))))
164+
if v.omopid:
165+
graph.add((URIRef(ACTIVEMOIETY_BASE + str(k)), linkedspls_vocabulary["OMOPConceptId"], Literal(OHDSI_BASE + str((v.omopid)))))
164166

165167

166168

0 commit comments

Comments
 (0)