Repository navigation
Addresses #1497: FeatureLocation invalid input exception - #1499
Conversation
FeatureLocation will now raise a value error if supplied an start location greater than the specified end location
|
When testing I discovered my change must support a feature location with an UnknownPosition like FeatureLocation(42, UnknownPosition()). However the len of a feature location with an UnknownPosition is invalid. I think it's right to have an exception raised in this case but would you like me to add a more informative error message to this PR? |
|
Good point - I'd forgotten about the annoying special case, yes, if either start or end is As to the exception with (Note now that I've merged #1500 the NumPy doctest failures on the master branch should be solved #1496; you were probably ignoring them anyway) |
| else: | ||
| raise TypeError("end=%r %s" % (end, type(end))) | ||
| if self._start > self._end: | ||
| if self.start.position and self.end.position and self.start > self.end: |
There was a problem hiding this comment.
Sadly zero is a valid start or end position, so I think this would miss some corner cases
| from Bio import SeqIO | ||
| from Bio.SeqFeature import FeatureLocation, AfterPosition, BeforePosition, CompoundLocation | ||
| from Bio.SeqFeature import FeatureLocation, AfterPosition, BeforePosition, \ | ||
| CompoundLocation, UnknownPosition |
There was a problem hiding this comment.
Could you use two import lines, rather than the slash continuation here.
| # Features with UnknownPositions should pass test | ||
| FeatureLocation(42, UnknownPosition()) | ||
| FeatureLocation(UnknownPosition(), 42) | ||
|
|
There was a problem hiding this comment.
Include some zero positions, and also special case where start and end are equal (e.g. location of digest enzyme cutting site between two bases)?
Codecov Report
@@ Coverage Diff @@
## master #1499 +/- ##
=========================================
+ Coverage 84.79% 84.8% +0.01%
=========================================
Files 323 323
Lines 49393 49395 +2
=========================================
+ Hits 41884 41891 +7
+ Misses 7509 7504 -5
Continue to review full report at Codecov.
|
|
So the travis build seems to have failed on a network error. I can't make much sense of why one of the appveyor builds failed it's tests |
|
@bow - does this seem fine to you too? |
|
@peterjc Any further feedback on this? |
|
I'm happy. @bow if this looks OK to you, either of us could go ahead and rebase-merge this. |
bow
left a comment
There was a problem hiding this comment.
@peterjc ~ sorry for the last ping (I missed that). This changeset looks ok ~ thank you @JamesJeffryes!
|
Thanks Bow, merging. Thank you James! |
All contributors as tracked by version control have agreed: - Adam Sjøgren https://mailman.open-bio.org/pipermail/biopython/2019-October/016696.html - Chris MacRaild (@macraild) biopython#2209 - James Jeffryes (@JamesJeffryes) biopython#1499 - Kai Blin (@kblin) biopython#898 (comment) - Michiel de Hoon (@mdehoon) biopython#898 (comment) - Peter Cock (@peterjc) biopython#898 (comment) - Ralf Stephan (@rwst) biopython#1900
All contributors as tracked by version control have agreed: - Adam Sjøgren https://mailman.open-bio.org/pipermail/biopython/2019-October/016696.html - Chris MacRaild (@macraild) biopython#2209 - James Jeffryes (@JamesJeffryes) biopython#1499 - Kai Blin (@kblin) biopython#898 (comment) - Michiel de Hoon (@mdehoon) biopython#898 (comment) - Peter Cock (@peterjc) biopython#898 (comment) - Ralf Stephan (@rwst) biopython#1900
FeatureLocation will now raise a value error if supplied an start location greater than the specified end location
This pull request addresses issue #1497
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I have read the
CONTRIBUTING.rstfile and understand that AppVeyor andTravisCI will be used to confirm the Biopython unit tests and
flake8stylechecks pass with these changes.
I am happy be thanked by name in the
NEWS.rstandCONTRIB.rstfiles,and have added myself to those files as part of this pull request. (This
acknowledgement is optional. Note we list the names sorted alphabetically.)