Skip to content

Commit

Permalink
Handle missing selventa mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaris committed Sep 26, 2023
1 parent ab88a63 commit e9ab61a
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions indra/sources/bel/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,14 @@ def get_db_refs_by_name(ns, name, node_data):
db_refs = {'UP': up_id}
# Map Selventa families and complexes to FamPlex
elif ns == 'SFAM':
sfam_id, xrefs = selventa_lookup[('SFAM', name)]
db_refs = {'SFAM': sfam_id}
indra_name = bel_to_indra.get(name)
try:
sfam_id, xrefs = selventa_lookup[('SFAM', name)]
db_refs = {"SFAM": sfam_id}
indra_name = bel_to_indra.get(name)
except KeyError:
indra_name = None
db_refs = None

if indra_name is None:
logger.info('Could not find mapping for BEL/SFAM family: '
'%s (%s)' % (name, node_data))
Expand Down Expand Up @@ -614,9 +619,15 @@ def get_db_refs_by_name(ns, name, node_data):
name = chebi_client.get_chebi_name_from_id(chebi_id)
# SDIS, SCHEM: Look up the ID and include it in the db_refs
elif ns in {'SDIS', 'SCHEM'}:
sid, xrefs = selventa_lookup[(ns, name)]
db_refs = xrefs.copy()
db_refs[ns] = sid
try:
sid, xrefs = selventa_lookup[(ns, name)]
db_refs = xrefs.copy()
db_refs[ns] = sid
except KeyError:
logger.info(
f"Could not map Selventa name {name} to ID for {ns}."
)
return name, None
elif ns == 'TEXT':
db_refs = {ns: name}
elif ns == 'TAX':
Expand Down

0 comments on commit e9ab61a

Please sign in to comment.