From a6876a0adc4a1dab0d0c271845d6269d1e7c335b Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Tue, 19 Nov 2019 11:33:17 +0100 Subject: [PATCH] added method to extract entity code from uri --- biokb/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 biokb/utils.py diff --git a/biokb/utils.py b/biokb/utils.py new file mode 100644 index 0000000..41ec421 --- /dev/null +++ b/biokb/utils.py @@ -0,0 +1,10 @@ +def uri_to_code(uri: str) -> str: + """Translates URIs such as http://lcsb.uni.lu/biokb/entities/BTO_0001043 to BTO_0001043 + + Arguments: + uri {str} -- [description] + + Returns: + str -- [description] + """ + return uri.split('/')[-1] \ No newline at end of file -- GitLab