Manager

class Manager(registry=None, metaregistry=None, collections=None, contexts=None, mismatches=None, base_url=None)[source]

Bases: object

A manager for functionality related to a metaregistry.

Instantiate a registry manager.

Parameters

Methods Summary

count_mappings([include_bioregistry])

Count the mappings for each registry.

get_appears_in(prefix)

Return a list of resources that this resources (has been annotated to) depends on.

get_bioportal_iri(prefix, identifier)

Get the Bioportal URL for the given CURIE.

get_bioregistry_iri(prefix, identifier)

Get a Bioregistry link.

get_canonical_for(prefix)

Get the prefixes for which this is annotated as canonical.

get_context(key)

Get a prescriptive context.

get_context_artifacts(key[, include_synonyms])

Get a prescriptive prefix map and pattern map.

get_converter(**kwargs)

Get a converter from this manager.

get_curie_pattern(prefix[, use_preferred])

Get the CURIE pattern for this resource.

get_curies_records([prefix_priority, ...])

Get a list of records for all resources in this manager.

get_default_iri(prefix, identifier)

Get the default URL for the given CURIE.

get_depends_on(prefix)

Return a list of resources that this resources (has been annotated to) depends on.

get_description(prefix, *[, use_markdown])

Get the description for the given prefix, it it's available.

get_example(prefix)

Get an example identifier, if it's available.

get_external(prefix, metaprefix)

Get the external data for the entry.

get_formatted_iri(metaprefix, prefix, identifier)

Get an IRI using the format in the metaregistry.

get_has_canonical(prefix)

Get the canonical prefix.

get_has_parts(prefix)

Get the children resources, if annotated.

get_homepage(prefix)

Get the description for the given prefix, it it's available.

get_internal_prefix_map()

Get an internal prefix map for RDF and SSSOM dumps.

get_iri(prefix[, identifier, priority, ...])

Get the best link for the CURIE pair, if possible.

get_license_conflicts()

Get license conflicts.

get_mapped_prefix(prefix, metaprefix)

Get the prefix mapped into another registry.

get_miriam_curie(prefix, identifier)

Get the identifiers.org CURIE for the given CURIE.

get_miriam_iri(prefix, identifier)

Get the identifiers.org URL for the given CURIE.

get_n2t_iri(prefix, identifier)

Get the name-to-thing URL for the given CURIE.

get_name(prefix)

Get the name for the given prefix, it it's available.

get_obo_health_url(prefix)

Get the OBO community health badge.

get_obofoundry_iri(prefix, identifier)

Get the OBO Foundry URL if possible.

get_ols_iri(prefix, identifier)

Get the OLS URL if possible.

get_part_of(prefix)

Get the parent resource, if annotated.

get_parts_collections()

Group resources' prefixes based on their part_of entries.

get_pattern(prefix)

Get the pattern for the given prefix, if it's available.

get_pattern_map(*[, prefix_priority, ...])

Get a mapping from prefixes to their regular expression patterns.

get_preferred_prefix(prefix)

Get the preferred prefix (e.g., with stylization) if it exists.

get_prefix_map(*[, uri_prefix_priority, ...])

Get a mapping from Bioregistry prefixes to their URI prefixes .

get_provided_by(prefix)

Get the resources that provide for the given prefix, or return none if the prefix can't be looked up.

get_provider_functions()

Return a mapping of provider functions.

get_providers(prefix, identifier)

Get all providers for the CURIE.

get_providers_list(prefix, identifier)

Get all providers for the CURIE.

get_provides_for(prefix)

Get the resource that the given prefix provides for, or return none if not a provider.

get_registry(metaprefix)

Get the metaregistry entry for the given prefix.

get_registry_description(metaprefix)

Get the registry description.

get_registry_homepage(metaprefix)

Get the registry homepage.

get_registry_invmap(metaprefix[, normalize])

Get a mapping from prefixes in another registry to Bioregistry prefixes.

get_registry_map(metaprefix)

Get a mapping from the Bioregistry prefixes to prefixes in another registry.

get_registry_name(metaprefix)

Get the registry name.

