Skip to content

Commit

Permalink
fixing linting error
Browse files Browse the repository at this point in the history
  • Loading branch information
callahantiff committed Sep 8, 2021
1 parent 1aa8588 commit 8061320
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkt_kg/utils/kg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def gets_ontology_class_synonyms(graph: Graph) -> Tuple:
{'susceptibility to herpesvirus': 'hasExactSynonym', 'full upper lip': 'hasExactSynonym'}
"""

synonyms = dict()
synonyms: Dict = dict()
class_list = [x for x in graph if 'synonym' in str(x[1]).lower() and isinstance(x[0], URIRef)]
for x in class_list:
if str(x[2]).lower() in synonyms.keys(): synonyms[str(x[2]).lower()].append(str(x[0]))
Expand All @@ -160,7 +160,7 @@ def gets_ontology_class_synonyms(graph: Graph) -> Tuple:
return synonyms, synonym_type


def gets_ontology_class_dbxrefs(graph: Graph):
def gets_ontology_class_dbxrefs(graph: Graph) -> Tuple:
"""Queries a knowledge graph and returns a dictionary containing all owl:Class objects and their database
cross references (dbxref). Function also includes exact matches. A tuple of dictionaries: (1) contains dbxref and
exact matches (URIs and labels); and (2) contains dbxref/exactmatch uris and a string indicating the type (i.e.
Expand All @@ -176,14 +176,14 @@ def gets_ontology_class_dbxrefs(graph: Graph):
dbxref_type: A dict where keys are dbxref/exact uris; values are str indicating if the uri is dbxref or exact.
"""

dbx_uris = dict()
dbx_uris: Dict = dict()
dbx = [x for x in graph if 'hasdbxref' in str(x[1]).lower() if isinstance(x[0], URIRef)]
for x in dbx:
if str(x[2]).lower() in dbx_uris.keys(): dbx_uris[str(x[2]).lower()].append(str(x[0]))
else: dbx_uris[str(x[2]).lower()] = [str(x[0])]
dbx_type = {str(x[2]).lower(): 'DbXref' for x in dbx}

ex_uris = dict()
ex_uris: Dict = dict()
ex = [x for x in graph if 'exactmatch' in str(x[1]).lower() if isinstance([0], URIRef)]
for x in ex:
if str(x[2]).lower() in ex_uris.keys(): ex_uris[str(x[2]).lower()].append(str(x[0]))
Expand Down

0 comments on commit 8061320

Please sign in to comment.