-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented working prototype of 3.X sub_component <---> 2.X component conversion #282
base: develop
Are you sure you want to change the base?
Conversation
… a test file, and wrote a unit test
…te a file in a temporary directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added my current thoughts.
You will also need to turn on GitHub actions in your branch and ensure that it passes when tested by GitHub
try: | ||
self.visit_component_reference(feature) | ||
except NotImplementedError as e: | ||
# highlights the error message in red. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe that you should be swallowing the error here and turning it into a print statement.
print(f"\033[91m{e}\033[0m") | ||
else: | ||
raise NotImplementedError( | ||
'Conversion of Component features from SBOL3 to SBOL2 not yet implemented') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Conversion of Component features from SBOL3 to SBOL2 not yet implemented') | |
f'Conversion of Component feature of type {type(feature)} from SBOL3 to SBOL2 not yet implemented') |
try: | ||
self.visit_interaction(interaction) | ||
except NotImplementedError as e: | ||
print(f"\033[91m{e}\033[0m") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above - do not swallow errors here, or below
identity_mappings[sub3.identity] = comp2.identity | ||
|
||
def handle_subcomponent_identity_triple_surgery(self, identity_mappings): | ||
with tempfile.TemporaryDirectory() as tmpdir: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that you should be reading and writing tempfiles here. This could result in large numbers of complete read-write cycles in the course of a single conversion and be extremely slow.
I would suggesting saving up all of the identity surgery plans into a single shared datastructure, then doing the surgery on the graph like it's done over here:
def convert_identities2to3(sbol3_data: str) -> str: |
I implemented a first working version of
sub_component
<--->component
conversionA Unit test for a round trip starting from SBOL2 still needs to be written.
In addition, the prototype does not handle
hasLocation
andorientation
properties.For the time being, I am conveerting all
sub_components
into 2.Xcomponents
. However, this is not always the case, since "SBOL 2.x Component, Module, and FunctionalComponent objects map to SBOL 3.x SubComponent objects" as per the documentation.I don't necessarily feel comfortable merging yet, but I would appreciate feedback on what I have at the moment.