bmt

Contents:

  • Installation
bmt
  • Welcome to Biolink Model Toolkit’s documentation!
  • View page source

Welcome to Biolink Model Toolkit’s documentation!

Contents:

  • Installation
    • For users
    • For developers
  • Index

  • Module Index

  • Search Page

class bmt.toolkit.Toolkit(schema: Union[str, TextIO, SchemaDefinition] = 'https://raw.githubusercontent.com/biolink/biolink-model/v4.2.2/biolink-model.yaml', predicate_map: str = 'https://raw.githubusercontent.com/biolink/biolink-model/v4.2.2/predicate_mapping.yaml')

Provides a series of methods for performing lookups on the Biolink Model

Parameters

schema: Union[str, TextIO, SchemaDefinition]

The path or url to an instance of the biolink-model.yaml file.

ancestors(name: str, mixin: bool = True) → List[str]

Deprecated since version 0.2.0: This will be removed in 1.0. Use get_ancestors method instead

children(name: str, mixin: bool = True) → List[str]

Deprecated since version 0.2.0: This will be removed in 1.0. Use get_children method instead

classmethod clear_warnings() → None

Clears out all warnings captured since initial Toolkit usage or since last invocation of this method. Returns ——-

None

descendents(name: str, mixin: bool = True) → List[str]

Deprecated since version 0.2.0: This will be removed in 1.0. Use get_descendants method instead

classmethod dump_warnings() → str

Dumps a flat list report by context of all warnings reported since Toolkit creation or since the last invocation of “clear_warnings’.

filter_values_on_slot(slot_values: List[str], definition: SlotDefinition, field: str, formatted: bool = True) → bool

Parameters

slot_values: List[str]

List of (Biolink CURIE) slot values to be matched against target slot field values.

definition: SlotDefinition

Slot definition containing the embedded target field.

field: str

Name of embedded (slot) field rooting the tree of elements against which the slot_values are to be matched.

formatted: bool = True

Use of Biolink CURIE identifiers assumed when True (default: True)

Returns

bool

Returns ‘True’ if any match is found for at least one entry in the slot_values, against the target field values.

get_all_associations(formatted: bool = False) → List[str]

Get all associations from Biolink Model.

This method returns a list of names or (optionally) curies designating classes that are descendants of the class association.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_all_by_mapping(uriorcurie: str) → List[str]

Deprecated since version 0.1.1: This will be removed in 1.0. Use get_all_elements_by_mapping method instead

get_all_classes(formatted: bool = False) → List[str]

Get all classes from Biolink Model.

This method returns a list containing all the classes defined in the model.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_all_edge_properties(formatted: bool = False) → List[str]

Get all edge properties from Biolink Model.

This method returns a list containing all the slots that are descendants of the slot association slot.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_all_elements(formatted: bool = False) → List[str]

Get all elements from Biolink Model.

This method returns a list containing all classes, slots, and types defined in the model.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_all_elements_by_mapping(identifier: str, formatted: bool = False) → List[str]

Given an identifier as IRI/CURIE, find all Biolink elements that correspond to the given identifier as part of its mappings.

Parameters

identifier: str

The identifier as an IRI or CURIE

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of Biolink elements that correspond to the given identifier IRI/CURIE

get_all_entities(formatted: bool = False) → List[str]

Get all entities from Biolink Model.

This method returns a list containing all the classes that are descendants of the class named thing.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_all_multivalued_slots() → List[str]

Gets a list of names of all multivalued slots.

Returns

List[str]

The names of all multivalued slots

get_all_node_properties(formatted: bool = False) → List[str]

Get all node properties from Biolink Model.

This method returns a list containing all the slots that are descendants of the slot node property.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_all_predicates_with_class_domain(class_name, check_ancestors: bool = False, formatted: bool = False, mixin: bool = True) → List[str]

Given a class, get all Biolink predicates where the class is the domain.

Parameters

class_name: str

The name or alias of a class in the Biolink Model

check_ancestors: bool

Whether or not to lookup slots that include ancestors of the given class as its domain

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

A list of slots

get_all_predicates_with_class_range(class_name, check_ancestors: bool = False, formatted: bool = False, mixin: bool = True)

Given a class, get all Biolink predicates where the class is the range.

Parameters

class_name: str

The name or alias of a class in the Biolink Model

check_ancestors: bool

Whether or not to lookup slots that include ancestors of the given class as its range

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

