{"library":"prefixcommons","title":"PrefixCommons Python API","description":"PrefixCommons is a Python API designed for working with ID prefixes, enabling the canonicalization, expansion, and contraction of CURIEs (Compact URIs). It is currently at version 0.1.12 and maintains an infrequent release cadence, often aligned with specific project requirements such as those from the Alliance of Genome Resources.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install prefixcommons"],"cli":null},"imports":["from prefixcommons.curie_util import expand_uri","from prefixcommons.curie_util import contract_uri","from prefixcommons.curie_util import read_biocontext"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from prefixcommons.curie_util import expand_uri, contract_uri, read_biocontext\n\n# Using the default prefix map\nexpanded_go = expand_uri('GO:0008150')\nprint(f\"Expanded GO: {expanded_go}\")\n\ncontracted_go = contract_uri('http://purl.obolibrary.org/obo/GO_0008150')\nprint(f\"Contracted GO: {contracted_go}\\n\")\n\n# Using a custom prefix map\ncustom_map = {'EXAMPLE': 'http://example.org/myterms/'}\nexpanded_custom = expand_uri('EXAMPLE:001', prefix_map=custom_map)\nprint(f\"Expanded custom: {expanded_custom}\")\n\n# Loading a biomedical context map\nbio_context = read_biocontext()\nexpanded_ncbi = expand_uri('NCBIGENE:12345', prefix_map=bio_context)\nprint(f\"Expanded NCBIGENE from bio_context: {expanded_ncbi}\")","lang":"python","description":"This quickstart demonstrates how to expand and contract CURIEs using the default prefix map provided by the library, as well as how to supply a custom prefix map or load a pre-defined biomedical context map for more specific use cases.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}