{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# pyomexmeta Demonstration Notebook\n", "\n", "This Jupyter Notebook provides detailed, executable examples that demonstrate how to use pyomexmeta, the Python interface to the [libOmexMeta](https://github.com/sys-bio/libOmexMeta) library. This notebook refers to the OMEX Metadata Specification document which describes the complete specification for annotations of biosimulation models. Note that we anticipate that users of libOmexMeta will be programmers rather than biologists. \n", "\n", "These examples demonstrate the construction of a variety of different types of annotations as defined in the OMEX Metadata Specification.\n", "\n", "* Section 1 demonstrates the creation of a singular annotations. Singular annotations are the lowest level of the pyomexmeta annotation API where the user wants to define the annotation triple directly.\n", "\n", "* Section 2 demonstrates the use of convenience methods for the creation of model-level annotations. Model-level annotations are knowledge about the whole model being annotated - for example, the author, related publication, or the relevante species of the model.\n", "\n", "* Section 3 demonstrates how to create the range of composite annotations defined in the OMEX Metadata Specification. Composite annotations are collections of singular annotations with a predefined structure and are used to construct precise physiological concepts that are not represented as singular terms in current knowledge resources. This section is divided into two parts, where we demonstrate these types of annotation first with models encoded in SBML and second with models encoded in CellML.\n", "\n", "Note that in the following examples the SBML and CellML model strings are not aiming to be full models and may not be complete. They are purely defined to provide sufficient model snippets to enable the demonstration of pyomexmeta functionality." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Singular Annotations\n", "\n", "In this section, we demonstrate how one can create a single annotation, which is an RDF triple object comprising a subject, a predicate and an object.\n", "\n", "The SBML model that we use in this example is a basic toy model where `A` transitions to `B` using first order mass action kinetics." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix bqbiol: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "\n", " bqbiol:is .\n", "\n", "\n" ] } ], "source": [ "# Example 1\n", "from pyomexmeta import RDF, eUriType\n", "\n", "# Define an SBML model to annotate\n", "sbml1 = \"\"\"\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " k1 \n", " A \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\"\"\"\n", "\n", "rdf_graph1 = RDF()\n", "rdf_graph1.set_archive_uri(\"MyOmexArchive.omex\")\n", "rdf_graph1.set_model_uri(\"MyModel.sbml\")\n", "annot_editor = rdf_graph1.to_editor(sbml1, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "with annot_editor.new_singular_annotation() as singular_annotation:\n", " # CHEBI:16236 = EtOH in chebi\n", " singular_annotation.about(\"A\") \\\n", " .predicate(\"bqbiol\", \"is\") \\\n", " .resource_uri(\"CHEBI:16236\")\n", "print(rdf_graph1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This example shows the lowest level interface for creating an annotation. These three methods (`about()` , `predicate()` and `resource_uri()`) demonstrate how to create the subject, predicate and resource ([reference](https://sys-bio.github.io/libOmexMeta/docsbuild/singular_annotations/index.html#subjects-predicates-and-resources)) parts of an RDF triple object respectively. Note, that there also exists a `resource_literal()` and a `resource_blank()` for creating RDF resources that are literal or blank nodes respectively. \n", "\n", "This annotation states that the SBML species with metaid `A` is the chemical entity that has the CHEBI identifier `CHEBI:16236`, which is ethanol." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Model-level annotations\n", "\n", "Here we demonstrate how to create annotations to indicate the creator, curator, taxon, publication ID, and creation date for an SBML model. We use the same SBML model from Section 1 above." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix pubmed: .\n", "@prefix dc: .\n", "@prefix bqbiol: .\n", "@prefix NCBI_Taxon: .\n", "@prefix bqmodel: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "\n", " dc:creator .\n", "\n", "\n", " bqbiol:hasTaxon ;\n", " bqmodel:isDescribedBy ;\n", " dc:created [\n", " dc:W3CDTF \"18-09-2020\"\n", " ] ;\n", " dc:creator .\n", "\n", "\n" ] } ], "source": [ "# example 2\n", "\n", "from pyomexmeta import RDF, eUriType\n", "\n", "# reuse SBML model from above\n", "sbml2 = sbml1\n", "\n", "rdf_graph2 = RDF()\n", "rdf_graph2.set_archive_uri(\"MyOmexArchive.omex\")\n", "rdf_graph2.set_model_uri(\"MyModel.sbml\")\n", "annot_editor = rdf_graph2.to_editor(sbml2, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "annot_editor.add_creator(\"0000-0001-8254-4957\") \\\n", " .add_curator(\"0000-0002-2390-6572\") \\\n", " .add_taxon(\"9895\") \\\n", " .add_pubmed(\"12334\") \\\n", " .add_date_created(\"18-09-2020\")\n", "\n", "print(rdf_graph2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As described in the Omex Metadata v1.1 specification, it is also optionally possible to specify the people (curators, creators) with strings for names, email addresses, etc." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Composite Annotations\n", "\n", "Composite annotations are collections of singular annotations with a predefined structure and are used to construct precise physiological concepts that are not represented as singular terms in current knowledge resources. Three types of composite annotations are defined in the OMEX Metadata Specification (version 1.1) and supported by libOmexMeta: 1) annotation for a physical entity; 2) a physical process; and 3) an energy differential. In this Section 3.1 we provide examples of each of these using models encoded in the SBML format and in Section 3.2 models encoded in the CellML format." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1 SBML\n", "\n", "#### 3.1.1 Annotations for a Physical Entity\n", "\n", "In many modeling situations, one may wish to annotate both the physical entity and the physical property that is being simulated, such as concentration, particle numbers, fluid volume or fluid pressure. This allows us to capture more complete biological semantics. For example, a cardiovascular fluid flow model might simulate the fluid volume or fluid pressure inside the left ventricle, or a chemical kinetic model might simulate the chemical concentration or the amount (in moles, perhaps) of a physical entity, such as glucose or ethanol.\n", "\n", "In some modeling languages, only one of these aspects may be explicitly represented in the code. For example, in CellML, one has variables that represent chemical concentrations, or blood pressures, but the biological physical entity is implicit. Conversely, in SBML, the physical entity is specified as a “species”, but the physical property (usually chemical concentration or particle numbers) is left implicit. Thus, for annotation, we must allow for either situation.\n", "\n", "A physical entity may be a complex structured object. For example, one may need to distinguish between nuclear and cytoplasmic\n", "glucose. These are both the same entity (glucose), but they are part of different anatomic structures. In the following example we demonstrate how to annotate such a situation using another toy model depicting glucose in dynamic equilibrium between two\n", "compartments, the `nucleus` and the `cytoplasm`." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix bqbiol: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "local:EntityProperty0000\n", " bqbiol:isPropertyOf ;\n", " bqbiol:isVersionOf .\n", "\n", "local:EntityProperty0001\n", " bqbiol:isPropertyOf ;\n", " bqbiol:isVersionOf .\n", "\n", "\n", " bqbiol:is ;\n", " bqbiol:isPartOf .\n", "\n", "\n", " bqbiol:is ;\n", " bqbiol:isPartOf .\n", "\n", "\n" ] } ], "source": [ "# Example 3.1.1\n", "from pyomexmeta import RDF, eUriType\n", "\n", "sbml3_1_1 = \"\"\"\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " cytoplasm \n", " kimp \n", " glucose_c \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " nucleus \n", " kexp \n", " glucose_n \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\"\"\"\n", "\n", "rdf_graph3_1_1 = RDF()\n", "rdf_graph3_1_1.set_archive_uri(\"GlucoseTransport3_1_1.omex\")\n", "rdf_graph3_1_1.set_model_uri(\"glucose_transport3_1_1.sbml\")\n", "annot_editor = rdf_graph3_1_1.to_editor(sbml3_1_1, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "with annot_editor.new_physical_entity() as cytosolic_glucose:\n", " # CHEBI:17234 = glucose\n", " # GO:0005737 = GO cellular component term for cytoplasm.\n", " # OPB:00340 = OPB term for chemical concentration\n", " cytosolic_glucose.about(\"glucose_c\", eUriType.MODEL_URI) \\\n", " .identity(\"CHEBI:17234\")\\\n", " .is_part_of(\"GO:0005737\") \\\n", " .has_property(\"OPB:OPB_00340\")\n", "\n", "with annot_editor.new_physical_entity() as nuclear_glucose:\n", " # CHEBI:17234 = The GO cellular component term for nucleus.\n", " nuclear_glucose.about(\"glucose_n\", eUriType.MODEL_URI) \\\n", " .identity(\"CHEBI:17234\")\\\n", " .is_part_of(\"GO:0005634\") \\\n", " .has_property(\"OPB:OPB_00340\")\n", " \n", "print(rdf_graph3_1_1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the above example we construct two physical entity annotations, one each for cytoplasmic and nuclear glucose. The argument to the `about()` method is the metadata ID (metaid) for the SBML species element called `glucose_c` . Internally, libOmexMeta creates a new RDF subject node `local:EntityProperty0000` which is local to the annotation document we are creating.\n", "\n", "The `is_part_of` relation is clearly critical when an entity can exist in multiple compartments and the modeler needs to distinguish between them. However, this relation may be useful in other settings as well.\n", "\n", "The `has_property` relation may be used to indicate the property we are simulating. In this case, we are simulating the chemical concentration of the glucose entity. Often, this property is not made explicit; the use of the `has_property` annotation is optional." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 3.1.2 Annotations for a Physical Process\n", "\n", "Perhaps the most prevalent type of biosimulation model is one that simulates biochemical reactions. Thus, we provide special attention to annotations for biological processes, such as reactions. Unlike physical entities, processes rarely have unique names. However, some processes can be categorized as a \"version of\" a Gene Ontology process term. Thus, in the main text, we used a \"version of\" alcohol dehydrogenase. Alcohol dehydrogenase ADH is the enzyme that catalyzes the conversion of ethanol EtOH into an aldehyde Aldehyde entity. Moreover, NAD+ gains an a H+ in the process as well as two electrons, thus neutralizing the charge on NAHD, the second product of this reaction. This reaction is depicted in the sbml model below with simple mass action kinetics." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix bqbiol: .\n", "@prefix semsim: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "local:MediatorParticipant0000\n", " semsim:hasPhysicalEntityReference .\n", "\n", "local:ProcessProperty0000\n", " bqbiol:isPropertyOf ;\n", " bqbiol:isVersionOf .\n", "\n", "local:SinkParticipant0000\n", " semsim:hasMultiplier \"1\"^^rdf:double ;\n", " semsim:hasPhysicalEntityReference .\n", "\n", "local:SinkParticipant0001\n", " semsim:hasMultiplier \"1\"^^rdf:double ;\n", " semsim:hasPhysicalEntityReference .\n", "\n", "local:SourceParticipant0000\n", " semsim:hasMultiplier \"1\"^^rdf:double ;\n", " semsim:hasPhysicalEntityReference .\n", "\n", "local:SourceParticipant0001\n", " semsim:hasMultiplier \"1\"^^rdf:double ;\n", " semsim:hasPhysicalEntityReference .\n", "\n", "\n", " semsim:hasMediatorParticipant local:MediatorParticipant0000 ;\n", " semsim:hasSinkParticipant local:SinkParticipant0000, local:SinkParticipant0001 ;\n", " semsim:hasSourceParticipant local:SourceParticipant0000, local:SourceParticipant0001 ;\n", " bqbiol:isVersionOf .\n", "\n", "\n" ] } ], "source": [ "# Example 3.1.2\n", "from pyomexmeta import RDF, eUriType\n", "\n", "sbml3_1_2_1 = \"\"\"\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " k\n", " ADH\n", " EtOH\n", " NAD\n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\"\"\"\n", "\n", "rdf_graph3_1_2_1 = RDF()\n", "rdf_graph3_1_2_1.set_archive_uri(\"AHD.omex\")\n", "rdf_graph3_1_2_1.set_model_uri(\"AHDModel.sbml\")\n", "annot_editor = rdf_graph3_1_2_1.to_editor(sbml3_1_2_1, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "\n", "# OPB:OPB_00237 = Chemical flow rate\n", "# GO:0004022 = GO term for Alcohol Dehydrogenase\n", "with annot_editor.new_physical_process() as phy_process:\n", " phy_process \\\n", " .about(\"ADHForwardReaction\", eUriType.MODEL_URI) \\\n", " .is_version_of(\"GO:0004022\") \\\n", " .add_source(physical_entity_reference=\"EtOH\", uri_type=eUriType.MODEL_URI, multiplier=1.0) \\\n", " .add_source(physical_entity_reference=\"NAD\", uri_type=eUriType.MODEL_URI, multiplier=1.0) \\\n", " .add_sink(physical_entity_reference=\"Aldehyde\", uri_type=eUriType.MODEL_URI, multiplier=1.0) \\\n", " .add_sink(physical_entity_reference=\"NADH\", uri_type=eUriType.MODEL_URI, multiplier=1.0) \\\n", " .add_mediator(physical_entity_reference=\"ADH\", uri_type=eUriType.MODEL_URI) \\\n", " .has_property(\"OPB:OPB_00237\") #Chemical flow rate\n", "\n", "print(rdf_graph3_1_2_1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the above example, the reaction has two reactants, two products, and one mediating enzyme. Note that stoichiometry, where\n", "appropriate (`sources` and `sinks`), can be specified via the `multiplier` fields. As with the physical entity type composite annotations, the about method provides the link between the annotation document we are composing and the SBML source code. Similarly, the `physical_entity_reference` arguments point to metaids on elements within the SBML document. The final optional clause has_property indicates that the reaction being simulated has the physical property of \"chemical flow rate\"." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 3.1.3 Annotations for an energy differential\n", "\n", "Finally, we provide an example for annotating the electrical potential across the cellular membrane, specifically resulting from calcium ions. In addition to source and sink, this is annotated with the OPB term for the Nernst, or reversal potential." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix bqbiol: .\n", "@prefix semsim: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "local:EnergyDiff000\n", " semsim:hasSinkParticipant local:SinkParticipant0000 ;\n", " semsim:hasSourceParticipant local:SourceParticipant0000 .\n", "\n", "local:SinkParticipant0000\n", " semsim:hasPhysicalEntityReference .\n", "\n", "local:SourceParticipant0000\n", " semsim:hasPhysicalEntityReference .\n", "\n", "\n", " bqbiol:isPropertyOf local:EnergyDiff000 ;\n", " bqbiol:isVersionOf .\n", "\n", "\n" ] } ], "source": [ "# Example 3_1_3\n", "from pyomexmeta import RDF, eUriType\n", "\n", "sbml3_1_3 = \"\"\"\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\"\"\"\n", "rdf_graph_3_1_3 = RDF()\n", "rdf_graph_3_1_3.set_archive_uri(\"Example3_1_3.omex\")\n", "rdf_graph_3_1_3.set_model_uri(\"Example3_1_3.sbml\")\n", "annot_editor = rdf_graph_3_1_3.to_editor(sbml3_1_3, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "\n", "# Ca_cyt: Calcium Ions cytosol\n", "# Ca_ex: Calcium Ions extracellular space\n", "# NernstPotential: The metaID of the SBML reaction\n", "# OPB/OPB_01581: Nernst reversal potential\n", "with annot_editor.new_energy_diff() as energy_in:\n", " energy_in \\\n", " .about(\"EnergyDiff000\", eUriType.LOCAL_URI) \\\n", " .add_source(physical_entity_reference=\"Ca_ex\", uri_type=eUriType.MODEL_URI) \\\n", " .add_sink(physical_entity_reference=\"Ca_cyt\", uri_type=eUriType.MODEL_URI) \\\n", " .has_property(property_about=\"NernstPotential\", about_uri_type=eUriType.MODEL_URI, is_version_of=\"OPB:OPB_01581\")\n", "\n", " \n", "print(rdf_graph_3_1_3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2 CellML\n", "\n", "#### 3.2.1 Annotations for a Physical Entity\n", "\n", "As mentioned earlier, in CellML one has variables which represent various physical properties but the biological physical entity is implicit. In this example, we demonstrate how to annotate the Volume of blood in the Lumen of the left coronary artery using a snippet of CellML code." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix bqbiol: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "\n", " bqbiol:isPropertyOf local:local-entity-0 ;\n", " bqbiol:isVersionOf .\n", "\n", "local:local-entity-0\n", " bqbiol:is ;\n", " bqbiol:isPartOf .\n", "\n", "\n" ] } ], "source": [ "# Example 3_2_1\n", "from pyomexmeta import RDF, eUriType\n", "\n", "cellml = \"\"\"\n", "\n", " \n", " \n", " \n", " \n", " \n", "\n", "\"\"\"\n", "\n", "rdf_graph_3_2_1 = RDF()\n", "rdf_graph_3_2_1.set_archive_uri(\"physical_process.omex\")\n", "rdf_graph_3_2_1.set_model_uri(\"model.cellml\")\n", "annot_editor = rdf_graph_3_2_1.to_editor(cellml, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "\n", "# OPB:00154 = fluid volume\n", "# FMA:9670 = portion of blood\n", "# FMA:18228 = Lumen of the left coronary artery\n", "with annot_editor.new_physical_entity() as arterial_volume:\n", " arterial_volume.about(\"local-entity-0\", eUriType.LOCAL_URI) \\\n", " .identity(\"FMA:9670\") \\\n", " .is_part_of(\"FMA:18228\") \\\n", " .has_property(\"main.Volume\", eUriType.MODEL_URI, \"opb:OPB_00154\")\n", "print(rdf_graph_3_2_1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example we construct a physical entity annotation for the arterial blood volume. The argument to the about method is the cmetaid for the CellML variable element called `main.Volume`.\n", "\n", "```xml\n", "\n", "```\n", "\n", "Internally, libOmexMeta creates a new entity (`local:local-entity-0`) which is local to the annotation document we are creating that links the variable with cmetaid `main.Volume` to the information that annotates this physical entity." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 3.2.2 Annotations for a Physical Process\n", "\n", "Here we describe the annotation of the CellML version of the conversion of `ethanol` into `aldehyde` as described in 3.1.2. In CellML this reaction is represented by the molar flow rate from the `source` `ethanol` to the `sink` `acetaldehyde` via the mediator `alcohol dehydrogenase 1A` within the cytosol of a `hepatocyte`." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix bqbiol: .\n", "@prefix semsim: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "\n", " bqbiol:isPropertyOf local:process ;\n", " bqbiol:isVersionOf .\n", "\n", "local:MediatorParticipant0000\n", " semsim:hasPhysicalEntityReference local:mediator .\n", "\n", "local:SinkParticipant0000\n", " semsim:hasMultiplier \"1\"^^rdf:double ;\n", " semsim:hasPhysicalEntityReference local:sink .\n", "\n", "local:SourceParticipant0000\n", " semsim:hasMultiplier \"1\"^^rdf:double ;\n", " semsim:hasPhysicalEntityReference local:source .\n", "\n", "local:cytosol\n", " bqbiol:is ;\n", " bqbiol:isPartOf .\n", "\n", "local:mediator\n", " bqbiol:is ;\n", " bqbiol:isPartOf local:cytosol .\n", "\n", "local:process\n", " semsim:hasMediatorParticipant local:MediatorParticipant0000 ;\n", " semsim:hasSinkParticipant local:SinkParticipant0000 ;\n", " semsim:hasSourceParticipant local:SourceParticipant0000 ;\n", " bqbiol:isVersionOf .\n", "\n", "local:sink\n", " bqbiol:is ;\n", " bqbiol:isPartOf local:cytosol .\n", "\n", "local:source\n", " bqbiol:is ;\n", " bqbiol:isPartOf local:cytosol .\n", "\n", "\n" ] } ], "source": [ "# Example 3_2_2 \n", "from pyomexmeta import RDF, eUriType\n", "\n", "cellml = \"\"\"\n", "\n", " \n", " \n", " \n", " \n", " \n", "\n", "\"\"\"\n", "\n", "rdf_graph_3_2_2 = RDF()\n", "rdf_graph_3_2_2.set_archive_uri(\"physical_process.omex\")\n", "rdf_graph_3_2_2.set_model_uri(\"model.cellml\")\n", "annot_editor = rdf_graph_3_2_2.to_editor(cellml, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "\n", "# fma:14515 = hepatocyte\n", "# fma:66836 = portion of cytosol\n", "with annot_editor.new_physical_entity() as cytosol:\n", " cytosol \\\n", " .about(\"cytosol\", eUriType.LOCAL_URI) \\\n", " .identity(\"FMA:66836\") \\\n", " .is_part_of(\"FMA:14515\")\n", " \n", "# http://purl.obolibrary.org/obo/PR_000003767 = alcohol dehydrogenase 1A\n", "with annot_editor.new_physical_entity() as mediator:\n", " mediator \\\n", " .about(\"mediator\", eUriType.LOCAL_URI) \\\n", " .identity(\"http://purl.obolibrary.org/obo/PR_000003767\") \\\n", " .is_part_of(\"cytosol\", eUriType.LOCAL_URI)\n", "\n", "# CHEBI:16236 = ethanol\n", "with annot_editor.new_physical_entity() as source:\n", " source \\\n", " .about(\"source\", eUriType.LOCAL_URI) \\\n", " .identity(\"CHEBI:16236\") \\\n", " .is_part_of(\"cytosol\", eUriType.LOCAL_URI)\n", "\n", "# CHEBI:15343 = acetaldehyde\n", "with annot_editor.new_physical_entity() as sink:\n", " sink \\\n", " .about(\"sink\", eUriType.LOCAL_URI) \\\n", " .identity(\"CHEBI:15343\") \\\n", " .is_part_of(\"cytosol\", eUriType.LOCAL_URI)\n", "\n", "# opb:OPB_00592 = chemical molar flow rate\n", "# GO:0004022 = alcohol dehydrogenase (NAD+) activity\n", "with annot_editor.new_physical_process() as reaction_rate:\n", " reaction_rate \\\n", " .about(\"process\", eUriType.LOCAL_URI) \\\n", " .is_version_of(\"GO:0004022\") \\\n", " .add_source(\"source\", eUriType.LOCAL_URI, multiplier=1) \\\n", " .add_sink(\"sink\", eUriType.LOCAL_URI, multiplier=1) \\\n", " .add_mediator(\"mediator\", eUriType.LOCAL_URI) \\\n", " .has_property(property_about=\"main.ReactionRate\", about_uri_type=eUriType.MODEL_URI, is_version_of=\"opb:OPB_00592\")\n", "\n", "print(rdf_graph_3_2_2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 3.2.3 Annotations for an energy differential\n", "\n", "We show here an example of annotating an energy differential, specifically the electrical potential across a membrane of a pancreatic islet." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "@prefix rdf: .\n", "@prefix bqbiol: .\n", "@prefix semsim: .\n", "@prefix OMEXlib: .\n", "@prefix local: .\n", "\n", "\n", " bqbiol:isPropertyOf local:energy-diff ;\n", " bqbiol:isVersionOf .\n", "\n", "local:SinkParticipant0000\n", " semsim:hasPhysicalEntityReference local:sink .\n", "\n", "local:SourceParticipant0000\n", " semsim:hasPhysicalEntityReference local:source .\n", "\n", "local:cytosol\n", " bqbiol:is ;\n", " bqbiol:isPartOf .\n", "\n", "local:energy-diff\n", " semsim:hasSinkParticipant local:SinkParticipant0000 ;\n", " semsim:hasSourceParticipant local:SourceParticipant0000 .\n", "\n", "local:intercellular-matrix\n", " bqbiol:is ;\n", " bqbiol:isPartOf .\n", "\n", "local:sink\n", " bqbiol:is ;\n", " bqbiol:isPartOf local:intercellular-matrix .\n", "\n", "local:source\n", " bqbiol:is ;\n", " bqbiol:isPartOf local:cytosol .\n", "\n", "\n" ] } ], "source": [ "# Example 3_2_3\n", "from pyomexmeta import RDF, eUriType\n", "\n", "cellml = \"\"\"\n", "\n", " \n", " \n", " \n", " \n", " \n", "\n", "\"\"\"\n", "\n", "rdf_graph_3_2_3 = RDF()\n", "rdf_graph_3_2_3.set_archive_uri(\"physical_process.omex\")\n", "rdf_graph_3_2_3.set_model_uri(\"model.cellml\")\n", "annot_editor = rdf_graph_3_2_3.to_editor(cellml, generate_new_metaids=False, sbml_semantic_extraction=False)\n", "\n", "# FMA:16016 = Pancreatic islet\n", "# FMA:9672 = Intercellular matrix\n", "with annot_editor.new_physical_entity() as matrix:\n", " matrix \\\n", " .about(\"intercellular-matrix\", eUriType.LOCAL_URI) \\\n", " .identity(\"FMA:9672\") \\\n", " .is_part_of(\"FMA:16016\")\n", " \n", "# CHEBI:24870 - ion\n", "with annot_editor.new_physical_entity() as sink:\n", " sink \\\n", " .about(\"sink\", eUriType.LOCAL_URI) \\\n", " .identity(\"CHEBI:24870\") \\\n", " .is_part_of(\"intercellular-matrix\", eUriType.LOCAL_URI)\n", "\n", "# FMA:70586 = Type B cell of pancreatic islet\n", "# FMA:66836 = Portion of cytosol\n", "with annot_editor.new_physical_entity() as cytosol:\n", " cytosol \\\n", " .about(\"cytosol\", eUriType.LOCAL_URI) \\\n", " .identity(\"FMA:66836\") \\\n", " .is_part_of(\"FMA:70586\")\n", " \n", "# CHEBI:24870 - ion\n", "with annot_editor.new_physical_entity() as source:\n", " source \\\n", " .about(\"source\", eUriType.LOCAL_URI) \\\n", " .identity(\"CHEBI:24870\") \\\n", " .is_part_of(\"cytosol\", eUriType.LOCAL_URI)\n", "\n", "# opb:OPB_00506 = Electrical potential\n", "with annot_editor.new_energy_diff() as energy_diff:\n", " energy_diff \\\n", " .about(\"energy-diff\", eUriType.LOCAL_URI) \\\n", " .add_source(\"source\", eUriType.LOCAL_URI) \\\n", " .add_sink(\"sink\", eUriType.LOCAL_URI) \\\n", " .has_property(\"main.MembraneVoltage\", eUriType.MODEL_URI, \"opb:OPB_00506\")\n", " \n", "print(rdf_graph_3_2_3)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.4" } }, "nbformat": 4, "nbformat_minor": 4 }