Manager

class Manager(registry=None, metaregistry=None)[source]

Bases: object

A manager for functionality related to a metaregistry.

Instantiate a registry manager.

Parameters

Methods Summary

from_path(path)

Load a manager from the given path.

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_curie_pattern(prefix)

Get the CURIE pattern for this resource.

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_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_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, 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_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_pattern(prefix)

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

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

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_list(**kwargs)

Get the default priority prefix list.

get_prefix_map(*[, 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_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_resource(prefix)

Get the Bioregistry entry for the given prefix.

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.

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.

write_registry()

Write the registry.

Methods Documentation

classmethod from_path(path)[source]

Load a manager from the given path.

Return type

Manager

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_curie_pattern(prefix)[source]

Get the CURIE pattern for this resource.

Parameters

prefix (str) – The prefix to look up

Return type

Optional[str]

Returns

The regular expression pattern to match CURIEs against

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_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'
>>> manager.get_formatted_iri("scholia", "lipidmaps", "00000052")
'https://scholia.toolforge.org/lipidmaps/00000052'
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_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)[source]

Get the best link for the CURIE, 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.

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’

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_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_pattern(prefix)[source]

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

Return type

Optional[str]

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

Get a mapping from prefixes to their regular expression patterns.

Parameters
  • 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.

  • use_preferred (bool) – Should preferred prefixes be used? Set this to true if you’re in the OBO context.

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_list(**kwargs)[source]

Get the default priority prefix list.

Return type

List[Tuple[str, str]]

get_prefix_map(*, priority=None, include_synonyms=False, remapping=None, use_preferred=False)[source]

Get a mapping from Bioregistry prefixes to their URI prefixes .

Parameters
  • priority (Optional[Sequence[str]]) – A priority list for how to generate URI 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.

  • use_preferred (bool) – Should preferred prefixes be used? Set this to true if you’re in the OBO context.

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.

Return type

Dict[str, str]

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_invmap(metaprefix, normalize=False)[source]

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

Return type

Dict[str, str]

get_registry_map(metaprefix)[source]

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

Return type

Dict[str, 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_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]

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.

write_registry()[source]

Write the registry.