get_registry_provider_uri_format(metaprefix, ...)

Get the URL for the resource inside registry, if available.

get_registry_uri(metaprefix, prefix, identifier)

Get the URL to resolve the given prefix/identifier pair with the given resolver.

get_resource(prefix)

Get the Bioregistry entry for the given prefix.

get_reverse_prefix_map([include_prefixes, ...])

Get a reverse prefix map, pointing to canonical prefixes.

get_scholia_iri(prefix, identifier)

Get a Scholia IRI, if possible.

get_synonyms(prefix)

Get the synonyms for a given prefix, if available.

get_uri_format(prefix[, priority])

Get the URI format string for the given prefix, if it's available.

get_uri_prefix(prefix[, priority])

Get a well-formed URI prefix, if available.

get_versions()

Get a map of prefixes to versions.

has_no_terms(prefix)

Get if the entry has been annotated to not have own terms.

is_deprecated(prefix)

Return if the given prefix corresponds to a deprecated resource.

is_novel(prefix)

Check if the prefix is novel to the Bioregistry, i.e., it has no external mappings.

is_standardizable_curie(curie)

Check if a CURIE is validatable, but not necessarily standardized.

is_standardizable_identifier(prefix, identifier)

Check if the identifier is standardizable.

is_valid_curie(curie)

Check if a CURIE is standardized and valid.

is_valid_identifier(prefix, identifier)

Check if the pre-parsed CURIE is standardized valid.

lookup_from(metaprefix, metaidentifier[, ...])

Get the bioregistry prefix from an external prefix.

normalize_curie(curie[, sep])

Normalize the prefix and identifier in the CURIE.

normalize_parsed_curie(prefix, identifier)

Normalize a prefix/identifier pair.

normalize_prefix(prefix)

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

parse_curie(curie[, sep])

Parse a CURIE and normalize its prefix and identifier.

rasterize()

Build a dictionary representing the fully constituted registry.

rasterized_resource(prefix, resource)

Rasterize a resource.

read_contributors([direct_only])

Get a mapping from contributor ORCID identifiers to author objects.

write_registry()

Write the registry.

Methods Documentation

count_mappings(include_bioregistry=True)[source]

Count the mappings for each registry.

Return type

Counter[str]

get_appears_in(prefix)[source]

Return a list of resources that this resources (has been annotated to) depends on.

This is complementary to get_depends_on().

Parameters

prefix (str) – The prefix to look up

Return type

Optional[List[str]]

Returns

The list of resources this prefix has been annotated to appear in. This list could be incomplete, since curation of these fields can easily get out of sync with curation of the resource itself. However, false positives should be pretty rare.

get_bioportal_iri(prefix, identifier)[source]

Get the Bioportal URL for the given CURIE.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Optional[str]

Returns

A link to the Bioportal page

>>> from bioregistry import manager
>>> manager.get_bioportal_iri('chebi', '24431')
'https://bioportal.bioontology.org/ontologies/CHEBI/?p=classes&conceptid=http://purl.obolibrary.org/obo/CHEBI_24431'
get_bioregistry_iri(prefix, identifier)[source]

Get a Bioregistry link.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Optional[str]

Returns

A link to the Bioregistry resolver

get_canonical_for(prefix)[source]

Get the prefixes for which this is annotated as canonical.

Return type

Optional[List[str]]

get_context(key)[source]

Get a prescriptive context.

Parameters

key (str) – The identifier for the prescriptive context, e.g., obo.

Return type

Optional[Context]

Returns

A prescriptive context object, if available

get_context_artifacts(key, include_synonyms=None)[source]

Get a prescriptive prefix map and pattern map.

Return type

Tuple[Mapping[str, str], Mapping[str, str]]

get_converter(**kwargs)[source]

Get a converter from this manager.

Return type

Converter

get_curie_pattern(prefix, use_preferred=False)[source]

Get the CURIE pattern for this resource.

Parameters
  • prefix (str) – The prefix to look up

  • use_preferred (bool) – Should the preferred prefix be used instead of the Bioregistry prefix (if it exists)?

