Skip to content

Commit f52fc51

Browse files
committed
revise README for clinical drug and active ingredient graph
1 parent 7c85f30 commit f52fc51

File tree

7 files changed

+551
-119
lines changed

7 files changed

+551
-119
lines changed

linkedSPLs/LinkedSPLs-activeMoiety/README

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,64 @@ OVERVIEW
44

55
This folder will hold a graph that maps the active moiety components of an SPL to other drug resources
66

7-
Inputs are original mappings listed as belows:
8-
9-
(1) PT to UNII
10-
(2) UNII to RxNORM
11-
(3) PT to Drugbank
12-
(4) PT to ChEBI
13-
(5) RxNORM to OMOP
14-
(6) RxNORM to DrOn
15-
(7) RxNORM to NDFRT (EPC)
16-
177
Outputs is a RDF/XML graph that represents all active moiety with linked resouces.
188

199

2010
################################################################################
21-
Procedures to get active moieties RDF graph
11+
PRE-CONDITIONS:
2212
################################################################################
2313

24-
<1>: query to get omopid mapping and put in mapping folder
14+
------------------------------------------------------------------------
15+
python libraries:
16+
------------------------------------------------------------------------
17+
18+
(1) Bio from "http://biopython.org/wiki/Download"
19+
(2) rdflib
20+
(3) rdflib#jsonld from "https://github.com/RDFLib/rdflib-jsonld"
21+
(4) pandas
22+
23+
------------------------------------------------------------------------
24+
Mappings from linkedSPLs core update
25+
------------------------------------------------------------------------
26+
27+
Please ensure following mappings are available at specified path. They are should be automatically generated when core graph updated (refers to LinkedSPLs-update/README)
2528

26-
mappings/active-ingredient-omopid-rxcui.dsv
29+
(1) PT (preferred term) to UNII: LinkedSPLs-update/data/FDA/FDAPreferredSubstanceToUNII.txt
30+
(2) UNII to RxNORM: LinkedSPLs-update/data/UMLS/UNIIs-Rxcuis-from-UMLS.txt
31+
(3) PT to Drugbank: LinkedSPLs-update/mappings/ChEBI-DrugBank-bio2rdf-mapping/fda-substance-preferred-name-to-drugbank.txt
32+
(4) PT to ChEBI: LinkedSPLs-update/mappings/PT-UNII-ChEBI-mapping/UNIIToChEBI.txt
33+
(5) RxNORM to DrOn: LinkedSPLs-update/mappings/DrOn-to-RxNorm/cleaned-dron-chebi-rxcui-ingredient.txt
34+
(6) RxNORM to NDFRT (EPC): LinkedSPLs-update/mappings/pharmacologic_class_indexing/EPC_extraction_most_recent.txt
35+
36+
(7) OMOP concept Id from OHDSI or query OMOP CDM V5 (GeriOMOP) by SQL query
2737

28-
2938
query OMOP CDM V5 (GeriOMOP) by SQL query below:
3039
SELECT cpt.CONCEPT_ID as omopid, cpt.CONCEPT_CODE as rxcui FROM
3140
CONCEPT cpt
3241
WHERE
3342
cpt.CONCEPT_CLASS = 'Ingredient';
3443

35-
09/04/2015: 17049 results
36-
3744
right click result table and export to csv ('|' delimited)
45+
save name as: active-ingredient-omopid-rxcui-<DATE>.dsv
46+
to dir: LinkedSPLs-activeMoiety/mappings/active-ingredient-omopid-rxcui.dsv
3847

48+
01/18/2017: 17049 results
3949

40-
<STEP 2>: run python script to merge those mappings together
50+
################################################################################
51+
Procedures to get active moieties RDF graph
52+
################################################################################
53+
54+
(1) run python script to merge those mappings together
4155

4256
$ python mergeToActiveMoiety.py
4357

4458
outputs: mergedActiveMoiety.csv contains all joined mappings
4559

4660
columns: pt, unii, db_uri1, db_uri2, rxcui, omopid, chebi, dron, nui, nameAndRole
4761

48-
<STEP 3>: run python script to create RDF graph for all active moieties
62+
(2) run python script to create RDF graph for all active moieties
4963

5064
$ python createActiveMoietySubInRDF.py
5165

5266
outputs: activeMoietySub-in-rdf.xml
5367

54-
55-
################################################################################
56-
PRE-REQUISITES:
57-
################################################################################
58-
59-
python libraries:
60-
61-
(1) Bio
62-
from "http://biopython.org/wiki/Download"
63-
64-
(2) rdflib
65-
66-
(3) rdflib#jsonld
67-
from "https://github.com/RDFLib/rdflib-jsonld"
68-
69-
(4) pandas
70-