A list of slots

get_all_properties_with_class_domain(class_name, check_ancestors: bool = False, formatted: bool = False, mixin: bool = True) → List[str]

Given a class, get all Biolink properties where the class is the domain.

Parameters

class_name: str

The name or alias of a class in the Biolink Model

check_ancestors: bool

Whether or not to lookup slots that include ancestors of the given class as its domain

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

A list of slots

get_all_properties_with_class_range(class_name, check_ancestors: bool = False, formatted: bool = False, mixin: bool = True) → List[str]

Given a class, get all Biolink properties where the class is the range.

Parameters

class_name: str

The name or alias of a class in the Biolink Model

check_ancestors: bool

Whether or not to lookup slots that include ancestors of the given class as its range

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

A list of slots

get_all_slots(formatted: bool = False) → List[str]

Get all slots from Biolink Model.

This method returns a list containing all the slots defined in the model.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_all_slots_with_class_domain(class_name, check_ancestors: bool = False, formatted: bool = False, mixin: bool = True) → List[str]

Given a class, get all the slots where the class is the domain.

Parameters

class_name: str

The name or alias of a class in the Biolink Model

check_ancestors: bool

Whether or not to lookup slots that include ancestors of the given class as its domain

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

A list of slots

get_all_slots_with_class_range(class_name, check_ancestors: bool = False, formatted: bool = False, mixin: bool = True) → List[str]

Given a class, get all the slots where the class is the range.

Parameters

class_name: str

The name or alias of a class in the Biolink Model

check_ancestors: bool

Whether or not to lookup slots that include ancestors of the given class as its range

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

A list of slots

get_all_types(formatted: bool = False) → List[str]

Get all types from Biolink Model.

This method returns a list containing all the built-in and defined types in the model.

Parameters

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_ancestors(name: str, reflexive: bool = True, formatted: bool = False, mixin: bool = True) → List[str]

Gets a list of names of ancestors.

Parameters

name: str

The name of an element in the Biolink Model

reflexive: bool

Whether to include the query element in the list of ancestors

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

The names of the given elements ancestors

get_associations(subject_categories: Optional[List[str]] = None, predicates: Optional[List[str]] = None, object_categories: Optional[List[str]] = None, match_inverses: bool = True, formatted: bool = False) → List[str]

Get associations from Biolink Model constrained by target list of subject categories, predicates and/or object categories.

Note: to get matches to most specific associations, it is recommended that the subject_categories and object_categories lists be limited to the most specific node categories of interest.

This method returns a list of names or (optionally formatted) curies designating classes that are descendants of the class biolink:Association.

Note that the method does not attempt to continue matching input constraints if any category or predicate is deemed unknown to the current Biolink Model: The caller should know well enough to check these, before calling this method! But log warnings are issued as a courtesy to inform them!

Parameters

subject_categories: Optional[List[str]]

List of node categories (as CURIES) that the associations must match for the subject node; default: None

predicates: Optional[List[str]]

List of edge predicates (as CURIES) that the associations allowed for matching associations; default: None

object_categories: Optional[List[str]]

List of node categories (as CURIES) that the associations must match for the object node; default: None

match_inverses: bool

Whether to also return associations with swapped subject and object with inverted qualifiers (as applicable) plus inverse predicates; default: rue

formatted: bool

Whether to format element names as CURIEs; default: False

Returns

List[str]

A list of elements

get_by_mapping(uriorcurie: str) → Optional[str]

Deprecated since version 0.1.1: This will be removed in 1.0. Use get_element_by_mapping method instead

get_children(name: str, formatted: bool = False, mixin: bool = True) → List[str]

Gets a list of names of children.

Parameters

name: str

The name of an element in the Biolink Model

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

The names of the given elements children

get_denormalized_association_slots(formatted) → List[Element]

Gets all association slots that are denormalized

Returns

List[linkml_model.meta.Element]

A list of association slots

get_descendants(name: str, reflexive: bool = True, formatted: bool = False, mixin: bool = True) → List[str]

Gets a list of names of descendants.

Parameters

name: str

The name of an element in the Biolink Model

reflexive: bool

Whether to include the query element in the list of descendants

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin descendants as well as is_a ancestors

Returns

List[str]

The names of the given element’s descendants

get_element(name: str) → Optional[Element]

Gets an element which is identified by the given name, either as its name or as one of its aliases.

Parameters

