normalize_curie
- normalize_curie(curie, *, sep=':', use_preferred=False)[source]
Normalize a CURIE.
- Parameters:
curie (
str
) – A compact URI (CURIE) in the form of <prefix:identifier>sep (
str
) – The separator for the CURIE. Defaults to the colon “:” however the slash “/” is sometimes used in Identifiers.org and the underscore “_” is used for OBO PURLs.use_preferred (
bool
) – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.
- Return type:
- Returns:
A normalized CURIE, if possible using the colon as a separator
>>> normalize_curie('pdb:1234') 'pdb:1234'
Fix commonly mistaken prefix >>> normalize_curie(‘pubchem:1234’) ‘pubchem.compound:1234’
Address banana problem >>> normalize_curie(’GO:GO:1234’) ‘go:1234’ >>> normalize_curie(’go:GO:1234’) ‘go:1234’ >>> normalize_curie(’go:go:1234’) ‘go:1234’ >>> normalize_curie(’go:1234’) ‘go:1234’
Address banana problem with OBO banana >>> normalize_curie(‘fbbt:FBbt:1234’) ‘fbbt:1234’ >>> normalize_curie(‘fbbt:fbbt:1234’) ‘fbbt:1234’ >>> normalize_curie(‘fbbt:1234’) ‘fbbt:1234’
Address banana problem with explit banana >>> normalize_curie(‘go.ref:GO_REF:1234’) ‘go.ref:1234’ >>> normalize_curie(‘go.ref:1234’) ‘go.ref:1234’
Parse OBO PURL curies >>> normalize_curie(‘GO_1234’, sep=”_”) ‘go:1234’
Use preferred >>> normalize_curie(‘GO_1234’, sep=”_”, use_preferred=True) ‘GO:1234’