Repository navigation
Conversation
_get_allele_location_pos picked the defined bound of an indefinite Range with `pos.root[0] or pos.root[1]`, so a bound of 0 (e.g. Range([0, None])) was treated as missing and val became None, which made normalize() raise a TypeError. Pick the defined side explicitly instead.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
normalize()raises aTypeErrorfor an allele whose location has an indefinite range with 0 as its defined bound, e.g.start=Range([0, None])orend=Range([0, None]):_get_allele_location_poschose the defined bound withpos.root[0] or pos.root[1]. Because 0 is falsy,Range([0, None])gaveval=None, which then reached bioutils'normalize.Range([1, None])andRange([None, 0])worked, so only a 0 lower bound on an open-upper range was affected.The fix picks the defined side explicitly:
pos.root[1] if pos0_is_none else pos.root[0].Tests
Two cases added to
normalize_location_in_bounds_cases(local test SeqRepo, no cassettes):start=[0, None], end=1substitutionstart=[None, 0], end=[0, None]insertionBoth fail on
mainwith the TypeError above and pass with this change.ruff checkandruff format --checkare clean.