name: str

The name or alias of an element in the Biolink Model

Returns

Element

The element identified by the given name

get_element_by_broad_mapping(identifier: str, formatted: bool = False) → List[str]

Given an identifier as IRI/CURIE, find a Biolink element that corresponds to the given identifier as part of its broad_mappings.

Parameters

identifier: str

The identifier as an IRI or CURIE

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of Biolink elements that correspond to the given identifier IRI/CURIE

get_element_by_close_mapping(identifier: str, formatted: bool = False) → List[str]

Given an identifier as IRI/CURIE, find a Biolink element that corresponds to the given identifier as part of its close_mappings.

Parameters

identifier:

The identifier as an IRI or CURIE

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of Biolink elements that correspond to the given identifier IRI/CURIE

get_element_by_exact_mapping(identifier: str, formatted: bool = False) → List[str]

Given an identifier as IRI/CURIE, find a Biolink element that corresponds to the given identifier as part of its exact_mappings.

Parameters

identifier: str

The identifier as an IRI or CURIE

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of Biolink elements that correspond to the given identifier IRI/CURIE

get_element_by_mapping(identifier: str, most_specific: bool = False, formatted: bool = False, mixin: bool = True) → Optional[str]

Get a Biolink Model element by mapping. This method returns the common ancestor of the set of elements referenced by uriorcurie.

Parameters

identifier: str

The identifier as an IRI or CURIE

most_specific: bool

Whether or not to get the first available mapping in the order of specificity or to get all mappings of varying specificity

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

Optional[str]

The Biolink element (or the common ancestor) corresponding to the given URI/CURIE

get_element_by_narrow_mapping(identifier: str, formatted: bool = False) → List[str]

Given an identifier as IRI/CURIE, find a Biolink element that corresponds to the given identifier as part of its narrow_mappings.

Parameters

identifier: str

The identifier as an IRI or CURIE

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of Biolink elements that correspond to the given identifier IRI/CURIE

get_element_by_prefix(identifier: str) → List[str]

Get a Biolink Model element by prefix.

Parameters

identifier: str

The identifier as a CURIE

Returns

Optional[str]

The Biolink element corresponding to the given URI/CURIE as available via the id_prefixes mapped to that element.

get_element_by_related_mapping(identifier: str, formatted: bool = False) → List[str]

Given an identifier as IRI/CURIE, find a Biolink element that corresponds to the given identifier as part of its related_mappings.

Parameters

identifier: str

The identifier as an IRI or CURIE

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of Biolink elements that correspond to the given identifier IRI/CURIE

get_element_depth(name: str, formatted: bool = False) → int

Gets the inheritance tree depth of a given element.

Parameters

name: str

The name of an element

formatted: bool

Whether to format element names as CURIEs

Returns

int

The depth of the given element in the model class inheritance tree

get_inverse_predicate(predicate: Optional[str], formatted: bool = False) → Optional[str]

Utility wrapper of logic to robustly test if a predicate exists and has an inverse.

Parameters

predicate: Optional[str]

CURIE or string name of predicate in the Biolink Model, for which the inverse is sought

formatted: bool

Whether to format element names as CURIEs

Returns

Optional[str]

CURIE string of inverse predicate, if it exists; None otherwise

static get_local_slot_usage(element: Element, slot: str) → Optional[SlotDefinition]

Retrieve the definition of a specified slot from the ‘slot_usage’ defined locally within the class model of the specified Element.

Parameters

element:

Element defining the specified ‘slot’ in its local ‘slot_usage’.

slot: str

Name of the slot whose definition is to be retrieved.

Returns

Optional[SlotDefinition]

None, if not available.

get_model_version() → str

Return the version of the biolink-model in use.

Returns

str

The biolink-model version

get_most_specific_association(association_list, formatted: bool = True) → str

Get the most specific category within a candidate list of association categories. Invalid association category names are ignored.

Parameters

association_list: list[str]

Target list of edge category names, descendants of biolink:Association. Note that the code should work upon either Biolink CURIE or unprefixed names. But a check is made whether the names are valid Biolink categories.

formatted: bool = True

Enforce formatting of the category names as a CURIE. If False, the name is returned as found in the original category list (or as an unprefixed ‘association’).

Returns

str

Most specific association category name in the given list. Returns ‘biolink:Association’ (or just ‘association’ if formatted == False) if no valid category in the list.

