Closed manulera closed 4 months ago
There are two problems here that you will face in pySBOL2 that you will not face in pySBOL3:
Here is equivalent construction code that follows these rules and produces a valid document:
import sbol2
import tyto
doc2 = sbol2.Document()
component2 = sbol2.ComponentDefinition('hello')
subcomponent2 = sbol2.FunctionalComponent('subcomp')
subcomponent2.definition=component2.identity
interaction2_component = sbol2.ModuleDefinition('hello2')
interaction2_component.functionalComponents.add(subcomponent2)
interaction2 = sbol2.Interaction('reaction1', interaction_type=tyto.SBO.cleavage)
interaction2_component.interactions.add(interaction2)
participation2 = sbol2.Participation(uri='reactant1')
participation2.addRole(sbol2.SBO_REACTANT)
participation2.participant=subcomponent2
interaction2.participations.add(participation2)
doc2.add(interaction2_component)
doc2.add(component2)
doc2.validate()
I am closing this as resolved since I have provided an answer to the question and code that produces a valid document. If this has not addressed the question sufficiently, please reopen.
Thanks, a followup question for the converter.
To convert from sbol2 to sbol3, where/how do we store the original uri of the sbol2 object in the sbol3 object?
We store SBOL2 version information, which doesn't have an equivalent in SBOL3, is saved in an extension property defined at the top of the file: https://github.com/SynBioDex/SBOL-utilities/blob/8a30f7b9fdc0d01b5f1637146e852cf3cc7a1702/sbol_utilities/sbol3_sbol2_conversion.py#L9
We can do the same thing for any child sbol2.persistentIdentity that doesn't match the sbol3.identity automatically assigned by SBOL3.
While working on https://github.com/SynBioDex/SBOL-utilities/issues/249 and https://github.com/SynBioDex/SBOL-utilities/issues/248 I encountered this error. I think this is how I would create an interaction in a document in SBOL2.
However, this seems to give a java exception in the validator:
This error comes from here: https://github.com/SynBioDex/libSBOLj/blob/5291cd38f02e74bb23fa37a17ca0167b0f854105/core2/src/main/java/org/sbolstandard/core2/SBOLReader.java#L5736C1-L5737C1
Am I doing something wrong in the python code?