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

added method to convert entity codes from colon to underscore syntax

parent 7b80bfc2
No related branches found
No related tags found
No related merge requests found
def uri_to_code(uri: str) -> str: def standarise_underscored_entity_code(entity_code: str) -> str:
"""Translates URIs such as http://lcsb.uni.lu/biokb/entities/BTO_0001043 to BTO_0001043 return entity_code.replace(':', '_', 1)
def uri_to_entity_code(uri: str) -> str:
"""Translates URIs such as http://lcsb.uni.lu/biokb/entities/BTO_0001043 to BTO:0001043
Replaces only the first underscore with colon.
Arguments: Arguments:
uri {str} -- [description] uri {str} -- [description]
...@@ -7,4 +12,4 @@ def uri_to_code(uri: str) -> str: ...@@ -7,4 +12,4 @@ def uri_to_code(uri: str) -> str:
Returns: Returns:
str -- [description] str -- [description]
""" """
return uri.split('/')[-1] return uri.split('/')[-1].replace('_', ':', 1)
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