From 7f676e65536518289e65447361f224e3eba0aac3 Mon Sep 17 00:00:00 2001 From: Gonzalo Vidal <35148159+Gonza10V@users.noreply.github.com> Date: Wed, 2 Apr 2025 11:30:18 -0600 Subject: [PATCH] adding sbol2 experimental data closes #13 --- .../ExperimentalData.ipynb | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 examples/sbol2/CreatingSBOL2Objects/ExperimentalData.ipynb diff --git a/examples/sbol2/CreatingSBOL2Objects/ExperimentalData.ipynb b/examples/sbol2/CreatingSBOL2Objects/ExperimentalData.ipynb new file mode 100644 index 0000000..294f0cf --- /dev/null +++ b/examples/sbol2/CreatingSBOL2Objects/ExperimentalData.ipynb @@ -0,0 +1,104 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Creating an ExperimentalData\n", + "\n", + "`ExperimentalData` objects have the following properties:\n", + "- `uri`\n", + "- `attachments`\n", + "\n", + "\n", + "In this tutorial, we will create an empty `ExperimentalData`. To do this, we will only need to set the `uri` property, we will not add `Attachments` check out the cooresponding notebooks.\n", + "\n", + "For more information on the `ExperimentalData` class and its properties, check out page 54 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": 5, + "metadata": {}, + "outputs": [], + "source": [ + "import sbol2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Create the document and set the namespace" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "doc = sbol2.Document()\n", + "sbol2.setHomespace('https://github.com/SynBioDex/SBOL-Notebooks')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Create an `ExperimentalData` object and add it to the document" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "expdata = sbol2.ExperimentalData('example_experimentaldata')\n", + "doc.add(expdata)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "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": "GLLDB", + "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.19" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}