Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from PGScatalog:master #99

Merged
merged 2 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions catalog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class Meta:

def parse_api(self):
import requests
response = requests.get('https://www.ebi.ac.uk/ols/api/ontologies/efo/terms?obo_id=%s'%self.id.replace('_', ':'))
response = requests.get(constants.USEFUL_URLS['OLS_ROOT_URL']+'/api/ontologies/efo/terms?obo_id=%s'%self.id.replace('_', ':'))
response = response.json()['_embedded']['terms']
if len(response) == 1:
response = response[0]
Expand Down Expand Up @@ -216,7 +216,7 @@ def display_label(self):
@property
def display_ext_url(self):
if not self.id.startswith('EFO'):
url = 'https://www.ebi.ac.uk/ols/ontologies/efo/terms?iri='+self.url
url = constants.USEFUL_URLS['OLS_ROOT_URL']+'/ontologies/efo/terms?iri='+self.url
else:
url = self.url
return '<a href="%s">%s</a>'%(url, self.id)
Expand Down
1 change: 1 addition & 0 deletions pgs_web/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'BAKER_URL' : 'https://baker.edu.au',
'EBI_URL' : 'https://www.ebi.ac.uk',
'HDR_UK_CAM_URL' : 'https://www.hdruk.ac.uk/about-us/our-locations/health-data-research-uk-hdr-uk-cambridge/',
'OLS_ROOT_URL' : 'https://www.ebi.ac.uk/ols4',
'PGS_CONTACT' : '[email protected]',
'PGS_FTP_ROOT' : 'ftp://ftp.ebi.ac.uk/pub/databases/spot/pgs',
'PGS_FTP_HTTP_ROOT' : 'https://ftp.ebi.ac.uk/pub/databases/spot/pgs',
Expand Down
8 changes: 4 additions & 4 deletions release/scripts/UpdateEFO.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
from catalog.models import EFOTrait, TraitCategory, EFOTrait_Ontology, Score
#from django.db import connection
from django.db import connections
from pgs_web import constants


class UpdateEFO:
Expand All @@ -18,7 +18,7 @@ class UpdateEFO:
direct_pgs_ids_key = 'direct_pgs_ids'
child_pgs_ids_key = 'child_pgs_ids'

ols_url_root = 'https://www.ebi.ac.uk/ols/api/ontologies/efo'
ols_url_root = constants.USEFUL_URLS['OLS_ROOT_URL']+'/api/ontologies/efo'

categories_info = {
'Biological process': { colour_key: '#BEBADA', parent_key: 'biological process', efo_key: ['GO_0008150'] },
Expand Down Expand Up @@ -104,8 +104,8 @@ def format_data(self, response):

# Mapped terms
new_mapped_terms_string = ''
if 'database_cross_reference' in response['annotation']:
new_mapped_terms = response['annotation']['database_cross_reference']
if 'has_dbxref' in response['annotation']:
new_mapped_terms = response['annotation']['has_dbxref']
if (new_mapped_terms):
new_mapped_terms_string = self.items_separator.join(sorted(new_mapped_terms))
data['mapped_terms'] = new_mapped_terms_string
Expand Down
Loading