linkedSPLs/LinkedSPLs-clinicalDrug/README

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,58 @@
1-
Merge clinical drug mapping to create clinical drug RDF graph. Each clinical drug entity include attributes FDA preferred name, Rxcui, DrOn Id, OMOP concept Id.
2-
3-
#############################################################
4-
update clinical drug entity graph
5-
#############################################################
1+
################################################################################
2+
OVERVIEW
3+
################################################################################
64

7-
<STEP1> update clinical drug mappings
5+
Merge clinical drug mapping to create clinical drug RDF graph. Each clinical drug entity include attributes FDA preferred name, Rxcui, DrOn Id, OMOP concept Id.
86

9-
mappings folder keep all orginal mappings from linkedSPLs
7+
################################################################################
8+
PRE-CONDITIONS:
9+
################################################################################
1010

11-
----------------------------------------------------------
12-
mappings of omopid and rxcui
13-
----------------------------------------------------------
14-
OMOP concept Id and Rxcui mapping download from "https://github.com/OHDSI/KnowledgeBase/tree/master/LAERTES/terminology-mappings/StandardVocabToRxNorm/imeds_drugids_to_rxcuis.csv"
11+
------------------------------------------------------------------------
12+
Mappings from linkedSPLs core update
13+
------------------------------------------------------------------------
1514

16-
OR
15+
(1) Dron to rxcui: linkedSPLs/LinkedSPLs-update/mappings/DrOn-to-RxNorm/cleaned-dron-to-rxcui-drug-<DATE>.txt
1716

18-
query OMOP CDM V5 (GeriOMOP) by SQL query below:
17+
(2) Dailymed setid and rxcui: LinkedSPLs-update/mappings/RxNORM-mapping/converted_rxnorm_mappings_<DATE>.txt converted_rxnorm_mappings.txt
1918

20-
SELECT cpt.CONCEPT_ID as omopid, cpt.CONCEPT_CODE as rxcui FROM
21-
CONCEPT cpt
22-
WHERE
23-
cpt.CONCEPT_CLASS = 'Clinical Drug';
24-
25-
09/04/2015: 120561 results
26-
27-
right click result table and export to csv ('|' delimited)
28-
29-
----------------------------------------------------------
30-
cleaned-dron-to-rxcui-drug-<DATE>.txt
31-
----------------------------------------------------------
32-
mappings of DrOn Id and Rxcui available from "linkedSPLs/LinkedSPLs-update/mappings/DrOn-to-RxNorm/cleaned-dron-to-rxcui-drug-<DATE>.txt"
19+
$ cat converted_rxnorm_mappings.txt | cut -f1,2 -d\| | sort | uniq > setid_rxcui.txt
3320

34-
----------------------------------------------------------
35-
converted_rxnorm_mappings_<DATE>.txt
36-
----------------------------------------------------------
21+
(3) Dailymed setid and drug fullname
3722

38-
Dailymed product label indexing mapping from "linkedSPLs/LinkedSPLs-update/mappings/RxNORM-mapping/converted_rxnorm_mappings_<DATE>"
23+
$ mysql -u <username> -p
24+
$ use linkedSPLs;
3925

40-
$ cd mappings
26+
SELECT setId, fullName FROM linkedSPLs.structuredProductLabelMetadata INTO OUTFILE '/tmp/setid_fullname.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
4127

42-
$ cp ../../LinkedSPLs-update/mappings/RxNORM-mapping/converted_rxnorm_mappings_10132015.txt converted_rxnorm_mappings.txt
28+
$ cp /tmp/setid_fullname.txt ../linkedSPLs/LinkedSPLs-clinicalDrug/mappings/
4329

44-
$ cat converted_rxnorm_mappings.txt | cut -f1,2 -d\| | sort | uniq > setid_rxcui.txt
30+
(4) mappings of omopid and rxcui
4531

46-
----------------------------------------------------------
47-
mappings of FDA preferred term and setId
48-
----------------------------------------------------------
32+
query OMOP CDM V5 (GeriOMOP) by SQL query below:
4933

50-
$ mysql -u <username> -p
34+
SELECT cpt.CONCEPT_ID as omopid, cpt.CONCEPT_CODE as rxcui FROM
35+
CONCEPT cpt
36+
WHERE
37+
cpt.CONCEPT_CLASS = 'Clinical Drug';
5138

52-
$ use linkedSPLs;
39+
01/18/2017: 120561 results
5340

54-
SELECT setId, fullName FROM linkedSPLs.structuredProductLabelMetadata INTO OUTFILE '/tmp/setid_fullname.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
41+
right click result table and export to delimited ('|' delimited, none Left or Right Enclosure)
42+
save name as: clinical-drug-omopid-rxcui-<DATE>.dsv
43+
to dir: LinkedSPLs-clinicalDrug/mappings/
5544

56-
$ cp /tmp/setid_fullname.txt ../linkedSPLs/LinkedSPLs-clinicalDrug/mappings/
45+
################################################################################
46+
Procedures to get clinical drug RDF graph
47+
################################################################################
5748

58-
<STEP 2> merge clinical drug mappings
49+
(1) merge clinical drug mappings
5950

