Class FQZCompDecode
java.lang.Object
htsjdk.samtools.cram.compression.fqzcomp.FQZCompDecode
Decoder for the CRAM 3.1 FQZComp codec, used for compressing quality scores. Allows the use of previous quality
values, position within the read sequence, a sum of the quality differences from the previous quality, and a generic
model selector to generate a context model.
Uses the range (adaptive arithmetic) codec internally for compression.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddecodeFQZNewRecord(ByteBuffer inBuffer, RangeCoder rangeCoder, FQZModels model, FQZParams fqzParams, FQZState state) Decode the header for a new record: selector, length, reverse flag, and duplicate flag.static intfqzUpdateContext(FQZParam params, FQZState state, int quality) Update the 16-bit context value after encoding/decoding a quality score.static voidreverseQualities(ByteBuffer outBuffer, int outBufferLength, FQZState fqzState) Reverse quality score arrays for records that were flagged for reversal during encoding.static ByteBufferuncompress(ByteBuffer inBuffer) Decompress a FQZComp-compressed quality score block.
-
Constructor Details
-
FQZCompDecode
public FQZCompDecode()
-
-
Method Details
-
uncompress
Decompress a FQZComp-compressed quality score block. Reads the uncompressed size, version, parameters, and then decodes quality symbols using adaptive arithmetic coding with the context model defined by the parameters.- Parameters:
inBuffer- the compressed FQZComp data (consumed by this call)- Returns:
- a rewound ByteBuffer containing the decompressed quality scores
-
decodeFQZNewRecord
public static void decodeFQZNewRecord(ByteBuffer inBuffer, RangeCoder rangeCoder, FQZModels model, FQZParams fqzParams, FQZState state) Decode the header for a new record: selector, length, reverse flag, and duplicate flag. Updates the FQZ state with the decoded record metadata. -
fqzUpdateContext
Update the 16-bit context value after encoding/decoding a quality score. Incorporates quality history, position, delta, and selector into the context based on the parameter configuration. Also decrements the remaining bases counter.- Parameters:
params- the parameter block controlling context bit allocationstate- the mutable encoder/decoder statequality- the quality value just encoded/decoded- Returns:
- the new 16-bit context value
-
reverseQualities
Reverse quality score arrays for records that were flagged for reversal during encoding. Called after all quality scores have been decoded when the global DO_REVERSE flag is set.
-