is_valid_curie

is_valid_curie(curie: str) bool[source]

Check if a CURIE is standardized and valid.

Parameters:

curie – A compact URI of the form <prefix>:<local unique identifier>.

Returns:

If the CURIE is standardized in both syntax and semantics. This means that it uses the Bioregistry canonical prefix, does not have a redundant prefix, and if available, matches the Bioregistry’s regular expression pattern for identifiers.

Standard CURIE

>>> is_valid_curie("go:0000001")
True

Not a standard CURIE (i.e., no colon)

>>> is_valid_curie("0000001")
False
>>> is_valid_curie("GO_0000001")
False
>>> is_valid_curie("PTM-0001")
False

Non-standardized prefix

>>> is_valid_curie("GO:0000001")
False

Incorrect identifier

>>> is_valid_curie("go:0001")
False

Banana scenario

>>> is_valid_curie("go:GO:0000001")
False

Unknown prefix

>>> is_valid_curie("xxx:yyy")
False