Manager
- class Manager(registry: None | str | Path | Mapping[str, Resource] = None, metaregistry: None | str | Path | Mapping[str, Registry] = None, collections: None | str | Path | Mapping[str, Collection] = None, contexts: None | str | Path | Mapping[str, Context] = None, mismatches: Mapping[str, Mapping[str, str]] | None = None, base_url: str | None = None)[source]
Bases:
object
A manager for functionality related to a metaregistry.
Instantiate a registry manager.
- Parameters:
registry – A custom registry. If none given, defaults to the Bioregistry.
metaregistry – A custom metaregistry. If none, defaults to the Bioregistry’s metaregistry.
collections – A custom collections dictionary. If none, defaults to the Bioregistry’s collections.
contexts – A custom contexts dictionary. If none, defaults to the Bioregistry’s contexts.
mismatches – A custom mismatches dictionary. If none, defaults to the Bioregistry’s mismatches.
base_url – The base URL.
Attributes Summary
Get the default converter.
Methods Summary
compress
(uri, *[, use_preferred])Parse a compact uniform resource identifier (CURIE) from a URI.
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_collection_name
(identifier)Get a collection's name.
get_context
(key)Get a prescriptive context.
get_context_artifacts
(key[, include_synonyms])Get a prescriptive prefix map and pattern map.
get_converter
(*[, prefix_priority, ...])Get a converter from this manager.
get_converter_from_context
(context[, ...])Get a converter based on a context.
get_curie_pattern
(prefix, *[, use_preferred])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_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_external_mappings
(source_metaprefix, ...)Get mappings between two external registries.
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_in_collections
(prefix)Get the identifiers for collections the prefix is in.
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_keywords
(prefix)Get keywords associated with a given prefix, if available.
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.
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.
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_rdf_uri
(prefix, identifier)Get the RDF URI for the given CURIE.
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_short_name
(metaprefix)Get the registry short name.
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_rrid_iri
(prefix, identifier)Get the RRID URL for the given CURIE.
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 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, use_preferred])Normalize the prefix and identifier in the CURIE.
normalize_parsed_curie
(prefix, identifier, *)Normalize a prefix/identifier pair.
normalize_prefix
(prefix, *[, use_preferred])Get the normalized prefix, or return None if not registered.
parse_curie
(curie, *[, sep, use_preferred])Parse a CURIE and normalize its prefix and identifier.
parse_uri
(uri, *[, use_preferred])Parse a compact identifier from a URI.
Build a dictionary representing the fully constituted registry.
rasterized_resource
(resource)Rasterize a resource.
read_contributors
([direct_only])Get a mapping from contributor ORCID identifiers to author objects.
Write the registry.
Attributes Documentation
- converter
Get the default converter.
Methods Documentation
- compress(uri: str, *, use_preferred: bool = False) str | None [source]
Parse a compact uniform resource identifier (CURIE) from a URI.
- Parameters:
uri – A valid URI
use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.
- Returns:
A CURIE, if the URI can be parsed
URI from an OBO PURL:
>>> from bioregistry import manager >>> manager.compress("http://purl.obolibrary.org/obo/DRON_00023232") 'dron:00023232'
URI from the OLS:
>>> manager.compress("https://www.ebi.ac.uk/ols/ontologies/ecao/terms?iri=http://purl.obolibrary.org/obo/ECAO_1") # noqa:E501 'ecao:1'
URI from native provider
>>> manager.compress("https://www.alzforum.org/mutations/1234") 'alzforum.mutation:1234'
Dog food:
>>> manager.compress("https://bioregistry.io/DRON:00023232") 'dron:00023232'
IRIs from Identifiers.org (https and http, colon and slash):
>>> manager.compress("https://identifiers.org/aop.relationships:5") 'aop.relationships:5' >>> manager.compress("http://identifiers.org/aop.relationships:5") 'aop.relationships:5' >>> manager.compress("https://identifiers.org/aop.relationships/5") 'aop.relationships:5' >>> manager.compress("http://identifiers.org/aop.relationships/5") 'aop.relationships:5'
URI from N2T >>> manager.compress(”https://n2t.net/aop.relationships:5”) ‘aop.relationships:5’
URI from an OBO PURL (with preferred prefix) >>> manager.compress(”http://purl.obolibrary.org/obo/DRON_00023232”, use_preferred=True) ‘DRON:00023232’
- count_mappings(include_bioregistry: bool = True) Counter[str] [source]
Count the mappings for each registry.
- get_appears_in(prefix: str) List[str] | None [source]
Return a list of resources that this resources (has been annotated to) depends on.
This is complementary to
get_depends_on()
.- Parameters:
prefix – The prefix to look up
- 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: str, identifier: str) str | None [source]
Get the Bioportal URL for the given CURIE.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- 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: str, identifier: str) str | None [source]
Get a Bioregistry link.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- Returns:
A link to the Bioregistry resolver
- get_canonical_for(prefix: str) List[str] | None [source]
Get the prefixes for which this is annotated as canonical.
- get_context(key: str) Context | None [source]
Get a prescriptive context.
- Parameters:
key – The identifier for the prescriptive context, e.g., obo.
- Returns:
A prescriptive context object, if available
- get_context_artifacts(key: str, include_synonyms: bool | None = None) Tuple[Mapping[str, str], Mapping[str, str]] [source]
Get a prescriptive prefix map and pattern map.
- get_converter(*, prefix_priority: Sequence[str] | None = None, uri_prefix_priority: Sequence[str] | None = None, include_prefixes: bool = False, strict: bool = False, remapping: Mapping[str, str] | None = None, rewiring: Mapping[str, str] | None = None, blacklist: Collection[str] | None = None) Converter [source]
Get a converter from this manager.
- Parameters:
prefix_priority – The order of metaprefixes OR “preferred” for choosing a primary prefix OR “default” for Bioregistry prefixes
uri_prefix_priority – The order of metaprefixes for choosing the primary URI prefix OR “default” for Bioregistry prefixes
include_prefixes – 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 – If true, errors on URI prefix collisions. If false, sends logging and skips them.
remapping – A mapping from bioregistry prefixes to preferred prefixes.
rewiring – A mapping from bioregistry prefixes to new URI prefixes.
blacklist – A collection of prefixes to skip
- Returns:
A list of records for
curies.Converter
- get_converter_from_context(context: str | Context, strict: bool = False, include_prefixes: bool = False) Converter [source]
Get a converter based on a context.
- get_curie_pattern(prefix: str, *, use_preferred: bool = False) str | None [source]
Get the CURIE pattern for this resource.
- Parameters:
prefix – The prefix to look up
use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.
- 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_default_iri(prefix: str, identifier: str) str | None [source]
Get the default URL for the given CURIE.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- Returns:
A IRI string corresponding to the default provider, if available.
>>> from bioregistry import manager >>> manager.get_default_iri('chebi', '24867') 'http://purl.obolibrary.org/obo/CHEBI_24867'
- get_depends_on(prefix: str) List[str] | None [source]
Return a list of resources that this resources (has been annotated to) depends on.
This is complementary to
get_appears_in()
.- Parameters:
prefix – The prefix to look up
- 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: str, *, use_markdown: bool = False) str | None [source]
Get the description for the given prefix, it it’s available.
- get_external(prefix: str, metaprefix: str) Mapping[str, Any] [source]
Get the external data for the entry.
- get_external_mappings(source_metaprefix: str, target_metaprefix: str) MappingsDiff [source]
Get mappings between two external registries.
- get_formatted_iri(metaprefix: str, prefix: str, identifier: str) str | None [source]
Get an IRI using the format in the metaregistry.
- Parameters:
metaprefix – The metaprefix of the registry in the metaregistry
prefix – A bioregistry prefix (will be mapped to the external one automatically)
identifier – The identifier for the entity
- 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_homepage(prefix: str) str | None [source]
Get the description for the given prefix, it it’s available.
- get_in_collections(prefix: str) List[str] | None [source]
Get the identifiers for collections the prefix is in.
- get_internal_prefix_map() Mapping[str, str] [source]
Get an internal prefix map for RDF and SSSOM dumps.
- get_iri(prefix: str, identifier: str | None = None, *, priority: Sequence[str] | None = None, prefix_map: Mapping[str, str] | None = None, use_bioregistry_io: bool = True, provider: str | None = None) str | None [source]
Get the best link for the CURIE pair, if possible.
- Parameters:
prefix – The prefix in the CURIE
identifier – 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 –
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 andcustom
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 – A custom prefix map to go with the
custom
key in the priority listuse_bioregistry_io – Should the bioregistry resolution IRI be used? Defaults to true.
provider – The provider code to use for a custom provider
- 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”) ‘http://purl.obolibrary.org/obo/CHEBI_24867’
A CURIE can be given directly as a single argument >>> manager.get_iri(“chebi:24867”) ‘http://purl.obolibrary.org/obo/CHEBI_24867’
A priority list can be given >>> priority = [“miriam”, “default”, “bioregistry”] >>> manager.get_iri(“chebi:24867”, priority=priority) ‘https://identifiers.org/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’
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_keywords(prefix: str) List[str] | None [source]
Get keywords associated with a given prefix, if available.
- get_license_conflicts() List[tuple[str, str | None, str | None, str | None]] [source]
Get license conflicts.
- get_mapped_prefix(prefix: str, metaprefix: str) str | None [source]
Get the prefix mapped into another registry.
- get_miriam_curie(prefix: str, identifier: str) str | None [source]
Get the identifiers.org CURIE for the given CURIE.
- get_miriam_iri(prefix: str, identifier: str) str | None [source]
Get the identifiers.org URL for the given CURIE.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- Returns:
A IRI string corresponding to the Identifiers.org, if the prefix exists and is mapped to MIRIAM.
- get_n2t_iri(prefix: str, identifier: str) str | None [source]
Get the name-to-thing URL for the given CURIE.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- 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_obofoundry_iri(prefix: str, identifier: str) str | None [source]
Get the OBO Foundry URL if possible.
- Parameters:
prefix – The prefix
identifier – The identifier
- 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_parts_collections() Mapping[str, List[str]] [source]
Group resources’ prefixes based on their
part_of
entries.- 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 itspart_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: str) str | None [source]
Get the pattern for the given prefix, if it’s available.
- get_pattern_map(*, prefix_priority: Sequence[str] | None = None, include_synonyms: bool = False, remapping: Mapping[str, str] | None = None, blacklist: Collection[str] | None = None) Mapping[str, str] [source]
Get a mapping from prefixes to their regular expression patterns.
- Parameters:
prefix_priority – The order of metaprefixes OR “preferred” for choosing a primary prefix OR “default” for Bioregistry prefixes
include_synonyms – Should synonyms of each prefix also be included as additional prefixes, but with the same URI prefix?
remapping – A mapping from prefixes to preferred prefixes.
blacklist – Prefixes to skip
- Returns:
A mapping from prefixes to regular expression pattern strings.
- get_preferred_prefix(prefix: str) str | None [source]
Get the preferred prefix (e.g., with stylization) if it exists.
- get_prefix_map(*, uri_prefix_priority: Sequence[str] | None = None, prefix_priority: Sequence[str] | None = None, include_synonyms: bool = False, remapping: Mapping[str, str] | None = None, rewiring: Mapping[str, str] | None = None, blacklist: Collection[str] | None = None) Mapping[str, str] [source]
Get a mapping from Bioregistry prefixes to their URI prefixes .
- Parameters:
prefix_priority – The order of metaprefixes OR “preferred” for choosing a primary prefix OR “default” for Bioregistry prefixes
uri_prefix_priority – The order of metaprefixes for choosing the primary URI prefix OR “default” for Bioregistry prefixes
include_synonyms – Should synonyms of each prefix also be included as additional prefixes, but with the same URI prefix?
remapping – A mapping from Bioregistry prefixes to preferred prefixes.
rewiring – A mapping from Bioregistry prefixes to URI prefixes.
blacklist – Prefixes to skip
- Returns:
A mapping from prefixes to URI prefixes.
- get_provided_by(prefix: str) List[str] | None [source]
Get the resources that provide for the given prefix, or return none if the prefix can’t be looked up.
- get_provider_functions() Mapping[str, Callable[[str, str], str | None]] [source]
Return a mapping of provider functions.
- get_providers(prefix: str, identifier: str) Dict[str, str] [source]
Get all providers for the CURIE.
- Parameters:
prefix – the prefix in the CURIE
identifier – the identifier in the CURIE
- 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: str, identifier: str) Sequence[Tuple[str, str]] [source]
Get all providers for the CURIE.
- get_provides_for(prefix: str) str | None [source]
Get the resource that the given prefix provides for, or return none if not a provider.
- get_rdf_uri(prefix: str, identifier: str) str | None [source]
Get the RDF URI for the given CURIE.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- Returns:
A IRI string corresponding to the canonical RDF provider, if available.
>>> from bioregistry import manager >>> manager.get_rdf_uri('edam', 'data_1153') 'http://edamontology.org/data_1153'
- get_registry(metaprefix: str) Registry | None [source]
Get the metaregistry entry for the given prefix.
- get_registry_invmap(metaprefix: str, normalize: bool = False) Dict[str, str] [source]
Get a mapping from prefixes in another registry to Bioregistry prefixes.
- Parameters:
metaprefix – Which external registry should be used?
normalize – Should the external prefixes be normalized?
- 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: str) Dict[str, str] [source]
Get a mapping from the Bioregistry prefixes to prefixes in another registry.
- get_registry_provider_uri_format(metaprefix: str, prefix: str) str | None [source]
Get the URL for the resource inside registry, if available.
- get_registry_uri(metaprefix: str, prefix: str, identifier: str) str | None [source]
Get the URL to resolve the given prefix/identifier pair with the given resolver.
- Parameters:
metaprefix – The metaprefix for an external registry
prefix – The Bioregistry prefix
identifier – The local unique identifier for a concept in the semantic space denoted by the prefix
- Returns:
The external registry’s URI (either for resolving or lookup) of the entity denoted by the prefix/identifier pair.
>>> from bioregistry import manager >>> manager.get_registry_uri("rrid", "antibodyregistry", "493771") 'https://scicrunch.org/resolver/RRID:AB_493771'
GO is not in RRID so this should return None
>>> manager.get_registry_uri("rrid", "GO", "493771")
- get_resource(prefix: str) Resource | None [source]
Get the Bioregistry entry for the given prefix.
- Parameters:
prefix – The prefix to look up, which is normalized with
normalize_prefix()
before lookup in the Bioregistry- Returns:
The Bioregistry entry dictionary, which includes several keys cross-referencing other registries when available.
- get_reverse_prefix_map(include_prefixes: bool = False, strict: bool = False) Mapping[str, str] [source]
Get a reverse prefix map, pointing to canonical prefixes.
- get_rrid_iri(prefix: str, identifier: str) str | None [source]
Get the RRID URL for the given CURIE.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- Returns:
A IRI string corresponding to the RRID resolver, if the prefix exists and is mapped to RRID.
>>> from bioregistry import manager >>> manager.get_rrid_iri("antibodyregistry", "493771") 'https://scicrunch.org/resolver/RRID:AB_493771'
- get_scholia_iri(prefix: str, identifier: str) str | None [source]
Get a Scholia IRI, if possible.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
- 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: str) Set[str] | None [source]
Get the synonyms for a given prefix, if available.
- get_uri_format(prefix: str, priority: Sequence[str] | None = None) str | None [source]
Get the URI format string for the given prefix, if it’s available.
- get_uri_prefix(prefix: str, priority: Sequence[str] | None = None) str | None [source]
Get a well-formed URI prefix, if available.
- is_deprecated(prefix: str) bool [source]
Return if the given prefix corresponds to a deprecated resource.
- is_novel(prefix: str) bool | None [source]
Check if the prefix is novel to the Bioregistry, i.e., it has no external mappings.
- is_standardizable_curie(curie: str) bool [source]
Check if a CURIE is validatable, but not necessarily standardized.
- Parameters:
curie – A compact URI
- 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: str, identifier: str) bool [source]
Check if the identifier is standardizable.
- Parameters:
prefix – The prefix from a compact URI
identifier – The local unique identifer from a compact URI
- 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: 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 >>> 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: str, identifier: str) bool [source]
Check if the pre-parsed CURIE is standardized valid.
- Parameters:
prefix – The prefix from a compact URI
identifier – The local unique identifer from a compact URI
- 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: str, metaidentifier: str, normalize: bool = False) str | None [source]
Get the bioregistry prefix from an external prefix.
- Parameters:
metaprefix – The key for the external registry
metaidentifier – The prefix in the external registry
normalize – Should external prefixes be normalized during lookup (e.g., lowercased)
- 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: str, *, sep: str = ':', use_preferred: bool = False) str | None [source]
Normalize the prefix and identifier in the CURIE.
- normalize_parsed_curie(prefix: str, identifier: str, *, use_preferred: bool = False) Tuple[str, str] | Tuple[None, None] [source]
Normalize a prefix/identifier pair.
- Parameters:
prefix – The prefix in the CURIE
identifier – The identifier in the CURIE
use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.
- Returns:
A normalized prefix/identifier pair, conforming to Bioregistry standards. This means no redundant prefixes or bananas, all lowercase.
- normalize_prefix(prefix: str, *, use_preferred: bool = False) str | None [source]
Get the normalized prefix, or return None if not registered.
- Parameters:
prefix – The prefix to normalize, which could come from Bioregistry, OBO Foundry, OLS, or any of the curated synonyms in the Bioregistry
use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.
- 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: str, *, sep: str = ':', use_preferred: bool = False) Tuple[str, str] | Tuple[None, None] [source]
Parse a CURIE and normalize its prefix and identifier.
- parse_uri(uri: str, *, use_preferred: bool = False) Tuple[str, str] | Tuple[None, None] [source]
Parse a compact identifier from a URI.
- Parameters:
uri – A valid URI
use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.
- Returns:
A pair of prefix/identifier, if can be parsed
IRI from an OBO PURL:
>>> from bioregistry import manager >>> manager.parse_uri("http://purl.obolibrary.org/obo/DRON_00023232") ('dron', '00023232')
IRI from the OLS:
>>> manager.parse_uri("https://www.ebi.ac.uk/ols/ontologies/ecao/terms?iri=http://purl.obolibrary.org/obo/ECAO_0107180") # noqa:E501 ('ecao', '0107180')
IRI from native provider
>>> manager.parse_uri("https://www.alzforum.org/mutations/1234") ('alzforum.mutation', '1234')
Dog food:
>>> manager.parse_uri("https://bioregistry.io/DRON:00023232") ('dron', '00023232')
IRIs from Identifiers.org (https and http, colon and slash):
>>> manager.parse_uri("https://identifiers.org/aop.relationships:5") ('aop.relationships', '5') >>> manager.parse_uri("http://identifiers.org/aop.relationships:5") ('aop.relationships', '5') >>> manager.parse_uri("https://identifiers.org/aop.relationships/5") ('aop.relationships', '5') >>> manager.parse_uri("http://identifiers.org/aop.relationships/5") ('aop.relationships', '5')
IRI from N2T >>> manager.parse_uri(”https://n2t.net/aop.relationships:5”) (‘aop.relationships’, ‘5’)
Handle either HTTP or HTTPS: >>> manager.parse_uri(”http://braininfo.rprc.washington.edu/centraldirectory.aspx?ID=268”) (‘neuronames’, ‘268’) >>> manager.parse_uri(”https://braininfo.rprc.washington.edu/centraldirectory.aspx?ID=268”) (‘neuronames’, ‘268’)
If you provide your own prefix map, you should pre-process the prefix map with:
>>> from curies import Converter, chain >>> prefix_map = {"chebi": "https://example.org/chebi:"} >>> converter = chain([Converter.from_prefix_map(prefix_map), manager.converter]) >>> converter.parse_uri("https://example.org/chebi:1234") ReferenceTuple(prefix='chebi', identifier='1234')
Corner cases:
>>> manager.parse_uri("https://omim.org/MIM:PS214100") ('omim.ps', '214100')
- rasterize() dict[str, Mapping[str, Any]] [source]
Build a dictionary representing the fully constituted registry.