Return type

Optional[str]

Returns

The regular expression pattern to match CURIEs against

>>> from bioregistry import manager
>>> manager.get_curie_pattern("go")
'^go:\\d{7}$'
>>> manager.get_curie_pattern("go", use_preferred=True)
'^GO:\\d{7}$'
>>> manager.get_curie_pattern("kegg.compound")
'^kegg\\.compound:C\\d+$'
>>> manager.get_curie_pattern("KEGG.COMPOUND")
'^kegg\\.compound:C\\d+$'
get_curies_records(prefix_priority=None, uri_prefix_priority=None, include_prefixes=False, strict=False, remapping=None, blacklist=None)[source]

Get a list of records for all resources in this manager.

Parameters
  • prefix_priority (Optional[Sequence[str]]) – The order of metaprefixes OR “preferred” for choosing a primary prefix OR “default” for Bioregistry prefixes

  • uri_prefix_priority (Optional[Sequence[str]]) – The order of metaprefixes for choosing the primary URI prefix OR “default” for Bioregistry prefixes

  • include_prefixes (bool) – Should prefixes be included with colon delimiters? Setting this to true makes an “omni”-reverse prefix map that can be used to parse both URIs and CURIEs

  • strict (bool) – If true, errors on URI prefix collisions. If false, sends logging and skips them.

  • remapping (Optional[Mapping[str, str]]) – A mapping from bioregistry prefixes to preferred prefixes.

  • blacklist (Optional[Collection[str]]) – A collection of prefixes to skip

Return type

List[Record]

Returns

A list of records for curies.Converter

get_default_iri(prefix, identifier)[source]

Get the default URL for the given CURIE.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Optional[str]

Returns

A IRI string corresponding to the default provider, if available.

>>> from bioregistry import manager
>>> manager.get_default_iri('chebi', '24867')
'https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:24867'
get_depends_on(prefix)[source]

Return a list of resources that this resources (has been annotated to) depends on.

This is complementary to get_appears_in().

Parameters

prefix (str) – The prefix to look up

Return type

Optional[List[str]]

Returns

The list of resources this prefix has been annotated to depend on. This list could be incomplete, since curation of these fields can easily get out of sync with curation of the resource itself. However, false positives should be pretty rare.

>>> from bioregistry import manager
>>> assert "bfo" in manager.get_depends_on("foodon")
get_description(prefix, *, use_markdown=False)[source]

Get the description for the given prefix, it it’s available.

Return type

Optional[str]

get_example(prefix)[source]

Get an example identifier, if it’s available.

Return type

Optional[str]

get_external(prefix, metaprefix)[source]

Get the external data for the entry.

Return type

Mapping[str, Any]

get_formatted_iri(metaprefix, prefix, identifier)[source]

Get an IRI using the format in the metaregistry.

Parameters
  • metaprefix (str) – The metaprefix of the registry in the metaregistry

  • prefix (str) – A bioregistry prefix (will be mapped to the external one automatically)

  • identifier (str) – The identifier for the entity

Return type

Optional[str]

Returns

An IRI generated from the resolver_url format string of the registry, if it exists.

>>> from bioregistry import manager
>>> manager.get_formatted_iri("miriam", "hgnc", "16793")
'https://identifiers.org/hgnc:16793'
>>> manager.get_formatted_iri("n2t", "hgnc", "16793")
'https://n2t.net/hgnc:16793'
>>> manager.get_formatted_iri("obofoundry", "fbbt", "00007294")
'http://purl.obolibrary.org/obo/FBbt_00007294'
get_has_canonical(prefix)[source]

Get the canonical prefix.

Return type

Optional[str]

get_has_parts(prefix)[source]

Get the children resources, if annotated.

Return type

Optional[List[str]]

get_homepage(prefix)[source]

Get the description for the given prefix, it it’s available.

Return type

Optional[str]

get_internal_prefix_map()[source]

Get an internal prefix map for RDF and SSSOM dumps.

Return type

Mapping[str, str]

get_iri(prefix, identifier=None, *, priority=None, prefix_map=None, use_bioregistry_io=True, provider=None)[source]