get_most_specific_category(category_list, formatted: bool = True) → str

Get the most specific category within a candidate list of categories. Invalid category names are ignored.

Parameters

category_list: list[str]

Target list of node category names, descendants of biolink:NamedThing. Note that the code should work upon either Biolink CURIE or unprefixed names. But a check is made whether the names are valid Biolink categories.

formatted: bool = True

Enforce formatting of the category names as a CURIE. If False, the name is returned as found in the original category list (or as an unprefixed ‘named thing’).

Returns

str

Most specific category name in the given list. Returns ‘biolink:NamedThing’ (or just ‘named thing’ if formatted == False) if no valid category in the list.

get_most_specific_element(element_list: list[str], formatted: bool = True, member_of: Optional = None, root_element: Optional[str] = None) → Optional[str]

Get the most specific element within a candidate list of elements. Elements need to be in the same hierarchy.

Parameters

element_list: list[str]

Target list of node category names, descendants of biolink:NamedThing. Note that the code should work upon either Biolink CURIE or unprefixed names. But a check is made whether the names are valid Biolink categories.

formatted: bool = True

Enforce formatting of the category names as a CURIE. If False, the name is returned as found in the original category list (or as an unprefixed ‘named thing’).

member_of: FunctionType, predicate membership function to filter name entries in an

‘element_list’, for membership in a given hierarchy

root_element: str, class name of the root element in a given

element hierarchy (e.g. ‘named thing’, ‘association’)

Returns

str

Most specific category name in the given list. Returns ‘biolink:NamedThing’ (or just ‘named thing’ if formatted == False) if no valid category in the list.

get_parent(name: str, formatted: bool = False) → Optional[str]

Gets the name of the parent.

Parameters

name: str

The name of an element in the Biolink Model

formatted: bool

Whether to format element names as CURIEs

Returns

Optional[str]

The name of the given elements parent

get_permissible_value_ancestors(permissible_value: str, enum_name: str, formatted: bool = False) → List[str]

Get ancestors of a permissible value.

This method returns a list containing all the ancestors of a permissible value of a given enum.

Parameters

enum_name: str

The name of the enum

permissible_value: str

The name of the permissible value

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_permissible_value_children(permissible_value: str, enum_name: str) → Optional[Union[str, PermissibleValueText]]

Gets the children of a permissible value in an enumeration.

Parameters:
  • permissible_value – The permissible value to check.

  • enum_name – The name of the enumeration.

Returns:

The children of the permissible value.

Raises:

ValueError – If the permissible value or enum is not valid.

get_permissible_value_descendants(permissible_value: str, enum_name: str, formatted: bool = False) → List[str]

Get descendants of a permissible value.

This method returns a list containing all the descendants of a permissible value of a given enum.

Parameters

enum_name: str

The name of the enum

permissible_value: str

The name of the permissible value

formatted: bool

Whether to format element names as CURIEs

Returns

List[str]

A list of elements

get_permissible_value_parent(permissible_value: str, enum_name: str) → str

Get parent of a permissible value.

This method returns a list containing all the parent of a permissible value of a given enum.

Parameters

enum_name: str

The name of the enum

permissible_value: str

The name of the permissible value

Returns

List[str]

A list of elements

get_predicate_mapping(mapped_predicate: str) → Dict[str, str]

Get the predicates that map to a given predicate.

This method returns a list containing all the predicates that map to a given predicate.

Parameters

mapped_predicate: str

The name of the mapped predicate

Returns

Dict[str, str]

A Dictionary of elements, indexed by formatted name

get_slot_domain(slot_name, include_ancestors: bool = False, formatted: bool = False, mixin: bool = True) → List[str]

Get the domain for a given slot.

Parameters

slot_name: str

The name or alias of a slot in the Biolink Model

include_ancestors: bool

Whether or not to include ancestors of the domain class

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

The domain for a given slot

get_slot_range(slot_name, include_ancestors: bool = False, formatted: bool = False, mixin: bool = True) → List[str]

Get the range for a given slot.

Parameters

slot_name: str

The name or alias of a slot in the Biolink Model

include_ancestors: bool

Whether to include ancestors of the range class

formatted: bool

Whether to format element names as CURIEs

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

List[str]

The range for a given slot

get_slot_usage(element: Element, slot: str) → Optional[SlotDefinition]

