Skip to content

Commit

Permalink
add primekg
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesamcl committed Jan 8, 2025
1 parent 4d087db commit 7c19443
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
5 changes: 5 additions & 0 deletions dataload/00_fetch_data/primekg/fetch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

curl -L https://dataverse.harvard.edu/api/access/datafile/6180620 > kg.csv


26 changes: 26 additions & 0 deletions dataload/01_ingest/primekg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

import pandas
import sys
import json

df = pandas.read_csv(sys.stdin, dtype=str)

for row in df.to_dict(orient="records"):

x_id = row['x_source'] + ':' + row['x_id']
y_id = row['y_source'] + ':' + row['y_id']

res = {
'id': x_id,
'grebi:name': row['x_name']
}

res["primekg:" + row['relation']] = {
'grebi:value': y_id,
'grebi:properties': {f"primekg:{key}": value for key, value in row.items()}
}

print(json.dumps(res))



6 changes: 6 additions & 0 deletions dataload/configs/datasource_configs/primekg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: PrimeKG
enabled: true
ingests:
- globs: ["./00_fetch_data/primekg/kg.csv"]
command: $GREBI_DATALOAD_HOME/01_ingest/primekg.py

6 changes: 4 additions & 2 deletions dataload/configs/subgraph_configs/ebi_monarch.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"mondo:0000001",
"efo:0000408",
"chebi:36080",
"chebi:24431"
"chebi:24431",
"biolink:ChemicalEntity"
],
"additional_equivalence_groups": [
[
Expand Down Expand Up @@ -167,6 +168,7 @@
"./configs/datasource_configs/robokop_string.yaml",
"./configs/datasource_configs/robokop_textmining.yaml",
"./configs/datasource_configs/robokop_viralproteome.yaml",
"./configs/datasource_configs/mesh.yaml"
"./configs/datasource_configs/mesh.yaml",
"./configs/datasource_configs/primekg.yaml"
]
}
6 changes: 4 additions & 2 deletions dataload/configs/subgraph_configs/ebi_monarch_xspecies.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"mondo:0000001",
"efo:0000408",
"chebi:36080",
"chebi:24431"
"chebi:24431",
"biolink:ChemicalEntity"
],
"additional_equivalence_groups": [
[
Expand Down Expand Up @@ -168,6 +169,7 @@
"./configs/datasource_configs/robokop_string.yaml",
"./configs/datasource_configs/robokop_textmining.yaml",
"./configs/datasource_configs/robokop_viralproteome.yaml",
"./configs/datasource_configs/mesh.yaml"
"./configs/datasource_configs/mesh.yaml",
"./configs/datasource_configs/primekg.yaml"
]
}
3 changes: 2 additions & 1 deletion dataload/configs/subgraph_configs/src/ebi_monarch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"./configs/datasource_configs/robokop_string.yaml",
"./configs/datasource_configs/robokop_textmining.yaml",
"./configs/datasource_configs/robokop_viralproteome.yaml",
"./configs/datasource_configs/mesh.yaml"
"./configs/datasource_configs/mesh.yaml",
"./configs/datasource_configs/primekg.yaml"
]

if __name__ == '__main__':
Expand Down

0 comments on commit 7c19443

Please sign in to comment.