modos.helpers.schema#
Introspection utilities for the MODO schema.
This module provides helpers for accessing the schema structure and for converting instances to different representations.
Attributes#
Classes#
Enumeration of element types exposed to the user. |
|
Enumeration of all element types. |
Functions#
|
|
|
|
|
Checks if an element_id contains the element type as prefix. |
|
Add element to the hasPart attribute of a parent zarr group |
|
update the id of the has_part property of an element to use the full id including its type |
|
Set the data_path attribute, if it is not specified to the modo root. |
|
Checks if input is a valid URI. |
Return a view over the schema structure. |
|
Load the prefixmap. |
|
|
Return a list of required slots for a class. |
|
|
|
Return the class-independent range of a slot. |
|
|
|
Return the name of the "has_part" property for a target class. |
Module Contents#
- modos.helpers.schema.dict_to_instance(element)[source]#
- Parameters:
element (Mapping[str, Any])
- Return type:
Any
- modos.helpers.schema.is_full_id(element_id)[source]#
Checks if an element_id contains the element type as prefix.
Examples
>>> is_full_id("sample1") False >>> is_full_id("data/test") True >>> is_full_id("/assay/test_assay") True
- modos.helpers.schema.set_haspart_relationship(child_class, child_path, parent_group)[source]#
Add element to the hasPart attribute of a parent zarr group
- Parameters:
child_class (str)
child_path (str)
parent_group (zarr.hierarchy.Group)
- modos.helpers.schema.update_haspart_id(element)[source]#
update the id of the has_part property of an element to use the full id including its type
- Parameters:
element (modos_schema.datamodel.DataEntity | modos_schema.datamodel.Sample | modos_schema.datamodel.Assay | modos_schema.datamodel.ReferenceGenome | modos_schema.datamodel.MODO)
- modos.helpers.schema.set_data_path(element, source_file=None)[source]#
Set the data_path attribute, if it is not specified to the modo root.
- Parameters:
element (dict)
source_file (Optional[Union[pathlib.Path, str]])
- Return type:
- class modos.helpers.schema.UserElementType[source]#
-
Enumeration of element types exposed to the user.
- modos.helpers.schema.load_schema()[source]#
Return a view over the schema structure.
- Return type:
linkml_runtime.utils.schemaview.SchemaView
- modos.helpers.schema.get_slots(target_class, required_only=False)[source]#
Return a list of required slots for a class.
- modos.helpers.schema.get_slot_range(slot_name)[source]#
Return the class-independent range of a slot.