EpiGraphDB API endpoints

1
2
3
4
5
6
from environs import Env
env = Env()
env.read_env()

EPIGRAPHDB_API_URL = env.str("EPIGRAPHDB_API_URL", "http://api.epigraphdb.org")
print(EPIGRAPHDB_API_URL)
1
## http://localhost:28046

Topic endpoints

/mr

1
2
3
4
  Return information related to Mendelian randomisation
  
  Specify at least one of `exposure_trait` and `outcome_trait`
  or both.

Params

1
2
3
{'exposure_trait': typing.Union[str, NoneType],
 'outcome_trait': typing.Union[str, NoneType],
 'pval_threshold': <class 'float'>}

1. Query for exposure trait

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/mr'
params = {'exposure_trait': 'Body mass index'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{'metadata': {'empty_results': False,
              'query': 'MATCH (exposure:Gwas)-[mr:MR]->(outcome:Gwas) WHERE '
                       'exposure.trait = "Body mass index" AND mr.pval < 1e-05 '
                       'RETURN exposure {.id, .trait}, outcome {.id, .trait}, '
                       'mr {.b, .se, .pval, .method, .selection, .moescore} '
                       'ORDER BY mr.pval ;',
              'total_seconds': 0.143854},
 'results': [{'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'mr': {'b': 0.034558869898319244,
                     'method': 'FE IVW',
                     'moescore': 0.9300000071525574,
                     'pval': 0.0,
                     'se': 0.002418252406641841,
                     'selection': 'DF'},
              'outcome': {'id': 'ukb-a-74',
                          'trait': 'Non-cancer illness code  self-reported: '
                                   'diabetes'}},
             {'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'mr': {'b': 0.7241045236587524,
                     'method': 'Simple median',
                     'moescore': 0.949999988079071,
                     'pval': 0.0,
                     'se': 0.02658814564347267,
                     'selection': 'Tophits'},
              'outcome': {'id': 'ukb-a-388', 'trait': 'Hip circumference'}},
             {'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'mr': {'b': 0.6564403176307678,
                     'method': 'Simple median',
                     'moescore': 0.9399999976158142,
                     'pval': 0.0,
                     'se': 0.024495629593729973,
                     'selection': 'Tophits'},
              'outcome': {'id': 'ukb-a-382', 'trait': 'Waist circumference'}},
             {'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'mr': {'b': 0.1366840898990631,
                     'method': 'FE IVW',
                     'moescore': 0.9399999976158142,
                     'pval': 0.0,
                     'se': 0.007909317500889301,
                     'selection': 'Tophits'},
              'outcome': {'id': 'ukb-a-35',
                          'trait': 'Comparative height size at age 10'}},
             {'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'mr': {'b': 0.3655795753002167,

2. Query for outcome trait

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/mr'
params = {'outcome_trait': 'Body mass index'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{'metadata': {'empty_results': False,
              'query': 'MATCH (exposure:Gwas)-[mr:MR]->(outcome:Gwas) WHERE '
                       'outcome.trait = "Body mass index" AND mr.pval < 1e-05 '
                       'RETURN exposure {.id, .trait}, outcome {.id, .trait}, '
                       'mr {.b, .se, .pval, .method, .selection, .moescore} '
                       'ORDER BY mr.pval ;',
              'total_seconds': 0.04706},
 'results': [{'exposure': {'id': 'ieu-a-971', 'trait': 'Ulcerative colitis'},
              'mr': {'b': -0.011570010334253311,
                     'method': 'FE IVW',
                     'moescore': 1.0,
                     'pval': 0.0,
                     'se': 0.000540608714800328,
                     'selection': 'DF'},
              'outcome': {'id': 'ieu-a-2', 'trait': 'Body mass index'}},
             {'exposure': {'id': 'ukb-a-344',
                           'trait': 'Difficulty not smoking for 1 day'},
              'mr': {'b': -0.12298495322465897,
                     'method': 'FE IVW',
                     'moescore': 1.0,
                     'pval': 0.0,
                     'se': 0.007653127424418926,
                     'selection': 'DF'},
              'outcome': {'id': 'ieu-a-2', 'trait': 'Body mass index'}},
             {'exposure': {'id': 'ieu-a-50', 'trait': 'Hip circumference'},
              'mr': {'b': 0.5895484089851379,
                     'method': 'FE IVW',
                     'moescore': 0.75,
                     'pval': 0.0,
                     'se': 0.03496060520410538,
                     'selection': 'DF'},
              'outcome': {'id': 'ieu-a-2', 'trait': 'Body mass index'}},
             {'exposure': {'id': 'ieu-a-90', 'trait': 'Obesity class 1'},
              'mr': {'b': 0.3400000035762787,
                     'method': 'Simple median',
                     'moescore': 0.800000011920929,
                     'pval': 0.0,
                     'se': 0.020444128662347794,
                     'selection': 'HF'},
              'outcome': {'id': 'ieu-a-2', 'trait': 'Body mass index'}},
             {'exposure': {'id': 'ieu-a-91', 'trait': 'Obesity class 2'},
              'mr': {'b': 0.2586517333984375,
                     'method': 'Penalised median',
                     'moescore': 0.8100000023841858,
                     'pval': 0.0,
                     'se': 0.016835452988

3. Query for both exposure and outcome

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/mr'
params = {'expsoure_trait': 'Body mass index', 'outcome_trait': 'Coronary heart disease'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{'metadata': {'empty_results': False,
              'query': 'MATCH (exposure:Gwas)-[mr:MR]->(outcome:Gwas) WHERE '
                       'outcome.trait = "Coronary heart disease" AND mr.pval < '
                       '1e-05 RETURN exposure {.id, .trait}, outcome {.id, '
                       '.trait}, mr {.b, .se, .pval, .method, .selection, '
                       '.moescore} ORDER BY mr.pval ;',
              'total_seconds': 0.02865},
 'results': [{'exposure': {'id': 'ieu-a-798', 'trait': 'Myocardial infarction'},
              'mr': {'b': 0.9747568964958191,
                     'method': 'Simple median',
                     'moescore': 0.8100000023841858,
                     'pval': 0.0,
                     'se': 0.06110995635390282,
                     'selection': 'Tophits'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'}},
             {'exposure': {'id': 'ukb-a-201',
                           'trait': 'Illnesses of father: Heart disease'},
              'mr': {'b': 8.245482444763184,
                     'method': 'FE IVW',
                     'moescore': 0.8600000143051147,
                     'pval': 0.0,
                     'se': 0.4599825441837311,
                     'selection': 'Tophits'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'}},
             {'exposure': {'id': 'ukb-a-20',
                           'trait': 'Exposure to tobacco smoke outside home'},
              'mr': {'b': 0.5509055256843567,
                     'method': 'FE IVW',
                     'moescore': 1.0,
                     'pval': 0.0,
                     'se': 0.008674023672938347,
                     'selection': 'DF'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'}},
             {'exposure': {'id': 'ieu-a-102', 'trait': 'Waist circumference'},
              'mr': {'b': 0.36000630259513855,
                     'method': 'FE IVW',
                     'moescore': 1.0,
                     'pval': 0.0,
                     'se': 0.009527594782412052,
                     'selection': 'DF'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'}},
             {'exposure': {'id': 'ieu-a-1079', 'trait': 'Zinc'},
              'mr': {'b': 0.060035590082407,
                     'method': 'FE IVW',
                     'moescore': 1.0,

/obs-cor

1
2
3
4
5
  Returns observational correlates for a trait.
  
  Args:
  - `trait`: A trait name, e.g. "body mass index"
  - `cor_coef_threshold`: Coefficient correlation threshold

Params

1
{'cor_coef_threshold': <class 'float'>, 'trait': <class 'str'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/obs-cor'
params = {'trait': 'Waist circumference'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       '(trait:Gwas)-[obs_cor:OBS_COR]-(assoc_trait:Gwas) '
                       'WHERE trait.trait = "Waist circumference" AND '
                       'abs(obs_cor.cor) > 0.8 RETURN trait {.id, .trait}, '
                       'assoc_trait {.id, .trait}, obs_cor {.cor} ORDER BY '
                       'obs_cor.cor DESC ;',
              'total_seconds': 0.002679},
 'results': [{'assoc_trait': {'id': 'ukb-b-11842', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8785216212272644},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-11842', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8785216212272644},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-12039', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8713608980178833},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-12039', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8713608980178833},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-19953',
                              'trait': 'Body mass index (BMI)'},
              'obs_cor': {'cor': 0.802693247795105},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-19953',
                              'trait': 'Body mass index (BMI)'},
              'obs_cor': {'cor': 0.802693247795105},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}}]}

2. Adjust for correlation coefficient

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/obs-cor'
params = {'trait': 'Waist circumference', 'cor_coef_threshold': 0.2}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       '(trait:Gwas)-[obs_cor:OBS_COR]-(assoc_trait:Gwas) '
                       'WHERE trait.trait = "Waist circumference" AND '
                       'abs(obs_cor.cor) > 0.2 RETURN trait {.id, .trait}, '
                       'assoc_trait {.id, .trait}, obs_cor {.cor} ORDER BY '
                       'obs_cor.cor DESC ;',
              'total_seconds': 0.008024},
 'results': [{'assoc_trait': {'id': 'ukb-b-11842', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8785216212272644},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-11842', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8785216212272644},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-12039', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8713608980178833},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-12039', 'trait': 'Weight'},
              'obs_cor': {'cor': 0.8713608980178833},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-19953',
                              'trait': 'Body mass index (BMI)'},
              'obs_cor': {'cor': 0.802693247795105},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-19953',
                              'trait': 'Body mass index (BMI)'},
              'obs_cor': {'cor': 0.802693247795105},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-2303',
                              'trait': 'Body mass index (BMI)'},
              'obs_cor': {'cor': 0.7957093119621277},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-2303',
                              'trait': 'Body mass index (BMI)'},
              'obs_cor': {'cor': 0.7957093119621277},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-20044', 'trait': 'Trunk fat mass'},
              'obs_cor': {'cor': 0.7381030917167664},

/genetic-cor

1
2
3
4
5
6
  Returns genetic correlates for a trait.
  
  Args:
  
  - `trait`: A trait name, e.g. Whole body fat mass
  - `cor_coef_threshold`: correlation coefficient threshold

Params

1
{'cor_coef_threshold': <class 'float'>, 'trait': <class 'str'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/genetic-cor'
params = {'trait': 'Waist circumference'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{'metadata': {'empty_results': False,
              'query': 'MATCH (trait:Gwas)-[gc:BN_GEN_COR]-(assoc_trait:Gwas) '
                       'WHERE trait.trait = "Waist circumference" AND '
                       'abs(gc.rg) > 0.8 RETURN trait {.id, .trait}, '
                       'assoc_trait {.id, .trait}, gc { .rg, .z, .se, .p, '
                       '.h2_int, .h2_int_se, .h2_obs, .h2_obs_se, .gcov_int, '
                       '.gcov_int_se } ORDER BY gc.rg DESC ;',
              'total_seconds': 0.01281},
 'results': [{'assoc_trait': {'id': 'ukb-b-8338',
                              'trait': 'Arm fat mass (left)'},
              'gc': {'gcov_int': 0.9110999703407288,
                     'gcov_int_se': 0.016610000282526016,
                     'h2_int': 1.0549999475479126,
                     'h2_int_se': 0.01720000058412552,
                     'h2_obs': 0.2029999941587448,
                     'h2_obs_se': 0.006928000133484602,
                     'p': 0.0,
                     'rg': 0.9541000127792358,
                     'se': 0.0034209999721497297,
                     'z': 278.8999938964844},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-7212',
                              'trait': 'Leg fat mass (left)'},
              'gc': {'gcov_int': 0.9081000089645386,
                     'gcov_int_se': 0.016950000077486038,
                     'h2_int': 1.0549999475479126,
                     'h2_int_se': 0.01720000058412552,
                     'h2_obs': 0.2029999941587448,
                     'h2_obs_se': 0.006928000133484602,
                     'p': 0.0,
                     'rg': 0.9541000127792358,
                     'se': 0.0028880001045763493,
                     'z': 330.3999938964844},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-6704',
                              'trait': 'Arm fat mass (right)'},
              'gc': {'gcov_int': 0.9120000004768372,
                     'gcov_int_se': 0.016839999705553055,
                     'h2_int': 1.0549999475479126,
                     'h2_int_se': 0.01720000058412552,
                     'h2_obs': 0.2029999941587448,
                     'h2_obs_se': 0.006928000133484602,
                     'p': 0.0,
                     'rg': 0.9539

2. Adjust for correlation coefficient

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/genetic-cor'
params = {'trait': 'Waist circumference', 'cor_coef_threshold': 0.2}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{'metadata': {'empty_results': False,
              'query': 'MATCH (trait:Gwas)-[gc:BN_GEN_COR]-(assoc_trait:Gwas) '
                       'WHERE trait.trait = "Waist circumference" AND '
                       'abs(gc.rg) > 0.2 RETURN trait {.id, .trait}, '
                       'assoc_trait {.id, .trait}, gc { .rg, .z, .se, .p, '
                       '.h2_int, .h2_int_se, .h2_obs, .h2_obs_se, .gcov_int, '
                       '.gcov_int_se } ORDER BY gc.rg DESC ;',
              'total_seconds': 0.04717},
 'results': [{'assoc_trait': {'id': 'ukb-b-8338',
                              'trait': 'Arm fat mass (left)'},
              'gc': {'gcov_int': 0.9110999703407288,
                     'gcov_int_se': 0.016610000282526016,
                     'h2_int': 1.0549999475479126,
                     'h2_int_se': 0.01720000058412552,
                     'h2_obs': 0.2029999941587448,
                     'h2_obs_se': 0.006928000133484602,
                     'p': 0.0,
                     'rg': 0.9541000127792358,
                     'se': 0.0034209999721497297,
                     'z': 278.8999938964844},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-7212',
                              'trait': 'Leg fat mass (left)'},
              'gc': {'gcov_int': 0.9081000089645386,
                     'gcov_int_se': 0.016950000077486038,
                     'h2_int': 1.0549999475479126,
                     'h2_int_se': 0.01720000058412552,
                     'h2_obs': 0.2029999941587448,
                     'h2_obs_se': 0.006928000133484602,
                     'p': 0.0,
                     'rg': 0.9541000127792358,
                     'se': 0.0028880001045763493,
                     'z': 330.3999938964844},
              'trait': {'id': 'ukb-b-9405', 'trait': 'Waist circumference'}},
             {'assoc_trait': {'id': 'ukb-b-6704',
                              'trait': 'Arm fat mass (right)'},
              'gc': {'gcov_int': 0.9120000004768372,
                     'gcov_int_se': 0.016839999705553055,
                     'h2_int': 1.0549999475479126,
                     'h2_int_se': 0.01720000058412552,
                     'h2_obs': 0.2029999941587448,
                     'h2_obs_se': 0.006928000133484602,
                     'p': 0.0,
                     'rg': 0.9539

/confounder

1
2
3
4
5
6
7
8
  Get confounder / intermediate / collider evidence between traits:
  
  `type` accepts 1 of the 4 options:
  
  - confounder: confounder->exposure->outcome<-confounder
  - intermediate: intermediate<-exposure->outcome<-confounder
  - reverse_intermediate: intermediate->exposure->outcome->confounder
  - collider: collider<-exposure->outcome->collider

Params

1
2
3
4
{'exposure_trait': typing.Union[str, NoneType],
 'outcome_trait': typing.Union[str, NoneType],
 'pval_threshold': <class 'float'>,
 'type': <enum 'ConfounderType'>}

1. Confounder (default)

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/confounder'
params = {'exposure_trait': 'Body mass index', 'outcome_trait': 'Coronary heart disease'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{'metadata': {'empty_results': False,
              'query': 'MATCH (cf:Gwas)-[r1:MR]-> (exposure:Gwas {trait: "Body '
                       'mass index"}) -[r2:MR]->(outcome:Gwas {trait: '
                       '"Coronary heart disease"}) <-[r3:MR]-(cf:Gwas) WHERE '
                       'r1.pval < 1e-05 AND r2.pval < 1e-05 AND r3.pval < '
                       '1e-05 AND cf.id <> exposure.id AND cf.id <> outcome.id '
                       'AND exposure.id <> outcome.id AND cf.trait <> '
                       'exposure.trait AND cf.trait <> outcome.trait AND '
                       'exposure.trait <> outcome.trait RETURN exposure {.id, '
                       '.trait}, outcome {.id, .trait}, cf {.id, .trait}, r1 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r2 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r3 '
                       '{.b, .se, .pval, .selection, .method, .moescore} ORDER '
                       'BY r1.p;',
              'total_seconds': 0.072355},
 'results': [{'cf': {'id': 'ieu-a-51', 'trait': 'Hip circumference'},
              'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'r1': {'b': 0.8169345855712891,
                     'method': 'Simple mean',
                     'moescore': 0.7799999713897705,
                     'pval': 9.296272196479549e-07,
                     'se': 0.05126238614320755,
                     'selection': 'DF + HF'},
              'r2': {'b': 0.3971014618873596,
                     'method': 'Simple median',
                     'moescore': 0.9200000166893005,
                     'pval': 4.793827557136865e-08,
                     'se': 0.07274528592824936,
                     'selection': 'HF'},
              'r3': {'b': 0.5012693405151367,
                     'method': 'FE IVW',
                     'moescore': 0.8299999833106995,
                     'pval': 1.8831789461160042e-09,
                     'se': 0.08343953639268875,
                     'selection': 'HF'}},
             {'cf': {'id': 'ukb-a-287', 'trait': 'Arm fat mass (left)'},
              'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'r1': {'b': 0.66366845369338

2. Intermediate

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/confounder'
params = {'exposure_trait': 'Body mass index', 'outcome_trait': 'Coronary heart disease', 'type': 'intermediate'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{'metadata': {'empty_results': False,
              'query': 'MATCH (cf:Gwas)<-[r1:MR]- (exposure:Gwas {trait: "Body '
                       'mass index"}) -[r2:MR]->(outcome:Gwas {trait: '
                       '"Coronary heart disease"}) <-[r3:MR]-(cf:Gwas) WHERE '
                       'r1.pval < 1e-05 AND r2.pval < 1e-05 AND r3.pval < '
                       '1e-05 AND cf.id <> exposure.id AND cf.id <> outcome.id '
                       'AND exposure.id <> outcome.id AND cf.trait <> '
                       'exposure.trait AND cf.trait <> outcome.trait AND '
                       'exposure.trait <> outcome.trait RETURN exposure {.id, '
                       '.trait}, outcome {.id, .trait}, cf {.id, .trait}, r1 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r2 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r3 '
                       '{.b, .se, .pval, .selection, .method, .moescore} ORDER '
                       'BY r1.p;',
              'total_seconds': 0.100049},
 'results': [{'cf': {'id': 'ieu-a-798', 'trait': 'Myocardial infarction'},
              'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'r1': {'b': 0.3962300419807434,
                     'method': 'Simple mean',
                     'moescore': 0.9200000166893005,
                     'pval': 2.842824500109975e-12,
                     'se': 0.04708648845553398,
                     'selection': 'HF'},
              'r2': {'b': 0.3971014618873596,
                     'method': 'Simple median',
                     'moescore': 0.9200000166893005,
                     'pval': 4.793827557136865e-08,
                     'se': 0.07274528592824936,
                     'selection': 'HF'},
              'r3': {'b': 0.9747568964958191,
                     'method': 'Simple median',
                     'moescore': 0.8100000023841858,
                     'pval': 0.0,
                     'se': 0.06110995635390282,
                     'selection': 'Tophits'}},
             {'cf': {'id': 'ieu-a-51', 'trait': 'Hip circumference'},
              'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'r1': {'b': 0.7941241264343262,

3. Reverse intermediate

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/confounder'
params = {'exposure_trait': 'Body mass index', 'outcome_trait': 'Coronary heart disease', 'type': 'reverse_intermediate'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{'metadata': {'empty_results': False,
              'query': 'MATCH (cf:Gwas)-[r1:MR]-> (exposure:Gwas {trait: "Body '
                       'mass index"}) -[r2:MR]->(outcome:Gwas {trait: '
                       '"Coronary heart disease"}) -[r3:MR]->(cf:Gwas) WHERE '
                       'r1.pval < 1e-05 AND r2.pval < 1e-05 AND r3.pval < '
                       '1e-05 AND cf.id <> exposure.id AND cf.id <> outcome.id '
                       'AND exposure.id <> outcome.id AND cf.trait <> '
                       'exposure.trait AND cf.trait <> outcome.trait AND '
                       'exposure.trait <> outcome.trait RETURN exposure {.id, '
                       '.trait}, outcome {.id, .trait}, cf {.id, .trait}, r1 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r2 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r3 '
                       '{.b, .se, .pval, .selection, .method, .moescore} ORDER '
                       'BY r1.p;',
              'total_seconds': 0.048714},
 'results': [{'cf': {'id': 'ukb-a-295', 'trait': 'Chest pain or discomfort'},
              'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'r1': {'b': -0.30070212483406067,
                     'method': 'FE IVW',
                     'moescore': 1.0,
                     'pval': 4.28797330083394e-43,
                     'se': 0.021849319338798523,
                     'selection': 'DF'},
              'r2': {'b': 0.3971014618873596,
                     'method': 'Simple median',
                     'moescore': 0.9200000166893005,
                     'pval': 4.793827557136865e-08,
                     'se': 0.07274528592824936,
                     'selection': 'HF'},
              'r3': {'b': 0.011360851116478443,
                     'method': 'RE IVW',
                     'moescore': 0.7900000214576721,
                     'pval': 8.067577823567262e-07,
                     'se': 0.0018616358283907175,
                     'selection': 'HF'}},
             {'cf': {'id': 'ukb-a-452',
                     'trait': 'Medication for pain relief  constipation  '
                              'heartburn: Aspirin'},
              'exposure': {'id': 'ieu-a-974', 'trait': 'Body mass index'},
              'outcome': {'id': 'ieu

4. Collider

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/confounder'
params = {'exposure_trait': 'Body mass index', 'outcome_trait': 'Coronary heart disease', 'type': 'collider'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{'metadata': {'empty_results': False,
              'query': 'MATCH (cf:Gwas)<-[r1:MR]- (exposure:Gwas {trait: "Body '
                       'mass index"}) -[r2:MR]->(outcome:Gwas {trait: '
                       '"Coronary heart disease"}) -[r3:MR]->(cf:Gwas) WHERE '
                       'r1.pval < 1e-05 AND r2.pval < 1e-05 AND r3.pval < '
                       '1e-05 AND cf.id <> exposure.id AND cf.id <> outcome.id '
                       'AND exposure.id <> outcome.id AND cf.trait <> '
                       'exposure.trait AND cf.trait <> outcome.trait AND '
                       'exposure.trait <> outcome.trait RETURN exposure {.id, '
                       '.trait}, outcome {.id, .trait}, cf {.id, .trait}, r1 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r2 '
                       '{.b, .se, .pval, .selection, .method, .moescore}, r3 '
                       '{.b, .se, .pval, .selection, .method, .moescore} ORDER '
                       'BY r1.p;',
              'total_seconds': 0.070376},
 'results': [{'cf': {'id': 'ukb-a-63',
                     'trait': 'Non-cancer illness code  self-reported: heart '
                              'attack/myocardial infarction'},
              'exposure': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'outcome': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'r1': {'b': 0.010374778881669044,
                     'method': 'FE IVW',
                     'moescore': 0.9200000166893005,
                     'pval': 4.42544889622809e-10,
                     'se': 0.0016630961326882243,
                     'selection': 'DF + HF'},
              'r2': {'b': 0.3971014618873596,
                     'method': 'Simple median',
                     'moescore': 0.9200000166893005,
                     'pval': 4.793827557136865e-08,
                     'se': 0.07274528592824936,
                     'selection': 'HF'},
              'r3': {'b': 0.02065565064549446,
                     'method': 'Weighted median',
                     'moescore': 0.9300000071525574,
                     'pval': 4.525633520383429e-41,
                     'se': 0.0015389990294352174,
                     'selection': 'HF'}},
             {'cf': {'id': 'ukb-a-62',
                     'trait': 'Non-cancer illness code  self-reported: angina'},
              'exposure': {

/drugs/risk-factors

1
  Drugs for common risk factors of diseases

Params

1
{'pval_threshold': <class 'float'>, 'trait': <class 'str'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/drugs/risk-factors'
params = {'trait': 'Coronary heart disease'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{'metadata': {'empty_results': False,
              'query': 'MATCH (trait:Gwas {trait: "Coronary heart '
                       'disease"})<-[mr:MR]-(assoc_trait:Gwas) '
                       '-[gwas_to_variant:GWAS_TO_VARIANT]->(variant:Variant) '
                       '-[:VARIANT_TO_GENE]->(gene:Gene) '
                       '<-[:CPIC|:OPENTARGETS_DRUG_TO_TARGET]-(drug:Drug) '
                       'WHERE trait.trait <> assoc_trait.trait AND mr.pval < '
                       '1e-08 AND gwas_to_variant.pval < 1e-8 RETURN trait '
                       '{.id, .trait}, assoc_trait {.id, .trait}, variant '
                       '{.name}, gene {.name}, drug {.label}, mr {.b, .se, '
                       '.pval, .selection, .method, .moescore} ORDER BY '
                       'mr.pval ;',
              'total_seconds': 0.240485},
 'results': [{'assoc_trait': {'id': 'ieu-a-798',
                              'trait': 'Myocardial infarction'},
              'drug': {'label': 'OCRIPLASMIN'},
              'gene': {'name': 'COL4A2'},
              'mr': {'b': 0.9747568964958191,
                     'method': 'Simple median',
                     'moescore': 0.8100000023841858,
                     'pval': 0.0,
                     'se': 0.06110995635390282,
                     'selection': 'Tophits'},
              'trait': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'variant': {'name': 'rs4773141'}},
             {'assoc_trait': {'id': 'ieu-a-798',
                              'trait': 'Myocardial infarction'},
              'drug': {'label': 'COLLAGENASE CLOSTRIDIUM HISTOLYTICUM'},
              'gene': {'name': 'COL4A2'},
              'mr': {'b': 0.9747568964958191,
                     'method': 'Simple median',
                     'moescore': 0.8100000023841858,
                     'pval': 0.0,
                     'se': 0.06110995635390282,
                     'selection': 'Tophits'},
              'trait': {'id': 'ieu-a-7', 'trait': 'Coronary heart disease'},
              'variant': {'name': 'rs4773141'}},
             {'assoc_trait': {'id': 'ieu-a-798',
                              'trait': 'Myocardial infarction'},
              'drug': {'label': 'OCRIPLASMIN'},
              'gene': {'name': 'COL4A1'},
              'mr': {'b': 0.9747568964958191,
                     'method': 'Simple median',

/pathway

1
  Pathway-based stratification of instruments

Params

1
{'pval_threshold': <class 'float'>, 'trait': <class 'str'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/pathway'
params = {'trait': 'LDL cholesterol'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas {trait: "LDL cholesterol"}) '
                       '-[gwas_to_variant:GWAS_TO_VARIANT]->(variant:Variant)-[variant_to_gene:VARIANT_TO_GENE]-> '
                       '(gene:Gene)-[gene_to_protein:GENE_TO_PROTEIN]->(protein:Protein) '
                       '-[protein_in_pathway:PROTEIN_IN_PATHWAY]->(pathway:Pathway) '
                       'WHERE gwas_to_variant.pval < 1e-05 AND gene.name is '
                       'not null RETURN gwas {.id, .trait}, gwas_to_variant '
                       '{.beta, .se, .pval, .samplesize}, variant {.name}, '
                       'gene {.name}, protein {.uniprot_id}, pathway '
                       '{.reactome_id, .name} ORDER BY gwas_to_variant.pval ;',
              'total_seconds': 0.021185},
 'results': [{'gene': {'name': 'APOC4'},
              'gwas': {'id': 'ieu-a-300', 'trait': 'LDL cholesterol'},
              'gwas_to_variant': {'beta': -0.44620001316070557,
                                  'pval': 0.0,
                                  'samplesize': 99409.0,
                                  'se': 0.018300000578165054},
              'pathway': {'name': 'VLDL assembly',
                          'reactome_id': 'R-HSA-8866423'},
              'protein': {'uniprot_id': 'P55056'},
              'variant': {'name': 'rs12721109'}},
             {'gene': {'name': 'APOC2'},
              'gwas': {'id': 'ieu-a-300', 'trait': 'LDL cholesterol'},
              'gwas_to_variant': {'beta': -0.44620001316070557,
                                  'pval': 0.0,
                                  'samplesize': 99409.0,
                                  'se': 0.018300000578165054},
              'pathway': {'name': 'Assembly of active LPL and LIPC lipase '
                                  'complexes',
                          'reactome_id': 'R-HSA-8963889'},
              'protein': {'uniprot_id': 'P02655'},
              'variant': {'name': 'rs12721109'}},
             {'gene': {'name': 'APOC2'},
              'gwas': {'id': 'ieu-a-300', 'trait': 'LDL cholesterol'},
              'gwas_to_variant': {'beta': -0.44620001316070557,
                                  'pval': 0.0,
                                  'samplesize': 99409.0,
                                  'se': 0.018300000578165054},
              'pathway': {'name': 'HDL remodeling

/xqtl/single-snp-mr/gene-by-variant

1
  Get the list of genes associated by an instrument SNP, nested per SNP

Params

1
{'data': <class 'app.apis.xqtl.models.GeneByVariantRequest'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/xqtl/single-snp-mr/gene-by-variant'
data = {'variant_list': ['rs9272544', 'rs242797']}
r = requests.post(url, json=data)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       '(variant:Variant)-[vg:XQTL_SINGLE_SNP_MR_SNP_GENE]-(gene:Gene) '
                       '-[xqtl:XQTL_SINGLE_SNP_MR_GENE_GWAS]-(gwas:Gwas) WHERE '
                       "variant.name IN ['rs9272544', 'rs242797'] AND "
                       "xqtl.rsid = variant.name AND xqtl.qtl_type = 'eQTL' "
                       'WITH variant.name AS variant, collect(DISTINCT '
                       'gene.name) AS gene_list RETURN variant, gene_list, '
                       'size(gene_list) AS n_genes',
              'total_seconds': 0.023504},
 'results': [{'gene_list': ['CSRP2BP', 'NENF'],
              'n_genes': 2,
              'variant': 'rs9272544'},
             {'gene_list': ['PPP1R3D', 'FAM217B'],
              'n_genes': 2,
              'variant': 'rs242797'}]}

/mappings/gene-to-protein

1
  Return protein uniprot_id from associated gene names

Params

1
{'data': <class 'app.apis.mappings.models.GeneToProteinRequest'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/mappings/gene-to-protein'
data = {'gene_name_list': ['GCH1', 'MYOF']}
r = requests.post(url, json=data)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       '(gene:Gene)-[gp:GENE_TO_PROTEIN]-(protein:Protein) '
                       "WHERE gene.name IN ['GCH1', 'MYOF'] RETURN gene "
                       '{.ensembl_id, .name}, protein {.uniprot_id}',
              'total_seconds': 0.00186},
 'results': [{'gene': {'ensembl_id': 'ENSG00000131979', 'name': 'GCH1'},
              'protein': {'uniprot_id': 'P30793'}},
             {'gene': {'ensembl_id': 'ENSG00000138119', 'name': 'MYOF'},
              'protein': {'uniprot_id': 'Q9NZM1'}}]}

/protein/ppi

1
2
  For the list of proteins, returns their **directly**
  associated proteins in protein-protein-interactions

Params

1
{'data': <class 'app.apis.protein.models.PpiRequest'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/protein/ppi'
data = {'uniprot_id_list': ['P30793', 'Q9NZM1', 'O95236']}
r = requests.post(url, json=data)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       'p=(protein:Protein)-[r:STRING_INTERACT_WITH]-(assoc_protein:Protein) '
                       "WHERE protein.uniprot_id IN ['P30793', 'Q9NZM1', "
                       "'O95236'] RETURN protein {.uniprot_id}, assoc_protein "
                       '{.uniprot_id}',
              'total_seconds': 0.003664},
 'results': [{'assoc_protein': {'uniprot_id': 'P00439'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'O14638'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'Q5TCS8'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P20711'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P00374'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'O43556'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P22392'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P05187'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P07101'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P22102'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'Q9BY32'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P50583'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'O95197'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P05186'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'Q05932'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'Q5MY95'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'P49961'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uniprot_id': 'Q9BX66'},
              'protein': {'uniprot_id': 'P30793'}},
             {'assoc_protein': {'uni

/protein/ppi/pairwise

1
2
3
  For the list of proteins, returns a graph edgelist
  where they are connected via protein-protein-interactions,
  with configurable middle steps

Params

1
{'data': <class 'app.apis.protein.models.PpiGraphRequest'>}

1. Default query (direct interaction)

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/protein/ppi/pairwise'
data = {'uniprot_id_list': ['P30793', 'Q9NZM1', 'O95236', 'P32456', 'Q13536', 'Q9NRQ5', 'O60674', 'O14933', 'P32455', 'P40306', 'P42224', 'P28838', 'P23381']}
r = requests.post(url, json=data)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       'p=(protein:Protein)-[r:STRING_INTERACT_WITH*1..1]-(assoc_protein:Protein) '
                       "WHERE protein.uniprot_id IN ['P30793', 'Q9NZM1', "
                       "'O95236', 'P32456', 'Q13536', 'Q9NRQ5', 'O60674', "
                       "'O14933', 'P32455', 'P40306', 'P42224', 'P28838', "
                       "'P23381'] AND assoc_protein.uniprot_id IN ['P30793', "
                       "'Q9NZM1', 'O95236', 'P32456', 'Q13536', 'Q9NRQ5', "
                       "'O60674', 'O14933', 'P32455', 'P40306', 'P42224', "
                       "'P28838', 'P23381'] RETURN protein.uniprot_id AS "
                       'protein, assoc_protein.uniprot_id AS assoc_protein, '
                       'length(p) AS path_size',
              'total_seconds': 0.011462},
 'results': [{'assoc_protein': 'P42224', 'path_size': 1, 'protein': 'P28838'},
             {'assoc_protein': 'P42224', 'path_size': 1, 'protein': 'O14933'},
             {'assoc_protein': 'P32455', 'path_size': 1, 'protein': 'O14933'},
             {'assoc_protein': 'P42224', 'path_size': 1, 'protein': 'P32455'},
             {'assoc_protein': 'O14933', 'path_size': 1, 'protein': 'P32455'},
             {'assoc_protein': 'P32456', 'path_size': 1, 'protein': 'P32455'},
             {'assoc_protein': 'P42224', 'path_size': 1, 'protein': 'P32456'},
             {'assoc_protein': 'P32455', 'path_size': 1, 'protein': 'P32456'},
             {'assoc_protein': 'P42224', 'path_size': 1, 'protein': 'O60674'},
             {'assoc_protein': 'P28838', 'path_size': 1, 'protein': 'P42224'},
             {'assoc_protein': 'O14933', 'path_size': 1, 'protein': 'P42224'},
             {'assoc_protein': 'P32455', 'path_size': 1, 'protein': 'P42224'},
             {'assoc_protein': 'P32456', 'path_size': 1, 'protein': 'P42224'},
             {'assoc_protein': 'O60674', 'path_size': 1, 'protein': 'P42224'}]}

2. With at most 1 intermediate protein

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/protein/ppi/pairwise'
data = {'uniprot_id_list': ['P30793', 'Q9NZM1', 'O95236', 'P32456', 'Q13536', 'Q9NRQ5', 'O60674', 'O14933', 'P32455', 'P40306', 'P42224', 'P28838', 'P23381'], 'n_intermediate_proteins': 1}
r = requests.post(url, json=data)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       'p=(protein:Protein)-[r:STRING_INTERACT_WITH*1..2]-(assoc_protein:Protein) '
                       "WHERE protein.uniprot_id IN ['P30793', 'Q9NZM1', "
                       "'O95236', 'P32456', 'Q13536', 'Q9NRQ5', 'O60674', "
                       "'O14933', 'P32455', 'P40306', 'P42224', 'P28838', "
                       "'P23381'] AND assoc_protein.uniprot_id IN ['P30793', "
                       "'Q9NZM1', 'O95236', 'P32456', 'Q13536', 'Q9NRQ5', "
                       "'O60674', 'O14933', 'P32455', 'P40306', 'P42224', "
                       "'P28838', 'P23381'] RETURN protein.uniprot_id AS "
                       'protein, assoc_protein.uniprot_id AS assoc_protein, '
                       'length(p) AS path_size',
              'total_seconds': 0.34403},
 'results': [{'assoc_protein': 'P42224', 'path_size': 1, 'protein': 'P28838'},
             {'assoc_protein': 'O14933', 'path_size': 2, 'protein': 'P28838'},
             {'assoc_protein': 'P32455', 'path_size': 2, 'protein': 'P28838'},
             {'assoc_protein': 'P32456', 'path_size': 2, 'protein': 'P28838'},
             {'assoc_protein': 'O60674', 'path_size': 2, 'protein': 'P28838'},
             {'assoc_protein': 'O60674', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P42224', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P40306', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P42224', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P42224', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P32455', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P32456', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'O60674', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P42224', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P40306', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P42224', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'O60674', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P42224', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein': 'P32456', 'path_size': 2, 'protein': 'O14933'},
             {'assoc_protein

/protein/in-pathway

1
2
  For the list of proteins, returns their associated
  pathway data

Params

1
{'data': <class 'app.apis.protein.models.PathwayRequest'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/protein/in-pathway'
data = {'uniprot_id_list': ['O14933', 'O60674', 'P32455']}
r = requests.post(url, json=data)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       'p=(protein:Protein)-[r:PROTEIN_IN_PATHWAY]-(pathway:Pathway) '
                       "WHERE protein.uniprot_id IN ['O14933', 'O60674', "
                       "'P32455'] RETURN protein.uniprot_id AS uniprot_id, "
                       'count(p) AS pathway_count, '
                       'collect(pathway.reactome_id) AS pathway_reactome_id',
              'total_seconds': 0.002253},
 'results': [{'pathway_count': 2,
              'pathway_reactome_id': ['R-HSA-977225', 'R-HSA-1169408'],
              'uniprot_id': 'O14933'},
             {'pathway_count': 11,
              'pathway_reactome_id': ['R-HSA-1059683',
                                      'R-HSA-6788467',
                                      'R-HSA-9020956',
                                      'R-HSA-512988',
                                      'R-HSA-983231',
                                      'R-HSA-1170546',
                                      'R-HSA-982772',
                                      'R-HSA-1433557',
                                      'R-HSA-9020591',
                                      'R-HSA-9020933',
                                      'R-HSA-6785807'],
              'uniprot_id': 'O60674'},
             {'pathway_count': 1,
              'pathway_reactome_id': ['R-HSA-877300'],
              'uniprot_id': 'P32455'}]}

/gene/druggability/ppi

1
2
  For a gene, search for its associated druggable genes
  via protein-protein-interaction (INTACT and STRING)

Params

1
{'gene_name': <class 'str'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/gene/druggability/ppi'
params = {'gene_name': 'IL23R'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{'metadata': {'empty_results': False,
              'query': 'MATCH (g1:Gene)-[:GENE_TO_PROTEIN]-(p1:Protein) '
                       '-[:INTACT_INTERACTS_WITH | STRING_INTERACT_WITH]- '
                       '(p2:Protein)-[:GENE_TO_PROTEIN]-(g2:Gene) WHERE '
                       "g1.name = 'IL23R' AND g2.name IS NOT NULL AND "
                       'g2.druggability_tier IS NOT NULL RETURN DISTINCT g1 '
                       '{.name}, p1 {.uniprot_id}, p2 {.uniprot_id}, g2 '
                       '{.name, .druggability_tier} ORDER BY '
                       'g2.druggability_tier, g2.name',
              'total_seconds': 0.008495},
 'results': [{'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'CSF2'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P04141'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IFNA1'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P01562'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IFNG'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P01579'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IL10'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P22301'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IL12B'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P29460'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IL12RB1'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P42701'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IL13'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P35225'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IL15'},
              'p1': {'uniprot_id': 'Q5VWK5'},
              'p2': {'uniprot_id': 'P40933'}},
             {'g1': {'name': 'IL23R'},
              'g2': {'druggability_tier': 'Tier 1', 'name': 'IL17A'},
              'p1': {'uniprot_i

/gene/literature

1
2
  For a gene, search for its literature evidence
  related to a semmed object

Params

1
{'gene_name': <class 'str'>, 'object_name': <class 'str'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/gene/literature'
params = {'gene_name': 'IL23R', 'object_name': 'Inflammatory bowel disease'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{'metadata': {'empty_results': False,
              'query': 'MATCH '
                       '(gene:Gene)-[:SEM_GENE]-(:SemmedTerm)-[:SEM_SUB|SEM_OBJ]- '
                       '(st:SemmedTriple)-[:SEM_TO_LIT]-(l:Literature) WHERE '
                       "gene.name = 'IL23R' AND "
                       'st.object_name=~"(?i).*Inflammatory bowel disease.*" '
                       'RETURN gene {.name}, st {.predicate, .object_name}, '
                       'collect(l.pubmed_id) AS pubmed_id',
              'total_seconds': 0.006049},
 'results': [{'gene': {'name': 'IL23R'},
              'pubmed_id': ['17484863', '21155887'],
              'st': {'object_name': 'Inflammatory Bowel Diseases',
                     'predicate': 'NEG_ASSOCIATED_WITH'}},
             {'gene': {'name': 'IL23R'},
              'pubmed_id': ['27852544'],
              'st': {'object_name': 'Inflammatory Bowel Diseases',
                     'predicate': 'AFFECTS'}},
             {'gene': {'name': 'IL23R'},
              'pubmed_id': ['17484863',
                            '19575361',
                            '19496308',
                            '18383521',
                            '18341487',
                            '29248579',
                            '18088064',
                            '19817673',
                            '18047540',
                            '21155887',
                            '25159710',
                            '18383363',
                            '19175939',
                            '18698678',
                            '20393462',
                            '19747142',
                            '21846945',
                            '18164077',
                            '20067801',
                            '18368064',
                            '24280935'],
              'st': {'object_name': 'Inflammatory Bowel Diseases',
                     'predicate': 'ASSOCIATED_WITH'}},
             {'gene': {'name': 'IL23R'},
              'pubmed_id': ['23131344'],
              'st': {'object_name': 'Inflammatory Bowel Diseases',
                     'predicate': 'PREDISPOSES'}}]}

/ontology/gwas-efo

1
  Map Gwas trait to EFO term, via `GWAS_NLP_EFO`

Params

1
2
3
4
{'efo_term': typing.Union[str, NoneType],
 'fuzzy': <class 'bool'>,
 'score_threshold': <class 'float'>,
 'trait': typing.Union[str, NoneType]}

1. Default (fuzzy matching)

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/ontology/gwas-efo'
params = {'trait': 'body mass', 'efo_term': 'body mass'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[r:GWAS_NLP_EFO]-(efo:Efo) WHERE '
                       'r.score > 0.75 AND gwas.trait =~ "(?i).*body mass.*" '
                       'AND efo.value =~ "(?i).*body mass.*" RETURN gwas {.id, '
                       '.trait}, r {.score}, efo {.type, .value, .id} ORDER BY '
                       'r.score DESC',
              'total_seconds': 0.065315},
 'results': [{'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-94', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-1089', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-785', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-974', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-95', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ebi-a-GCST006368', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.u

2. Exact matching

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/ontology/gwas-efo'
params = {'trait': 'Body mass index', 'fuzzy': False}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[r:GWAS_NLP_EFO]-(efo:Efo) WHERE '
                       'r.score > 0.75 AND gwas.trait = "Body mass index" '
                       'RETURN gwas {.id, .trait}, r {.score}, efo {.type, '
                       '.value, .id} ORDER BY r.score DESC',
              'total_seconds': 0.00728},
 'results': [{'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-2', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-974', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-95', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ebi-a-GCST006368', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-835', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ebi-a-GCST004904', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-literal',
                      'value': 'body mass index'},
              'gwas': {'id': 'ieu-a-1089', 'trait': 'Body mass index'},
              'r': {'score': 1.0}},
             {'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004340',
                      'type': 'typed-li

/ontology/disease-efo

1
  Map Disease label to EFO term, via `MONDO_MAP_EFO`

Params

1
2
3
{'disease_label': typing.Union[str, NoneType],
 'efo_term': typing.Union[str, NoneType],
 'fuzzy': <class 'bool'>}

1. Query

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/ontology/disease-efo'
params = {'disease_label': 'leukemia', 'efo_term': 'leukemia'}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{'metadata': {'empty_results': False,
              'query': 'MATCH (disease:Disease)-[r:MONDO_MAP_EFO]-(efo:Efo) '
                       'WHERE disease.label =~ "(?i).*leukemia.*" AND '
                       'efo.value =~ "(?i).*leukemia.*" RETURN disease {.id, '
                       '.label}, efo {.type, .value, .id}',
              'total_seconds': 0.059249},
 'results': [{'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0010643',
                          'label': 'acute leukemia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_1000068',
                      'type': 'typed-literal',
                      'value': 'Acute Leukemia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0011996',
                          'label': 'chronic myelogenous leukemia, BCR-ABL1 '
                                   'positive'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0000339',
                      'type': 'typed-literal',
                      'value': 'chronic myelogenous leukemia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0004948',
                          'label': 'B-cell chronic lymphocytic leukemia'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0000095',
                      'type': 'typed-literal',
                      'value': 'chronic lymphocytic leukemia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0004947',
                          'label': 'B-cell acute lymphoblastic leukemia'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0000094',
                      'type': 'typed-literal',
                      'value': 'B-cell acute lymphoblastic leukemia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0004967',
                          'label': 'acute lymphoblastic leukemia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0000220',
                      'type': 'typed-literal',
                      'value': 'acute lymphoblastic leukemia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0004963',
                          'label': 'T-cell acute lymphoblastic leukemia'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0000209',
                      'type': 'typed-literal',
                      'value': 'T-cell acute lympho

/ontology/gwas-efo-disease

1
  Map Gwas trait to Disease label, via Efo term.

Params

1
2
3
4
5
{'disease_label': typing.Union[str, NoneType],
 'efo_term': typing.Union[str, NoneType],
 'fuzzy': <class 'bool'>,
 'score_threshold': <class 'float'>,
 'trait': typing.Union[str, NoneType]}

1. By trait and disease_label

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/ontology/gwas-efo-disease'
params = {'trait': 'infectious disease', 'disease_label': 'infectious disease', 'score_threshold': 0.7}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[ge:GWAS_NLP_EFO]-(efo:Efo) '
                       '-[ed:MONDO_MAP_EFO]-(disease:Disease) WHERE ge.score > '
                       '0.7 AND gwas.trait =~ "(?i).*infectious disease.*" AND '
                       'disease.label =~ "(?i).*infectious disease.*" RETURN '
                       'gwas {.id, .trait}, ge {.score}, efo {.type, .value, '
                       '.id}, disease {.id, .label}',
              'total_seconds': 0.060179},
 'results': [{'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0005940',
                          'label': 'respirovirus infectious disease'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0007465',
                      'type': 'typed-literal',
                      'value': 'Respirovirus infectious disease'},
              'ge': {'score': 0.743891716003418},
              'gwas': {'id': 'ukb-b-7375',
                       'trait': 'Main speciality of consultant (recoded): '
                                'Infectious diseases'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0005949',
                          'label': 'roseolovirus infectious disease'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0007474',
                      'type': 'typed-literal',
                      'value': 'Roseolovirus infectious disease'},
              'ge': {'score': 0.740414023399353},
              'gwas': {'id': 'ukb-b-7375',
                       'trait': 'Main speciality of consultant (recoded): '
                                'Infectious diseases'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0005876',
                          'label': 'Nidovirales infectious disease'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0007396',
                      'type': 'typed-literal',
                      'value': 'Nidovirales infectious disease'},
              'ge': {'score': 0.7003502249717712},
              'gwas': {'id': 'ukb-b-7375',
                       'trait': 'Main speciality of consultant (recoded): '
                                'Infectious diseases'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0005786',
                          'label': 'Hepadnaviridae infectious disease'},
              'efo': {'id': 'http://www.ebi.a

2. By trait and efo_term

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/ontology/gwas-efo-disease'
params = {'trait': 'insomnia', 'efo_term': 'insomnia', 'score_threshold': 0.7}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[ge:GWAS_NLP_EFO]-(efo:Efo) '
                       '-[ed:MONDO_MAP_EFO]-(disease:Disease) WHERE ge.score > '
                       '0.7 AND gwas.trait =~ "(?i).*insomnia.*" AND efo.value '
                       '=~ "(?i).*insomnia.*" RETURN gwas {.id, .trait}, ge '
                       '{.score}, efo {.type, .value, .id}, disease {.id, '
                       '.label}',
              'total_seconds': 0.028903},
 'results': [{'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.8038048148155212},
              'gwas': {'id': 'ebi-a-GCST006488',
                       'trait': 'Insomnia complaints'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.8038048148155212},
              'gwas': {'id': 'ebi-a-GCST006487',
                       'trait': 'Insomnia complaints'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.929945170879364},
              'gwas': {'id': 'ukb-a-13', 'trait': 'Sleeplessness / insomnia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.929945170879364},
              'gwas': {'id': 'ukb-b-3957',
                       'trait': 'Sleeplessness / insomnia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'labe

3. By efo_term and disease_label

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/ontology/gwas-efo-disease'
params = {'efo_term': 'insomnia', 'disease_label': 'insomnia', 'score_threshold': 0.7}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[ge:GWAS_NLP_EFO]-(efo:Efo) '
                       '-[ed:MONDO_MAP_EFO]-(disease:Disease) WHERE ge.score > '
                       '0.7 AND efo.value =~ "(?i).*insomnia.*" AND '
                       'disease.label =~ "(?i).*insomnia.*" RETURN gwas {.id, '
                       '.trait}, ge {.score}, efo {.type, .value, .id}, '
                       'disease {.id, .label}',
              'total_seconds': 0.054628},
 'results': [{'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.8038048148155212},
              'gwas': {'id': 'ebi-a-GCST006488',
                       'trait': 'Insomnia complaints'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.8038048148155212},
              'gwas': {'id': 'ebi-a-GCST006487',
                       'trait': 'Insomnia complaints'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.929945170879364},
              'gwas': {'id': 'ukb-a-13', 'trait': 'Sleeplessness / insomnia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'label': 'insomnia (disease)'},
              'efo': {'id': 'http://www.ebi.ac.uk/efo/EFO_0004698',
                      'type': 'typed-literal',
                      'value': 'insomnia'},
              'ge': {'score': 0.929945170879364},
              'gwas': {'id': 'ukb-b-3957',
                       'trait': 'Sleeplessness / insomnia'}},
             {'disease': {'id': 'http://purl.obolibrary.org/obo/MONDO_0013600',
                          'l

/literature/gwas

1
2
3
4
5
6
7
8
  Search for literature evidence of a Gwas trait via semmed.
  
  - `semmed_triple_id`: search for a specific semmed triple id,
    e.g. "ghrelin:INHIBITS:Leptin"
  - `semmed_predicates`: list of predicates for **whitelist**
  - `by_gwas_id`: False. If True search by Gwas.id
  - `fuzzy`: True. By default fuzzy match trait name.
  - `skip`: pagination

Params

1
2
3
4
5
6
7
8
9
{'by_gwas_id': <class 'bool'>,
 'fuzzy': <class 'bool'>,
 'gwas_id': typing.Union[str, NoneType],
 'limit': <class 'int'>,
 'pval_threshold': <class 'float'>,
 'semmed_predicates': typing.List[str],
 'semmed_triple_id': typing.Union[str, NoneType],
 'skip': <class 'int'>,
 'trait': typing.Union[str, NoneType]}

1. Search by trait name

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/literature/gwas'
params = {'trait': 'Sleep duration', 'fuzzy': False}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas) -[gl:GWAS_TO_LIT]->(lit:Literature) '
                       '<-[sl:SEM_TO_LIT]-(triple:SemmedTriple) '
                       '<-[gs:GWAS_SEM]-(gwas:Gwas) WHERE gwas.trait = "Sleep '
                       'duration" AND gs.pval < 0.001 RETURN gwas {.id, '
                       '.trait}, gs {.pval, .localCount}, triple {.id, '
                       '.subject_name, .object_name, .predicate}, lit '
                       '{.pubmed_id} SKIP 0 LIMIT 50',
              'total_seconds': 0.019415},
 'results': [{'gs': {'localCount': 2, 'pval': 1.5405496014864184e-05},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '27353839'},
              'triple': {'id': 'Amyotrophic Lateral '
                               'Sclerosis:COEXISTS_WITH:Respiratory Failure',
                         'object_name': 'Respiratory Failure',
                         'predicate': 'COEXISTS_WITH',
                         'subject_name': 'Amyotrophic Lateral Sclerosis'}},
             {'gs': {'localCount': 3, 'pval': 2.9767304177141796e-09},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '26710225'},
              'triple': {'id': 'Chronic pain:COEXISTS_WITH:Dyssomnias',
                         'object_name': 'Dyssomnias',
                         'predicate': 'COEXISTS_WITH',
                         'subject_name': 'Chronic pain'}},
             {'gs': {'localCount': 3, 'pval': 2.9767304177141796e-09},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '26683236'},
              'triple': {'id': 'Chronic pain:COEXISTS_WITH:Dyssomnias',
                         'object_name': 'Dyssomnias',
                         'predicate': 'COEXISTS_WITH',
                         'subject_name': 'Chronic pain'}},
             {'gs': {'localCount': 2, 'pval': 4.776185960508883e-05},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '8604274'},
              'triple': {'id': 'Prednisone:TREATS:Infantile spasms',
                         'object_name': 'Infantile spasms',
                         'predicate': 'TREATS',
                         'subject_name': 'Prednisone'}}

2. Search by id

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/literature/gwas'
params = {'gwas_id': 'ieu-a-1088', 'by_gwas_id': True}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas) -[gl:GWAS_TO_LIT]->(lit:Literature) '
                       '<-[sl:SEM_TO_LIT]-(triple:SemmedTriple) '
                       '<-[gs:GWAS_SEM]-(gwas:Gwas) WHERE gwas.id = '
                       '"ieu-a-1088" AND gs.pval < 0.001 RETURN gwas {.id, '
                       '.trait}, gs {.pval, .localCount}, triple {.id, '
                       '.subject_name, .object_name, .predicate}, lit '
                       '{.pubmed_id} SKIP 0 LIMIT 50',
              'total_seconds': 0.015685},
 'results': [{'gs': {'localCount': 2, 'pval': 7.85111933510052e-06},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '10930561'},
              'triple': {'id': 'Caffeine:INTERACTS_WITH:Melatonin',
                         'object_name': 'Melatonin',
                         'predicate': 'INTERACTS_WITH',
                         'subject_name': 'Caffeine'}},
             {'gs': {'localCount': 6, 'pval': 2.4355837781168434e-14},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '9337448'},
              'triple': {'id': 'Melatonin:ASSOCIATED_WITH:Sleep Disorders',
                         'object_name': 'Sleep Disorders',
                         'predicate': 'ASSOCIATED_WITH',
                         'subject_name': 'Melatonin'}},
             {'gs': {'localCount': 6, 'pval': 2.4355837781168434e-14},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '28460563'},
              'triple': {'id': 'Melatonin:ASSOCIATED_WITH:Sleep Disorders',
                         'object_name': 'Sleep Disorders',
                         'predicate': 'ASSOCIATED_WITH',
                         'subject_name': 'Melatonin'}},
             {'gs': {'localCount': 6, 'pval': 2.4355837781168434e-14},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '17022876'},
              'triple': {'id': 'Melatonin:ASSOCIATED_WITH:Sleep Disorders',
                         'object_name': 'Sleep Disorders',
                         'predicate': 'ASSOCIATED_WITH',
                         'subject_name': 'Melatonin'}},
             {'gs': {'localCount': 6, 'pval': 2.4355837781168434e-14},
              'gwas': {

3. Search by id and semmed triple id

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/literature/gwas'
params = {'gwas_id': 'ieu-a-1088', 'semmed_triple_id': 'ghrelin:INHIBITS:Leptin', 'by_gwas_id': True}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas) -[gl:GWAS_TO_LIT]->(lit:Literature) '
                       '<-[sl:SEM_TO_LIT]-(triple:SemmedTriple) '
                       '<-[gs:GWAS_SEM]-(gwas:Gwas) WHERE gwas.id = '
                       '"ieu-a-1088" AND triple.id = "ghrelin:INHIBITS:Leptin" '
                       'AND gs.pval < 0.001 RETURN gwas {.id, .trait}, gs '
                       '{.pval, .localCount}, triple {.id, .subject_name, '
                       '.object_name, .predicate}, lit {.pubmed_id} SKIP 0 '
                       'LIMIT 50',
              'total_seconds': 0.003659},
 'results': [{'gs': {'localCount': 5, 'pval': 1.7678480207505842e-12},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '21659802'},
              'triple': {'id': 'ghrelin:INHIBITS:Leptin',
                         'object_name': 'Leptin',
                         'predicate': 'INHIBITS',
                         'subject_name': 'ghrelin'}},
             {'gs': {'localCount': 5, 'pval': 1.7678480207505842e-12},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '30364557'},
              'triple': {'id': 'ghrelin:INHIBITS:Leptin',
                         'object_name': 'Leptin',
                         'predicate': 'INHIBITS',
                         'subject_name': 'ghrelin'}},
             {'gs': {'localCount': 5, 'pval': 1.7678480207505842e-12},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '22473743'},
              'triple': {'id': 'ghrelin:INHIBITS:Leptin',
                         'object_name': 'Leptin',
                         'predicate': 'INHIBITS',
                         'subject_name': 'ghrelin'}},
             {'gs': {'localCount': 5, 'pval': 1.7678480207505842e-12},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '18719052'},
              'triple': {'id': 'ghrelin:INHIBITS:Leptin',
                         'object_name': 'Leptin',
                         'predicate': 'INHIBITS',
                         'subject_name': 'ghrelin'}},
             {'gs': {'localCount': 5, 'pval': 1.7678480207505842e-12},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},

4. Search by trait name and filter predicate

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/literature/gwas'
params = {'trait': 'Sleep duration', 'semmed_predicates': ['COEXISTS_WITH', 'TREATS'], 'fuzzy': False}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas) -[gl:GWAS_TO_LIT]->(lit:Literature) '
                       '<-[sl:SEM_TO_LIT]-(triple:SemmedTriple) '
                       '<-[gs:GWAS_SEM]-(gwas:Gwas) WHERE gwas.trait = "Sleep '
                       'duration" AND gs.pval < 0.001 AND triple.predicate IN '
                       "['COEXISTS_WITH','TREATS'] RETURN gwas {.id, .trait}, "
                       'gs {.pval, .localCount}, triple {.id, .subject_name, '
                       '.object_name, .predicate}, lit {.pubmed_id} SKIP 0 '
                       'LIMIT 50',
              'total_seconds': 0.022011},
 'results': [{'gs': {'localCount': 2, 'pval': 1.5405496014864184e-05},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '27353839'},
              'triple': {'id': 'Amyotrophic Lateral '
                               'Sclerosis:COEXISTS_WITH:Respiratory Failure',
                         'object_name': 'Respiratory Failure',
                         'predicate': 'COEXISTS_WITH',
                         'subject_name': 'Amyotrophic Lateral Sclerosis'}},
             {'gs': {'localCount': 3, 'pval': 2.9767304177141796e-09},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '26710225'},
              'triple': {'id': 'Chronic pain:COEXISTS_WITH:Dyssomnias',
                         'object_name': 'Dyssomnias',
                         'predicate': 'COEXISTS_WITH',
                         'subject_name': 'Chronic pain'}},
             {'gs': {'localCount': 3, 'pval': 2.9767304177141796e-09},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '26683236'},
              'triple': {'id': 'Chronic pain:COEXISTS_WITH:Dyssomnias',
                         'object_name': 'Dyssomnias',
                         'predicate': 'COEXISTS_WITH',
                         'subject_name': 'Chronic pain'}},
             {'gs': {'localCount': 2, 'pval': 4.776185960508883e-05},
              'gwas': {'id': 'ebi-a-GCST003839', 'trait': 'Sleep duration'},
              'lit': {'pubmed_id': '8604274'},
              'triple': {'id': 'Prednisone:TREATS:Infantile spasms',
                         'object_name': 'Infantile spasms',
                         '

/literature/gwas/pairwise

1
2
3
4
5
6
7
8
9
  Return information of traits in a Subject-Predicate-Object
  association graph.
  
  Args:
  - `blacklist` (True) and `semmantic_types`: The list of
  [semmantic types](https://mmtx.nlm.nih.gov/MMTx/semanticTypes.shtml) to exclude (`blacklist`=True) or include (`blacklist`=False).
  Leave `semmantic_types` blank to disable this.
  - `by_gwas_id` (False): If True search by Gwas.id
  - `fuzzy` (True): By default fuzzy match trait name.

Params

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{'assoc_gwas_id': typing.Union[str, NoneType],
 'assoc_trait': typing.Union[str, NoneType],
 'blacklist': <class 'bool'>,
 'by_gwas_id': <class 'bool'>,
 'fuzzy': <class 'bool'>,
 'gwas_id': typing.Union[str, NoneType],
 'limit': <class 'int'>,
 'pval_threshold': <class 'float'>,
 'semmantic_types': typing.List[str],
 'skip': <class 'int'>,
 'trait': typing.Union[str, NoneType]}

1. Search by trait name

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/literature/gwas/pairwise'
params = {'trait': 'Sleep duration', 'assoc_trait': 'Coronary heart disease', 'pval_threshold': 0.1, 'blacklist': True, 'semmantic_types': ['nusq', 'dsyn'], 'limit': 10, 'fuzzy': True}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[gs1:GWAS_SEM]->(s1:SemmedTriple) '
                       '-[:SEM_OBJ]->(st:SemmedTerm)<-[:SEM_SUB]- '
                       '(s2:SemmedTriple)<-[gs2:GWAS_SEM]-(assoc_gwas:Gwas) '
                       'WHERE gwas.trait =~ "(?i).*sleep duration.*" AND '
                       'assoc_gwas.trait =~ "(?i).*coronary heart disease.*" '
                       'AND gs1.pval < 0.1 AND gs2.pval < 0.1 AND NOT st.type '
                       "IN ['nusq','dsyn'] RETURN gwas {.id, .trait}, gs1 "
                       '{.pval, .localCount}, s1 {.id, .subject_name, '
                       '.object_name, .predicate}, st {.name, .type}, s2 {.id, '
                       '.subject_name, .object_name, .predicate}, gs2 {.pval, '
                       '.localCount}, assoc_gwas {.id, .trait} SKIP 0 LIMIT 10',
              'total_seconds': 30.02282},
 'results': [{'assoc_gwas': {'id': 'ieu-a-7',
                             'trait': 'Coronary heart disease'},
              'gs1': {'localCount': 2, 'pval': 1.6847636743477779e-06},
              'gs2': {'localCount': 2, 'pval': 0.05353609845042229},
              'gwas': {'id': 'ukb-a-9', 'trait': 'Sleep duration'},
              's1': {'id': 'NKRF:INTERACTS_WITH:Glutathione',
                     'object_name': 'Glutathione',
                     'predicate': 'INTERACTS_WITH',
                     'subject_name': 'NKRF'},
              's2': {'id': 'Glutathione:INHIBITS:Hydrogen Peroxide',
                     'object_name': 'Hydrogen Peroxide',
                     'predicate': 'INHIBITS',
                     'subject_name': 'Glutathione'},
              'st': {'name': 'Glutathione', 'type': 'aapp'}},
             {'assoc_gwas': {'id': 'ieu-a-9',
                             'trait': 'Coronary heart disease'},
              'gs1': {'localCount': 2, 'pval': 1.6847636743477779e-06},
              'gs2': {'localCount': 2, 'pval': 0.05353609845042229},
              'gwas': {'id': 'ukb-a-9', 'trait': 'Sleep duration'},
              's1': {'id': 'NKRF:INTERACTS_WITH:Glutathione',
                     'object_name': 'Glutathione',
                     'predicate': 'INTERACTS_WITH',
                     'subject_name': 'NKRF'},
              's2': {'id': 'Glutathione:INHIBITS:Hydrogen Peroxide',
                     'object_name': 'Hydrogen Peroxide

2. Search by Gwas.id

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/literature/gwas/pairwise'
params = {'gwas_id': 'ieu-a-1088', 'assoc_gwas_id': 'ieu-a-6', 'by_gwas_id': True, 'pval_threshold': 0.1, 'blacklist': True, 'semmantic_types': ['nusq', 'dsyn'], 'limit': 10, 'fuzzy': False}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[gs1:GWAS_SEM]->(s1:SemmedTriple) '
                       '-[:SEM_OBJ]->(st:SemmedTerm)<-[:SEM_SUB]- '
                       '(s2:SemmedTriple)<-[gs2:GWAS_SEM]-(assoc_gwas:Gwas) '
                       'WHERE gwas.id = "ieu-a-1088" AND assoc_gwas.id = '
                       '"ieu-a-6" AND gs1.pval < 0.1 AND gs2.pval < 0.1 AND '
                       "NOT st.type IN ['nusq','dsyn'] RETURN gwas {.id, "
                       '.trait}, gs1 {.pval, .localCount}, s1 {.id, '
                       '.subject_name, .object_name, .predicate}, st {.name, '
                       '.type}, s2 {.id, .subject_name, .object_name, '
                       '.predicate}, gs2 {.pval, .localCount}, assoc_gwas '
                       '{.id, .trait} SKIP 0 LIMIT 10',
              'total_seconds': 0.046638},
 'results': [{'assoc_gwas': {'id': 'ieu-a-6',
                             'trait': 'Coronary heart disease'},
              'gs1': {'localCount': 2, 'pval': 7.85111933510052e-06},
              'gs2': {'localCount': 3, 'pval': 8.329045522259548e-05},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              's1': {'id': 'Caffeine:INTERACTS_WITH:Melatonin',
                     'object_name': 'Melatonin',
                     'predicate': 'INTERACTS_WITH',
                     'subject_name': 'Caffeine'},
              's2': {'id': 'Melatonin:ASSOCIATED_WITH:Acute coronary syndrome',
                     'object_name': 'Acute coronary syndrome',
                     'predicate': 'ASSOCIATED_WITH',
                     'subject_name': 'Melatonin'},
              'st': {'name': 'Melatonin', 'type': 'horm'}},
             {'assoc_gwas': {'id': 'ieu-a-6',
                             'trait': 'Coronary heart disease'},
              'gs1': {'localCount': 2, 'pval': 7.85111933510052e-06},
              'gs2': {'localCount': 2, 'pval': 0.010943863540887833},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              's1': {'id': 'Caffeine:INTERACTS_WITH:Melatonin',
                     'object_name': 'Melatonin',
                     'predicate': 'INTERACTS_WITH',
                     'subject_name': 'Caffeine'},
              's2': {'id': 'Melatonin:ASSOCIATED_WITH:Myocardial Infarction',
                     'object_name': 'Myocardial Infarct

3. Whitelist semmantic types

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/literature/gwas/pairwise'
params = {'gwas_id': 'ieu-a-1088', 'assoc_gwas_id': 'ieu-a-6', 'by_gwas_id': True, 'pval_threshold': 0.1, 'blacklist': False, 'semmantic_types': ['aapp', 'orch'], 'limit': 10, 'fuzzy': False}
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{'metadata': {'empty_results': False,
              'query': 'MATCH (gwas:Gwas)-[gs1:GWAS_SEM]->(s1:SemmedTriple) '
                       '-[:SEM_OBJ]->(st:SemmedTerm)<-[:SEM_SUB]- '
                       '(s2:SemmedTriple)<-[gs2:GWAS_SEM]-(assoc_gwas:Gwas) '
                       'WHERE gwas.id = "ieu-a-1088" AND assoc_gwas.id = '
                       '"ieu-a-6" AND gs1.pval < 0.1 AND gs2.pval < 0.1 AND '
                       "st.type IN ['aapp','orch'] RETURN gwas {.id, .trait}, "
                       'gs1 {.pval, .localCount}, s1 {.id, .subject_name, '
                       '.object_name, .predicate}, st {.name, .type}, s2 {.id, '
                       '.subject_name, .object_name, .predicate}, gs2 {.pval, '
                       '.localCount}, assoc_gwas {.id, .trait} SKIP 0 LIMIT 10',
              'total_seconds': 0.09756},
 'results': [{'assoc_gwas': {'id': 'ieu-a-6',
                             'trait': 'Coronary heart disease'},
              'gs1': {'localCount': 2, 'pval': 1.6847636743477779e-06},
              'gs2': {'localCount': 4, 'pval': 1.3662128367286641e-05},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              's1': {'id': 'Aspirin:INHIBITS:Oral anticoagulants',
                     'object_name': 'Oral anticoagulants',
                     'predicate': 'INHIBITS',
                     'subject_name': 'Aspirin'},
              's2': {'id': 'Oral anticoagulants:INHIBITS:P2RY12',
                     'object_name': 'P2RY12',
                     'predicate': 'INHIBITS',
                     'subject_name': 'Oral anticoagulants'},
              'st': {'name': 'Oral anticoagulants', 'type': 'orch'}},
             {'assoc_gwas': {'id': 'ieu-a-6',
                             'trait': 'Coronary heart disease'},
              'gs1': {'localCount': 2, 'pval': 1.6847636743477779e-06},
              'gs2': {'localCount': 2, 'pval': 0.005275744013488293},
              'gwas': {'id': 'ieu-a-1088', 'trait': 'Sleep duration'},
              's1': {'id': 'Aspirin:INHIBITS:Oral anticoagulants',
                     'object_name': 'Oral anticoagulants',
                     'predicate': 'INHIBITS',
                     'subject_name': 'Aspirin'},
              's2': {'id': 'Oral anticoagulants:NEG_PREVENTS:Cerebrovascular '
                           'accident',
                     'object_name': 'Cerebrovas

Utility endpoints

/ping

1
  Test that you are connected to the API.

Params

1
{}

1. Default

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/ping'
params = None
r = requests.get(url, params=params)
r.raise_for_status()
r.json()

Results

1
True

/cypher/builder/plain

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  Execute a plain cypher query of the following form:
  
  ```
  MATCH
      (source_node:{source_meta_node})
      -[rel:{meta_rel}]-
      (target_node:{target_meta_node})
  {
      WHERE [where0] AND [where1] AND ...
  }
  RETURN p
  {
     ORDER BY [order_by0], [order_by1], ...
  }
  LIMIT {limit}
  ```
  
  NOTE:
  - Please check API documentation for usage examples.
  - where: A list of strings where each is a cypher WHERE clause.
  - order_by: A list of strings where each is a cypher ORDER BY clase.
  It is only valid if your request contains valid where clauses
  - limit: Currently we limit maximum paths to 1000 (default to 100)

Params

1
{'data': <class 'app.apis.cypher.models.CypherBuilderRequest'>}

1. Query for MR

Script

1
2
3
4
5
6
7
8
import requests


url = f'{EPIGRAPHDB_API_URL}/cypher/builder/plain'
data = {'source_meta_node': 'Gwas', 'target_meta_node': 'Gwas', 'meta_rel': 'MR', 'where': ['rel.pval < 1e-12'], 'order_by': ['rel.pval'], 'limit': 20}
r = requests.post(url, json=data)
r.raise_for_status()
r.json()

Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{'metadata': {'empty_results': False,
              'query': 'MATCH (source_node:Gwas) -[rel:MR]- (target_node:Gwas) '
                       'WHERE rel.pval < 1e-12 RETURN source_node, rel, '
                       'target_node ORDER BY rel.pval LIMIT 20',
              'total_seconds': 1.212506},
 'results': [{'rel': {'b': -0.11279977113008499,
                      'ci_low': -0.11457046121358871,
                      'ci_upp': -0.11102908104658127,
                      'log10pval': 9.223372036854776e+18,
                      'method': 'FE IVW',
                      'moescore': 1.0,
                      'nsnp': 2,
                      'pval': 0.0,
                      'se': 0.0009034122922457755,
                      'selection': 'DF'},
              'source_node': {'access': 'public',
                              'author': 'Neale',
                              'category': 'NA',
                              'consortium': 'Neale Lab',
                              'id': 'ukb-a-529',
                              'mr': '1',
                              'ncase': '2651',
                              'ncontrol': '334548',
                              'note': 'NA',
                              'nsnp': '10894596',
                              'population': 'European',
                              'priority': '1',
                              'sample_size': '337199',
                              'sex': 'Males and Females',
                              'subcategory': 'NA',
                              'trait': 'Diagnoses - main ICD10: H25 Senile '
                                       'cataract',
                              'unit': 'SD',
                              'year': '2017'},
              'target_node': {'access': 'public',
                              'author': 'Neale',
                              'category': 'NA',
                              'consortium': 'Neale Lab',
                              'id': 'ukb-a-173',
                              'mr': '1',
                              'ncase': '326',
                              'ncontrol': '336833',
                              'note': 'NA',
                              'nsnp': '10894596',
                              'population': 'European',
                              'priority': '1',
                              'sample_size': '337159',