get_iri

get_iri(prefix, identifier=None, *, priority=None, prefix_map=None, use_bioregistry_io=True, provider=None)[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.

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

Return type

Optional[str]

Returns

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

A pre-parse CURIE can be given as the first two arguments >>> 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 >>> 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”] >>> 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/”} >>> get_iri(“chebi:24867”, prefix_map=prefix_map) ‘https://example.org/chebi/24867’ >>> 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”] >>> get_iri(“chebi:24867”, prefix_map=prefix_map, priority=priority) ‘http://purl.obolibrary.org/obo/CHEBI_24867’ >>> 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 >>> get_iri(“chebi:24867”, provider=”chebi-img”) ‘https://www.ebi.ac.uk/chebi/displayImage.do?defaultImage=true&imageIndex=0&chebiId=24867’