-
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
update CramCompressionRecord.isPlaced() to make it APDelta-aware #1284
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1284 +/- ##
==============================================
+ Coverage 67.49% 67.768% +0.278%
- Complexity 8150 8345 +195
==============================================
Files 558 561 +3
Lines 33365 33929 +564
Branches 5608 5752 +144
==============================================
+ Hits 22518 22993 +475
- Misses 8658 8733 +75
- Partials 2189 2203 +14
|
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 comments/questions.
@@ -379,8 +379,8 @@ protected void flushContainer() throws IllegalArgumentException, IllegalAccessEx | |||
while (last.next != null) last = last.next; | |||
|
|||
if (cramRecord.isFirstSegment() && last.isLastSegment()) { | |||
|
|||
final int templateLength = CramNormalizer.computeInsertSize(cramRecord, last); | |||
final boolean coordinateSorted = (samFileHeader.getSortOrder() == SAMFileHeader.SortOrder.unsorted); |
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.
This one seems inverted - it will be false for coordinate sorted. Since no tests failed, we should add one somewhere that verifies this is working correctly.
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.
oops, good catch.
Unfortunately, I believe that it would take me a substantial amount of time to make sense of CramNormalizer and write a reasonable test for it, so I don't think that's feasible with the quick turnaround time we want for this PR.
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.
Is there any test in this PR that would have failed before without the fix for APDelta, but passes now so at least we can be sure that we've fixed it ? I assume we didn't have one before this bug was introduced, since no test caught the issue ? Without that, I'm not even sure I'd recognize the failure if I saw it. Ideally we'd create a ticket describing it (that will be fixed by this PR) so we have a record in case anyone sees it using the interim version that had the issue.
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.
Yes. The pair of SliceTests cases starting with the comment on line 97 calls this out explicitly.
On a lower level, the combinations in CramCompressionRecordTest.placedTests show that the APDelta flag does affect results, and some would fail without this fix.
src/main/java/htsjdk/samtools/cram/structure/CramCompressionRecord.java
Outdated
Show resolved
Hide resolved
src/main/java/htsjdk/samtools/cram/structure/CramCompressionRecord.java
Outdated
Show resolved
Hide resolved
src/test/java/htsjdk/samtools/cram/structure/CramCompressionRecordTest.java
Outdated
Show resolved
Hide resolved
src/test/java/htsjdk/samtools/cram/structure/CramCompressionRecordTest.java
Outdated
Show resolved
Hide resolved
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 think its worth investing in some test cleanup for this one - lots of test comments.
src/test/java/htsjdk/samtools/cram/structure/CramCompressionRecordTest.java
Outdated
Show resolved
Hide resolved
src/test/java/htsjdk/samtools/cram/structure/CramCompressionRecordTest.java
Show resolved
Hide resolved
src/test/java/htsjdk/samtools/cram/structure/CramCompressionRecordTest.java
Outdated
Show resolved
Hide resolved
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.
It would be nicer if CramCompressionRecord knew if it was delta encoded, but this is fine too.
Description
isPlaced() was not checking for the APDelta flag, thus inappropriately marking some records as unplaced.
Error introduced on 1/30 with #1266
Checklist