Implemented working prototype of 3.X sub_component <---> 2.X component conversion#282
Implemented working prototype of 3.X sub_component <---> 2.X component conversion#282Yehuda-Binik wants to merge 14 commits intoSynBioDex:developfrom
Conversation
… a test file, and wrote a unit test
…te a file in a temporary directory
jakebeal
left a comment
There was a problem hiding this comment.
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.
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.
| '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.
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.
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:
I implemented a first working version of
sub_component<--->componentconversionA Unit test for a round trip starting from SBOL2 still needs to be written.
In addition, the prototype does not handle
hasLocationandorientationproperties.For the time being, I am conveerting all
sub_componentsinto 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.