Class FQZCompEncode
java.lang.Object
htsjdk.samtools.cram.compression.fqzcomp.FQZCompEncode
Encoder for the CRAM 3.1 FQZComp quality score compression codec. Uses an adaptive arithmetic
(range) coder with a 16-bit context model built from quality history, position within read,
and optionally delta and selector information.
The encoder analyzes quality data to select context model parameters, matching the adaptive
parameter training in htslib's fqz_pick_parameters (fqzcomp_qual.c). Features:
- Quality map for sparse symbol sets (e.g., NovaSeq 4-bin quality)
- Delta table with approximate-sqrt mapping for running quality difference context
- Symbol-count-based tuning (NovaSeq, HiSeqX, small datasets)
- Duplicate detection for consecutive identical quality strings
- Quality reversal for reverse-complemented reads (GFLAG_DO_REV)
- Fixed-length read optimization
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompress(ByteBuffer inBuffer, int[] recordLengths) Compress concatenated quality scores using the FQZComp codec.compress(ByteBuffer inBuffer, int[] recordLengths, int[] bamFlags) Compress concatenated quality scores using the FQZComp codec with per-record BAM flags.static voidstoreArray(ByteBuffer outBuffer, int[] array, int size) Serialize an array using the two-level run-length encoding used by FQZComp for tables.
-
Constructor Details
-
FQZCompEncode
public FQZCompEncode()
-
-
Method Details
-
compress
Compress concatenated quality scores using the FQZComp codec.- Parameters:
inBuffer- concatenated quality scores for all records (position to limit is compressed)recordLengths- per-record quality score lengths; sum must equal inBuffer.remaining()- Returns:
- a rewound ByteBuffer containing the compressed data
-
compress
Compress concatenated quality scores using the FQZComp codec with per-record BAM flags.- Parameters:
inBuffer- concatenated quality scores for all records (position to limit is compressed)recordLengths- per-record quality score lengths; sum must equal inBuffer.remaining()bamFlags- per-record BAM flags (for reverse-complement and dedup detection), or null- Returns:
- a rewound ByteBuffer containing the compressed data
-
storeArray
Serialize an array using the two-level run-length encoding used by FQZComp for tables. This is the inverse ofFQZUtils.readArray(ByteBuffer, int[], int).- Parameters:
outBuffer- output buffer to write toarray- the array to serializesize- number of elements to serialize
-