-
Notifications
You must be signed in to change notification settings - Fork 245
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
Improve exception message for unset VCF output type #1357
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1357 +/- ##
==============================================
+ Coverage 67.848% 67.858% +0.01%
- Complexity 8283 8284 +1
==============================================
Files 563 563
Lines 33706 33707 +1
Branches 5657 5657
==============================================
+ Hits 22869 22873 +4
+ Misses 8659 8657 -2
+ Partials 2178 2177 -1
|
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.
nice idea. thanks for the PR. perhaps be more explicit about what extensions are legal and what file was being attempted.
@@ -453,7 +453,7 @@ else if (STREAM_TYPES.contains(this.outType)) | |||
|
|||
switch (typeToBuild) { | |||
case UNSPECIFIED: | |||
throw new IllegalArgumentException("Must specify file or stream output type."); | |||
throw new IllegalArgumentException("Output format type is not set, or could not be inferred from the output path. If a path was used, does it have a valid VCF extension?"); |
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.
if you're at it, why not take htsjdk.samtools.util.IOUtil#VCF_EXTENSIONS_LIST and present it to the user for reference?
e8229de
to
146fd1a
Compare
Thanks @yfarjoun! I added a list of valid VCF extensions. Here is how the message renders:
I chose not to include the output filepath in the exception message because there can be many valid reasons why the output type is left unspecified and it may not be because of an output path. I chose to suggest to the user that the extension of the file path may be the issue, since that is the most common case in my experience. For example:
htsjdk/src/main/java/htsjdk/variant/variantcontext/writer/VariantContextWriterBuilder.java Lines 98 to 101 in e8229de
htsjdk/src/main/java/htsjdk/variant/variantcontext/writer/VariantContextWriterBuilder.java Lines 172 to 177 in e8229de
htsjdk/src/main/java/htsjdk/variant/variantcontext/writer/VariantContextWriterBuilder.java Lines 214 to 219 in e8229de
|
Description
I, and fellow developers, hit this exception when we've accidentally used an improper VCF extension in an output file path (our most common mistake is using
.gvcf
). I think the exception message needs to be improved so it is clear that Picard is dynamically changing output file type based on the extension of a file path in most cases.I think the exception bites new users and could be improved so the issue is easier to resolve.
What do you think? Happy to amend!
Current behavior:
Checklist