from_ontoportal
- from_ontoportal(ontology_1: str, ontology_2: str, *, converter: curies.Converter, client: ontoportal_client.OntoPortalClient, progress: bool = False) list[SemanticMapping][source]
Get mappings from an OntoPortal instance.
- Parameters:
ontology_1 – The OntoPortal instance’s key for the first ontology. Note that this might not be the standard key/prefix, e.g., that’s in the Bioregistry.
ontology_2 – The OntoPortal instance’s key for the second ontology. Note that this might not be the standard key/prefix, e.g., that’s in the Bioregistry.
converter –
A converter for parsing URIs.
Because OntoPortal’s mapping data model does not incorporate a prefix map, an explicit converter must be passed to this function. The Bioregistry’s default converter is sometimes a good option to put here if you’re not sure (returned by
bioregistry.get_converter()), but OntoPortal instances tend to make their own PURLs that might not be known to the Bioregistry.client – A pre-instantiated OntoPortal client, e.g., to BioPortal, AgroPortal, EcoPortal, etc.
- Returns:
A list of semantic mappings.
Warning
OntoPortal doesn’t provide an option to only return mappings between entities defined in the two given ontologies. For example, if you ask for mappings between
SNOMEDCTandAEROin BioPortal, you will also get mappings between OGMS and SNOMEDCT (because OGMS terms are imported in AERO).This means that you should probably apply post-hoc filtering to only retain relevant mappings.
Simple usage:
import bioregistry from ontoportal_client import BioPortalClient from sssom_pydantic.contrib.ontoportal import from_ontoportal converter = bioregistry.get_converter() client = BioPortalClient() mappings = from_ontoportal("SNOMEDCT", "AERO", converter=converter, client=client)
Usage with explicitly defined converter, which implicitly filters only to relevant mappings:
import curies from ontoportal_client import BioPortalClient from sssom_pydantic.contrib.ontoportal import from_ontoportal converter = curies.Converter.from_prefix_map( { "AERO": "http://purl.obolibrary.org/obo/AERO_", "SNOMEDCT": "http://purl.bioontology.org/ontology/SNOMEDCT/", } ) client = BioPortalClient() mappings = from_bioportal("SNOMEDCT", "AERO", converter=converter, client=client)