Get the definition of a specified slot from the ‘slot_usage’ of a specified Element. A relatively deep search is made within the Element context - local class, parent class and associated mixins - to discover an available ‘slot_usage’ definition for the slot.

Parameters

element:

Element defining the specified ‘slot’ in ‘slot_usage’.

slot: str

Name of the slot whose definition is to be retrieved.

Returns

Optional[SlotDefinition]

None, if not available.

get_value_type_for_slot(slot_name, formatted: bool = False) → str

Get the value type for a given slot.

Parameters

slot_name: str

The name or alias of a slot in the Biolink Model

formatted: bool

Whether to format element names as CURIEs

Returns

str

The slot type

has_inverse(name: str) → bool

Determines whether the given name exists and has an inverse defined in the Biolink Model. An element is a predicate if it descends from RELATED_TO but this is not directly tested here (use the method ‘is_predicate()’ to be sure).

Parameters

name: str

The name or alias of an slot element in the Biolink Model

Returns

bool

That the named element is a slot element with an inverse in the Biolink Model

in_subset(name: str, subset: str) → bool

Determines whether the given name is in a given subset in the Biolink Model.

Parameters

name: str

The name or alias of an element in the Biolink Model.

subset: str

The name of the subset

Returns

bool

That the named element is part of a given subset in Biolink Model

is_association(name: str, mixin: bool = True) → bool

Determines whether the given name is the name of an edge category in the Biolink Model. An element is a category if it descends from association

Parameters

namestr

The name or alias of an element in the Biolink Model

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

bool

That the named element is a valid edge category in Biolink Model

is_association_slot(name: str, mixin: bool = True) → bool

Determines whether the given name is the name of an association slot in the Biolink Model. An element is an association slot if it descends from ASSOCIATION_SLOT

Parameters

name: str

The name or alias of an element in the Biolink Model

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

bool

That the named element is a valid an association slot in Biolink Model

is_category(name: str, mixin: bool = True) → bool

Determines whether the given name is the name of a node category in the Biolink Model. An element is a category if it descends from named thing

Parameters

namestr

The name or alias of an element in the Biolink Model

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

bool

That the named element is a valid node category in Biolink Model

is_edgelabel(name: str, mixin: bool = True) → bool

Deprecated since version 0.1.1: This will be removed in 1.0. Use is_predicate method instead

is_enum(name: str) → bool

Predicate to test (by name) if a given Biolink Model element is an Enum.

Parameters

namestr

The name or alias of an element in the Biolink Model

Returns

bool

That the named element is a valid enum in the Biolink Model

is_mixin(name: str) → bool

Determines whether the given name is the name of a mixin in the Biolink Model. An element is a mixin if one of its properties is “is_mixin:true”

Parameters

name: str

The name or alias of an element in the Biolink Model

Returns

bool

That the named element is a valid mixin in Biolink Model

is_node_property(name: str, mixin: bool = True) → bool

Determines whether the given name is the name of a node property in the Biolink Model. An element is a node property if it descends from NODE_PROPERTY

Parameters

name: str

The name or alias of an element in the Biolink Model

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

bool

That the named element is a valid node property in Biolink Model

is_permissible_value_of_enum(enum_name: str, value) → bool

method to test (by name) if a candidate ‘permissible value’ is associated with the given Enum

Parameters

enum_namestr

The name or alias of an Enum in the Biolink Model

valueAny

The name or alias of the candidate ‘permissible value’ associated with the given Enum

Returns

bool

That the named element is in the set of ‘permissible values’ of the Enum

is_predicate(name: str, mixin: bool = True) → bool

Determines whether the given name is the name of a relation/predicate in the Biolink Model. An element is a predicate if it descends from RELATED_TO

Parameters

name: str

The name or alias of an element in the Biolink Model

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

bool

That the named element is a valid relation/predicate in Biolink Model

is_qualifier(name: str) → bool

Predicate to test (by name) if a given Biolink Model element is an Edge Qualifier.

Parameters

namestr

The name or alias of an element in the Biolink Model

Returns

bool

That the named element is a valid edge qualifier in the Biolink Model

is_subproperty_of(predicate: str, name: str, formatted: bool = False) → bool

Checks if a given name is a ‘subproperty_of’ a given predicate. Note: unsure if this method yet captures the full subtlety of ‘subproperty_of’.

Parameters

predicate: str

Target predicate against which a given name is to be searched as a subproperty

name: str

Name to be searched

formatted: bool = False

