Skip to content
Snippets Groups Projects
Commit 1456aa81 authored by Carlos Vega's avatar Carlos Vega
Browse files

autopep8 applied

parent 05bfd92c
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ from SPARQLWrapper.SPARQLExceptions import EndPointNotFound, EndPointInternalErr
import logging
logger = logging.getLogger(__name__)
class BioKBClientException(Exception):
pass
......@@ -93,7 +94,7 @@ class BioKBservice(TextMiningService):
values = []
for result in results['results']['bindings']:
entity_code = uri_to_code(result['other_entity']['value'])
count = int(result['count']['value'])
co_occur = CoOccurrence(entity_code, count)
count = int(result['count']['value'])
co_occur = CoOccurrence(entity_code, count)
values.append(co_occur)
return values
def uri_to_code(uri: str) -> str:
"""Translates URIs such as http://lcsb.uni.lu/biokb/entities/BTO_0001043 to BTO_0001043
Arguments:
uri {str} -- [description]
Returns:
str -- [description]
"""
return uri.split('/')[-1]
\ No newline at end of file
return uri.split('/')[-1]
......@@ -3,6 +3,7 @@ from typing import List
from models.publication import Publication
from models.coocurrence import CoOccurrence
class TextMiningService(metaclass=ABCMeta):
def __init__(self, name: str, description: str):
......
class CoOccurrence:
def __init__(self, entity: str, score: float):
self.entity = entity
self.score = score
\ No newline at end of file
self.score = score
......@@ -4,4 +4,4 @@ class Publication:
self.pm_id = pm_id
self.doi = doi
self.preprint_id = preprint_id
self.other_id = other_id
\ No newline at end of file
self.other_id = other_id
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