!pip install requests
import requests
doc = requests.post("https://biothings.ncats.io/text_mining_co_occurrence_kp/query",
json={
"q": [["PR:000010229", "UBERON:0000043"]],
"scopes": [["subject.PR", "object.PR"], ["subject.UBERON", "object.UBERON"],],
"fields": "association.ngd",
"dotfield": True,
}).json()
doc
[{'query': ['PR:000010229', 'UBERON:0000043'],
'_id': 'NCBIGene:8720-UBERON:0000043-0.6896383897934035',
'_score': 16.28219,
'association.ngd': 0.6896383897934035}]
Result is represented as a list of dictionaries.
The query field represents your input, e.g. ['MONOD:0015338', 'CHEBI:31522']
The association.ngd field represents the ngd score.
doc = requests.post("https://biothings.ncats.io/text_mining_co_occurrence_kp/query",
json={
"q": [["MONDO:0015338", "CHEBI:31522"], ["MONDO:0021669", "CHEBI:31522"], ["MONDO:0004993", "CHEBI:30674"]],
"scopes": [["subject.MONDO", "object.MONDO"], ["subject.CHEBI", "object.CHEBI"]],
"fields": "association.ngd",
"dotfield": True,
}).json()
doc
[{'query': ['MONDO:0015338', 'CHEBI:31522'],
'_id': 'CHEBI:31522-MONDO:0015338-0.6780940282884421',
'_score': 17.552275,
'association.ngd': 0.6780940282884421},
{'query': ['MONDO:0021669', 'CHEBI:31522'],
'_id': 'CHEBI:31522-MONDO:0021669-0.681381466532217',
'_score': 16.74813,
'association.ngd': 0.681381466532217},
{'query': ['MONDO:0004993', 'CHEBI:30674'],
'_id': 'CHEBI:30674-MONDO:0004993-0.7395095443131897',
'_score': 18.456928,
'association.ngd': 0.7395095443131897}]
It will be labeled as notfound
doc = requests.post("https://biothings.ncats.io/text_mining_co_occurrence_kp/query",
json={
"q": [["MONDO:001533", "CHEBI:31522"], ["MONDO:0021669", "CHEBI:31522"], ["MONDO:0004993", "CHEBI:30674"]],
"scopes": [["subject.MONDO", "object.MONDO"], ["subject.CHEBI", "object.CHEBI"]],
"fields": "association.ngd",
"dotfield": True,
}).json()
doc
[{'query': ['MONDO:001533', 'CHEBI:31522'], 'notfound': True},
{'query': ['MONDO:0021669', 'CHEBI:31522'],
'_id': 'CHEBI:31522-MONDO:0021669-0.681381466532217',
'_score': 16.74813,
'association.ngd': 0.681381466532217},
{'query': ['MONDO:0004993', 'CHEBI:30674'],
'_id': 'CHEBI:30674-MONDO:0004993-0.7395095443131897',
'_score': 18.456928,
'association.ngd': 0.7395095443131897}]