{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d82643aa", "metadata": {}, "outputs": [], "source": [ "from linkml_runtime.utils.schemaview import SchemaView" ] }, { "cell_type": "code", "execution_count": 2, "id": "850e4b34", "metadata": {}, "outputs": [], "source": [ "view = SchemaView(\"../tests/test_utils/input/mixs/mixs.yaml\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "c0e9ccd4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Loading schema water from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema terms from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema ranges from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema https://w3id.org/linkml/types from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema wastewater_sludge from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema soil from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema sediment from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema plant_associated from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema miscellaneous_natural_or_artificial_environment from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema microbial_mat_biofilm from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema hydrocarbon_resources_fluids_swabs from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema hydrocarbon_resources_cores from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema human_vaginal from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema human_skin from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema human_oral from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema human_gut from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema human_associated from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema host_associated from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema built_environment from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema air from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema core from ../tests/test_utils/input/mixs/mixs.yaml\n", "Loading schema checklists from ../tests/test_utils/input/mixs/mixs.yaml\n" ] }, { "data": { "text/plain": [ "609" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(view.all_slots())" ] }, { "cell_type": "code", "execution_count": 10, "id": "98f7305b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['water',\n", " 'quantity value',\n", " 'wastewater_sludge',\n", " 'soil',\n", " 'sediment',\n", " 'plant-associated',\n", " 'miscellaneous natural or artificial environment',\n", " 'microbial mat_biofilm',\n", " 'hydrocarbon resources-fluids_swabs',\n", " 'hydrocarbon resources-cores']" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "list(view.all_classes().keys())[0:10]" ] }, { "cell_type": "code", "execution_count": 19, "id": "84e6ff27", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.get_slot('elev').required is True" ] }, { "cell_type": "code", "execution_count": 20, "id": "cf892380", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.induced_slot('elev', 'soil').required is True" ] }, { "cell_type": "code", "execution_count": 21, "id": "735859e1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.induced_slot('elev', 'human-gut').required is True" ] }, { "cell_type": "code", "execution_count": 23, "id": "ff33091c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Minimum Information About an Uncultivated Virus Genome'" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.get_class('MIUVIG').description" ] }, { "cell_type": "code", "execution_count": 25, "id": "11a0226e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['MIUVIG',\n", " 'air MIUVIG',\n", " 'built environment MIUVIG',\n", " 'host-associated MIUVIG',\n", " 'human-associated MIUVIG',\n", " 'human-gut MIUVIG',\n", " 'human-oral MIUVIG',\n", " 'human-skin MIUVIG',\n", " 'human-vaginal MIUVIG',\n", " 'hydrocarbon resources-cores MIUVIG',\n", " 'hydrocarbon resources-fluids_swabs MIUVIG',\n", " 'microbial mat_biofilm MIUVIG',\n", " 'miscellaneous natural or artificial environment MIUVIG',\n", " 'plant-associated MIUVIG',\n", " 'sediment MIUVIG',\n", " 'soil MIUVIG',\n", " 'wastewater_sludge MIUVIG',\n", " 'water MIUVIG']" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.class_descendants('MIUVIG')" ] }, { "cell_type": "code", "execution_count": 26, "id": "4656e62b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.induced_slot('vir_ident_software', 'MIUVIG').required is True" ] }, { "cell_type": "code", "execution_count": 27, "id": "2e103d35", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.induced_slot('vir_ident_software', 'soil MIUVIG').required is True" ] }, { "cell_type": "code", "execution_count": 28, "id": "1b9d4bd2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view.induced_slot('vir_ident_software', 'soil').required is True" ] }, { "cell_type": "code", "execution_count": null, "id": "1b8dcfa2", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.5" } }, "nbformat": 4, "nbformat_minor": 5 }