-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix: do not allow SequenceLocation
to have negative start
/end
v…
#443
Conversation
…alues close #442 * Add model_validators to `Range` and `SequenceLocation`
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.
start < end should not be enforced, unless SequenceReference.circular = False
. Though it would be nice to raise a warning if end < start and SequenceReference.circular is undefined. A discussion on this topic was first raised in #362, and later moved ga4gh/vrs#477. The VRS documentation doesn't capture this (ope), but it will be necessary to represent variants spanning the origin.
This isn't described in the VRS documentation, opened ga4gh/vrs#537 to address. Just providing a heads-up here as this PR contains some validation code corresponding to this issue.
src/ga4gh/vrs/models.py
Outdated
@@ -454,15 +471,55 @@ class SequenceLocation(_Ga4ghIdentifiableObject): | |||
) | |||
start: Optional[Union[Range, int]] = Field( | |||
None, | |||
description='The start coordinate or range of the SequenceLocation. The minimum value of this coordinate or range is 0. MUST represent a coordinate or range less than the value of `end`.', | |||
description='The start coordinate or range of the SequenceLocation. The minimum value of this coordinate or range is 0. MUST represent a coordinate or range less than or equal to the value of `end`.', |
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.
Like that this needs to be >= 0. There should not be a constraint on start
< end
for VRS 2.0, but just noted that this wasn't updated in the VRS 2.0 field definitions. Will address presently.
src/ga4gh/vrs/models.py
Outdated
) | ||
end: Optional[Union[Range, int]] = Field( | ||
None, | ||
description='The end coordinate or range of the SequenceLocation. The minimum value of this coordinate or range is 0. MUST represent a coordinate or range greater than the value of `start`.', | ||
description='The end coordinate or range of the SequenceLocation. The minimum value of this coordinate or range is 0. MUST represent a coordinate or range greater than or equal to the value of `start`.', |
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.
Like that this needs to be >= 0. There should not be a constraint on start
< end
for VRS 2.0, but just noted that this wasn't updated in the VRS 2.0 field definitions. Will address presently.
@ahwagner can you re-review? |
…alues
close #442
Range
andSequenceLocation