Skip to content

Conversation

@GeneCodeSavvy
Copy link
Collaborator

@GeneCodeSavvy GeneCodeSavvy commented Jun 17, 2025

Solves #22

@GeneCodeSavvy GeneCodeSavvy requested a review from Gonza10V June 17, 2025 14:25
"source": [
"# MapsTo in pySBOL2\n",
"\n",
"The `MapsTo` class in the Synthetic Biology Open Language (SBOL) is used to explicitly state that two `ComponentInstance` objects, often from different levels of design hierarchy, represent the same biological entity. It is most often used when `ModuleDefinition` and `ComponentDefinition` objects are composed using `Module` and `ComponentInstance` objects.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Give an intuitive example of what this means - why would you want to do this, biologically?

Copy link
Contributor

Choose a reason for hiding this comment

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

For example, to design a genetic "toggle switch" ModuleDefinition we can compose two mutually repressing transcriptional units as its Modules. The transcriptional units ModuleDefinition might be one where its promoter is repressed by the cI transcription factor (TF) protein ComponentInstance and its CDS codes for the LacI TF protein ComponentInstance. And the the other where its prmoter is repressed by LacI and its CDS codes for cI.
In this context we would like to know that the proteins expressed by each transcriptional unit is the one repressing the other. To do this we "map" LacI and ci ComponentInstance from one ModuleDefinition to the other.

"- `remote`: Refers to the `ComponentInstance` in the lower-level design. The referenced instance must have `access=\"public\"`.\n",
"- `refinement`: Specifies how to interpret the relationship between the local and remote instances using a URI. For example: `http://sbols.org/v2#useRemote`.\n",
"\n",
"This example demonstrates linking a `FunctionalComponent` in a high-level toggle switch module to one in a lower-level LacI inverter using a `MapsTo` object. We will:\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, we need to explain what this means biologically

Copy link
Contributor

Choose a reason for hiding this comment

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

We think the example will provide enought link between the biology and its representation.

"id": "cell-004",
"metadata": {},
"source": [
"Creating a MapsTo Object"
Copy link
Contributor

Choose a reason for hiding this comment

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

Say what we're actually doing, biologically

Copy link
Contributor

Choose a reason for hiding this comment

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

"source": [
"# Create lower-level ModuleDefinition\n",
"inverter_md = sbol2.ModuleDefinition('laci_inverter')\n",
"tf_fc = inverter_md.functionalComponents.create('TF')\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

What is TF?

Copy link
Contributor

Choose a reason for hiding this comment

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

now included in the example

"tf_fc = inverter_md.functionalComponents.create('TF')\n",
"tf_fc.definition = tf_fc\n",
"tf_fc.access = sbol2.SBOL_ACCESS_PUBLIC\n",
"tf_fc.direction = sbol2.SBOL_DIRECTION_IN_OUT\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this in/out?

Copy link
Contributor

Choose a reason for hiding this comment

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

@GeneCodeSavvy TBI give readable and explicit names

"# Create lower-level ModuleDefinition\n",
"inverter_md = sbol2.ModuleDefinition('laci_inverter')\n",
"tf_fc = inverter_md.functionalComponents.create('TF')\n",
"tf_fc.definition = tf_fc\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect, and it shouldn't be letting us get away with this. This should be pointing at a ComponentDefinition.

"# Create higher-level ModuleDefinition\n",
"toggle_md = sbol2.ModuleDefinition('toggle_switch')\n",
"laci_fc = toggle_md.functionalComponents.create('LacI')\n",
"laci_fc.definition = laci_fc\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect, and it shouldn't be letting us get away with this. This should be pointing at a ComponentDefinition.

Copy link
Contributor

Choose a reason for hiding this comment

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

@GeneCodeSavvy create a ComponentDefinition for each object that needs it, then create the functionalComponents pointing to them.

"\n",
"# Create higher-level ModuleDefinition\n",
"toggle_md = sbol2.ModuleDefinition('toggle_switch')\n",
"laci_fc = toggle_md.functionalComponents.create('LacI')\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Explain what this is for, biologically: why do we need this here if it is private and not interacting with anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

"mod = toggle_md.modules.create('laci_inverter_instance')\n",
"mod.definition = inverter_md.identity\n",
"\n",
"# Create the MapsTo\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Explain what this means, intuitively.

Copy link
Contributor

Choose a reason for hiding this comment

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

"outputs": [],
"source": [
"# Validate the document\n",
"report = doc.validate()\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you do something with the contents of the document to show it's correct and useful besides just validate it?

Copy link
Contributor

Choose a reason for hiding this comment

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

do you have any idea in how to do it? We can use it as input fora model (like iBioSim)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking something like starting with LacI and tracing the Interactions to show that the linkages go around in a circle.

Copy link
Contributor

Choose a reason for hiding this comment

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

@GeneCodeSavvy please implement this idea so we can review it in the 1o1

@GeneCodeSavvy GeneCodeSavvy requested a review from jakebeal June 26, 2025 18:28
@GeneCodeSavvy
Copy link
Collaborator Author

GeneCodeSavvy commented Jun 26, 2025

I have considered all the comments and added more biological context overall, with the help of @Gonza10V explanation.

"gene_out = laci_inverter_md.functionalComponents.create('output_gene')\n",
"gene_out.definition = cI_cds.identity\n",
"gene_out.access = sbol2.SBOL_ACCESS_PUBLIC\n",
"gene_out.direction = sbol2.SBOL_DIRECTION_OUT\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

This ModuleDefinition is incomplete without the Interaction objects that link the Promoter to the TF to the output gene.
As such, you should either add the two Interaction objects (my preference) or should add a comment saying that they have been omitted for simplicity.
Same for the other inverter ModuleDefinition

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay I will include it.

"source": [
"# Map 1: LacI protein is the input to the LacI inverter\n",
"map1 = laci_inverter_instance.mapsTos.create('map_laci_in')\n",
"map1.refinement = sbol2.SBOL_REFINEMENT_USE_REMOTE\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the others have their refinement values set as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, missed this.
Updated.

"outputs": [],
"source": [
"# Validate the document\n",
"report = doc.validate()\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 was thinking something like starting with LacI and tracing the Interactions to show that the linkages go around in a circle.

Co-authored-by: Jacob Beal <jakebeal@gmail.com>
"outputs": [],
"source": [
"# Validate the document\n",
"report = doc.validate()\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

@GeneCodeSavvy please implement this idea so we can review it in the 1o1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants