normalize_prefix(prefix: str, *, use_preferred: bool = False) str | None[source]

Get the normalized prefix, or return None if not registered.

  • prefix – The prefix to normalize, which could come from Bioregistry, OBO Foundry, OLS, or any of the curated synonyms in the Bioregistry

  • use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.


The canonical Bioregistry prefix, it could be looked up. This will usually take precedence: MIRIAM, OBO Foundry / OLS, Custom except in a few cases, such as NCBITaxon.

This works for synonym prefixes, like:

>>> assert 'ncbitaxon' == normalize_prefix('taxonomy')

This works for common mistaken prefixes, like:

>>> assert 'pubchem.compound' == normalize_prefix('pubchem')

This works for prefixes that are often written many ways, like:

>>> assert 'eccode' == normalize_prefix('ec-code')
>>> assert 'eccode' == normalize_prefix('EC_CODE')

Get a “preferred” prefix:

>>> normalize_prefix("go", use_preferred=True)