-
Notifications
You must be signed in to change notification settings - Fork 4
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
try cases where .hap
file does not follow format exactly
#51
Comments
.hap
file does not follow format exactly.hap
file does not follow format exactly
@ciarareeve , if you choose to do this issue, can you write a small/informal report detailing your findings here within a comment to this issue? |
In the case that there is any additional field which haptools does not anticipate for a given subcommand then it will produce a KeyError. In the case that a string is given when a float or int is required then haptools will throw a ValueError. Lastly, when there is an unsupported line type (beginning with anything other than an H, V, or #), if it is the first row following the header, then an IndexError is thrown. If the unsupported line type is any other following row then the unsupported line type is ignored and the output produced is identical to what would be produced if the user had input an expected line type. |
looks great, @ciarareeve! thanks for doing all of this Probably all of these are ok. The user will encounter these errors and then probably just run the If it's easy to do (and only if it is!), it would be helpful if you could attach stack-traces for each of these Exceptions. Basically, it would be useful to know
That way, I can potentially wrap those exceptions with a try-except block and then error out with a message that's more useful, like "Your .hap file is malformed. Please run the validate subcommand." |
Here is a screen shot if there is an additional field - this is a value error rather than a key error which is either because you have made changes or because there were changes that were not saved before running the test on my end, sorry about that: This is for a syntax mismatch: Unsupported line type starting with first row: And unsupported line type with any following row ( no error): If you would like this copy&pasted/typed out as more of a report please let me know. |
No, this is perfect - it's exactly what I was looking for! I'll go ahead and use this info to update the TODO for #47 |
The
.hap
file format is described in our documentation hereThe
data.haplotypes.Haplotypes
class is responsible for reading and writing.hap
files. We have test cases to ensure the class works properlyBut what does our code do in situations where the
.hap
file isn't formatted properly and doesn't follow the specification? Can we give helpful error messages?Here are some things to check:
Once we know what happens in each case, we should either
validate
subcommandWe should only do item 2 if the issue is especially egregious and will prevent us from continuing. And we should do item 3 if it would be too cumbersome to report the error. But in either case 1 or 2, we could create test cases to ensure these error messages appear.
The text was updated successfully, but these errors were encountered: