Conversation
|
I would like to get feedback on this one. I'll try to get more of these implemented. |
|
|
||
| # convert locations | ||
| locations2 = [] | ||
| if seqfeat3.locations: |
There was a problem hiding this comment.
This can all be done with just a single list comprehension:
locations2 = [loc3.accept(self) for loc3 in seqfeat3.locations]
There was a problem hiding this comment.
I also realized that I dont need to convert name, description, wasDerivedFrom, nor wasGeneratedBy as those are handled by _convert_identified. So I'm removing those.
| elif type(loc3) is sbol3.location.EntireSequence: | ||
| raise NotImplementedError('Conversion of EntireSequence from SBOL3 to SBOL2 not yet implemented') | ||
| else: raise ValueError(f'Unknown location type {type(loc3)}, SequenceFeature cannot convert to SBOL2') | ||
| else: raise ValueError('SequenceFeature must have at least one location') |
There was a problem hiding this comment.
No need to check this if we've validated in advance.
There was a problem hiding this comment.
removed with the implementation of the list comprehension
| # If they do have a component, their locations are added to the corresponding SBOL3 SubComponent. | ||
|
|
||
| # convert locations | ||
| locations3 = [] |
There was a problem hiding this comment.
Similar notes to above for converting to a list comprehension and dealing with exception handling. For pySBOL2 there's no accept function to call, but you can move the if/elif into a nested function and call that from the list comprehension.
|
|
||
| # Create SBOL3 SequenceFeature | ||
| if seqanno2.component: | ||
| feature3 = sbol3.SubComponent(namespace=self._sbol3_namespace(seqanno2), |
There was a problem hiding this comment.
These aren't top-levels, so they don't take a namespace - they're going to get their name from their parent.
Closes #241
Closes #242