From b07205096d27d207eeda1652be51670a2a81502b Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Mon, 16 Sep 2024 21:51:01 -0400 Subject: [PATCH 1/8] cleaned up Component.ipynb" --- .../CreatingSBOL2Objects/Component.ipynb | 195 ++++++++++++++++++ .../Component_Definition.ipynb | 136 ------------ 2 files changed, 195 insertions(+), 136 deletions(-) create mode 100644 examples/sbol2/CreatingSBOL2Objects/Component.ipynb delete mode 100644 examples/sbol2/CreatingSBOL2Objects/Component_Definition.ipynb diff --git a/examples/sbol2/CreatingSBOL2Objects/Component.ipynb b/examples/sbol2/CreatingSBOL2Objects/Component.ipynb new file mode 100644 index 0000000..ae4bb61 --- /dev/null +++ b/examples/sbol2/CreatingSBOL2Objects/Component.ipynb @@ -0,0 +1,195 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Creating a Component\n", + "\n", + "`Components` connect component `ComponentDefinitions` into a hierarchy. In this totorial, we will have one a parent `ComponentDefinition` representing a gene and a child `ComponentDefinition` representing a promoter on said gene.\n", + "\n", + "\n", + "`Component` objects have the following properties:\n", + "- `uri` \n", + "- `definition`\n", + "- `mapsTo`\n", + "- `access`\n", + "- `measures`\n", + "- `roles`\n", + "- `roleIntegration`\n", + "- `sourceLocations`\n", + "\n", + "In this tutorial, we will not be dealing with neither the `mapsTo` nor the `measures` atributes. For a guide on those, check out the corresponding notebooks.\n", + "\n", + "For more information on the `Component` class and its properties, check out page 28 of the SBOL 2.3.0 specifications which can be found at the following [link](https://sbolstandard.org/docs/SBOL2.3.0.pdf).\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Import the module" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [], + "source": [ + "import sbol2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Create the document and set the namespace" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [], + "source": [ + "doc = sbol2.Document()\n", + "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Create a plasmid `Sequence` object and add it to the document" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [], + "source": [ + "plasmid_sequence = sbol2.Sequence('example_plasmid')\n", + "plasmid_sequence.elements = 'ATGCGTACGATCGTAAAGAGGAGAAAATGCGTACGTAGCTAGTCTGATCGTAGCTAGT'\n", + "plasmid_sequence.encoding = sbol2.SBOL_ENCODING_IUPAC\n", + "doc.addSequence(plasmid_sequence)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Ceate a `ComponentDefinition` object for the promoter `Sequence`" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [], + "source": [ + "plasmid_component_definition = sbol2.ComponentDefinition(uri='plasmid_component_definition', component_type=sbol2.BIOPAX_DNA)\n", + "plasmid_component_definition.addRole(sbol2.SO_PROMOTER)\n", + "plasmid_component_definition.sequence = plasmid_sequence\n", + "doc.addComponentDefinition(plasmid_component_definition)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now, Create a `Range` object to define the portion of the plasmids's sequence that will be included in the RBS (lets say 15 - 28)" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [], + "source": [ + "promoter_range = sbol2.Range(uri='sample_range')\n", + "promoter_range.start = 15\n", + "promoter_range.end = 28\n", + "doc.add(promoter_range)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Create a `Component` object for the Promoter that is situated inside the plasmid" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [], + "source": [ + "promoter_component = sbol2.Component(uri='RBS_component', access=sbol2.SBOL_ACCESS_PRIVATE)\n", + "promoter_component.definition = plasmid_component_definition\n", + "promoter_component.sourceLocations = [promoter_range]\n", + "promoter_component.roles = [sbol2.SO_PROMOTER]\n", + "promoter_component.roleIntegration = sbol2.SBOL_ROLE_INTEGRATION_OVERRIDE" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Ceate a `ComponentDefinition` object for the Gene the Promoter will be promoting, and then add the promoter to said compo. You can optionally add a `Sequence` and `SequenceAnnotation` to the Gene to specify the full gene sequence as well as where the promoter for the gene is situated, however we will not go into how to do that here. For more information, go over to the relevent NoteBooks." + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [], + "source": [ + "example_gene_component_definition = sbol2.ComponentDefinition(uri='example_gene_component_definition', component_type=sbol2.BIOPAX_DNA)\n", + "example_gene_component_definition.addRole(sbol2.SO_GENE)\n", + "example_gene_component_definition.addRole(sbol2.SO_PROMOTER)\n", + "doc.addComponentDefinition(example_gene_component_definition)\n", + "example_gene_component_definition.components.add(promoter_component)" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [], + "source": [ + "report = doc.validate()\n", + "if (report == 'Valid.'):\n", + " doc.write('component_example.xml')\n", + "else:\n", + " print(report)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "SBOL-test", + "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.10.14" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/sbol2/CreatingSBOL2Objects/Component_Definition.ipynb b/examples/sbol2/CreatingSBOL2Objects/Component_Definition.ipynb deleted file mode 100644 index 82427a8..0000000 --- a/examples/sbol2/CreatingSBOL2Objects/Component_Definition.ipynb +++ /dev/null @@ -1,136 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Creating a ComponentDefinition\n", - "\n", - "`ComponentDefinition` objects have the following properties:\n", - "- `uri`\n", - "- `types`\n", - "- `roles`\n", - "- `sequences`\n", - "- `components`\n", - "- `sequenceAnnotations`\n", - "- `sequenceConstraints`\n", - "\n", - "In this tutorial, we will be creating a `ComponentDefinition` with a `Sequence` and so will only be setting the `uri`, `types`, `roles`, and `sequences` properties. For a guide on setting the `components`, `sequenceAnnotations`, and `sequenceConstraints` properties, check out the cooresponding notebooks.\n", - "\n", - "For more information on the `ComponentDefinition` class and its properties, check out page 22 of the SBOL 2.3.0 specifications which can be found at the following [link](https://sbolstandard.org/docs/SBOL2.3.0.pdf)." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Import the module" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [], - "source": [ - "import sbol2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Create the document and set the namespace" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [], - "source": [ - "doc = sbol2.Document()\n", - "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Create a `Sequence` object and add it to the document" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [], - "source": [ - "seq = sbol2.Sequence('example_sequence')\n", - "seq.elements = 'AAAGAGGAGAAAATGCGTACGTAGCTAGTCTGATCGTAGCTAGT'\n", - "seq.encoding = sbol2.SBOL_ENCODING_IUPAC\n", - "doc.addSequence(seq)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Ceate a `ComponentDefinition` object for a DNA component and add it to the document." - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [], - "source": [ - "comp_def = sbol2.ComponentDefinition(uri='example_component_definition', component_type=sbol2.BIOPAX_DNA)\n", - "comp_def.addRole(sbol2.SO_RBS)\n", - "comp_def.sequences = [seq]\n", - "doc.addComponentDefinition(comp_def)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Validate the document Save the document to an SBOL file" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [], - "source": [ - "report = doc.validate()\n", - "if (report == 'Valid.'):\n", - " doc.write('comp_def_example.xml')\n", - "else:\n", - " print(report)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SBOL-test", - "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.10.14" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} From 2dd153170a262b30d62487cca3c194d0b5d9d6a8 Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Wed, 9 Oct 2024 20:28:10 -0400 Subject: [PATCH 2/8] Modeled SequenceConstraint notebook off of example in test suite --- .../SequenceConstraint.ipynb | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb diff --git a/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb new file mode 100644 index 0000000..f564ff9 --- /dev/null +++ b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb @@ -0,0 +1,108 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Using `SequenceConstraint` to place restrictions on `Components` within the same `ComponentDefinition`\n", + "\n", + "`SequenceConstraints` are used to describe the relative position and orientation between two components within the same component definition. There are four types of restriction that two components can have. They are outlined through the following examples:\n", + "1. `ComponentA` precedes `ComponentB`\n", + "2. `ComponentA` is the same orientation as `ComponentB`\n", + "3. `ComponentA` is the opposite orientation as `ComponentB`\n", + "4. `ComponentA` is different from `ComponentB`\n", + "\n", + "Of the four examples, only #4 is not immediatly straight forward.\n", + "\n", + "To demonstrate the various `SequenceConstraints`, we will model the following genetic circuit\n", + "[SequenceConstraintCircuit.PNG](attachment:SequenceConstraintCircuit.PNG)" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Valid.'" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import sbol2\n", + "\n", + "# Create a new SBOL document\n", + "doc = sbol2.Document()\n", + "\n", + "# Set the homespace (namespace) for the document\n", + "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')\n", + "\n", + "# Create a ComponentDefinition for the LacI operator\n", + "lacI_operator_comp_def = sbol2.ComponentDefinition('LacI_operator', sbol2.BIOPAX_DNA)\n", + "lacI_operator_comp_def.description = 'LacI binding site'\n", + "# The role \"SO:0000057\" is for an operator, as defined in the Sequence Ontology\n", + "lacI_operator_comp_def.roles = [\"http://identifiers.org/so/SO:0000057\"]\n", + "doc.addComponentDefinition(lacI_operator_comp_def)\n", + "\n", + "# Create a ComponentDefinition for the pspac promoter\n", + "pspac_promotor_comp_def = sbol2.ComponentDefinition('pspac', sbol2.BIOPAX_DNA)\n", + "pspac_promotor_comp_def.roles = [sbol2.SO_PROMOTER]\n", + "doc.addComponentDefinition(pspac_promotor_comp_def)\n", + "\n", + "# Create a ComponentDefinition for the genetic construct\n", + "genetic_construct_comp_def = sbol2.ComponentDefinition('BBa_K174004', sbol2.BIOPAX_DNA)\n", + "genetic_construct_comp_def.description = 'pspac core promoter region'\n", + "genetic_construct_comp_def.roles = [sbol2.SO_PROMOTER]\n", + "doc.addComponentDefinition(genetic_construct_comp_def)\n", + "\n", + "# Create Component instances for pspac promoter and LacI operator within the genetic construct\n", + "pspac_promoter_comp = sbol2.Component('pspac')\n", + "pspac_promoter_comp.definition = pspac_promotor_comp_def.identity\n", + "genetic_construct_comp_def.components.add(pspac_promoter_comp)\n", + "\n", + "LacI_operator_comp = sbol2.Component('LacI_operator')\n", + "LacI_operator_comp.definition = lacI_operator_comp_def.identity\n", + "genetic_construct_comp_def.components.add(LacI_operator_comp)\n", + "\n", + "# Create a SequenceConstraint specifying that the pspac promoter precedes the LacI operator\n", + "constraint = genetic_construct_comp_def.sequenceConstraints.create('Constraint1')\n", + "constraint.subject = pspac_promoter_comp.identity # Set the subject to the identity of pspac promoter\n", + "constraint.object = LacI_operator_comp.identity # Set the object to the identity of LacI operator\n", + "constraint.restriction = sbol2.SBOL_RESTRICTION_PRECEDES # Use the SBOL_RESTRICTION_PRECEDES restriction\n", + "\n", + "# Validate the document to ensure compliance with SBOL standards\n", + "doc.validate()\n", + "\n", + "# Save the document to an SBOL file\n", + "doc.write('sequence_constraint_example.xml')\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "SBOL-test", + "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.10.14" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} From fffd8333d919de915df87977b2bb1c96c140d22c Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Wed, 16 Oct 2024 11:06:27 -0400 Subject: [PATCH 3/8] Worked on the introduction to the NoteBook --- .../SequenceConstraint.ipynb | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb index f564ff9..b25b539 100644 --- a/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb +++ b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb @@ -6,21 +6,27 @@ "source": [ "## Using `SequenceConstraint` to place restrictions on `Components` within the same `ComponentDefinition`\n", "\n", - "`SequenceConstraints` are used to describe the relative position and orientation between two components within the same component definition. There are four types of restriction that two components can have. They are outlined through the following examples:\n", - "1. `ComponentA` precedes `ComponentB`\n", - "2. `ComponentA` is the same orientation as `ComponentB`\n", - "3. `ComponentA` is the opposite orientation as `ComponentB`\n", - "4. `ComponentA` is different from `ComponentB`\n", + "`SequenceConstraints` are used to describe the relative position and orientation between two components within the same component definition. \n", "\n", - "Of the four examples, only #4 is not immediatly straight forward.\n", + "`SequenceConstraints have three properties:\n", + "1. Subject\n", + "2. Object\n", + "3. Restriction\n", "\n", - "To demonstrate the various `SequenceConstraints`, we will model the following genetic circuit\n", - "[SequenceConstraintCircuit.PNG](attachment:SequenceConstraintCircuit.PNG)" + "### Four Restriction Types:\n", + "1. `SBOL_RESTRICTION_PRECEDES`: `Component_A` precedes `Component_B` \n", + "2. `SBOL_RESTRICTION_SAME_ORIENTATION_AS`: The two `Components` have the same orrientation as each other\n", + "3. `SBOL_RESTRICTION_OPPOSITE_ORIENTATION_AS`: The two `Components` have the opposite orrientation as each other\n", + "4. `SBOL_RESTRICTION_DIFFERENT_FROM`: The two `Components` do not refer to the same `ComponentDefinition`\n", + "\n", + "For more information on the `SequenceConstraint` class and its properties, check out page 36 of the [SBOL 2.3.0 specifications](https://sbolstandard.org/docs/SBOL2.3.0.pdf).\n", + "\n", + "We will demonstrate `SBOL_RESTRICTION_PRECEDES` using the [Part:BBa_K174004](https://parts.igem.org/Part:BBa_K174004), a pspac promoter, designed by the The Newcastle 2009 iGEM team. The genetic device has two parts, a pspac promoter and a Lac operator, with the promoter directly preceding the operator. We can use `SBOL_RESTRICTION_PRECEDES` to model this relationship." ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -29,13 +35,14 @@ "'Valid.'" ] }, - "execution_count": 25, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sbol2\n", + "import sbol2.sequenceconstraint\n", "\n", "# Create a new SBOL document\n", "doc = sbol2.Document()\n", @@ -43,6 +50,7 @@ "# Set the homespace (namespace) for the document\n", "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')\n", "\n", + "\n", "# Create a ComponentDefinition for the LacI operator\n", "lacI_operator_comp_def = sbol2.ComponentDefinition('LacI_operator', sbol2.BIOPAX_DNA)\n", "lacI_operator_comp_def.description = 'LacI binding site'\n", From c5c3aa1089d6ed5239e46aa190899ba0d4f4fb3c Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Wed, 16 Oct 2024 12:09:28 -0400 Subject: [PATCH 4/8] First attempt at compile method --- .../SequenceConstraint.ipynb | 105 +++++++++++++++--- 1 file changed, 89 insertions(+), 16 deletions(-) diff --git a/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb index b25b539..310c824 100644 --- a/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb +++ b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb @@ -6,12 +6,12 @@ "source": [ "## Using `SequenceConstraint` to place restrictions on `Components` within the same `ComponentDefinition`\n", "\n", - "`SequenceConstraints` are used to describe the relative position and orientation between two components within the same component definition. \n", + "`SequenceConstraints` are used to describe the relative position and orientation between two components within the same `ComponentDefinition`. \n", "\n", - "`SequenceConstraints have three properties:\n", - "1. Subject\n", - "2. Object\n", - "3. Restriction\n", + "A minimally useful version of this object requires the existence of:\n", + "\n", + "- a parent ComponentDefinition\n", + "- Two child Components\n", "\n", "### Four Restriction Types:\n", "1. `SBOL_RESTRICTION_PRECEDES`: `Component_A` precedes `Component_B` \n", @@ -63,32 +63,105 @@ "pspac_promotor_comp_def.roles = [sbol2.SO_PROMOTER]\n", "doc.addComponentDefinition(pspac_promotor_comp_def)\n", "\n", - "# Create a ComponentDefinition for the genetic construct\n", - "genetic_construct_comp_def = sbol2.ComponentDefinition('BBa_K174004', sbol2.BIOPAX_DNA)\n", - "genetic_construct_comp_def.description = 'pspac core promoter region'\n", - "genetic_construct_comp_def.roles = [sbol2.SO_PROMOTER]\n", - "doc.addComponentDefinition(genetic_construct_comp_def)\n", + "# Create a ComponentDefinition for the genetic part\n", + "genetic_part_comp_def = sbol2.ComponentDefinition('BBa_K174004', sbol2.BIOPAX_DNA)\n", + "genetic_part_comp_def.description = 'pspac core promoter region'\n", + "genetic_part_comp_def.roles = [sbol2.SO_PROMOTER]\n", + "doc.addComponentDefinition(genetic_part_comp_def)\n", "\n", - "# Create Component instances for pspac promoter and LacI operator within the genetic construct\n", + "# Create a Component instance for the pspac promoter and add it to the genetic part\n", "pspac_promoter_comp = sbol2.Component('pspac')\n", "pspac_promoter_comp.definition = pspac_promotor_comp_def.identity\n", - "genetic_construct_comp_def.components.add(pspac_promoter_comp)\n", + "genetic_part_comp_def.components.add(pspac_promoter_comp)\n", "\n", + "# Create a Component instance for the LacI operator and add it to the genetic part\n", "LacI_operator_comp = sbol2.Component('LacI_operator')\n", "LacI_operator_comp.definition = lacI_operator_comp_def.identity\n", - "genetic_construct_comp_def.components.add(LacI_operator_comp)\n", + "genetic_part_comp_def.components.add(LacI_operator_comp)\n", "\n", "# Create a SequenceConstraint specifying that the pspac promoter precedes the LacI operator\n", - "constraint = genetic_construct_comp_def.sequenceConstraints.create('Constraint1')\n", + "constraint = genetic_part_comp_def.sequenceConstraints.create('Constraint1')\n", "constraint.subject = pspac_promoter_comp.identity # Set the subject to the identity of pspac promoter\n", "constraint.object = LacI_operator_comp.identity # Set the object to the identity of LacI operator\n", - "constraint.restriction = sbol2.SBOL_RESTRICTION_PRECEDES # Use the SBOL_RESTRICTION_PRECEDES restriction\n", + "constraint.restriction = sbol2.SBOL_RESTRICTION_PRECEDES # Use the SBOL_RESTRICTION_PRECEDES restriction\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As you can see, creating a `SequenceConstraint` is very easy, as all that is needed are two `Components` within the same parent `ComponentDefinition`. For our next step, we will show off some of the functionality of `SequenceConstraint`. One useful aspect of `SequenceConstraint` is that if we have specified the `Sequences` of the ... we can calculate the `Sequence` of the entire Genetic part" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + ">\n" + ] + }, + { + "data": { + "text/plain": [ + "'Valid.'" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Create the pspac sequence\n", + "pspac_sequence = sbol2.Sequence('pspac_sequence')\n", + "pspac_sequence.elements = 'ttgttgactttatctacaaggtgtggcataatgtgtgg'\n", + "pspac_sequence.encoding = sbol2.SBOL_ENCODING_IUPAC\n", + "pspac_promotor_comp_def.sequence = pspac_sequence\n", + "\n", + "# Create the LacI sequence\n", + "LacI_sequence = sbol2.Sequence('LacI_sequence')\n", + "LacI_sequence.elements = 'attgtgagcgctcacaatt'\n", + "LacI_sequence.encoding = sbol2.SBOL_ENCODING_IUPAC\n", + "lacI_operator_comp_def.sequence = LacI_sequence" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + ">\n" + ] + }, + { + "data": { + "text/plain": [ + "'Valid.'" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "genetic_part_comp_def.compile\n", + "\n", "\n", "# Validate the document to ensure compliance with SBOL standards\n", "doc.validate()\n", "\n", "# Save the document to an SBOL file\n", - "doc.write('sequence_constraint_example.xml')\n" + "doc.write('sequence_constraint_example.xml')" ] } ], From 6a696a89bea500a53527d430da98d230475a6ed2 Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Mon, 28 Oct 2024 16:50:22 -0400 Subject: [PATCH 5/8] Made changes to component --- examples/sbol2/CreatingSBOL2Objects/Component.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/sbol2/CreatingSBOL2Objects/Component.ipynb b/examples/sbol2/CreatingSBOL2Objects/Component.ipynb index ae4bb61..b1c5138 100644 --- a/examples/sbol2/CreatingSBOL2Objects/Component.ipynb +++ b/examples/sbol2/CreatingSBOL2Objects/Component.ipynb @@ -36,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -88,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ From 178f1bcf8ee11fd40c9eea7b6ee2cba74e4367d9 Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Wed, 30 Oct 2024 11:55:24 -0400 Subject: [PATCH 6/8] modified Component to bring it up to date with other branch --- .../CreatingSBOL2Objects/Component.ipynb | 196 ++++++++---------- 1 file changed, 86 insertions(+), 110 deletions(-) diff --git a/examples/sbol2/CreatingSBOL2Objects/Component.ipynb b/examples/sbol2/CreatingSBOL2Objects/Component.ipynb index b1c5138..89c730e 100644 --- a/examples/sbol2/CreatingSBOL2Objects/Component.ipynb +++ b/examples/sbol2/CreatingSBOL2Objects/Component.ipynb @@ -4,170 +4,146 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Creating a Component\n", + "# Introduction\n", "\n", - "`Components` connect component `ComponentDefinitions` into a hierarchy. In this totorial, we will have one a parent `ComponentDefinition` representing a gene and a child `ComponentDefinition` representing a promoter on said gene.\n", + "A `Component` is used to compose `ComponentDefinition` objects into a structural hierarchy. For example, the `ComponentDefinition` of a gene could contain four `Component` objects: a promoter, RBS, CDS, and terminator. In turn, the `ComponentDefinition` of the promoter `Component` could contain Component objects defined as various operator sites.\n", "\n", + "`Component` objects have the following properties of note:\n", "\n", - "`Component` objects have the following properties:\n", - "- `uri` \n", - "- `definition`\n", - "- `mapsTo`\n", - "- `access`\n", - "- `measures`\n", - "- `roles`\n", - "- `roleIntegration`\n", - "- `sourceLocations`\n", + "- `definition`: Identifies the `ComponentDefinition` that provides the detailed description or blueprint for the Component. It is `MANDATORY`.\n", "\n", - "In this tutorial, we will not be dealing with neither the `mapsTo` nor the `measures` atributes. For a guide on those, check out the corresponding notebooks.\n", + "- `roles`: describes the expected purpose and function of the component. Used when the `role` of the component differes from that of the `sub-componentDefinition`. For example, A component Definition that is an activator is being used as a repressor. \n", "\n", - "For more information on the `Component` class and its properties, check out page 28 of the SBOL 2.3.0 specifications which can be found at the following [link](https://sbolstandard.org/docs/SBOL2.3.0.pdf).\n", + "- `roleIntegration`: Specifies the relationship between a Component instance’s own set of roles and the set of roles on the included sub-ComponentDefinition. It is only mandatory to set if one or more `roles` are set. It can be set to:\n", + " 1. `SBOL_ROLE_INTEGRATION_MERGE`: This option combines the roles from both the current Component and the included sub-ComponentDefinition, resulting in the union of their roles​. It is the default.\n", + " 2. `SBOL_ROLE_INTEGRATION_OVERRIDE`: This option instructs that any roles specified for the included sub-ComponentDefinition should be ignored, and only the roles explicitly defined for the current Component should be used.\n", "\n", + "- `sourceLocations`: Indicates which elements of a `ComponentDefinition`'s `Sequence` are to be included in the `Component`'s Parent. It is optional. If it is not set, the whole `Sequence` is assumed to be included.\n", "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Import the module" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import sbol2" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Create the document and set the namespace" + "- `mapsTo`: Defines relationships between `Component` objects in different contexts, such as hierarchical designs. For details, see the `MapsTo` Notebook.\n", + "\n", + "- `access`: the access property of a Component controls whether it can be referenced by other components or modules through a `MapsTo` object. There are two options:\n", + "\n", + " 1. `SBOL_ACCESS_PUBLIC`: The component is visible and accessible to other designs, meaning it can be used in different parts of a larger system.\n", + " 2. `SBOL_ACCESS_PRIVATE`: The component is only accessible within the design it belongs to and cannot be used by external components.\n", + "\n", + "- `measures`: The measures property is OPTIONAL and MAY contain a set of Measure objects. For details, see the `Measures` Notebook.\n", + "\n", + "For more information on the `Component` class and its properties, check out page 28 of the SBOL 2.3.0 specifications, which can be found at the following [link](https://sbolstandard.org/docs/SBOL2.3.0.pdf)." ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ + "# import dependency\n", + "import sbol2\n", + "\n", + "# Create the document and set the namespace\n", "doc = sbol2.Document()\n", - "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Create a plasmid `Sequence` object and add it to the document" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "plasmid_sequence = sbol2.Sequence('example_plasmid')\n", - "plasmid_sequence.elements = 'ATGCGTACGATCGTAAAGAGGAGAAAATGCGTACGTAGCTAGTCTGATCGTAGCTAGT'\n", - "plasmid_sequence.encoding = sbol2.SBOL_ENCODING_IUPAC\n", - "doc.addSequence(plasmid_sequence)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Ceate a `ComponentDefinition` object for the promoter `Sequence`" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "plasmid_component_definition = sbol2.ComponentDefinition(uri='plasmid_component_definition', component_type=sbol2.BIOPAX_DNA)\n", - "plasmid_component_definition.addRole(sbol2.SO_PROMOTER)\n", - "plasmid_component_definition.sequence = plasmid_sequence\n", - "doc.addComponentDefinition(plasmid_component_definition)" + "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')\n", + "\n", + "# Create a Sequence object for the genetic construct\n", + "genetic_construct_sequence = sbol2.Sequence('genetic_construct_sequence')\n", + "genetic_construct_sequence.elements = 'ATGCGTACGATCGTAAAGAGGAGAAAATGCGTACGTAGCTAGTCTGATCGTAGCTAGTTGGCTCTGGTTTACTGGGCG'\n", + "genetic_construct_sequence.encoding = sbol2.SBOL_ENCODING_IUPAC\n", + "doc.addSequence(genetic_construct_sequence)\n", + "\n", + "# Create a ComponentDefinition object to house the genetic construct sequence\n", + "genetic_construct_cd = sbol2.ComponentDefinition('genetic_construct_component_definition', component_type=sbol2.BIOPAX_DNA)\n", + "genetic_construct_cd.addRole(sbol2.SBO_GENE)\n", + "genetic_construct_cd.sequence = genetic_construct_sequence\n", + "doc.addComponentDefinition(genetic_construct_cd)\n", + "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Now, Create a `Range` object to define the portion of the plasmids's sequence that will be included in the RBS (lets say 15 - 28)" + "## Steps in Creating A `Component`" ] }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ - "promoter_range = sbol2.Range(uri='sample_range')\n", - "promoter_range.start = 15\n", - "promoter_range.end = 28\n", - "doc.add(promoter_range)" + "# --- First Component: Promoter ---\n", + "# Step 1: Ceate a ComponentDefinition object for the promoter\n", + "promoter_component_definition = sbol2.ComponentDefinition('promoter_component_definition', component_type=sbol2.BIOPAX_DNA)\n", + "promoter_component_definition.addRole(sbol2.SO_PROMOTER)\n", + "doc.addComponentDefinition(promoter_component_definition)\n", + "\n", + "# Step 2: Create a Component object for the promoter\n", + "promotor_component = sbol2.Component('promoter_comoponent')\n", + "\n", + "# Step 3: Connect the Component object to the ComponentDefinition object through the definition property\n", + "promotor_component.definition = promoter_component_definition\n", + "\n", + "# Step 4: Add the Component to the the components list in the parent ComponentDefinition\n", + "genetic_construct_cd.components.add(promotor_component)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Create a `Component` object for the Promoter that is situated inside the plasmid" + "We can also specify which elements of the gene-construct `ComponentDefinition` is to be included in the promoter. Let us say that the promoter spans the first 26 DNA nucleotides of the gene-construct." ] }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ - "promoter_component = sbol2.Component(uri='RBS_component', access=sbol2.SBOL_ACCESS_PRIVATE)\n", - "promoter_component.definition = plasmid_component_definition\n", - "promoter_component.sourceLocations = [promoter_range]\n", - "promoter_component.roles = [sbol2.SO_PROMOTER]\n", - "promoter_component.roleIntegration = sbol2.SBOL_ROLE_INTEGRATION_OVERRIDE" + "\n", + "# Create a range objects to specify the location of the promotor on the genetic construct sequence\n", + "promotor_range = sbol2.Range('promoter_range', start=1, end=26)\n", + "promotor_component.sourceLocations.add(promotor_range)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Ceate a `ComponentDefinition` object for the Gene the Promoter will be promoting, and then add the promoter to said compo. You can optionally add a `Sequence` and `SequenceAnnotation` to the Gene to specify the full gene sequence as well as where the promoter for the gene is situated, however we will not go into how to do that here. For more information, go over to the relevent NoteBooks." - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "metadata": {}, - "outputs": [], - "source": [ - "example_gene_component_definition = sbol2.ComponentDefinition(uri='example_gene_component_definition', component_type=sbol2.BIOPAX_DNA)\n", - "example_gene_component_definition.addRole(sbol2.SO_GENE)\n", - "example_gene_component_definition.addRole(sbol2.SO_PROMOTER)\n", - "doc.addComponentDefinition(example_gene_component_definition)\n", - "example_gene_component_definition.components.add(promoter_component)" + "## Creating the CDS `Component`\n", + "We will now create a second Sub-Component for the gene-construct: A CDS. " ] }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ - "report = doc.validate()\n", - "if (report == 'Valid.'):\n", - " doc.write('component_example.xml')\n", - "else:\n", - " print(report)" + "\n", + "# --- Second Component: CDS ---\n", + "# Step 1: Ceate a ComponentDefinition object for the promoter\n", + "cds_component_definition = sbol2.ComponentDefinition('cds_component_definition', component_type=sbol2.BIOPAX_DNA)\n", + "cds_component_definition.addRole(sbol2.SO_CDS)\n", + "\n", + "doc.addComponentDefinition(cds_component_definition)\n", + "\n", + "# Step 2: Create a Component object for the promoter\n", + "cds_component = sbol2.Component('cds_component')\n", + "\n", + "# Step 3: Connect the Component object to the ComponentDefinition object through the definition property\n", + "cds_component.definition = cds_component_definition\n", + "\n", + "# Step 4: Add the Component to the the components list in the parent ComponentDefinition\n", + "genetic_construct_cd.components.add(cds_component)\n", + "\n", + "\n", + "# Check if the SBOL document is valid\n", + "doc.validate()\n", + "\n", + "# Save the document to an SBOL file\n", + "doc.write('component_example.xml')" ] } ], From 9b352cdabeab9e6c3c122a80e5390cddf37c81b4 Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Wed, 30 Oct 2024 11:57:00 -0400 Subject: [PATCH 7/8] got rid of Component.ipynb since this branch is not involved in that file --- .../CreatingSBOL2Objects/Component.ipynb | 171 ------------------ 1 file changed, 171 deletions(-) delete mode 100644 examples/sbol2/CreatingSBOL2Objects/Component.ipynb diff --git a/examples/sbol2/CreatingSBOL2Objects/Component.ipynb b/examples/sbol2/CreatingSBOL2Objects/Component.ipynb deleted file mode 100644 index 89c730e..0000000 --- a/examples/sbol2/CreatingSBOL2Objects/Component.ipynb +++ /dev/null @@ -1,171 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Introduction\n", - "\n", - "A `Component` is used to compose `ComponentDefinition` objects into a structural hierarchy. For example, the `ComponentDefinition` of a gene could contain four `Component` objects: a promoter, RBS, CDS, and terminator. In turn, the `ComponentDefinition` of the promoter `Component` could contain Component objects defined as various operator sites.\n", - "\n", - "`Component` objects have the following properties of note:\n", - "\n", - "- `definition`: Identifies the `ComponentDefinition` that provides the detailed description or blueprint for the Component. It is `MANDATORY`.\n", - "\n", - "- `roles`: describes the expected purpose and function of the component. Used when the `role` of the component differes from that of the `sub-componentDefinition`. For example, A component Definition that is an activator is being used as a repressor. \n", - "\n", - "- `roleIntegration`: Specifies the relationship between a Component instance’s own set of roles and the set of roles on the included sub-ComponentDefinition. It is only mandatory to set if one or more `roles` are set. It can be set to:\n", - " 1. `SBOL_ROLE_INTEGRATION_MERGE`: This option combines the roles from both the current Component and the included sub-ComponentDefinition, resulting in the union of their roles​. It is the default.\n", - " 2. `SBOL_ROLE_INTEGRATION_OVERRIDE`: This option instructs that any roles specified for the included sub-ComponentDefinition should be ignored, and only the roles explicitly defined for the current Component should be used.\n", - "\n", - "- `sourceLocations`: Indicates which elements of a `ComponentDefinition`'s `Sequence` are to be included in the `Component`'s Parent. It is optional. If it is not set, the whole `Sequence` is assumed to be included.\n", - "\n", - "- `mapsTo`: Defines relationships between `Component` objects in different contexts, such as hierarchical designs. For details, see the `MapsTo` Notebook.\n", - "\n", - "- `access`: the access property of a Component controls whether it can be referenced by other components or modules through a `MapsTo` object. There are two options:\n", - "\n", - " 1. `SBOL_ACCESS_PUBLIC`: The component is visible and accessible to other designs, meaning it can be used in different parts of a larger system.\n", - " 2. `SBOL_ACCESS_PRIVATE`: The component is only accessible within the design it belongs to and cannot be used by external components.\n", - "\n", - "- `measures`: The measures property is OPTIONAL and MAY contain a set of Measure objects. For details, see the `Measures` Notebook.\n", - "\n", - "For more information on the `Component` class and its properties, check out page 28 of the SBOL 2.3.0 specifications, which can be found at the following [link](https://sbolstandard.org/docs/SBOL2.3.0.pdf)." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "# import dependency\n", - "import sbol2\n", - "\n", - "# Create the document and set the namespace\n", - "doc = sbol2.Document()\n", - "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')\n", - "\n", - "# Create a Sequence object for the genetic construct\n", - "genetic_construct_sequence = sbol2.Sequence('genetic_construct_sequence')\n", - "genetic_construct_sequence.elements = 'ATGCGTACGATCGTAAAGAGGAGAAAATGCGTACGTAGCTAGTCTGATCGTAGCTAGTTGGCTCTGGTTTACTGGGCG'\n", - "genetic_construct_sequence.encoding = sbol2.SBOL_ENCODING_IUPAC\n", - "doc.addSequence(genetic_construct_sequence)\n", - "\n", - "# Create a ComponentDefinition object to house the genetic construct sequence\n", - "genetic_construct_cd = sbol2.ComponentDefinition('genetic_construct_component_definition', component_type=sbol2.BIOPAX_DNA)\n", - "genetic_construct_cd.addRole(sbol2.SBO_GENE)\n", - "genetic_construct_cd.sequence = genetic_construct_sequence\n", - "doc.addComponentDefinition(genetic_construct_cd)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Steps in Creating A `Component`" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], - "source": [ - "# --- First Component: Promoter ---\n", - "# Step 1: Ceate a ComponentDefinition object for the promoter\n", - "promoter_component_definition = sbol2.ComponentDefinition('promoter_component_definition', component_type=sbol2.BIOPAX_DNA)\n", - "promoter_component_definition.addRole(sbol2.SO_PROMOTER)\n", - "doc.addComponentDefinition(promoter_component_definition)\n", - "\n", - "# Step 2: Create a Component object for the promoter\n", - "promotor_component = sbol2.Component('promoter_comoponent')\n", - "\n", - "# Step 3: Connect the Component object to the ComponentDefinition object through the definition property\n", - "promotor_component.definition = promoter_component_definition\n", - "\n", - "# Step 4: Add the Component to the the components list in the parent ComponentDefinition\n", - "genetic_construct_cd.components.add(promotor_component)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We can also specify which elements of the gene-construct `ComponentDefinition` is to be included in the promoter. Let us say that the promoter spans the first 26 DNA nucleotides of the gene-construct." - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "# Create a range objects to specify the location of the promotor on the genetic construct sequence\n", - "promotor_range = sbol2.Range('promoter_range', start=1, end=26)\n", - "promotor_component.sourceLocations.add(promotor_range)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Creating the CDS `Component`\n", - "We will now create a second Sub-Component for the gene-construct: A CDS. " - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "# --- Second Component: CDS ---\n", - "# Step 1: Ceate a ComponentDefinition object for the promoter\n", - "cds_component_definition = sbol2.ComponentDefinition('cds_component_definition', component_type=sbol2.BIOPAX_DNA)\n", - "cds_component_definition.addRole(sbol2.SO_CDS)\n", - "\n", - "doc.addComponentDefinition(cds_component_definition)\n", - "\n", - "# Step 2: Create a Component object for the promoter\n", - "cds_component = sbol2.Component('cds_component')\n", - "\n", - "# Step 3: Connect the Component object to the ComponentDefinition object through the definition property\n", - "cds_component.definition = cds_component_definition\n", - "\n", - "# Step 4: Add the Component to the the components list in the parent ComponentDefinition\n", - "genetic_construct_cd.components.add(cds_component)\n", - "\n", - "\n", - "# Check if the SBOL document is valid\n", - "doc.validate()\n", - "\n", - "# Save the document to an SBOL file\n", - "doc.write('component_example.xml')" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SBOL-test", - "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.10.14" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} From d9ca910aac2ea168a2450e1135e9a523a5c0e842 Mon Sep 17 00:00:00 2001 From: Yehuda Binik Date: Wed, 30 Oct 2024 12:04:33 -0400 Subject: [PATCH 8/8] worked on the description for generating ComponentDefinition sequences --- .../SequenceConstraint.ipynb | 48 ++++--------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb index 310c824..38682ff 100644 --- a/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb +++ b/examples/sbol2/CreatingSBOL2Objects/SequenceConstraint.ipynb @@ -26,20 +26,9 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'Valid.'" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "import sbol2\n", "import sbol2.sequenceconstraint\n", @@ -90,32 +79,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "As you can see, creating a `SequenceConstraint` is very easy, as all that is needed are two `Components` within the same parent `ComponentDefinition`. For our next step, we will show off some of the functionality of `SequenceConstraint`. One useful aspect of `SequenceConstraint` is that if we have specified the `Sequences` of the ... we can calculate the `Sequence` of the entire Genetic part" + "As you can see, creating a `SequenceConstraint` is very easy, as all that is needed are two `Components` within the same parent `ComponentDefinition`. For our next step, we will show off some of the functionality of `SequenceConstraint`. One useful aspect of `SequenceConstraint` is that if we have specified the `Sequences` of the individual Components we can calculate the `Sequence` of the entire Genetic part." ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - ">\n" - ] - }, - { - "data": { - "text/plain": [ - "'Valid.'" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Create the pspac sequence\n", "pspac_sequence = sbol2.Sequence('pspac_sequence')\n", @@ -132,14 +103,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - ">\n" + ">\n" ] }, { @@ -148,13 +119,14 @@ "'Valid.'" ] }, - "execution_count": 3, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "genetic_part_comp_def.compile\n", + "print(genetic_part_comp_def.compile)\n", + "\n", "\n", "\n", "# Validate the document to ensure compliance with SBOL standards\n",