Skip to content

Commit

Permalink
Deal with outdated chebi ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ddomingof committed Feb 10, 2019
1 parent 87f40b4 commit 12763c7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pathme/reactome/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def get_hgnc_node_info(gene):
"""
return gene.identifier, gene.symbol, HGNC

def get_valid_node_parameters(node, hgnc_manager, chebi_manager):

def get_valid_node_parameters(node, hgnc_manager, chebi_manager):
namespace = None

if 'uri_id' in node:
Expand Down Expand Up @@ -83,8 +83,14 @@ def get_valid_node_parameters(node, hgnc_manager, chebi_manager):
name = node['display_name']
if namespace == 'chebi' or namespace == 'CHEBI':
if not chebi_manager.get_chemical_by_chebi_name(node['display_name']):
chem = chebi_manager.get_chemical_by_chebi_id(identifier.replace('CHEBI:', ''))
name = chem.safe_name
identifier = identifier.replace('CHEBI:', '')
chem = chebi_manager.get_chemical_by_chebi_id(identifier)

# In case chebi id is outdated use the identifier as the name
if chem:
name = chem.safe_name
else:
name = identifier

else:
if 'name' in node:
Expand Down Expand Up @@ -112,6 +118,7 @@ def process_multiple_proteins(hgnc_entries: List) -> List:

return protein_group


def untar_file(file_path, export_folder):
"""Unzip file into a destination folder.
Expand Down

0 comments on commit 12763c7

Please sign in to comment.