6051
$ python mergeToClinicalDrug.py
6152

6253
output: mergedClinicalDrug.tsv
6354

64-
<STEP 3> create clinical drug entity graph
55+
(2) create clinical drug entity graph
6556

6657
$ python createClinicalDrugSubInRDF.py
6758

linkedSPLs/LinkedSPLs-clinicalDrug/mergeToClinicalDrug.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020
DRON_RXCUI = "../LinkedSPLs-update/mappings/DrOn-to-RxNorm/cleaned-dron-to-rxcui-drug.txt"
2121
SETID_RXCUI = "mappings/setid_rxcui.txt"
2222
FULLNAME_SETID = "mappings/setid_fullname.txt"
23-
24-
#OMOP_RXCUI = "mappings/imeds_drugids_to_rxcuis.csv"
2523
OMOP_RXCUI = "mappings/clinical-drug-omopid-rxcui.dsv"
2624

27-
28-
2925
## read mappings of dron and rxcui
3026

3127
dron_rxcui_cols = ['dron', 'chebi', 'rxcui']

linkedSPLs/LinkedSPLs-core/linkedSPLs_dump_rdf_config.n3

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@
3838
map:database a d2rq:Database;
3939
d2rq:jdbcDriver "com.mysql.jdbc.Driver";
4040

41-
#d2rq:jdbcDSN "jdbc:mysql://136.142.148.191/linkedSPLs?autoReconnect=true&user=root&password=";
41+
d2rq:jdbcDSN "jdbc:mysql://localhost/linkedSPLs";
42+
d2rq:jdbcDriver "com.mysql.jdbc.Driver";
43+
d2rq:username "root";
44+
d2rq:password "";
45+
.
4246

4347
# d2rq:resultSizeLimit 500;
4448
# d2rq:fetchSize 500;
45-
.
49+
#.
4650

4751
map:DrugsRdfTypeBridge a d2rq:PropertyBridge;
4852
d2rq:belongsToClassMap map:structuredProductLabelMetadata;

linkedSPLs/LinkedSPLs-update/README

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Authors: Richard Boyce, Greg Gardner, Yifan Ning
33

44
Last updated Date: 01/18/2017
55

6-
76
################################################################################
87
OVERVIEW
98
################################################################################
@@ -197,6 +196,7 @@ CONCEPT cpt
197196
WHERE
198197
cpt.CONCEPT_CLASS = 'Ingredient';
199198

199+
right click result table and export to delimited ('|' delimited, none Left or Right Enclosure)
200200
save name as: active-ingredient-omopid-rxcui-<DATE>.dsv
201201
to dir: LinkedSPLs-activeMoiety/mappings/
202202

@@ -261,36 +261,4 @@ Updating the public D2R webpage to communicate changes to the sample LinkedSPLs
261261
On the public server:
262262
cd Downloads/d2rq-0.8.1/webapp/WEB-INF/templates
263263

264-
...Then edit the root_page.vm file
265-
266-
------------------------------------------------------------
267-
CREATING AN RDF DUMP OF THE DATA IN THE D2R SERVER
268-
------------------------------------------------------------
269-
270-
$ cd <d2r server for linkedSPLs>
271-
$ ./dump-rdf -m <path to mapping file> -o linkedSPLs-dump.nt
272-
273-
---------------------------------------------------------------------------------------
274-
LOADING AN RDF DUMP OF THE DATA INTO VIRTUOSO (tested with OpenLink Virtuoso in Ubuntu)
275-
---------------------------------------------------------------------------------------
276-
277-
Initial load:
278-
$ isql-vt
279-
SQL> ld_dir ('/path/to/files', '*.n3', 'http://dbpedia.org');
280-
SQL> rdf_loader_run();
281-
SQL> select * from DB.DBA.load_list;
282-
283-
Reloading (DELETE THE OLD GRAPH FIRST from Virtuoso composer!):
284-
$ isql-vt
285-
SQL> log_enable(3,1); # see http://www.openlinksw.com/dataspace/dav/wiki/Main/VirtTipsAndTricksGuideDeleteLargeGraphs
286-
SQL> SPARQL CLEAR GRAPH <http://dbmi-icode-01.dbmi.pitt.edu/linkedSPLs/>;
287-
SQL> update DB.DBA.load_list set ll_state = 0 where ll_file = '<name of RDF file>';
288-
SQL> rdf_loader_run();
289-
SQL> select * from DB.DBA.load_list;
290-
291-
Graph list:
292-
http://purl.org/net/nlprepository/spl-core
293-
http://purl.org/net/nlprepository/spl-active-moiety
294-
http://purl.org/net/nlprepository/spl-clinical-drug
295-
296-
- The D2R file has the mapping from RDB tables to RDF: ../LinkedSPLs-core/linkedSPLs_dump_rdf_config.n3
264+
...Then edit the root_page.vm file

0 commit comments

Comments
 (0)