Get the best link for the CURIE pair, if possible.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (Optional[str]) – The identifier in the CURIE. If identifier is given as None, then this function will assume that the first argument (prefix) is actually a full CURIE.

  • priority (Optional[Sequence[str]]) –

    A user-defined priority list. In addition to the metaprefixes in the Bioregistry corresponding to resources that are resolvers/lookup services, you can also use default to correspond to the first-party IRI and custom to refer to the custom prefix map. The default priority list is:

    1. Custom prefix map (custom) 1. First-party IRI (default) 2. Identifiers.org / MIRIAM (miriam) 3. Ontology Lookup Service (ols) 4. OBO PURL (obofoundry) 5. Name-to-Thing (n2t) 6. BioPortal (bioportal)

  • prefix_map (Optional[Mapping[str, str]]) – A custom prefix map to go with the custom key in the priority list

  • use_bioregistry_io (bool) – Should the bioregistry resolution IRI be used? Defaults to true.

  • provider (Optional[str]) – The provider code to use for a custom provider

Return type

Optional[str]

Returns

The best possible IRI that can be generated based on the priority list.

A pre-parse CURIE can be given as the first two arguments >>> from bioregistry import manager >>> manager.get_iri(“chebi”, “24867”) ‘https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:24867

A CURIE can be given directly as a single argument >>> manager.get_iri(“chebi:24867”) ‘https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:24867’

A priority list can be given >>> priority = [“obofoundry”, “default”, “bioregistry”] >>> manager.get_iri(“chebi:24867”, priority=priority) ‘http://purl.obolibrary.org/obo/CHEBI_24867’

