Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions examples/sbol2/CreatingSBOL2Objects/ExperimentalData.ipynb
Original file line number Diff line number Diff line change
@@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be better/easier to show how an attachment can be added. Without it, ExperimentalData doesn't hold much value. I'd recommend adding 1-2 Attachments and referencing them in the ExperimentalData object.

"\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
}