-
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
Immutable CRAIEntry #1256
Immutable CRAIEntry #1256
Conversation
- explicitly set nOfRecords and index to 0 - remove unused sliceIndex
} | ||
return entries; | ||
return Arrays.stream(container.slices) | ||
.map(slice -> slice.getCRAIEntry(slice.containerOffset)) |
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.
Can't necessarily derive the container offset from the Slice because sometimes it conflicts with the Container's own offset - will need to look into why.
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 don't have high confidence that these are managed correctly by the existing code, but in this case it's using the value from the slice anyway. Can we add a method to slice that uses it's offset directly, and if there is some other context for which that fails, maybe also add a static with this signature for that one case until we figure out whats going on, since thats the broken one ?
BTW, is slice.containerOffset
supposed to be the offset of the containing container, or is it the offset of the slice relative to the beginning of the containing container ? Might be good to document those.
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.
Also, any reason not to move this method to container getCRAIEntries
just as it is, and have it return the list of entries. Eventually it should end up there I think, and would be similar to the new one you added to Slice
.
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.
OK, these suggestions make sense.
Slice.containerOffset is the byte offset of the Container from the beginning of the stream.
Slice.offset is the byte offset of the Slice from the beginning of its Container.
I'll add comments making this more clear to Slice
@@ -114,19 +111,6 @@ public int compareTo(final CRAIEntry o) { | |||
return (int) (containerStartOffset - o.containerStartOffset); | |||
} | |||
|
|||
@Override | |||
public CRAIEntry clone() throws CloneNotSupportedException { |
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.
only tests were using this
e.sliceIndex = i; | ||
|
||
entries.add(e); | ||
final Map<Integer, AlignmentSpan> spans = s.getMultiRefAlignmentSpans(container.header, ValidationStringency.DEFAULT_STRINGENCY); |
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.
equivalent to what getCRAIEntriesForMultiRefSlice()
did
entry.sliceOffset = 3; | ||
entry.sliceSize = 4; | ||
entry.containerStartOffset = 5; | ||
final CRAIEntry entry = CRAIEntryTest.newEntry(0, 1, 2, 5, 3, 4); |
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.
preserves the values set above rather than the order
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.
A few questions/suggestions for the initial pass.
} | ||
return entries; | ||
return Arrays.stream(container.slices) | ||
.map(slice -> slice.getCRAIEntry(slice.containerOffset)) |
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 don't have high confidence that these are managed correctly by the existing code, but in this case it's using the value from the slice anyway. Can we add a method to slice that uses it's offset directly, and if there is some other context for which that fails, maybe also add a static with this signature for that one case until we figure out whats going on, since thats the broken one ?
BTW, is slice.containerOffset
supposed to be the offset of the containing container, or is it the offset of the slice relative to the beginning of the containing container ? Might be good to document those.
} | ||
return entries; | ||
return Arrays.stream(container.slices) | ||
.map(slice -> slice.getCRAIEntry(slice.containerOffset)) |
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.
Also, any reason not to move this method to container getCRAIEntries
just as it is, and have it return the list of entries. Eventually it should end up there I think, and would be similar to the new one you added to Slice
.
Codecov Report
@@ Coverage Diff @@
## master #1256 +/- ##
==========================================
Coverage ? 69.359%
Complexity ? 8164
==========================================
Files ? 548
Lines ? 32682
Branches ? 5521
==========================================
Hits ? 22668
Misses ? 7795
Partials ? 2219
|
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.
@lbergelson LGTM as an incremental step.
@cmnbroad @jmthibault79 👍 Thank you. |
…ry that affects CramSource in Disq. See the note about incompatible CRAM changes at https://github.com/samtools/htsjdk/releases/tag/2.17.0. This commit uses the new CRAIEntry API introduced in samtools/htsjdk#1256
…ry that affects CramSource in Disq. See the note about incompatible CRAM changes at https://github.com/samtools/htsjdk/releases/tag/2.17.0. This commit uses the new CRAIEntry API introduced in samtools/htsjdk#1256
…ry that affects CramSource in Disq. See the note about incompatible CRAM changes at https://github.com/samtools/htsjdk/releases/tag/2.17.0. This commit uses the new CRAIEntry API introduced in samtools/htsjdk#1256
…ry that affects CramSource in Disq. See the note about incompatible CRAM changes at https://github.com/samtools/htsjdk/releases/tag/2.17.0. This commit uses the new CRAIEntry API introduced in samtools/htsjdk#1256 remove use of SAMRecord.getIndexBin() since the method has been removed Convert catch for EOFException -> RuntimeEOFException Use htsjdk 2.19.0-rc3-SNAPSHOT Use htsjdk 2.19.0
* The changes to CRAM have introduced an incompatible change to CRAIEntry that affects CramSource in Disq. See the note about incompatible CRAM changes at https://github.com/samtools/htsjdk/releases/tag/2.17.0. This commit uses the new CRAIEntry API introduced in samtools/htsjdk#1256 * Convert catch for EOFException -> RuntimeEOFException * Use htsjdk 2.19.0
Description
Code cleanup for CRAIEntry
Checklist