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
unsigned int is backed by a long value #339
Conversation
4ee2787
to
90bdc58
Compare
@vadimzalunin I've made some changes in master to make it easier to see which tests are failing in travis, and have taken the liberty of rebasing this branch on top of those changes. It's clear from doing this that the test failure in this branch is closely related to the changes you've made in it, as you should now be able to see in travis:
|
Back to @vadimzalunin for test fixes |
Looks like this only failing on the incorrect test testUnsignedIntegerSAM which is expecting an exception to be thrown (it shouldn't be with this fix in place). Maybe update the test? |
@mp15 done |
@vadimzalunin Could you please squash this branch into a single commit? |
c294bf7
to
0b259ff
Compare
@droazen squashed |
@@ -1203,7 +1203,7 @@ protected void setAttribute(final short tag, final Object value) { | |||
|
|||
protected void setAttribute(final short tag, final Object value, final boolean isUnsignedArray) { | |||
if (value != null && | |||
!(value instanceof Byte || value instanceof Short || value instanceof Integer || | |||
!(value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long || |
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.
With this change to allow Long
values directly in SAMRecord
attributes, what protection do we have against a client setting an attribute outside the range of uint32_t
that bams can handle? The htsjdk BAM codec will fail given a Long
value that exceeds BinaryCodec.MAX_UINT
.
Also, if you set such an attribute using setAttribute()
and then call getIntegerAttribute()
you'll get a RuntimeException
if the value exceeds Integer.MAX_VALUE
(even though the attribute may be marked as of type i/I, like the ia:i:4294967295
attribute in http://gatkforums.broadinstitute.org/discussion/comment/24038/#Comment_24038).
Can you comment on these concerns? I don't want to block this important fix, but I want to be sure we're not doing something here that will cause problems later on.
Back to @vadimzalunin for comments. |
794f45e
to
0c3f09b
Compare
@droazen re-implemented the fix, basically made uint32 policy the same in CRAM as in BAM. Added dedicated test class and a BAM file. |
0c3f09b
to
ed25614
Compare
added tests for values over max unsigned int |
@droazen please review |
@vadimzalunin It won't stop an effective review but it looks like you've accidentally left the squashed branch as two commits with same message rather than one? (This has been fixed by 19e8e3b) |
7729dc8
to
19e8e3b
Compare
@@ -379,6 +379,8 @@ protected void finish() { | |||
outputStream.flush(); | |||
if (indexer != null) | |||
indexer.finish(); | |||
}catch (final RuntimeException re) { |
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.
} catch
@droazen thanks for the context as it wasn't clear here, it also is timely as htsjdk states that java 7 will be supported only until October 2015, so we should feel free to move to java 8 if we need specific features there. There seem to be a lot of Cram changes here, are those also necessary given @droazen suggestions, which seem reasonable? |
@vadimzalunin Ping me once you've made the requested changes and this is ready for final review. |
78309c8
to
7749f23
Compare
@droazen please review |
@@ -1159,6 +1161,32 @@ public Object getAttribute(final short tag) { | |||
} | |||
|
|||
/** | |||
* A convinience method that will return a valid unsigned integer or fail with an exception if the tag value is invalid. |
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.
convenience -> convenience
Sorry guys, I appreciate this has turned into a large patch. I tried to cover critical points with tests, in particular see src/tests/java/htsjdk/samtools/SAMIntegerTagTest.java |
@droazen ping |
@vadimzalunin Am going to take a look now -- while you're waiting, perhaps you could take a look at this serious-sounding CRAM bug we discovered recently? It sounds like the kind of thing that might be a quick fix (ie., a simple off-by-one error) |
Looks like there are a few additional changes I'd like to see here -- since we're pressed for time, I'll make these changes myself and push them directly into this branch to spare us another code review cycle. While I do this if you could look at #364 it would be much appreciated, as we can't really recommend that anyone use GATK 3.5 with cram for anything other than testing purposes if we have bugs like that open. |
3676253
to
fbeb137
Compare
Ok, I've finished making changes to this branch -- a summary of the notable changes: - -Removed some unrelated cram changes in -Added an overload of -Moved -Improved error messages, documentation, and naming of test cases. Will rebase and merge now, once tests pass. |
@droazen thanks! looks good to me 👍 |
fbeb137
to
ca7e1c9
Compare
unsigned int is backed by a long value
Changes Unknown when pulling ca7e1c9 on CRAM_uint32_t_in_ReadTag into ** on master**. |
While it was a Google Docs document, the specification was corrected to reflect that HTTP Range byte ranges are zero-based fully-inclusive. Update the OpenAPI description correspondingly. Also fix typos.
replaced exception when reading unsigned int in ReadTag with a direct conversion to long