Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
concept[NAMESPACE] = _mapped[NAMESPACE]
concept[IDENTIFIER] = _mapped[IDENTIFIER]
concept[NAME] = _mapped[NAME]
return True
elif prefix == 'bel':
logger.warning('could not figure out how to map bel ! %s', name)
return False
if prefix == 'uniprot':
# assume identifier given as name
identifier = get_id_from_mnemonic(name)
if identifier is not None:
concept[IDENTIFIER] = identifier
return True
mnemomic = get_mnemonic(name, web_fallback=True)
if mnemomic is not None:
concept[IDENTIFIER] = name
concept[NAME] = mnemomic
return True
logger.warning('could not interpret uniprot name: %s', name)
return False
try:
id_name_mapping = get_name_id_mapping(prefix)
except (NoOboFoundry, MissingOboBuild) as e:
logger.warning('could not get namespace %s - %s', prefix, e)
return False
if id_name_mapping is None:
logger.warning('unhandled namespace in %s ! %s', prefix, name)
def _handle_identifier_not_name(*, concept, prefix, identifier) -> bool:
# Some namespaces are just too much of a problem at the moment to look up
if prefix in SKIP:
return False
if prefix in NO_NAMES:
concept[NAME] = concept[IDENTIFIER]
return True
if prefix == 'uniprot':
concept[NAME] = get_mnemonic(identifier)
return True
try:
id_name_mapping = get_id_name_mapping(prefix)
except (NoOboFoundry, MissingOboBuild):
return False
if id_name_mapping is None:
logger.warning('could not get names for prefix %s', prefix)
return False
name = id_name_mapping.get(identifier)
if name is None:
logger.warning('could not get name for %s:%s', prefix, identifier)
return False
concept[NAME] = name