A custom prefix map can be supplied. >>> prefix_map = {“chebi”: “https://example.org/chebi/”} >>> manager.get_iri(“chebi:24867”, prefix_map=prefix_map) ‘https://example.org/chebi/24867’ >>> manager.get_iri(“fbbt:00007294”) ‘https://flybase.org/cgi-bin/cvreport.pl?id=FBbt:00007294’

A custom prefix map can be supplied in combination with a priority list >>> prefix_map = {“lipidmaps”: “https://example.org/lipidmaps/”} >>> priority = [“obofoundry”, “custom”, “default”, “bioregistry”] >>> manager.get_iri(“chebi:24867”, prefix_map=prefix_map, priority=priority) ‘http://purl.obolibrary.org/obo/CHEBI_24867’ >>> manager.get_iri(“lipidmaps:1234”, prefix_map=prefix_map, priority=priority) ‘https://example.org/lipidmaps/1234’

A custom provider is given, which makes the Bioregistry very extensible >>> manager.get_iri(“chebi:24867”, provider=”chebi-img”) ‘https://www.ebi.ac.uk/chebi/displayImage.do?defaultImage=true&imageIndex=0&chebiId=24867’

get_license_conflicts()[source]

Get license conflicts.

get_mapped_prefix(prefix, metaprefix)[source]

Get the prefix mapped into another registry.

Return type

Optional[str]

get_miriam_curie(prefix, identifier)[source]

Get the identifiers.org CURIE for the given CURIE.

Return type

Optional[str]

get_miriam_iri(prefix, identifier)[source]

Get the identifiers.org URL for the given CURIE.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Optional[str]

Returns

A IRI string corresponding to the Identifiers.org, if the prefix exists and is mapped to MIRIAM.

get_n2t_iri(prefix, identifier)[source]

Get the name-to-thing URL for the given CURIE.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Optional[str]

Returns

A IRI string corresponding to the N2T resolve, if the prefix exists and is mapped to N2T.

>>> from bioregistry import manager
>>> manager.get_n2t_iri("chebi", "24867")
'https://n2t.net/chebi:24867'
get_name(prefix)[source]

Get the name for the given prefix, it it’s available.

Return type

Optional[str]

get_obo_health_url(prefix)[source]

Get the OBO community health badge.

Return type

Optional[str]

get_obofoundry_iri(prefix, identifier)[source]

Get the OBO Foundry URL if possible.

Parameters
  • prefix (str) – The prefix

  • identifier (str) – The identifier

Return type

Optional[str]

Returns

The OBO Foundry URL if the prefix can be mapped to an OBO Foundry entry

>>> from bioregistry import manager
>>> manager.get_obofoundry_iri('chebi', '24431')
'http://purl.obolibrary.org/obo/CHEBI_24431'

For entries where there’s a preferred prefix, it is respected.

>>> manager.get_obofoundry_iri('fbbt', '00007294')
'http://purl.obolibrary.org/obo/FBbt_00007294'
get_ols_iri(prefix, identifier)[source]

Get the OLS URL if possible.

Return type

Optional[str]

get_part_of(prefix)[source]

Get the parent resource, if annotated.

Return type

Optional[str]

get_parts_collections()[source]

Group resources’ prefixes based on their part_of entries.

Return type

Mapping[str, List[str]]

Returns

A dictionary with keys that appear as the values of Resource.part_of and whose values are lists of prefixes for resources that have the key as a value in its part_of field.

Warning

Many of the keys in this dictionary are valid Bioregistry prefixes, but this is not necessary. For example, ctd is one key that appears that explicitly has no prefix, since it corresponds to a resource and not a vocabulary.

get_pattern(prefix)[source]

Get the pattern for the given prefix, if it’s available.

Return type

Optional[str]

get_pattern_map(*, prefix_priority=None, include_synonyms=False, remapping=None, blacklist=None)[source]

Get a mapping from prefixes to their regular expression patterns.

Parameters
  • prefix_priority (Optional[Sequence[str]]) – The order of metaprefixes OR “preferred” for choosing a primary prefix OR “default” for Bioregistry prefixes

  • include_synonyms (bool) – Should synonyms of each prefix also be included as additional prefixes, but with the same URI prefix?

  • remapping (Optional[Mapping[str, str]]) – A mapping from prefixes to preferred prefixes.

  • blacklist (Optional[Collection[str]]) – Prefixes to skip

Return type

Mapping[str, str]

Returns

A mapping from prefixes to regular expression pattern strings.

get_preferred_prefix(prefix)[source]

Get the preferred prefix (e.g., with stylization) if it exists.

Return type

Optional[str]

get_prefix_map(*, uri_prefix_priority=None, prefix_priority=None, include_synonyms=False, remapping=None, blacklist=None)[source]

Get a mapping from Bioregistry prefixes to their URI prefixes .

Parameters
  • prefix_priority (Optional[Sequence[str]]) – The order of metaprefixes OR “preferred” for choosing a primary prefix OR “default” for Bioregistry prefixes

  • uri_prefix_priority (Optional[Sequence[str]]) – The order of metaprefixes for choosing the primary URI prefix OR “default” for Bioregistry prefixes

  • include_synonyms (bool) – Should synonyms of each prefix also be included as additional prefixes, but with the same URI prefix?

  • remapping (Optional[Mapping[str, str]]) – A mapping from Bioregistry prefixes to preferred prefixes.

  • blacklist (Optional[Collection[str]]) – Prefixes to skip

Return type

Mapping[str, str]

Returns

A mapping from prefixes to URI prefixes.

get_provided_by(prefix)[source]

Get the resources that provide for the given prefix, or return none if the prefix can’t be looked up.

Return type

Optional[List[str]]

get_provider_functions()[source]

Return a mapping of provider functions.

Return type

Mapping[str, Callable[[str, str], Optional[str]]]

get_providers(prefix, identifier)[source]

Get all providers for the CURIE.

Parameters
  • prefix (str) – the prefix in the CURIE

  • identifier (str) – the identifier in the CURIE

Return type

Dict[str, str]

Returns

A dictionary of IRIs associated with the CURIE

>>> from bioregistry import manager
>>> assert "chebi-img" in manager.get_providers("chebi", "24867")
get_providers_list(prefix, identifier)[source]

Get all providers for the CURIE.

Return type

Sequence[Tuple[str, str]]

get_provides_for(prefix)[source]

Get the resource that the given prefix provides for, or return none if not a provider.

Return type

Optional[str]

get_registry(metaprefix)[source]

Get the metaregistry entry for the given prefix.

Return type

Optional[Registry]

get_registry_description(metaprefix)[source]

Get the registry description.

Return type

Optional[str]

get_registry_homepage(metaprefix)[source]

Get the registry homepage.

Return type

Optional[str]

get_registry_invmap(metaprefix, normalize=False)[source]

Get a mapping from prefixes in another registry to Bioregistry prefixes.

Parameters
  • metaprefix (str) – Which external registry should be used?

  • normalize (bool) – Should the external prefixes be normalized?

Return type

Dict[str, str]

Returns

A mapping of external prefixes to bioregistry prefies

>>> from bioregistry import manager
>>> obofoundry_to_bioregistry = manager.get_registry_invmap("obofoundry", normalize=True)
>>> obofoundry_to_bioregistry["go"]
'go'
>>> obofoundry_to_bioregistry["geo"]
'geogeo'
get_registry_map(metaprefix)[source]

Get a mapping from the Bioregistry prefixes to prefixes in another registry.

Return type

Dict[str, str]

get_registry_name(metaprefix)[source]

Get the registry name.

Return type

Optional[str]

get_registry_provider_uri_format(metaprefix, prefix)[source]

Get the URL for the resource inside registry, if available.

Return type

Optional[str]

get_registry_uri(metaprefix, prefix, identifier)[source]

Get the URL to resolve the given prefix/identifier pair with the given resolver.

Return type

Optional[str]

get_resource(prefix)[source]

Get the Bioregistry entry for the given prefix.

Parameters

prefix (str) – The prefix to look up, which is normalized with normalize_prefix() before lookup in the Bioregistry

Return type

Optional[Resource]

Returns

The Bioregistry entry dictionary, which includes several keys cross-referencing other registries when available.

get_reverse_prefix_map(include_prefixes=False, strict=False)[source]

Get a reverse prefix map, pointing to canonical prefixes.

Return type

Mapping[str, str]

get_scholia_iri(prefix, identifier)[source]

Get a Scholia IRI, if possible.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Optional[str]

Returns

A link to the Scholia page

>>> from bioregistry import manager
>>> manager.get_scholia_iri("pubmed", "1234")
'https://scholia.toolforge.org/pubmed/1234'
>>> manager.get_scholia_iri("pdb", "1234")
None
get_synonyms(prefix)[source]

Get the synonyms for a given prefix, if available.

Return type

Optional[Set[str]]

get_uri_format(prefix, priority=None)[source]

Get the URI format string for the given prefix, if it’s available.

Return type

Optional[str]

get_uri_prefix(prefix, priority=None)[source]

Get a well-formed URI prefix, if available.

Return type

Optional[str]

get_versions()[source]

Get a map of prefixes to versions.

Return type

Mapping[str, str]

has_no_terms(prefix)[source]

Get if the entry has been annotated to not have own terms.

Return type

bool

is_deprecated(prefix)[source]

Return if the given prefix corresponds to a deprecated resource.

Return type

bool

is_novel(prefix)[source]

Check if the prefix is novel to the Bioregistry, i.e., it has no external mappings.

Return type

Optional[bool]

is_standardizable_curie(curie)[source]

Check if a CURIE is validatable, but not necessarily standardized.

Parameters

curie (str) – A compact URI

Return type

bool

Returns

If the CURIE can be standardized (e.g., prefix normalize and identifier normalized) then validated.

Standard CURIE >>> from bioregistry import manager >>> manager.is_standardizable_curie(”go:0000001”) True

Not a standard CURIE (i.e., no colon) >>> manager.is_standardizable_curie(“0000001”) False >>> manager.is_standardizable_curie(“GO_0000001”) False >>> manager.is_standardizable_curie(“PTM-0001”) False

Non-standardized prefix >>> manager.is_standardizable_curie(”GO:0000001”) True

Incorrect identifier >>> manager.is_standardizable_curie(”go:0001”) False

Banana scenario >>> manager.is_standardizable_curie(”go:GO:0000001”) True

Unknown prefix >>> manager.is_standardizable_curie(“xxx:yyy”) False

is_standardizable_identifier(prefix, identifier)[source]

Check if the identifier is standardizable.

Parameters
  • prefix (str) – The prefix from a compact URI

  • identifier (str) – The local unique identifer from a compact URI

Return type

bool

Returns

If the CURIE can be standardized (e.g., prefix normalize and identifier normalized) then validated.

Standard CURIE >>> from bioregistry import manager >>> manager.is_standardizable_identifier(“go”, “0000001”) True

Non-standardized prefix >>> manager.is_standardizable_identifier(“GO”, “0000001”) True

Incorrect identifier >>> manager.is_standardizable_identifier(“go”, “0001”) False

Banana scenario >>> manager.is_standardizable_identifier(“go”, “GO:0000001”) True

Unknown prefix >>> manager.is_standardizable_identifier(“xxx”, “yyy”) False

is_valid_curie(curie)[source]

Check if a CURIE is standardized and valid.

Parameters

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

Return type

bool

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 >>> from bioregistry import manager >>> manager.is_valid_curie(”go:0000001”) True

Not a standard CURIE (i.e., no colon) >>> manager.is_valid_curie(“0000001”) False >>> manager.is_valid_curie(“GO_0000001”) False >>> manager.is_valid_curie(“PTM-0001”) False

Non-standardized prefix >>> manager.is_valid_curie(”GO:0000001”) False

Incorrect identifier >>> manager.is_valid_curie(”go:0001”) False

Banana scenario >>> manager.is_valid_curie(”go:GO:0000001”) False

Unknown prefix >>> manager.is_valid_curie(“xxx:yyy”) False

is_valid_identifier(prefix, identifier)[source]

Check if the pre-parsed CURIE is standardized valid.

Parameters
  • prefix (str) – The prefix from a compact URI

  • identifier (str) – The local unique identifer from a compact URI

Return type

bool

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 >>> from bioregistry import manager >>> manager.is_valid_identifier(“go”, “0000001”) True

Non-standardized prefix >>> manager.is_valid_identifier(“GO”, “0000001”) False

Incorrect identifier >>> manager.is_valid_identifier(“go”, “0001”) False

Banana scenario >>> manager.is_valid_identifier(“go”, “GO:0000001”) False

Unknown prefix >>> manager.is_valid_identifier(“xxx”, “yyy”) False

lookup_from(metaprefix, metaidentifier, normalize=False)[source]

Get the bioregistry prefix from an external prefix.

Parameters
  • metaprefix (str) – The key for the external registry

  • metaidentifier (str) – The prefix in the external registry

  • normalize (bool) – Should external prefixes be normalized during lookup (e.g., lowercased)

Return type

Optional[str]

Returns

The bioregistry prefix (if it can be mapped)

>>> from bioregistry import manager
>>> manager.lookup_from("obofoundry", "GO")
'go'
>>> manager.lookup_from("obofoundry", "go")
None
>>> manager.lookup_from("obofoundry", "go", normalize=True)
'go'
normalize_curie(curie, sep=':')[source]

Normalize the prefix and identifier in the CURIE.

Return type

Optional[str]

normalize_parsed_curie(prefix, identifier)[source]

Normalize a prefix/identifier pair.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Union[Tuple[str, str], Tuple[None, None]]

Returns

A normalized prefix/identifier pair, conforming to Bioregistry standards. This means no redundant prefixes or bananas, all lowercase.

normalize_prefix(prefix)[source]

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

Parameters

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

Return type

Optional[str]

Returns

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.

parse_curie(curie, sep=':')[source]

Parse a CURIE and normalize its prefix and identifier.

Return type

Union[Tuple[str, str], Tuple[None, None]]

rasterize()[source]

Build a dictionary representing the fully constituted registry.

rasterized_resource(prefix, resource)[source]

Rasterize a resource.

Return type

Resource

read_contributors(direct_only=False)[source]

Get a mapping from contributor ORCID identifiers to author objects.

Return type

Mapping[str, Attributable]

write_registry()[source]

Write the registry.