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 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_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.
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 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.
Build a dictionary representing the fully constituted registry.
Write the registry.
Methods Documentation
- 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
- 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
- Return type
- 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_default_iri(prefix, identifier)[source]
Get the default URL for the given CURIE.
- Parameters
- Return type
- 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
- 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_formatted_iri(metaprefix, prefix, identifier)[source]
Get an IRI using the format in the metaregistry.
- Parameters
- Return type
- 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_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 CURIEidentifier (
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 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 (
Optional
[Mapping
[str
,str
]]) – A custom prefix map to go with thecustom
key in the priority listuse_bioregistry_io (
bool
) – Should the bioregistry resolution IRI be used? Defaults to true.
- Return type
- 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_n2t_iri(prefix, identifier)[source]
Get the name-to-thing URL for the given CURIE.
- Parameters
- Return type
- 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, identifier)[source]
Get the OBO Foundry URL if possible.
- Parameters
- Return type
- 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_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
- 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.
- 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
- 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.
- get_provides_for(prefix)[source]
Get the resource that the given prefix provides for, or return none if not a provider.
- get_registry_invmap(metaprefix, normalize=False)[source]
Get a mapping from prefixes in another registry to Bioregistry prefixes.
- get_registry_map(metaprefix)[source]
Get a mapping from the Bioregistry prefixes to prefixes in another registry.
- get_resource(prefix)[source]
Get the Bioregistry entry for the given prefix.
- Parameters
prefix (
str
) – The prefix to look up, which is normalized withnormalize_prefix()
before lookup in the Bioregistry- Return type
- 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
- Return type
- 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_uri_format(prefix, priority=None)[source]
Get the URI format string for the given prefix, if it’s available.
- has_no_terms(prefix)[source]
Get if the entry has been annotated to not have own terms.
- Return type
- is_deprecated(prefix)[source]
Return if the given prefix corresponds to a deprecated resource.
- Return type
- is_novel(prefix)[source]
Check if the prefix is novel to the Bioregistry, i.e., it has no external mappings.
- lookup_from(metaprefix, metaidentifier, normalize=False)[source]
Get the bioregistry prefix from an external prefix.
- Parameters
- Return type
- 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_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
- 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.