-
Notifications
You must be signed in to change notification settings - Fork 94
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
'str()' fails with 'HGVSUnsupportedOperationError' for variants containing an uncertain position #532
Comments
str()
fails with HGVSUnsupportedOperationError
for variants containing an uncertain position
@dhauge: Your very clear report is a model for others to follow. Thanks! I'm inclined to agree with you: objects should be compared exclusively on their members. (Is that what you meant by "violation of Python equality semantics"? If so, this interpretation of equality is well-beyond Python.) I think it should suffice to drop the uncertain comparison and instead add the equality to the other conditionals in the return statement. In retrospect, I think we can drop the eq method altogether because attr's default eq is to compare objects by type and members, which is exactly what we want. (I think.) Would you care to work up a PR? |
Yes, I can create a PR. I wasn't sure how you felt about the similar uncertain checks in the other comparison operators; I'm not sure exactly how I'd want them to behave in all circumstances. My current thoughts are along the lines of
|
Thanks for your willingness to contribute. I don't recall at the moment where or why Two options: 1) Just try it and see what tests say. 2) Profile to get call traces and the contexts in which eq, lt, and gt are used. (1) seems likely to succeed, can be done iteratively, and is likely faster. I'd go that way. Specific comments:
Thanks! |
If a variant is constructed with a position for which
uncertain
isTrue
, then callingstr()
on it fails with aHGVSUnsupportedOperationError
(A detailed stack trace is included below). This is caused by theInterval.format
function comparing itsstart
andend
, but__eq__
raises that error if either is uncertain (which itself seems a violation of Python equality semantics).This same problem is also manifested in the
validate()
method, where trying to validate a variant with an uncertain position producesHere's a
hgvs-shell
session that demonstrates the problems.The text was updated successfully, but these errors were encountered: