-
Notifications
You must be signed in to change notification settings - Fork 242
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
new Interface VCFIterator extends CloseableIterator<VariantContext> (continued) #1245
Conversation
- better @see syntax - extra open(String, wrapper) method in VCFIteratorBuilder - IOTestUtil tests isGZIPInputStream function using a @dataProvider
Codecov Report
@@ Coverage Diff @@
## master #1245 +/- ##
===============================================
+ Coverage 69.359% 69.404% +0.045%
- Complexity 8143 8156 +13
===============================================
Files 547 548 +1
Lines 32649 32691 +42
Branches 5517 5521 +4
===============================================
+ Hits 22645 22689 +44
+ Misses 7784 7783 -1
+ Partials 2220 2219 -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.
@romanzenka Thank you for taking this on and doing the rebase / resolving the last round of comments. @lindenb Thank you for doing this work initially.
I wrote a bunch of nitpicky comments, but i'm going to resolve them myself in a future pr rather than delay this longer.
@@ -66,26 +66,11 @@ public static boolean isBAMFile(final InputStream stream) | |||
/** | |||
* Checks whether the file is a gzipped sam file. Returns true if it | |||
* is and false otherwise. | |||
* @see @link IOUtil#isGZIPInputStream(InputStream) |
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.
* @see @link IOUtil#isGZIPInputStream(InputStream) | |
* @deprecated use {@link IOUtil#isGZIPInputStream(InputStream)} instead |
@@ -1157,6 +1155,38 @@ public static Path toPath(File fileOrNull) { | |||
return files.stream().map(File::toPath).collect(Collectors.toList()); | |||
} | |||
|
|||
/** number of bytes that will be read for the GZIP-header in the function {@link #isGZIPInputStream(InputStream)} */ | |||
public static final int GZIP_HEADER_READ_LENGTH = 8000; |
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.
Could you stick this at the top of the file with the other constants?
* @param stream the input stream. | ||
* @return true if `stream` starts with a gzip signature | ||
* @throws IllegalArgumentException if `stream` cannot mark or reset the stream | ||
* @see SamStreams#isGzippedSAMFile(InputStream) |
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.
* @see SamStreams#isGzippedSAMFile(InputStream) |
We can drop this pointer to the old method.
* @see SamStreams#isGzippedSAMFile(InputStream) | ||
*/ | ||
public static boolean isGZIPInputStream(final InputStream stream) { | ||
/* this function was previously implemented in SamStreams.isGzippedSAMFile */ |
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.
You don't need this comment.
/* this function was previously implemented in SamStreams.isGzippedSAMFile */ |
// wrap the input stream into a BufferedInputStream to reset/read a BCFHeader or a GZIP | ||
// buffer must be large enough to contain the BCF header and/or GZIP signature | ||
BufferedInputStream bufferedinput = new BufferedInputStream(in, Math.max( | ||
BCF2Codec.SIZEOF_BCF_HEADER, |
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.
I would just put these one one line, but that's just a very minor nitpick.
if(IOUtil.isGZIPInputStream(bufferedinput)) { | ||
// this is a gzipped input stream, wrap it into GZIPInputStream | ||
// and re-wrap it into BufferedInputStream so we can test for the BCF header | ||
bufferedinput = new BufferedInputStream( |
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.
same here
throw new IllegalStateException("Could not reset stream."); | ||
} | ||
} | ||
return IOUtil.isGZIPInputStream(stream); |
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.
There's a new use of this deprecated method in VCFHeaderReader. It should be migrated.
🎉 |
I was going to resolve the "nitpicks", but it looks like you've done it alraedy. Thank you! |
Description
This is a PR based on #837 - the only difference is addressing the reviewer comments + a little bit of extra testing.
My purpose is to continue "carrying the torch" of the original PR by @lindenb until successful completion, as I could REALLY use the VCFIterator interface.
Checklist