Skip to content

Replace CURIE inference mechanism with curies.Converter.from_extended_prefix_map #363

@matentzn

Description

@matentzn

Right now, we are using the bioregistry bimap, and old bioregistry tooling for getting from CU:RIE string to URIs and back.

@cthoyt has now introduced the concept of "extended prefix maps" which are much more powerful for guessing and standardising prefixes then the bimap.

Here is a snippet:

import curies

#: OBO context's extended prefix map
url = "https://github.com/biopragmatics/bioregistry/raw/main/exports/contexts/obo.epm.json"
converter = curies.Converter.from_extended_prefix_map(url)

>>> converter.expand("GO:1234567")
'http://purl.obolibrary.org/obo/GO_1234567'

>>> converter.compress("http://purl.obolibrary.org/obo/GO_1234567")
'GO:1234567'
>>> converter.compress("http://amigo.geneontology.org/amigo/term/GO:1234567")
'GO:1234567'

>>> converter.standardize_prefix("gomf")
'GO'
>>> converter.standardize_curie"gomf:1234567")
'GO:1234567'
>>> converter.standardize_uri("http://amigo.geneontology.org/amigo/term/GO:1234567")
'http://purl.obolibrary.org/obo/GO_1234567'

We should replace the old way of doing this with the new one.

For now, I still want to mirror the prefix map as part of the package rather than relying on bioregistry to doing the hosting/versioning.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions