from linkml_runtime.utils.schemaview import SchemaView
view = SchemaView("../tests/test_utils/input/biolink-model.yaml")
view.imports_closure()
Loading schema https://w3id.org/linkml/types from ../tests/test_utils/input/biolink-model.yaml
['Biolink-Model', 'linkml:types']
len(view.all_classes()), len(view.all_slots()), len(view.all_subsets())
(257, 421, 4)
view.class_ancestors('gene')
['gene', 'gene or gene product', 'genomic entity', 'chemical entity or gene or gene product', 'physical essence', 'ontology class', 'biological entity', 'named thing', 'entity', 'physical essence or occurrent', 'thing with taxon', 'macromolecular machine mixin']
[view.get_uri(c) for c in view.class_ancestors('gene')]
['biolink:Gene', 'biolink:GeneOrGeneProduct', 'biolink:GenomicEntity', 'biolink:ChemicalEntityOrGeneOrGeneProduct', 'biolink:PhysicalEssence', 'biolink:OntologyClass', 'biolink:BiologicalEntity', 'biolink:NamedThing', 'biolink:Entity', 'biolink:PhysicalEssenceOrOccurrent', 'biolink:ThingWithTaxon', 'biolink:MacromolecularMachineMixin']
[view.get_uri(c, expand=True) for c in view.class_ancestors('gene')]
['https://w3id.org/biolink/vocab/Gene', 'https://w3id.org/biolink/vocab/GeneOrGeneProduct', 'https://w3id.org/biolink/vocab/GenomicEntity', 'https://w3id.org/biolink/vocab/ChemicalEntityOrGeneOrGeneProduct', 'https://w3id.org/biolink/vocab/PhysicalEssence', 'https://w3id.org/biolink/vocab/OntologyClass', 'https://w3id.org/biolink/vocab/BiologicalEntity', 'https://w3id.org/biolink/vocab/NamedThing', 'https://w3id.org/biolink/vocab/Entity', 'https://w3id.org/biolink/vocab/PhysicalEssenceOrOccurrent', 'https://w3id.org/biolink/vocab/ThingWithTaxon', 'https://w3id.org/biolink/vocab/MacromolecularMachineMixin']
view.class_ancestors('gene', mixins=False)
['gene', 'biological entity', 'named thing', 'entity']
view.slot_ancestors('affects')
['affects', 'related to']
view.slot_children('affects')
['affects abundance of', 'abundance affected by', 'affects activity of', 'activity affected by', 'activity affects', 'affects expression of', 'expression affected by', 'affects folding of', 'folding affected by', 'affects localization of', 'localization affected by', 'affects metabolic processing of', 'metabolic processing affected by', 'affects molecular modification of', 'molecular modification affected by', 'affects synthesis of', 'sythesis affected by', 'affects degradation of', 'degradation affected by', 'affects mutation rate of', 'mutation rate affected by', 'affects response to', 'response affected by', 'affects splicing of', 'splicing affected by', 'affects stability of', 'stability affected by', 'affects transport of', 'transport affected by', 'affects secretion of', 'secretion affected by', 'affects uptake of', 'uptake affected by', 'process regulates process', 'entity regulates entity', 'disrupts', 'ameliorates', 'exacerbates', 'affects expression in']
affects = view.get_slot('affects')
affects.exact_mappings
['SEMMEDDB:AFFECTS', 'SEMMEDDB:affects', 'DGIdb:affects', 'RTXKG1:affects']
view.get_mappings(affects.name)
{'self': ['biolink:affects'], 'native': ['biolink:affects'], 'exact': ['SEMMEDDB:AFFECTS', 'SEMMEDDB:affects', 'DGIdb:affects', 'RTXKG1:affects'], 'narrow': ['SEMMEDDB:administered_to', 'CTD:prediction_hypothesis', 'GOREL:0001006', 'CTD:inferred', 'UPHENO:0000001', 'RO:0002263', 'RO:0002264', 'NCIT:R158', 'NCIT:R160', 'NCIT:R30', 'NCIT:R150', 'NCIT:R72', 'NCIT:R146', 'NCIT:R124', 'NCIT:R173', 'NCIT:R100', 'NCIT:R102', 'NCIT:R101', 'NCIT:R113', 'NCIT:R23', 'NCIT:R25', 'NCIT:gene_mapped_to_disease', 'NCIT:R133', 'RO:0002343', 'RO:0002355', 'RO:0002591', 'RO:0002592', 'RO:0012003', 'SNOMED:has_pathological_process'], 'broad': [], 'related': ['DRUGBANK:pathway'], 'close': [], 'undefined': []}
view.get_mappings(affects.name, expand=True)
{'self': ['https://w3id.org/biolink/vocab/affects'], 'native': ['https://w3id.org/biolink/vocab/affects'], 'exact': ['https://skr3.nlm.nih.gov/SemMedDBAFFECTS', 'https://skr3.nlm.nih.gov/SemMedDBaffects', 'https://www.dgidb.org/interaction_typesaffects', 'http://kg1endpoint.rtx.ai/affects'], 'narrow': ['https://skr3.nlm.nih.gov/SemMedDBadministered_to', 'http://translator.ncats.nih.gov/CTD_prediction_hypothesis', 'http://purl.obolibrary.org/obo/GOREL_0001006', 'http://translator.ncats.nih.gov/CTD_inferred', 'http://purl.obolibrary.org/obo/UPHENO_0000001', 'http://purl.obolibrary.org/obo/RO_0002263', 'http://purl.obolibrary.org/obo/RO_0002264', 'http://purl.obolibrary.org/obo/NCIT_R158', 'http://purl.obolibrary.org/obo/NCIT_R160', 'http://purl.obolibrary.org/obo/NCIT_R30', 'http://purl.obolibrary.org/obo/NCIT_R150', 'http://purl.obolibrary.org/obo/NCIT_R72', 'http://purl.obolibrary.org/obo/NCIT_R146', 'http://purl.obolibrary.org/obo/NCIT_R124', 'http://purl.obolibrary.org/obo/NCIT_R173', 'http://purl.obolibrary.org/obo/NCIT_R100', 'http://purl.obolibrary.org/obo/NCIT_R102', 'http://purl.obolibrary.org/obo/NCIT_R101', 'http://purl.obolibrary.org/obo/NCIT_R113', 'http://purl.obolibrary.org/obo/NCIT_R23', 'http://purl.obolibrary.org/obo/NCIT_R25', 'http://purl.obolibrary.org/obo/NCIT_gene_mapped_to_disease', 'http://purl.obolibrary.org/obo/NCIT_R133', 'http://purl.obolibrary.org/obo/RO_0002343', 'http://purl.obolibrary.org/obo/RO_0002355', 'http://purl.obolibrary.org/obo/RO_0002591', 'http://purl.obolibrary.org/obo/RO_0002592', 'http://purl.obolibrary.org/obo/RO_0012003', 'http://purl.obolibrary.org/obo/SNOMED_has_pathological_process'], 'broad': [], 'related': ['http://identifiers.org/drugbank/pathway'], 'close': [], 'undefined': []}
[c for c in view.all_classes().keys() if view.is_relationship(c)][0:20]
['association', 'contributor association', 'genotype to genotype part association', 'genotype to gene association', 'genotype to variant association', 'gene to gene association', 'gene to gene homology association', 'gene to gene coexpression association', 'pairwise gene to gene interaction', 'pairwise molecular interaction', 'cell line to disease or phenotypic feature association', 'chemical to chemical association', 'reaction to participant association', 'reaction to catalyst association', 'chemical to chemical derivation association', 'chemical to disease or phenotypic feature association', 'chemical to pathway association', 'chemical to gene association', 'drug to gene association', 'material sample derivation association']
view.annotation_dict(affects.name)
{}
affects.annotations
{'biolink:canonical_predicate': Annotation(tag='biolink:canonical_predicate', value='True', extensions={}, annotations={})}
from linkml_runtime.linkml_model.annotations import Annotation, Annotatable
isinstance(affects, Annotatable)
False
affects
SlotDefinition(name='affects', id_prefixes=[], definition_uri=None, aliases=[], local_names={}, mappings=[], exact_mappings=['SEMMEDDB:AFFECTS', 'SEMMEDDB:affects', 'DGIdb:affects', 'RTXKG1:affects'], close_mappings=[], related_mappings=['DRUGBANK:pathway'], narrow_mappings=['SEMMEDDB:administered_to', 'CTD:prediction_hypothesis', 'GOREL:0001006', 'CTD:inferred', 'UPHENO:0000001', 'RO:0002263', 'RO:0002264', 'NCIT:R158', 'NCIT:R160', 'NCIT:R30', 'NCIT:R150', 'NCIT:R72', 'NCIT:R146', 'NCIT:R124', 'NCIT:R173', 'NCIT:R100', 'NCIT:R102', 'NCIT:R101', 'NCIT:R113', 'NCIT:R23', 'NCIT:R25', 'NCIT:gene_mapped_to_disease', 'NCIT:R133', 'RO:0002343', 'RO:0002355', 'RO:0002591', 'RO:0002592', 'RO:0012003', 'SNOMED:has_pathological_process'], broad_mappings=[], extensions={}, annotations={'biolink:canonical_predicate': Annotation(tag='biolink:canonical_predicate', value='True', extensions={}, annotations={})}, description="describes an entity that has a direct affect on the state or quality of another existing entity. Use of the 'affects' predicate implies that the affected entity already exists, unlike predicates such as 'affects risk for' and 'prevents, where the outcome is something that may or may not come to be.", alt_descriptions={}, deprecated=None, todos=[], notes=[], comments=[], examples=[], in_subset=['translator_minimal'], from_schema=None, imported_from=None, see_also=[], deprecated_element_has_exact_replacement=None, deprecated_element_has_possible_replacement=None, is_a='related to', abstract=None, mixin=None, mixins=[], apply_to=[], values_from=[], created_by=None, created_on=None, last_updated_on=None, modified_by=None, status=None, string_serialization=None, singular_name=None, domain=None, range=None, slot_uri=None, multivalued=None, inherited=None, readonly=None, ifabsent=None, required=None, recommended=None, inlined=None, inlined_as_list=None, key=None, identifier=None, alias=None, owner=None, domain_of=[], subproperty_of=None, symmetric=None, inverse=None, is_class_field=None, role=None, is_usage_slot=None, usage_slot_name=None, minimum_value=None, maximum_value=None, pattern=None)
e = view.get_element('affects')
e
SlotDefinition(name='affects', id_prefixes=[], definition_uri=None, aliases=[], local_names={}, mappings=[], exact_mappings=['SEMMEDDB:AFFECTS', 'SEMMEDDB:affects', 'DGIdb:affects', 'RTXKG1:affects'], close_mappings=[], related_mappings=['DRUGBANK:pathway'], narrow_mappings=['SEMMEDDB:administered_to', 'CTD:prediction_hypothesis', 'GOREL:0001006', 'CTD:inferred', 'UPHENO:0000001', 'RO:0002263', 'RO:0002264', 'NCIT:R158', 'NCIT:R160', 'NCIT:R30', 'NCIT:R150', 'NCIT:R72', 'NCIT:R146', 'NCIT:R124', 'NCIT:R173', 'NCIT:R100', 'NCIT:R102', 'NCIT:R101', 'NCIT:R113', 'NCIT:R23', 'NCIT:R25', 'NCIT:gene_mapped_to_disease', 'NCIT:R133', 'RO:0002343', 'RO:0002355', 'RO:0002591', 'RO:0002592', 'RO:0012003', 'SNOMED:has_pathological_process'], broad_mappings=[], extensions={}, annotations={'biolink:canonical_predicate': Annotation(tag='biolink:canonical_predicate', value='True', extensions={}, annotations={})}, description="describes an entity that has a direct affect on the state or quality of another existing entity. Use of the 'affects' predicate implies that the affected entity already exists, unlike predicates such as 'affects risk for' and 'prevents, where the outcome is something that may or may not come to be.", alt_descriptions={}, deprecated=None, todos=[], notes=[], comments=[], examples=[], in_subset=['translator_minimal'], from_schema=None, imported_from=None, see_also=[], deprecated_element_has_exact_replacement=None, deprecated_element_has_possible_replacement=None, is_a='related to', abstract=None, mixin=None, mixins=[], apply_to=[], values_from=[], created_by=None, created_on=None, last_updated_on=None, modified_by=None, status=None, string_serialization=None, singular_name=None, domain=None, range=None, slot_uri=None, multivalued=None, inherited=None, readonly=None, ifabsent=None, required=None, recommended=None, inlined=None, inlined_as_list=None, key=None, identifier=None, alias=None, owner=None, domain_of=[], subproperty_of=None, symmetric=None, inverse=None, is_class_field=None, role=None, is_usage_slot=None, usage_slot_name=None, minimum_value=None, maximum_value=None, pattern=None)