diff --git a/idutils/normalizers.py b/idutils/normalizers.py index c85e81c..4d5aff7 100644 --- a/idutils/normalizers.py +++ b/idutils/normalizers.py @@ -260,6 +260,8 @@ def to_url(val, scheme, url_scheme="http"): pid = pid[len("wikidata:") :] if scheme == "openalex": url_scheme = "https" + if scheme == "ensembl": + pid = pid.split(".")[0] return landing_urls[scheme].format(scheme=url_scheme, pid=pid) elif scheme in ["purl", "url"]: return pid diff --git a/idutils/utils.py b/idutils/utils.py index 1f6b6b7..dae49e1 100644 --- a/idutils/utils.py +++ b/idutils/utils.py @@ -247,7 +247,7 @@ """ ensembl_regexp = re.compile( - r"({prefixes})(E|FM|G|GT|P|R|T)\d{{11}}$".format( + r"({prefixes})(E|FM|G|GT|P|R|T)\d{{11}}(\.\d+)?$".format( prefixes="|".join(ENSEMBL_PREFIXES) ) ) diff --git a/tests/test_idutils.py b/tests/test_idutils.py index 577b0f5..f67530b 100644 --- a/tests/test_idutils.py +++ b/tests/test_idutils.py @@ -460,6 +460,14 @@ "", "http://www.ensembl.org/id/ENSMUST00000017290", ), + ( + "ENSG00000012048.15", + [ + "ensembl", + ], + "", + "http://www.ensembl.org/id/ENSG00000012048", + ), ( "P02833", [