NormalizedReference

class NormalizedReference(*, prefix: Prefix, identifier: str)[source]

Bases: Reference

Extends curies.Reference to normalize the prefix against the Bioregistry.

>>> NormalizedReference(prefix="go", identifier="0032571")
NormalizedReference(prefix='go', identifier='0032571')

With a name:

>>> NormalizedReference(prefix="go", identifier="0032571")
NormalizedReference(prefix='go', identifier='0032571')

Standardizes capitalization to lowercase:

>>> NormalizedReference(prefix="GO", identifier="0032571")
NormalizedReference(prefix='go', identifier='0032571')

Standardizes prefix synonyms to lowercase:

>>> NormalizedReference(prefix="GOBP", identifier="0032571")
NormalizedReference(prefix='go', identifier='0032571')

If you’re deriving a model, then pass a string, this can still work

>>> from pydantic import BaseModel
>>> class Derived(BaseModel):
...     reference: NormalizedReference
>>> Derived(reference="go:0032571")
Derived(reference=NormalizedReference(prefix='go', identifier='0032571'))

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes Summary

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Summary

validate_identifier(values)

Validate the identifier.

Attributes Documentation

model_config = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Documentation

classmethod validate_identifier(values: dict[str, str] | str | Reference) dict[str, str][source]

Validate the identifier.