Package htsjdk.samtools.cram.structure

# Class CRAMEncodingStrategy

java.lang.Object
htsjdk.samtools.cram.structure.CRAMEncodingStrategy

public class CRAMEncodingStrategy extends Object
Parameters that can be set to control the encoding strategy used when writing CRAM.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DEFAULT_MINIMUM_SINGLE_REFERENCE_SLICE_THRESHOLD`
`static final int`
`DEFAULT_READS_PER_SLICE`

## Constructor Summary

Constructors
Constructor
Description
`CRAMEncodingStrategy()`
Create an encoding strategy that uses all default values.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object o)`
`CompressionHeaderEncodingMap`
`getCustomCompressionHeaderEncodingMap()`
`int`
`getGZIPCompressionLevel()`
`int`
`getMinimumSingleReferenceSliceSize()`
`int`
`getReadsPerSlice()`
`int`
`getSlicesPerContainer()`
`int`
`hashCode()`
`void`
`setCustomCompressionHeaderEncodingMap(CompressionHeaderEncodingMap encodingMap)`
Set the `CompressionHeaderEncodingMap` to use.
`CRAMEncodingStrategy`
`setGZIPCompressionLevel(int compressionLevel)`
`CRAMEncodingStrategy`
`setMinimumSingleReferenceSliceSize(int minimumSingleReferenceSliceSize)`
The minimum number of reads we need to have seen to emit a single-reference slice.
`CRAMEncodingStrategy`
`setReadsPerSlice(int readsPerSlice)`
Set number of slices per container.
`CRAMEncodingStrategy`
`setSlicesPerContainer(int slicesPerContainer)`
Set the number of slices per container.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### DEFAULT_MINIMUM_SINGLE_REFERENCE_SLICE_THRESHOLD

public static final int DEFAULT_MINIMUM_SINGLE_REFERENCE_SLICE_THRESHOLD

See Also:
  - Constant Field Values

### DEFAULT_READS_PER_SLICE

public static final int DEFAULT_READS_PER_SLICE

See Also:
  - Constant Field Values

## Constructor Details

### CRAMEncodingStrategy

public CRAMEncodingStrategy()
Create an encoding strategy that uses all default values.

## Method Details

### setReadsPerSlice

public CRAMEncodingStrategy setReadsPerSlice(int readsPerSlice)
Set number of slices per container. In some cases, a container containing fewer slices than the requested value will be produced in order to honor the specification rule that all slices in a container must have the same `ReferenceContextType`. Note: this value must be >= `getMinimumSingleReferenceSliceSize()`.

Parameters:
  `readsPerSlice` - number of slices written per container
Returns:
  updated CRAMEncodingStrategy

### setMinimumSingleReferenceSliceSize

public CRAMEncodingStrategy setMinimumSingleReferenceSliceSize(int minimumSingleReferenceSliceSize)
The minimum number of reads we need to have seen to emit a single-reference slice. If we've seen fewer than this number, and we have more reads from a different reference context, we prefer to switch to, and subsequently emit, a multiple reference slice, rather than a small single-reference that contains fewer than this number of records. This number must be invalid input: '<' the value for `getReadsPerSlice()`

Parameters:
  `minimumSingleReferenceSliceSize` -

### getMinimumSingleReferenceSliceSize

public int getMinimumSingleReferenceSliceSize()

### setGZIPCompressionLevel

public CRAMEncodingStrategy setGZIPCompressionLevel(int compressionLevel)

### setSlicesPerContainer

public CRAMEncodingStrategy setSlicesPerContainer(int slicesPerContainer)
Set the number of slices per container. If > 1, multiple slices will be placed in the same container if the slices share the same reference context (container records mapped to the same contig). MULTI-REF slices are always emitted as a single contain to avoid conferring MULTI-REF on the next slice, which might otherwise be single-ref; the spec requires a MULTI_REF container to only contain multi-ref slices).

Parameters:
  `slicesPerContainer` - - requested number of slices per container
Returns:
  CRAMEncodingStrategy

### setCustomCompressionHeaderEncodingMap

public void setCustomCompressionHeaderEncodingMap(CompressionHeaderEncodingMap encodingMap)
Set the `CompressionHeaderEncodingMap` to use.

Parameters:
  `encodingMap` - the encoding map to use

### getCustomCompressionHeaderEncodingMap

public CompressionHeaderEncodingMap getCustomCompressionHeaderEncodingMap()

### getGZIPCompressionLevel

public int getGZIPCompressionLevel()

### getReadsPerSlice

public int getReadsPerSlice()

### getSlicesPerContainer

public int getSlicesPerContainer()

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`