Input name assumed to be a CURIE

Returns

True if the name is observed to be equivalent to, or a ‘subproperty’ descendant of, the given predicate.

is_symmetric(name: str) → bool

Checks if a given element identified by name, is a symmetric (predicate) slot.

Parameters

name: str

The name or alias of an element in the Biolink Model

Returns

bool

That the named element is tagged as symmetric: true in Biolink Model

is_translator_canonical_predicate(name: str, mixin: bool = True) → bool

Determines whether the given name is the name of a canonical relation/predicate in the Biolink Model. An element is a canonical predicate if it descends from RELATED_TO and is tagged with the annotation ‘biolink:canonical_predicate’

Parameters

name: str

The name or alias of an element in the Biolink Model

mixin: bool

If True, then that means we want to find mixin ancestors as well as is_a ancestors

Returns

bool

That the named element is a valid translator canonical prediacte in Biolink Model

match_association(assoc: Element, subj_cats: List[str], predicates: List[str], obj_cats: List[str], formatted: bool = True) → bool

Match a specified element (assumed to be a child of biolink:Association) to a given set of Subject category – Predicate -> Object category name constraints.

Parameters

assoc: Element

Subclass of biolink:Association to be matched.

subj_cats: List[str]

List of Biolink CURIEs of subject categories.

predicates: List[str]

List of Biolink CURIEs of predicates.

obj_cats: List[str]

List of Biolink CURIEs of object categories.

formatted: bool = True

Use of Biolink CURIE identifiers in ‘subj_cats’, ‘preds’ and ‘obj_cats’ assumed when True (default: True)

Returns

bool:

True if all constraints match the slot_usage of the Association components.

match_slot_usage(element, slot: str, slot_values: List[str], formatted: bool = True) → bool

Match slot_values against expected slot_usage for specified slot in specified (association) element.

Parameters

element: Element

Target element against which slot_usage is being assessed.

slot: str

Name of target slot in given element, against which slot_usage is being assessed.

slot_values: List[str]

List of slot value (strings) e.g. categories, predicates, etc. - being assessed against slot_usage

formatted: bool = True

Use of Biolink CURIE identifiers in slot_values assumed when True (default: True)

Returns

bool

Returns ‘True’ if slot exists and slot_values are compatible with slot usage within the given element (or its immediate parent or mixins); False otherwise

names(formatted: bool = False) → List[str]

Deprecated since version 0.3.0: This will be removed in 1.0. Use get_all_elements method instead

parent(name: str, mixin: bool = True) → Optional[str]

Deprecated since version 0.2.0: This will be removed in 1.0. Use get_parent method instead

rank_element_by_specificity(element_list: list[str], most_specific: bool = True) → list[str]

Rank elements by depth in the class hierarchy tree within which the elements belong.

Parameters

element_list: list[str]

Target list of model element names (e.g., category names). This method does not attempt to validate the names as belonging to the same hierarchy but simply returns the ranking of the elements within their respective hierarchies.

most_specific: bool = True

If True, order elements by giving the most specific element first; Otherwise, ordered first by most generic.

Returns

list[str]

Ordered list of element names.

validate_edge(subject: str, predicate: str, p_object: str, ancestors: bool = True) → bool

Validates an edge.

Parameters

subject: str

The name or alias of a subject in the Biolink Model

predicate: str

The name or alias of a predicate in the Biolink Model

p_object: str

The name or alias of an object in the Biolink Model

ancestors: bool

Whether to include ancestors of the domain and range classes

Returns

bool

Whether or not the given edge is valid

validate_qualifier(qualifier_type_id: str, qualifier_value: str, associations: Optional[List[str]] = None) → bool

Validates a qualifier.

Parameters

qualifier_type_id: str

The name or alias of a qualifier in the Biolink Model

qualifier_value: str

The value of the qualifier

associations: Optional[List[str]] = None

Optional list of possible biolink:Association subclass (CURIEs) which could resolve the context for qualifier_value validation.

Returns

bool

Whether or not the given qualifier is valid

classmethod warning(context: str, identifier: str) → None

Method to log warnings in a specified context and associated with a specific element, denoted by ‘identifier’.

Parameters

context: str

Specific functional context for which the warning is being reported.

identifier: str

Specific element identifier target of the warning.

Returns

None

Next

© Copyright 2021, bmt Authors.

Built with Sphinx using a theme provided by Read the Docs.