Resource
- class Resource(*, prefix: str, name: str | None = None, description: str | None = None, pattern: str | None = None, uri_format: str | None = None, uri_format_resolvable: bool | None = None, rdf_uri_format: str | None = None, providers: list[Provider] | None = None, homepage: str | None = None, repository: str | None = None, contact: Attributable | None = None, contact_extras: list[Attributable] | None = None, contact_group_email: EmailStr | None = None, contact_page: str | None = None, owners: list[Organization] | None = None, example: str | None = None, example_extras: list[str] | None = None, example_decoys: list[str] | None = None, license: str | None = None, version: str | None = None, part_of: str | None = None, part_of_database: str | None = None, provides: str | None = None, download_owl: str | None = None, download_obo: str | None = None, download_json: str | None = None, download_rdf: str | AnnotatedURL | None = None, download_skos: str | AnnotatedURL | None = None, download_jskos: str | None = None, banana: str | None = None, banana_peel: str | None = None, deprecated: bool | None = None, mappings: dict[str, str] | None = None, synonyms: list[str] | None = None, keywords: list[str] | None = None, domain: Literal['chemical', 'tissue', 'reaction', 'gene', 'cell and cell line', 'cellular component', 'model', 'metabolite', 'organization', 'clinical trial', 'pathway', 'protein family', 'gene family', 'disease', 'data model', 'vaccine', 'multiple', 'variant', 'publication', 'protein complex', 'mirna', 'taxonomy', 'project', 'grant', 'classification', 'protein', 'study', 'relationship', 'relationship type', 'antibody', 'peptide', 'schema', 'strain', 'license', 'semantic web', 'geography', 'assay', 'ptm', 'bibliometrics', 'experiment', 'genetic code', 'mathematics', 'registry'] | None = None, references: list[str] | None = None, publications: list[Publication] | None = None, appears_in: list[str] | None = None, depends_on: list[str] | None = None, namespace_in_lui: bool | None = None, no_own_terms: bool | None = None, comment: str | None = None, contributor: Author | None = None, contributor_extras: list[Author] | None = None, reviewer: Author | None = None, reviewer_extras: list[Author] | None = None, proprietary: bool | None = None, has_canonical: str | None = None, preferred_prefix: str | None = None, mastodon: str | None = None, github_request_issue: int | None = None, logo: str | None = None, miriam: Mapping[str, Any] | None = None, n2t: Mapping[str, Any] | None = None, prefixcommons: Mapping[str, Any] | None = None, wikidata: Mapping[str, Any] | None = None, wikidata_entity: Mapping[str, Any] | None = None, go: Mapping[str, Any] | None = None, obofoundry: Mapping[str, Any] | None = None, bioportal: Mapping[str, Any] | None = None, ecoportal: Mapping[str, Any] | None = None, agroportal: Mapping[str, Any] | None = None, cropoct: Mapping[str, Any] | None = None, ols: Mapping[str, Any] | None = None, aberowl: Mapping[str, Any] | None = None, ncbi: Mapping[str, Any] | None = None, uniprot: Mapping[str, Any] | None = None, biolink: Mapping[str, Any] | None = None, cellosaurus: Mapping[str, Any] | None = None, ontobee: Mapping[str, Any] | None = None, cheminf: Mapping[str, Any] | None = None, fairsharing: Mapping[str, Any] | None = None, biocontext: Mapping[str, Any] | None = None, edam: Mapping[str, Any] | None = None, re3data: Mapping[str, Any] | None = None, hl7: Mapping[str, Any] | None = None, bartoc: Mapping[str, Any] | None = None, rrid: Mapping[str, Any] | None = None, lov: Mapping[str, Any] | None = None, zazuko: Mapping[str, Any] | None = None, togoid: Mapping[str, Any] | None = None, integbio: Mapping[str, Any] | None = None, pathguide: Mapping[str, Any] | None = None, tib: Mapping[str, Any] | None = None, biodivportal: Mapping[str, Any] | None = None)[source]
Bases:
BaseModelMetadata about an ontology, database, or other resource.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Attributes Summary
The point of this priority order is to figure out what URI format string to give back.
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Summary
Get the optional redundant prefix to go before an identifier.
Get the delimiter between the banana and the local unique identifier.
Get the BARTOC URI format string for this entry, if available.
Get the BioContext URI format string for this entry, if available.
Get the Bioregisry URI format string for this entry.
Get the BioSchemas JSON-LD.
Get the contact, if available.
Return the contact email, if available.
Return the contact GitHub handle, if available.
Return the contact name, if available.
Return the contact ORCiD, if available.
get_curie(identifier[, use_preferred])Get a CURIE for a local unique identifier in this resource's semantic space.
Get the default, first-party URI prefix.
get_default_uri(identifier)Return the default URI for the identifier.
get_description([use_markdown])Get the description for the given prefix, if available.
Get the domain.
Get a download link.
Get the download link for the latest JSKOS JSON file.
Get the download link for the latest OBO file.
Get the download link for the latest OBOGraph JSON file.
Get the download link for the latest OWL file.
get_download_rdf(...)Get the download link for the latest RDF file.
get_download_skos(...)Get the download link for the latest SKOS RDF file.
get_example(-> str | None)Get an example identifier, if it's available.
get_example_curie([use_preferred])Get an example CURIE, if an example identifier is available.
Aggregate manually curated examples with provider-specific examples.
Get an example IRI.
Get a list of examples.
get_external(metaprefix)Get an external registry.
get_extra_providers(*[, filter_known_inactive])Get a list of all extra providers.
Return the homepage, if available.
Get the MIRIAM/Identifiers.org prefix, if available.
Get keywords.
Get the legacy Identifiers.org URI format string for this entry, if possible.
Get the legacy Identifiers.org URI format string for this entry, if possible.
Get the license for the resource.
Get a license URL.
get_logo()Get the logo for the resource.
Get the group email.
get_mapped_prefix(metaprefix[, ...])Get the prefix for the given external.
Get the mappings to external registries, if available.
Get the Mastodon handle for the resource.
Get the Mastodon URL for the resource.
get_miriam_curie(identifier)Get the MIRIAM-flavored CURIE.
Get the MIRIAM/Identifiers.org prefix, if available.
get_miriam_uri_format([legacy_delimiter, ...])Get the Identifiers.org URI format string for this entry, if possible.
get_miriam_uri_prefix([legacy_delimiter, ...])Get the Identifiers.org URI prefix for this entry, if possible.
get_n2t_uri_format([legacy_protocol])Get the Name-to-Thing URI format string, if available.
get_name(...)Get the name for the given prefix, if it's available.
get_namespace_in_lui(...)Check if the namespace should appear in the LUI.
get_nt2_uri_prefix([legacy_protocol])Get the Name-to-Thing URI prefix for this entry, if possible.
Get the OBO preferred prefix, if this resource is mapped to the OBO Foundry.
Get the OBO Foundry prefix if available.
Get the OBO Foundry URI format string for this entry, if possible.
Get the OBO Foundry URI prefix for this entry, if possible.
get_ols_config([ontology_purl])Get a JSON configuration usable in the OLS.
Get the OLS prefix if available.
Get the OLS URI format string for this entry, if possible.
Get the OLS URI prefix for this entry, if possible.
Get owners.
Get the pattern for the given prefix, if it's available.
Get the compiled pattern for the given prefix, if it's available.
get_pattern_re_with_banana([strict])Get the compiled pattern for the prefix including a banana if available.
get_pattern_with_banana([strict])Get the pattern for the prefix including a banana if available.
Get the preferred prefix (e.g., with stylization) if it exists.
get_prefix_key(...)Get a key enriched by the given external resources' data.
Get the Prefix Commons prefix.
Get the Prefix Commons URI format string for this entry, if available.
get_priority_prefix([priority])Get a prioritized prefix.
Get a list of publications.
get_rdf_uri(identifier)Return the RDF URI for the identifier.
Get the URI format string for the given prefix for RDF usages.
Get the URI prefix for the prefix for RDF usages.
Return the repository, if available.
Get the RRID URI format.
Get the Scholia prefix, if available.
get_short_description([use_markdown])Get a short description.
Get synonyms.
Get the Twitter handle for the resource.
get_uri_format([priority])Get the URI format string for the given prefix, if it's available.
get_uri_formats(*[, enforce_w3c])Get the set of all URI format strings.
get_uri_prefix(-> str | None)Get a well-formed URI prefix, if available.
get_uri_prefixes(*[, enforce_w3c])Get the set of all URI prefixes.
Get the version for the resource.
Get the wikidata database mapping.
Check if this resource can be downloaded.
has_organization(reference)Check if this resource has an organization with the given ROR.
Check if this resource has an organization with the given ROR.
Return if the given prefix corresponds to a deprecated resource.
is_standardizable_identifier(identifier)Check that a local unique identifier can be normalized and also matches a prefix's pattern.
is_valid_identifier(identifier)Check that a local unique identifier is canonical, meaning no bananas.
miriam_standardize_identifier(identifier)Normalize the identifier for legacy usage with MIRIAM using the appropriate banana.
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
standardize_identifier(identifier)Normalize the identifier to not have a redundant prefix or banana.
Attributes Documentation
- DEFAULT_URI_FORMATTER_PRIORITY: ClassVar[Sequence[str]] = ('default', 'obofoundry', 'bioregistry')
The point of this priority order is to figure out what URI format string to give back. The “default” means it’s going to go into the metaregistry and try and find a real URI, not a re-directed one. If it can’t manage that, try and get an OBO foundry redirect (though note this is only applicable to a small number of prefixes corresponding to ontologies). Finally, if this doesn’t work, give a Bioregistry URI
- URI_FORMATTERS: ClassVar[Mapping[str, Callable[[Resource], str | None]]] = {'biocontext': <function Resource.get_biocontext_uri_format>, 'bioregistry': <function Resource.get_bioregistry_uri_format>, 'default': <function Resource.get_default_format>, 'miriam': <function Resource.get_miriam_uri_format>, 'miriam.legacy': <function Resource.get_legacy_miriam_uri_format>, 'miriam.legacy_banana': <function Resource.get_legacy_alt_miriam_uri_format>, 'n2t': <function Resource.get_n2t_uri_format>, 'obofoundry': <function Resource.get_obofoundry_uri_format>, 'ols': <function Resource.get_ols_uri_format>, 'prefixcommons': <function Resource.get_prefixcommons_uri_format>, 'rdf': <function Resource.get_rdf_uri_format>, 'rrid': <function Resource.get_rrid_uri_format>}
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Documentation
- get_banana() str | None[source]
Get the optional redundant prefix to go before an identifier.
A “banana” is an embedded prefix that isn’t actually part of the identifier. Usually this corresponds to the prefix itself, with some specific stylization such as in the case of FBbt. The banana does NOT include a colon “:” at the end
- Returns:
The banana, if the prefix is valid and has an associated banana.
Explicitly annotated banana
>>> from bioregistry import get_resource >>> get_resource("go.ref").get_banana() 'GO_REF'
Banana imported through OBO Foundry
>>> get_resource("go").get_banana() 'GO' >>> get_resource("vario").get_banana() 'VariO'
Banana inferred for OBO Foundry ontology
>>> get_resource("chebi").get_banana() 'CHEBI'
No banana, no namespace in LUI
>>> get_resource("pdb").get_banana() None
Banana is not inferred for OBO Foundry ontologies that were imported
>>> get_resource("ncit").get_banana() None >>> get_resource("ncbitaxon").get_banana() None
- get_banana_peel() str[source]
Get the delimiter between the banana and the local unique identifier.
- get_bartoc_uri_format() str | None[source]
Get the BARTOC URI format string for this entry, if available.
- Returns:
The BARTOC URI format string, if available.
>>> from bioregistry import get_resource >>> get_resource("ddc").get_bartoc_uri_format() 'http://dewey.info/class/$1/e23/'
- get_biocontext_uri_format() str | None[source]
Get the BioContext URI format string for this entry, if available.
- Returns:
The BioContext URI format string, if available.
>>> from bioregistry import get_resource >>> get_resource("hgmd").get_biocontext_uri_format() 'http://www.hgmd.cf.ac.uk/ac/gene.php?gene=$1'
- get_bioregistry_uri_format() str | None[source]
Get the Bioregisry URI format string for this entry.
- Returns:
A Bioregistry URI, if this can be resolved.
>>> from bioregistry import get_resource >>> get_resource("go").get_bioregistry_uri_format() 'https://bioregistry.io/go:$1'
- get_contact() Attributable | None[source]
Get the contact, if available.
- Returns:
A contact
>>> from bioregistry import get_resource >>> get_resource("frapo").get_contact().email 'silvio.peroni@unibo.it'
- get_contact_email() str | None[source]
Return the contact email, if available.
- Returns:
The resource’s contact email address, if it is available.
>>> from bioregistry import get_resource >>> get_resource("bioregistry").get_contact_email() # from bioregistry curation 'cthoyt@gmail.com' >>> get_resource("chebi").get_contact_email() 'amalik@ebi.ac.uk' >>> get_resource("frapo").get_contact_email() 'silvio.peroni@unibo.it'
- get_contact_github() str | None[source]
Return the contact GitHub handle, if available.
- Returns:
The resource’s contact GitHub handle, if it is available.
>>> from bioregistry import get_resource >>> get_resource("bioregistry").get_contact_github() # from bioregistry curation 'cthoyt' >>> get_resource("agro").get_contact_github() # from OBO Foundry 'marieALaporte'
- get_contact_name() str | None[source]
Return the contact name, if available.
- Returns:
The resource’s contact name, if it is available.
>>> from bioregistry import get_resource >>> get_resource("bioregistry").get_contact_name() # from bioregistry curation 'Charles Tapley Hoyt' >>> get_resource("chebi").get_contact_name() 'Adnan Malik' >>> get_resource("frapo").get_contact_name() 'Silvio Peroni'
- get_contact_orcid() str | None[source]
Return the contact ORCiD, if available.
- Returns:
The resource’s contact ORCiD, if it is available.
>>> from bioregistry import get_resource >>> get_resource("bioregistry").get_contact_orcid() # from bioregistry curation '0000-0003-4423-4370' >>> get_resource("aero").get_contact_orcid() '0000-0002-9551-6370' >>> get_resource("frapo").get_contact_orcid() '0000-0003-0530-4305'
- get_curie(identifier: str, use_preferred: bool = False) str[source]
Get a CURIE for a local unique identifier in this resource’s semantic space.
- Parameters:
identifier – A local unique identifier in this resource’s semantic space
use_preferred – Should preferred prefixes be used? Set this to true if you’re in the OBO context.
- Returns:
A CURIE for the given identifier
>>> import bioregistry >>> resource = bioregistry.get_resource("go") >>> resource.get_curie("0000001") 'go:0000001' >>> resource.get_curie("0000001", use_preferred=True) 'GO:0000001'
- get_default_format() str | None[source]
Get the default, first-party URI prefix.
- Returns:
The first-party URI prefix string, if available.
>>> from bioregistry import get_resource >>> get_resource("ncbitaxon").get_default_format() 'http://purl.obolibrary.org/obo/NCBITaxon_$1' >>> get_resource("go").get_default_format() 'http://purl.obolibrary.org/obo/GO_$1'
- get_default_uri(identifier: str) str | None[source]
Return the default URI for the identifier.
- Parameters:
identifier – The local identifier in the nomenclature represented by this resource
- Returns:
The first-party provider URI for the local identifier, if one can be constructed
>>> from bioregistry import get_resource >>> get_resource("chebi").get_default_uri("24867") 'http://purl.obolibrary.org/obo/CHEBI_24867'
- get_description(use_markdown: bool = False) str | None[source]
Get the description for the given prefix, if available.
- get_download_obo() str | None[source]
Get the download link for the latest OBO file.
- Returns:
A URL for an OBO text file download, if exists.
Get an ontology download link annotated directly in the Bioregistry:
>>> from bioregistry import get_resource >>> get_resource("caloha").get_download_obo() 'https://raw.githubusercontent.com/calipho-sib/controlled-vocabulary/master/caloha.obo'
Get an ontology download link from the OBO Foundry:
>>> get_resource("bfo").get_download_obo() 'http://purl.obolibrary.org/obo/bfo.obo'
Get ontology download link from OLS where OWL isn’t available
>>> get_resource("hpath").get_download_obo() 'https://raw.githubusercontent.com/Novartis/hpath/master/src/hpath.obo'
Get ontology download link in AberOWL but not OBO Foundry (note this might change over time so the exact value isn’t used in the doctest):
>>> url = get_resource("dermo").get_download_obo() >>> assert url is not None and url.startswith("http://aber-owl.net/media/ontologies/DERMO")
- get_download_obograph() str | None[source]
Get the download link for the latest OBOGraph JSON file.
- get_download_owl() str | None[source]
Get the download link for the latest OWL file.
- Returns:
A URL for an OWL file download, if exists.
Get an ontology download link annotated directly in the Bioregistry:
>>> from bioregistry import get_resource >>> get_resource("orphanet.ordo").get_download_owl() 'http://www.orphadata.org/data/ORDO/ordo_orphanet.owl'
Get an ontology download link from the OBO Foundry:
>>> get_resource("mod").get_download_owl() 'http://purl.obolibrary.org/obo/mod.owl'
Get ontology download link in AberOWL but not OBO Foundry (note this might change over time so the exact value isn’t used in the doctest):
>>> url = get_resource("birnlex").get_download_owl() >>> assert url is not None and url.startswith( ... "http://aber-owl.net/media/ontologies/BIRNLEX/" ... )
- get_download_rdf(*, get_format: Literal[True] = False) str | AnnotatedURL | None[source]
- get_download_rdf(*, get_format: Literal[False] = False) str | None
Get the download link for the latest RDF file.
- get_download_skos(*, get_format: Literal[True] = False) str | AnnotatedURL | None[source]
- get_download_skos(*, get_format: Literal[False] = False) str | None
Get the download link for the latest SKOS RDF file.
- get_example(*, strict: Literal[False] = False) str | None[source]
- get_example(*, strict: Literal[True] = True) str
Get an example identifier, if it’s available.
- get_example_curie(use_preferred: bool = False) str | None[source]
Get an example CURIE, if an example identifier is available.
- Parameters:
use_preferred – Should the preferred prefix be used instead of the Bioregistry prefix (if it exists)?
- Returns:
An example CURIE for this resource
- get_example_extras() list[str][source]
Aggregate manually curated examples with provider-specific examples.
- get_extra_providers(*, filter_known_inactive: bool = False) list[Provider][source]
Get a list of all extra providers.
- get_identifiers_org_prefix() str | None[source]
Get the MIRIAM/Identifiers.org prefix, if available.
- Returns:
The Identifiers.org/MIRIAM prefix corresponding to the prefix, if mappable.
>>> from bioregistry import get_resource >>> get_resource("chebi").get_identifiers_org_prefix() 'chebi' >>> get_resource("ncbitaxon").get_identifiers_org_prefix() 'taxonomy' >>> assert get_resource("bioregistry").get_identifiers_org_prefix() is None
- get_legacy_alt_miriam_uri_format() str | None[source]
Get the legacy Identifiers.org URI format string for this entry, if possible.
- get_legacy_miriam_uri_format() str | None[source]
Get the legacy Identifiers.org URI format string for this entry, if possible.
- get_mapped_prefix(metaprefix: str, use_obo_preferred: bool = True) str | None[source]
Get the prefix for the given external.
- Parameters:
metaprefix – The metaprefix for the external resource
use_obo_preferred – Whether to use OBO preferred prefix
- Returns:
The prefix in the external registry, if it could be mapped
>>> from bioregistry import get_resource >>> get_resource("chebi").get_mapped_prefix("wikidata") 'P683' >>> get_resource("chebi").get_mapped_prefix("obofoundry") 'CHEBI'
- get_mastodon() str | None[source]
Get the Mastodon handle for the resource.
- Returns:
The Mastodon handle. Note that this does not include a leading
@
>>> from bioregistry import get_resource >>> get_resource("go").get_mastodon() 'go@genomic.social'
- get_mastodon_url() str | None[source]
Get the Mastodon URL for the resource.
- Returns:
The URL link for the mastodon account, if available
>>> from bioregistry import get_resource >>> get_resource("go").get_mastodon_url() 'https://genomic.social/@go'
- get_miriam_uri_format(legacy_delimiter: bool = False, legacy_protocol: bool = False, legacy_banana: bool = False) str | None[source]
Get the Identifiers.org URI format string for this entry, if possible.
- Parameters:
legacy_protocol – If true, uses HTTP
legacy_delimiter – If true, uses a slash delimiter for CURIEs instead of colon
legacy_banana – If true, uses a slash delimiter for CURIEs and a redundant namespace in prefix
- Returns:
The Identifiers.org/MIRIAM URL format string, if available.
>>> from bioregistry import get_resource >>> get_resource("ncbitaxon").get_miriam_uri_format() 'https://identifiers.org/taxonomy:$1' >>> get_resource("go").get_miriam_uri_format() 'https://identifiers.org/GO:$1' >>> assert get_resource("sty").get_miriam_uri_format() is None
- get_miriam_uri_prefix(legacy_delimiter: bool = False, legacy_protocol: bool = False, legacy_banana: bool = False) str | None[source]
Get the Identifiers.org URI prefix for this entry, if possible.
- Parameters:
legacy_protocol – If true, uses HTTP
legacy_delimiter – If true, uses a slash delimiter for CURIEs instead of colon
legacy_banana – If true, uses a slash delimiter for CURIEs and a redundant namespace in prefix
- Returns:
The Identifiers.org/MIRIAM URI prefix, if available.
>>> from bioregistry import get_resource >>> get_resource("ncbitaxon").get_miriam_uri_prefix() 'https://identifiers.org/taxonomy:' >>> get_resource("go").get_miriam_uri_prefix() 'https://identifiers.org/GO:' >>> get_resource("doid").get_miriam_uri_prefix(legacy_banana=True) 'https://identifiers.org/doid/DOID:' >>> get_resource("vario").get_miriam_uri_prefix(legacy_banana=True) 'https://identifiers.org/vario/VariO:' >>> get_resource("cellosaurus").get_miriam_uri_prefix(legacy_banana=True) 'https://identifiers.org/cellosaurus/CVCL_' >>> get_resource("doid").get_miriam_uri_prefix(legacy_delimiter=True) 'https://identifiers.org/DOID/' >>> assert get_resource("sty").get_miriam_uri_prefix() is None
- get_n2t_uri_format(legacy_protocol: bool = False) str | None[source]
Get the Name-to-Thing URI format string, if available.
- get_name(*, provenance: Literal[False] = False, strict: Literal[False] = False) None | str[source]
- get_name(*, provenance: Literal[True] = False, strict: Literal[False] = False) None | MetaprefixAnnotatedValue[str]
- get_name(*, provenance: Literal[False] = False, strict: Literal[True] = False) str
- get_name(*, provenance: Literal[True] = False, strict: Literal[True] = False) MetaprefixAnnotatedValue[str]
Get the name for the given prefix, if it’s available.
- get_namespace_in_lui(*, provenance: Literal[True] = True) MetaprefixAnnotatedValue[bool] | None[source]
- get_namespace_in_lui(*, provenance: Literal[False] = False) bool | None
Check if the namespace should appear in the LUI.
- get_nt2_uri_prefix(legacy_protocol: bool = False) str | None[source]
Get the Name-to-Thing URI prefix for this entry, if possible.
- get_obo_preferred_prefix() str | None[source]
Get the OBO preferred prefix, if this resource is mapped to the OBO Foundry.
- get_obofoundry_prefix() str | None[source]
Get the OBO Foundry prefix if available.
- Returns:
The OBO prefix, if available.
>>> from bioregistry import get_resource >>> get_resource("go").get_obofoundry_prefix() # standard 'GO' >>> get_resource("aao").get_obofoundry_prefix() # standard but deprecated 'AAO' >>> get_resource("ncbitaxon").get_obofoundry_prefix() # mixed case 'NCBITaxon' >>> assert get_resource("sty").get_obofoundry_prefix() is None
- get_obofoundry_uri_format() str | None[source]
Get the OBO Foundry URI format string for this entry, if possible.
- Returns:
The OBO PURL format string, if available.
>>> from bioregistry import get_resource >>> get_resource("go").get_obofoundry_uri_format() # standard 'http://purl.obolibrary.org/obo/GO_$1' >>> get_resource("ncbitaxon").get_obofoundry_uri_format() # mixed case 'http://purl.obolibrary.org/obo/NCBITaxon_$1' >>> assert get_resource("sty").get_obofoundry_uri_format() is None
- get_obofoundry_uri_prefix() str | None[source]
Get the OBO Foundry URI prefix for this entry, if possible.
- Returns:
The OBO PURL URI prefix corresponding to the prefix, if mappable.
>>> from bioregistry import get_resource >>> get_resource("go").get_obofoundry_uri_prefix() # standard 'http://purl.obolibrary.org/obo/GO_' >>> get_resource("ncbitaxon").get_obofoundry_uri_prefix() # mixed case 'http://purl.obolibrary.org/obo/NCBITaxon_' >>> assert get_resource("sty").get_obofoundry_uri_prefix() is None
- get_ols_config(ontology_purl: str | None = None) OlsConfig[source]
Get a JSON configuration usable in the OLS.
- get_ols_uri_format() str | None[source]
Get the OLS URI format string for this entry, if possible.
- Returns:
The OLS format string, if available.
Warning
This doesn’t have a normal form, so it only works for OBO Foundry at the moment.
>>> from bioregistry import get_resource >>> get_resource("go").get_ols_uri_format() # standard 'https://www.ebi.ac.uk/ols/ontologies/go/terms?iri=http://purl.obolibrary.org/obo/GO_$1' >>> get_resource("ncbitaxon").get_ols_uri_format() # mixed case 'https://www.ebi.ac.uk/ols/ontologies/ncbitaxon/terms?iri=http://purl.obolibrary.org/obo/NCBITaxon_$1' >>> assert get_resource("sty").get_ols_uri_format() is None
- get_ols_uri_prefix() str | None[source]
Get the OLS URI prefix for this entry, if possible.
- Returns:
The OLS URI prefix, if available.
Warning
This doesn’t have a normal form, so it only works for OBO Foundry at the moment.
>>> from bioregistry import get_resource >>> get_resource("go").get_ols_uri_prefix() # standard 'https://www.ebi.ac.uk/ols/ontologies/go/terms?iri=http://purl.obolibrary.org/obo/GO_' >>> get_resource("ncbitaxon").get_ols_uri_prefix() # mixed case 'https://www.ebi.ac.uk/ols/ontologies/ncbitaxon/terms?iri=http://purl.obolibrary.org/obo/NCBITaxon_' >>> assert get_resource("sty").get_ols_uri_prefix() is None
- get_owners() list[Organization][source]
Get owners.
- get_pattern() str | None[source]
Get the pattern for the given prefix, if it’s available.
- Returns:
The pattern for the prefix, if it is available, using the following order of preference:
Custom
MIRIAM
Wikidata
BARTOC
- get_pattern_re() Pattern[str] | None[source]
Get the compiled pattern for the given prefix, if it’s available.
- get_pattern_re_with_banana(strict: bool = True) Pattern[str] | None[source]
Get the compiled pattern for the prefix including a banana if available.
Warning
This function is meant to mediate backwards compatibility with legacy MIRIAM/Identifiers.org standards. New projects should not use redundant prefixes in their local unique identifiers.
- Parameters:
strict – If True (default), and a banana exists for the prefix, the banana is required in the pattern. If False, the pattern will match the banana if present but will also match the identifier without the banana.
- Returns:
A compiled pattern for the prefix if available
>>> import bioregistry as br >>> resource = br.get_resource("chebi")
Strict match requires banana
>>> resource.get_pattern_re_with_banana().match("1234")
>>> resource.get_pattern_re_with_banana().match("CHEBI:1234") <re.Match object; span=(0, 10), match='CHEBI:1234'>
Loose match does not require banana
>>> resource.get_pattern_re_with_banana(strict=False).match("1234") <re.Match object; span=(0, 4), match='1234'> >>> resource.get_pattern_re_with_banana(strict=False).match("CHEBI:1234") <re.Match object; span=(0, 10), match='CHEBI:1234'>
- get_pattern_with_banana(strict: bool = True) str | None[source]
Get the pattern for the prefix including a banana if available.
Warning
This function is meant to mediate backwards compatibility with legacy MIRIAM/Identifiers.org standards. New projects should not use redundant prefixes in their local unique identifiers.
- Parameters:
strict – If True (default), and a banana exists for the prefix, the banana is required in the pattern. If False, the pattern will match the banana if present but will also match the identifier without the banana.
- Returns:
A pattern for the prefix if available
>>> import bioregistry as br >>> resource = br.get_resource("chebi")
Strict match requires the banana to be present
>>> resource.get_pattern_with_banana() '^CHEBI:\\d+$'
Non-strict match allows the banana to be optionally present
>>> resource.get_pattern_with_banana(strict=False) '^(CHEBI:)?\\d+$'
- get_preferred_prefix() str | None[source]
Get the preferred prefix (e.g., with stylization) if it exists.
- Returns:
The preferred prefix, if annotated in the Bioregistry or OBO Foundry.
No preferred prefix annotation, defaults to normalized prefix
>>> from bioregistry import get_resource >>> get_resource("rhea").get_preferred_prefix() None
Preferred prefix defined in the Bioregistry
>>> get_resource("wb").get_preferred_prefix() 'WormBase'
Preferred prefix defined in the OBO Foundry
>>> get_resource("fbbt").get_preferred_prefix() 'FBbt'
Preferred prefix from the OBO Foundry overridden by the Bioregistry (see also https://github.com/OBOFoundry/OBOFoundry.github.io/issues/1559)
>>> get_resource("dpo").get_preferred_prefix() 'DPO'
- get_prefix_key(key: str, metaprefixes: str | Sequence[str], *, rv_type: type[X], provenance: Literal[True] = True) MetaprefixAnnotatedValue[X] | None[source]
- get_prefix_key(key: str, metaprefixes: str | Sequence[str], *, rv_type: type[X], provenance: Literal[False] = False) X | None
Get a key enriched by the given external resources’ data.
- get_prefixcommons_uri_format() str | None[source]
Get the Prefix Commons URI format string for this entry, if available.
- Returns:
The Prefix Commons URI format string, if available.
>>> from bioregistry import get_resource >>> get_resource("antweb").get_prefixcommons_uri_format() 'http://www.antweb.org/specimen.do?name=$1'
- get_priority_prefix(priority: None | str | Sequence[str] = None) str[source]
Get a prioritized prefix.
- Parameters:
priority –
A metaprefix or list of metaprefixes used to choose a prioritized prefix. Some special values that are not themselves metaprefixes are allowed from the following list:
”default”: corresponds to the bioregistry prefix
”bioregistry.upper”: an uppercase transform of the canonical bioregistry prefix
”preferred”: a preferred prefix, typically includes stylization in capitalization
”obofoundry.preferred”: the preferred prefix annotated in OBO Foundry
- Returns:
The prioritized prefix for this record
- get_rdf_uri(identifier: str) str | None[source]
Return the RDF URI for the identifier.
- Parameters:
identifier – The local identifier in the nomenclature represented by this resource
- Returns:
The canonical RDF URI for the local identifier, if one can be constructed
>>> from bioregistry import get_resource >>> get_resource("edam").get_rdf_uri("data_1153") 'http://edamontology.org/data_1153'
- get_rdf_uri_format() str | None[source]
Get the URI format string for the given prefix for RDF usages.
- get_rrid_uri_format() str | None[source]
Get the RRID URI format.
- Returns:
The RRID format string, if available.
>>> from bioregistry import get_resource >>> get_resource("antibodyregistry").get_rrid_uri_format() # standard 'https://scicrunch.org/resolver/RRID:AB_$1' >>> assert get_resource("go").get_rrid_uri_format() is None
- get_uri_format(priority: Sequence[str] | None = None) str | None[source]
Get the URI format string for the given prefix, if it’s available.
- Parameters:
priority –
The priority order of metaresources to use for format URI lookup. The default is:
Manually curated URI Format in the Bioregistry
Default first party (e.g., MIRIAM, BioContext, Prefix Commons, Wikidata)
OBO Foundry
MIRIAM/Identifiers.org (i.e., make a URI like https://identifiers.org/<prefix>:<identifier>)
N2T (i.e., make a URI like https://n2t.org/<prefix>:<identifier>)
OLS
- Returns:
The best URI format string, where the
$1should be replaced by a local unique identifier.$1could potentially appear multiple times.
>>> from bioregistry import get_resource >>> get_resource("chebi").get_uri_format() 'http://purl.obolibrary.org/obo/CHEBI_$1'
If you want to specify a different priority order, you can do so with the
prioritykeyword. This is of particular interest to ontologists and semantic web people who might want to usepurl.obolibrary.orgURL prefixes over the URL prefixes corresponding to the first-party providers for each resource (e.g., the ChEBI example above). Do so like:>>> from bioregistry import get_resource >>> priority = ["obofoundry", "bioregistry", "biocontext", "miriam", "ols"] >>> get_resource("chebi").get_uri_format(priority=priority) 'http://purl.obolibrary.org/obo/CHEBI_$1'
- get_uri_formats(*, enforce_w3c: bool = False) set[str][source]
Get the set of all URI format strings.
- Parameters:
enforce_w3c – When generating URI prefixes from prefix synonyms, should synonyms that aren’t W3C-compliant be filtered out?
- Returns:
A set of URI format strings, containing
$1where a local unique identifier should be formatted in.
- get_uri_prefix(priority: Sequence[str] | None = None, *, strict: Literal[False] = False) str | None[source]
- get_uri_prefix(priority: Sequence[str] | None = None, *, strict: Literal[True] = False) str
Get a well-formed URI prefix, if available.
- Parameters:
priority – The prioirty order for
get_format().- Returns:
The URI prefix. Similar to what’s returned by
get_uri_format(), but it MUST have only one$1and end with$1to use the function.
>>> import bioregistry >>> bioregistry.get_uri_prefix("chebi") 'http://purl.obolibrary.org/obo/CHEBI_'
- get_uri_prefixes(*, enforce_w3c: bool = False) set[str][source]
Get the set of all URI prefixes.
- Parameters:
enforce_w3c – When generating URI prefixes from prefix synonyms, should synonyms that aren’t W3C-compliant be filtered out?
- Returns:
A set of URI prefixes.
- has_organization(reference: Reference) bool[source]
Check if this resource has an organization with the given ROR.
- has_organization_with_ror(ror: str) bool[source]
Check if this resource has an organization with the given ROR.
- is_deprecated() bool[source]
Return if the given prefix corresponds to a deprecated resource.
- Returns:
If the prefix has been explicitly marked as deprecated either by the Bioregistry, OBO Foundry, OLS, or MIRIAM. If no marks are present, assumed not to be deprecated.
>>> from bioregistry import get_resource >>> assert get_resource("imr").is_deprecated() # marked by OBO >>> assert get_resource("iro").is_deprecated() # marked by Bioregistry >>> assert get_resource("miriam.collection").is_deprecated() # marked by MIRIAM
- is_standardizable_identifier(identifier: str) bool[source]
Check that a local unique identifier can be normalized and also matches a prefix’s pattern.
- is_valid_identifier(identifier: str) bool[source]
Check that a local unique identifier is canonical, meaning no bananas.
- miriam_standardize_identifier(identifier: str) str | None[source]
Normalize the identifier for legacy usage with MIRIAM using the appropriate banana.
- Parameters:
identifier – The identifier in the CURIE
- Returns:
A normalize identifier, possibly with banana/redundant prefix added
Because identifiers.org used to have URIs in the form of https://identifiers.org/<prefix>/<prefix>:<identifier> for entries annotated with
namespaceEmbeddedInLuiastrueExamples with explicitly annotated bananas
>>> from bioregistry import get_resource >>> get_resource("vario").miriam_standardize_identifier("0376") 'VariO:0376' >>> get_resource("vario").miriam_standardize_identifier("VariO:0376") 'VariO:0376'
Examples with bananas from OBO
>>> get_resource("go").miriam_standardize_identifier("0000001") 'GO:0000001' >>> get_resource("go").miriam_standardize_identifier("GO:0000001") 'GO:0000001'
Examples from OBO Foundry
>>> get_resource("chebi").miriam_standardize_identifier("1234") 'CHEBI:1234' >>> get_resource("chebi").miriam_standardize_identifier("CHEBI:1234") 'CHEBI:1234'
Examples from OBO Foundry that should not have a redundant prefix added
>>> get_resource("ncit").miriam_standardize_identifier("C73192") 'C73192' >>> get_resource("ncbitaxon").miriam_standardize_identifier("9606") '9606'
Standard
>>> get_resource("pdb").miriam_standardize_identifier("00000020") '00000020'
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Args:
self: The BaseModel instance. context: The context.
- standardize_identifier(identifier: str) str[source]
Normalize the identifier to not have a redundant prefix or banana.
- Parameters:
identifier – The identifier in the CURIE
- Returns:
A normalized identifier, possibly with banana/redundant prefix removed
Examples with explicitly annotated bananas
>>> from bioregistry import get_resource >>> get_resource("vario").standardize_identifier("0376") '0376' >>> get_resource("vario").standardize_identifier("VariO:0376") '0376' >>> get_resource("swisslipid").standardize_identifier("000000001") '000000001' >>> get_resource("swisslipid").standardize_identifier("SLM:000000001") '000000001'
Examples with bananas from OBO
>>> get_resource("fbbt").standardize_identifier("00007294") '00007294' >>> get_resource("chebi").standardize_identifier("1234") '1234' >>> get_resource("chebi").standardize_identifier("CHEBI:1234") '1234' >>> get_resource("chebi").standardize_identifier("CHEBI_1234") '1234'
Examples from OBO Foundry that should not have a redundant prefix added
>>> get_resource("ncit").standardize_identifier("C73192") 'C73192' >>> get_resource("ncbitaxon").standardize_identifier("9606") '9606'
Standard
>>> get_resource("pdb").standardize_identifier("00000020") '00000020'