Skip to content
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

CRAM: revert #1326 and fix tests and comments #1341

Merged
merged 4 commits into from
Apr 3, 2019

Conversation

jmthibault79
Copy link
Contributor

@jmthibault79 jmthibault79 commented Apr 1, 2019

Description

Please explain the changes you made here.
Explain the motivation for making this change. What existing problem does the pull request solve?

Checklist

  • Code compiles correctly
  • New tests covering changes and new functionality
  • All tests passing
  • Extended the README / documentation, if necessary
  • Is not backward compatible (breaks binary or source compatibility)

@jmthibault79
Copy link
Contributor Author

#1326 was based on a misunderstanding of values in the CRAM Container Header. samtools/hts-specs#398 is the companion PR for the spec.

@@ -159,7 +159,7 @@ void recordMetaData(final Slice slice) {
unAlignedRecords += slice.unmappedReadsCount;
}

final long start = slice.byteOffsetFromContainer;
final long start = slice.byteOffsetFromCompressionHeaderStart;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a mouthful but it's correct

}

final Slice lastSlice = slices[lastSliceIndex];
lastSlice.index = lastSliceIndex;
lastSlice.byteOffsetFromContainer = landmarks[lastSliceIndex];

// calculate a "final landmark" indicating the byte offset of the end of the container
Copy link
Contributor Author

@jmthibault79 jmthibault79 Apr 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. containerBlocksByteSize is already equal to that "final landmark".

This is the section that reverts #1326

@codecov-io
Copy link

codecov-io commented Apr 1, 2019

Codecov Report

Merging #1341 into master will decrease coverage by 0.003%.
The diff coverage is 80.488%.

@@               Coverage Diff               @@
##              master     #1341       +/-   ##
===============================================
- Coverage     67.848%   67.846%   -0.003%     
  Complexity      8273      8273               
===============================================
  Files            562       562               
  Lines          33678     33675        -3     
  Branches        5653      5653               
===============================================
- Hits           22850     22847        -3     
  Misses          8653      8653               
  Partials        2175      2175
Impacted Files Coverage Δ Complexity Δ
...n/java/htsjdk/samtools/cram/structure/SliceIO.java 83.333% <ø> (ø) 14 <0> (ø) ⬇️
...mtools/cram/build/CramContainerHeaderIterator.java 100% <100%> (ø) 2 <0> (ø) ⬇️
src/main/java/htsjdk/samtools/CRAMFileReader.java 76.02% <100%> (ø) 53 <0> (ø) ⬇️
...jdk/samtools/cram/structure/ContainerHeaderIO.java 74.545% <100%> (ø) 7 <0> (ø) ⬇️
...rc/main/java/htsjdk/samtools/BAMIndexMetaData.java 77.67% <100%> (ø) 22 <0> (ø) ⬇️
src/main/java/htsjdk/samtools/CRAMBAIIndexer.java 81.034% <100%> (ø) 17 <0> (ø) ⬇️
...ain/java/htsjdk/samtools/cram/structure/Slice.java 67.593% <100%> (ø) 43 <0> (ø) ⬇️
src/main/java/htsjdk/samtools/cram/CRAIIndex.java 88.571% <100%> (ø) 26 <0> (ø) ⬇️
...va/htsjdk/samtools/cram/structure/ContainerIO.java 63.333% <57.143%> (-0.601%) 10 <0> (ø)
src/main/java/htsjdk/samtools/cram/CRAIEntry.java 73.684% <71.429%> (ø) 25 <1> (ø) ⬇️
... and 2 more

final ReferenceContext refContext = new ReferenceContext(0);

final Container container = new Container(refContext);
container.containerByteSize = slice0size;
container.containerBlocksByteSize = compressionHeaderSize + slice0size;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the change to the test (as well the similar line below)

// a Slice of size 6262 bytes

final int containerHeaderSize = 1234;
final int compressionHeaderSize = 7552;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the meaningful changes here are below, in createOneSliceContainer() / createTwoSliceContainer()

@cmnbroad cmnbroad self-assigned this Apr 1, 2019
Copy link
Collaborator

@cmnbroad cmnbroad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of minor changes requested.

@jmthibault79 jmthibault79 merged commit 5442f78 into master Apr 3, 2019
@jmthibault79 jmthibault79 deleted the jt_container_blocks branch April 3, 2019 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants