Skip to content
Snippets Groups Projects
Commit a0ef822c authored by AndiMajore's avatar AndiMajore
Browse files

updated open nedrex_v2 api route; circumvented nedrex version issue

parent c644b277
No related branches found
No related tags found
No related merge requests found
...@@ -86,8 +86,8 @@ class Command(BaseCommand): ...@@ -86,8 +86,8 @@ class Command(BaseCommand):
def populate(kwargs): def populate(kwargs):
nedrex_api_url_unlicenced= "https://nedrex-api-open.zbh.uni-hamburg.de/" nedrex_api_url_open= "https://api.nedrex.net/open"
nedrex_api_url_licenced = "https://nedrex-api-licenced.zbh.uni-hamburg.de/" nedrex_api_url_licenced = "https://nedrex-api-licenced.zbh.uni-hamburg.de/licensed"
data_dir = kwargs['data_dir'] data_dir = kwargs['data_dir']
...@@ -102,7 +102,7 @@ def populate(kwargs): ...@@ -102,7 +102,7 @@ def populate(kwargs):
cache = NodeCache() cache = NodeCache()
update = True if kwargs['update'] else False update = True if kwargs['update'] else False
importer = NedrexImporter(nedrex_api_url_licenced, nedrex_api_url_unlicenced, cache) importer = NedrexImporter(nedrex_api_url_licenced, nedrex_api_url_open, cache)
populator = DataPopulator(cache) populator = DataPopulator(cache)
total_n = 0 total_n = 0
...@@ -152,7 +152,7 @@ def populate(kwargs): ...@@ -152,7 +152,7 @@ def populate(kwargs):
if kwargs['protein_drug']: if kwargs['protein_drug']:
print('Importing PDIs from unlicenced NeDRexDB...') print('Importing PDIs from unlicenced NeDRexDB...')
n = NedrexImporter.import_drug_target_interactions(importer, n = NedrexImporter.import_drug_target_interactions(importer,
DatasetLoader.get_drug_target_nedrex(nedrex_api_url_unlicenced, False), DatasetLoader.get_drug_target_nedrex(nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} PDIs from unlicenced NeDRexDB') print(f'Imported {n} PDIs from unlicenced NeDRexDB')
...@@ -179,7 +179,7 @@ def populate(kwargs): ...@@ -179,7 +179,7 @@ def populate(kwargs):
print('Importing PDis from unlicenced NeDRexDB...') print('Importing PDis from unlicenced NeDRexDB...')
n = NedrexImporter.import_protein_disorder_associations(importer, n = NedrexImporter.import_protein_disorder_associations(importer,
DatasetLoader.get_protein_disorder_nedrex( DatasetLoader.get_protein_disorder_nedrex(
nedrex_api_url_unlicenced, False), nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} PDis from unlicenced NeDRexDB') print(f'Imported {n} PDis from unlicenced NeDRexDB')
...@@ -196,7 +196,7 @@ def populate(kwargs): ...@@ -196,7 +196,7 @@ def populate(kwargs):
if kwargs['drug_disorder']: if kwargs['drug_disorder']:
print('Importing DrDis from unlicenced NeDRexDB...') print('Importing DrDis from unlicenced NeDRexDB...')
n = NedrexImporter.import_drug_disorder_indications(importer, n = NedrexImporter.import_drug_disorder_indications(importer,
DatasetLoader.get_drug_disorder_nedrex(nedrex_api_url_unlicenced, False), DatasetLoader.get_drug_disorder_nedrex(nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} DrDis from unlicenced NeDRexDB') print(f'Imported {n} DrDis from unlicenced NeDRexDB')
...@@ -217,7 +217,7 @@ def populate(kwargs): ...@@ -217,7 +217,7 @@ def populate(kwargs):
if kwargs['protein_protein']: if kwargs['protein_protein']:
print('Importing PPIs from unlicenced NeDRexDB...') print('Importing PPIs from unlicenced NeDRexDB...')
n = NedrexImporter.import_protein_protein_interactions(importer, n = NedrexImporter.import_protein_protein_interactions(importer,
DatasetLoader.get_ppi_nedrex(nedrex_api_url_unlicenced, False), DatasetLoader.get_ppi_nedrex(nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} PPIs from unlicended NeDRexDB') print(f'Imported {n} PPIs from unlicended NeDRexDB')
......
...@@ -39,7 +39,9 @@ def get_ppi_biogrid(): ...@@ -39,7 +39,9 @@ def get_ppi_biogrid():
def get_nedrex_version(): def get_nedrex_version():
version = get_today_version() version = get_today_version()
try: try:
version = get_metadata()['version'] real_version = get_metadata()['version']
if real_version != "0.0.0":
version = real_version
except RetryError: except RetryError:
pass pass
return version return version
...@@ -50,7 +52,7 @@ def get_nedrex_source_version(source): ...@@ -50,7 +52,7 @@ def get_nedrex_source_version(source):
# TODO remove once fixed in nedrex db # TODO remove once fixed in nedrex db
if 'drug_central' in metadata: if 'drug_central' in metadata:
metadata['drugcentral'] = metadata['drug_central'] metadata['drugcentral'] = metadata['drug_central']
return metadata[source]['date'] return metadata[source]['date']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment