-
Notifications
You must be signed in to change notification settings - Fork 29
conversion seqfeat_anno and tests #367
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
base: develop
Are you sure you want to change the base?
Conversation
|
I would like to get feedback on this one. I'll try to get more of these implemented. |
jakebeal
left a comment
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.
Tests are failing.
|
|
||
| # convert locations | ||
| locations2 = [] | ||
| if seqfeat3.locations: |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to check this if we've validated in advance.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren't top-levels, so they don't take a namespace - they're going to get their name from their parent.
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.
removed
Closes #241
Closes #242