Skip to content

Commit 5e11528

Browse files
committed
updated MapsTo
1 parent 7a9925d commit 5e11528

File tree

1 file changed

+115
-60
lines changed

1 file changed

+115
-60
lines changed

examples/sbol2/CreatingSBOL2Objects/MapsTo.ipynb

Lines changed: 115 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@
6363
{
6464
"cell_type": "code",
6565
"execution_count": 3,
66+
"id": "ae833529",
67+
"metadata": {},
68+
"outputs": [],
69+
"source": [
70+
"B0032_rbs = sbol2.ComponentDefinition('B0032', sbol2.BIOPAX_DNA)\n",
71+
"B0032_rbs.name = 'B0032_rbs'\n",
72+
"B0032_rbs.addRole(sbol2.SO_RBS)\n",
73+
"doc.addComponentDefinition(B0032_rbs)\n",
74+
"\n",
75+
"B0015_terminator = sbol2.ComponentDefinition('B0015', sbol2.BIOPAX_DNA)\n",
76+
"B0015_terminator.name = 'B0015_terminator'\n",
77+
"B0015_terminator.addRole(sbol2.SO_TERMINATOR)\n",
78+
"doc.addComponentDefinition(B0015_terminator)"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": 4,
6684
"id": "cell-005",
6785
"metadata": {},
6886
"outputs": [],
@@ -90,92 +108,129 @@
90108
"doc.addComponentDefinition(pR)"
91109
]
92110
},
111+
{
112+
"cell_type": "code",
113+
"execution_count": 8,
114+
"id": "cedd52b6",
115+
"metadata": {},
116+
"outputs": [],
117+
"source": [
118+
"# The toggle switch's behavior is defined by two protein pools\n",
119+
"LacI_protein = sbol2.ComponentDefinition('LacI_protein', sbol2.BIOPAX_PROTEIN)\n",
120+
"LacI_protein.name = 'LacI Protein'\n",
121+
"LacI_protein.addRole('http://identifiers.org/ncit/NCIT:C17207') # 'Transcriptional factor'\n",
122+
"doc.addComponentDefinition(LacI_protein)\n",
123+
"\n",
124+
"cI_protein = sbol2.ComponentDefinition('cI_protein', sbol2.BIOPAX_PROTEIN)\n",
125+
"cI_protein.name = 'Lambda cI Protein'\n",
126+
"cI_protein.addRole('http://identifiers.org/ncit/NCIT:C17208') # 'Transcriptional factor'\n",
127+
"doc.addComponentDefinition(cI_protein) "
128+
]
129+
},
93130
{
94131
"cell_type": "markdown",
95-
"id": "cell-006",
132+
"id": "cell-008",
96133
"metadata": {},
97134
"source": [
98-
"## Define the Inverter Modules (Lower-Level Subsystems)\n",
99-
"\n",
100-
"A toggle switch is composed of two inverters. We define each as a `ModuleDefinition`. Each inverter has an input (the repressor protein), a regulated promoter, and an output (the protein it produces). We also add `Interaction` objects to specify the biological function: repression.\n",
135+
"## Define the Toggle Switch Module (Higher-Level Circuit)\n",
101136
"\n",
102-
"- **LacI Inverter**: Takes LacI as input to repress the pLac promoter, which produces the cI protein.\n",
103-
"- **cI Inverter**: Takes cI as input to repress the pR promoter, which produces the LacI protein."
137+
"This `ModuleDefinition` represents the complete genetic toggle switch. From this high-level perspective, we only care about the two key players: the LacI protein and the cI protein."
104138
]
105139
},
106140
{
107141
"cell_type": "code",
108-
"execution_count": 4,
109-
"id": "cell-007",
142+
"execution_count": 10,
143+
"id": "cell-009",
110144
"metadata": {},
111145
"outputs": [],
112146
"source": [
113-
"# 1. LacI Inverter Module (LacI represses production of cI)\n",
114-
"lacI_inverter_md = sbol2.ModuleDefinition('LacI_Inverter')\n",
115-
"\n",
116-
"# Functional Components of the LacI inverter\n",
117-
"lacI_tf_fc = lacI_inverter_md.functionalComponents.create('laci_transcription_factor')\n",
118-
"lacI_tf_fc.definition = lacI_cds\n",
119-
"lacI_tf_fc.access = sbol2.SBOL_ACCESS_PUBLIC\n",
120-
"lacI_tf_fc.direction = sbol2.SBOL_DIRECTION_IN\n",
121-
"\n",
122-
"pLac_fc = lacI_inverter_md.functionalComponents.create('pLac_promoter')\n",
123-
"pLac_fc.definition = pLac\n",
124-
"pLac.access = sbol2.SBOL_ACCESS_PRIVATE\n",
125-
"\n",
126-
"cI_gene_product_fc = lacI_inverter_md.functionalComponents.create('cI_gene_product')\n",
127-
"cI_gene_product_fc.definition = cI_cds\n",
128-
"cI_gene_product_fc.access = sbol2.SBOL_ACCESS_PUBLIC\n",
129-
"cI_gene_product_fc.direction = sbol2.SBOL_DIRECTION_OUT\n",
130-
"\n",
131-
"\n",
132-
"\n",
133-
"# 2. cI Inverter Module (cI represses production of LacI)\n",
134-
"cI_inverter_md = sbol2.ModuleDefinition('cI_Inverter')\n",
147+
"toggle_md = sbol2.ModuleDefinition('toggle_switch')\n",
135148
"\n",
136-
"# Functional Components of the cI inverter\n",
137-
"cI_tf_fc = cI_inverter_md.functionalComponents.create('cI_transcription_factor')\n",
138-
"cI_tf_fc.definition = cI_cds\n",
139-
"cI_tf_fc.access = sbol2.SBOL_ACCESS_PUBLIC\n",
140-
"cI_tf_fc.direction = sbol2.SBOL_DIRECTION_IN\n",
149+
"# create functional components by calling.using protein ComponentDefinitions\n",
141150
"\n",
142-
"pR_fc = cI_inverter_md.functionalComponents.create('pR_promoter')\n",
143-
"pR_fc.definition = pR\n",
144-
"pR_fc.access = sbol2.SBOL_ACCESS_PRIVATE\n",
151+
"lacI_prot_fc = toggle_md.functionalComponents.create('LacI_protein_toggle')\n",
152+
"lacI_prot_fc.definition = LacI_protein\n",
153+
"lacI_prot_fc.direction = sbol2.SBOL_DIRECTION_IN_OUT\n",
145154
"\n",
146-
"lacI_gene_product_fc = cI_inverter_md.functionalComponents.create('LacI_gene_product')\n",
147-
"lacI_gene_product_fc.definition = lacI_cds\n",
148-
"lacI_gene_product_fc.access = sbol2.SBOL_ACCESS_PUBLIC\n",
149-
"lacI_gene_product_fc.direction = sbol2.SBOL_DIRECTION_OUT"
155+
"cI_prot_fc = toggle_md.functionalComponents.create('cI_protein_toggle')\n",
156+
"cI_prot_fc.definition = cI_protein\n",
157+
"cI_prot_fc.direction = sbol2.SBOL_DIRECTION_IN_OUT"
150158
]
151159
},
152160
{
153161
"cell_type": "markdown",
154-
"id": "cell-008",
162+
"id": "cell-006",
155163
"metadata": {},
156164
"source": [
157-
"## Define the Toggle Switch Module (Higher-Level Circuit)\n",
165+
"## Define the Inverter Modules (Lower-Level Subsystems)\n",
158166
"\n",
159-
"This `ModuleDefinition` represents the complete genetic toggle switch. From this high-level perspective, we only care about the two key players: the LacI protein and the cI protein."
167+
"A toggle switch is composed of two inverters. We define each as a `ModuleDefinition`. Each inverter has an input (the repressor protein), a regulated promoter, and an output (the protein it produces). We also add `Interaction` objects to specify the biological function: repression.\n",
168+
"\n",
169+
"- **LacI Inverter**: Takes LacI as input to repress the pLac promoter, which produces the cI protein.\n",
170+
"- **cI Inverter**: Takes cI as input to repress the pR promoter, which produces the LacI protein."
160171
]
161172
},
162173
{
163174
"cell_type": "code",
164-
"execution_count": 5,
165-
"id": "cell-009",
175+
"execution_count": 24,
176+
"id": "cell-007",
166177
"metadata": {},
167178
"outputs": [],
168179
"source": [
169-
"toggle_md = sbol2.ModuleDefinition('toggle_switch')\n",
180+
"# 1. LacI Inverter Module (LacI represses production of cI)\n",
181+
"lacI_inverter_md = sbol2.ModuleDefinition('LacI_Inverter')\n",
170182
"\n",
171-
"# The toggle switch's behavior is defined by two protein pools\n",
172-
"lacI_prot_fc = toggle_md.functionalComponents.create('LacI_protein')\n",
173-
"lacI_prot_fc.definition = lacI_cds\n",
183+
"lacI_inverter_plac_comp = sbol2.component.Component('pLac_promoter', pLac.identity)\n",
184+
"lacI_inverter_b0032_rbs = sbol2.component.Component('B0032_rbs', B0032_rbs.identity)\n",
185+
"lacI_inverter_cI_cds = sbol2.component.Component('cI_cds', cI_cds.identity)\n",
186+
"lacI_inverter_b0015_terminator = sbol2.component.Component('B0015_terminator', B0015_terminator.identity)\n",
187+
"\n",
188+
"# LacI Inverter Transcriptional Unit Component Definition\n",
189+
"lacI_engineered_region = sbol2.ComponentDefinition('LacI_Engineered_Region', sbol2.BIOPAX_DNA)\n",
190+
"lacI_engineered_region.name = 'LacI Engineered Region'\n",
191+
"lacI_engineered_region.addRole('http://identifiers.org/so/SO:0000804') \n",
192+
"lacI_engineered_region.components.add(lacI_inverter_plac_comp)\n",
193+
"lacI_engineered_region.components.add(lacI_inverter_b0032_rbs)\n",
194+
"lacI_engineered_region.components.add(lacI_inverter_cI_cds)\n",
195+
"lacI_engineered_region.components.add(lacI_inverter_b0015_terminator)\n",
196+
"doc.addComponentDefinition(lacI_engineered_region)\n",
197+
"\n",
198+
"# LacI Inverter Proteins\n",
199+
"lacI_prot_fc_lacI_inverter = lacI_inverter_md.functionalComponents.create('LacI_protein_LacI_inverter')\n",
200+
"lacI_prot_fc_lacI_inverter.definition = LacI_protein\n",
201+
"lacI_prot_fc_lacI_inverter.direction = sbol2.SBOL_DIRECTION_IN_OUT\n",
202+
"\n",
203+
"cI_prot_fc_lacI_inverter = lacI_inverter_md.functionalComponents.create('cI_protein_LacI_inverter')\n",
204+
"cI_prot_fc_lacI_inverter.definition = cI_protein\n",
205+
"cI_prot_fc_lacI_inverter.direction = sbol2.SBOL_DIRECTION_IN_OUT\n",
206+
"\n",
207+
"\n",
208+
"# 2. cI Inverter Module (cI represses production of LacI)\n",
209+
"cI_inverter_md = sbol2.ModuleDefinition('cI_Inverter')\n",
210+
"\n",
211+
"cI_inverter_pR_comp = sbol2.component.Component('pR_promoter', pR.identity)\n",
212+
"cI_inverter_b0032_rbs = sbol2.component.Component('B0032_rbs', B0032_rbs.identity)\n",
213+
"cI_inverter_lacI_cds = sbol2.component.Component('lacI_cds', lacI_cds.identity)\n",
214+
"cI_inverter_b0015_terminator = sbol2.component.Component('B0015_terminator', B0015_terminator.identity) \n",
215+
"\n",
216+
"# cI Inverter Transcriptional Unit Component Definition\n",
217+
"cI_engineered_region = sbol2.ComponentDefinition('cI_Engineered_Region', sbol2.BIOPAX_DNA)\n",
218+
"cI_engineered_region.name = 'cI Engineered Region'\n",
219+
"cI_engineered_region.addRole('http://identifiers.org/so/SO:0000804') \n",
220+
"cI_engineered_region.components.add(cI_inverter_pR_comp)\n",
221+
"cI_engineered_region.components.add(cI_inverter_b0032_rbs)\n",
222+
"cI_engineered_region.components.add(cI_inverter_lacI_cds)\n",
223+
"cI_engineered_region.components.add(cI_inverter_b0015_terminator)\n",
224+
"doc.addComponentDefinition(cI_engineered_region)\n",
225+
"\n",
226+
"# cI Inverter Proteins\n",
227+
"lacI_prot_fc = cI_inverter_md.functionalComponents.create('LacI_protein_cI_inverter')\n",
228+
"lacI_prot_fc.definition = LacI_protein\n",
174229
"lacI_prot_fc.direction = sbol2.SBOL_DIRECTION_IN_OUT\n",
175230
"\n",
176-
"cI_prot_fc = toggle_md.functionalComponents.create('cI_protein')\n",
177-
"cI_prot_fc.definition = cI_cds\n",
178-
"cI_prot_fc.direction = sbol2.SBOL_DIRECTION_IN_OUT"
231+
"cI_prot_fc = cI_inverter_md.functionalComponents.create('cI_protein_cI_inverter')\n",
232+
"cI_prot_fc.definition = cI_protein\n",
233+
"cI_prot_fc.direction = sbol2.SBOL_DIRECTION_IN_OUT "
179234
]
180235
},
181236
{
@@ -190,7 +245,7 @@
190245
},
191246
{
192247
"cell_type": "code",
193-
"execution_count": 6,
248+
"execution_count": 25,
194249
"id": "cell-010b",
195250
"metadata": {},
196251
"outputs": [],
@@ -206,7 +261,7 @@
206261
},
207262
{
208263
"cell_type": "code",
209-
"execution_count": 7,
264+
"execution_count": null,
210265
"id": "9cdcd7c0-e419-4106-b7f3-7c8aba06fd7e",
211266
"metadata": {},
212267
"outputs": [],
@@ -263,7 +318,7 @@
263318
},
264319
{
265320
"cell_type": "code",
266-
"execution_count": 8,
321+
"execution_count": null,
267322
"id": "cell-012",
268323
"metadata": {},
269324
"outputs": [],
@@ -305,7 +360,7 @@
305360
},
306361
{
307362
"cell_type": "code",
308-
"execution_count": 9,
363+
"execution_count": null,
309364
"id": "cell-014",
310365
"metadata": {},
311366
"outputs": [
@@ -334,7 +389,7 @@
334389
],
335390
"metadata": {
336391
"kernelspec": {
337-
"display_name": "Python 3 (ipykernel)",
392+
"display_name": "GLLDB",
338393
"language": "python",
339394
"name": "python3"
340395
},
@@ -348,7 +403,7 @@
348403
"name": "python",
349404
"nbconvert_exporter": "python",
350405
"pygments_lexer": "ipython3",
351-
"version": "3.13.5"
406+
"version": "3.9.19"
352407
}
353408
},
354409
"nbformat": 4,

0 commit comments

Comments
 (0)