# Class DnaQualityCoder

java.lang.Object
org.snpeff.binseq.coder.Coder
org.snpeff.binseq.coder.DnaCoder
org.snpeff.binseq.coder.DnaQualityCoder

All Implemented Interfaces:
  `Serializable`

public class DnaQualityCoder extends DnaCoder
Class used to encode invalid input: '&' decode sequences into binary and vice-versa - Every base is encoded in 8 bits: - Six bits for the base quality [0 , .. , 63] - Two bits for the base {a, c, g, t} invalid input: '<'=> {0, 1, 2, 3}

Author:
  pcingola
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`MAX_QUALITY`
`static final int`
`MIN_QUALITY`

### Fields inherited from class DnaCoder

`BASES_PER_LONGWORD, BITS_PER_BASE, COUNT_DIFFS, debug, LAST_BASE_IN_LONGWORD, MASK_ALL_WORD, MASK_BASE, MASK_FIRST_BASE, MASK_HIGH, MASK_LOW, TO_BASE`

### Fields inherited from class Coder

`BITS_PER_LONGWORD, BYTES_PER_LONGWORD`

## Method Summary

Modifier and Type
Method
Description
`int`
`basesPerWord()`
How many bases can we pack in a word
`int`
`baseToBits(char c, int quality)`
`static DnaQualityCoder`
`get()`
`int`
`qualityToBits(int quality)`
WARNING: This implementation transforms the quality to a range [0, ..., 63] (in order to use 6 bits)
`int`
`replaceQuality(byte code, int newQuality)`
Replace quality value in a given code
`char`
`toBase(int code)`
Decode a base using 2 bits
`int`
`toQuality(int code)`
Decode a quality

### Methods inherited from class DnaCoder

`baseToBits, baseToBits, bitsPerBase, copyBases, copyBases, decodeWord, encodeWord, lastBaseinWord, length2words, mask, replaceBase, reverseBases, score, toBase`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### MAX_QUALITY

public static final int MAX_QUALITY

See Also:
  - Constant Field Values

### MIN_QUALITY

public static final int MIN_QUALITY

See Also:
  - Constant Field Values

## Method Details

### get

public static DnaQualityCoder get()

### basesPerWord

public int basesPerWord()
Description copied from class: `Coder`
How many bases can we pack in a word

Overrides:
  `basesPerWord` in class `DnaCoder`
Returns:

### baseToBits

public int baseToBits(char c, int quality)

### qualityToBits

public int qualityToBits(int quality)
WARNING: This implementation transforms the quality to a range [0, ..., 63] (in order to use 6 bits)

Overrides:
  `qualityToBits` in class `Coder`
Returns:

### replaceQuality

public int replaceQuality(byte code, int newQuality)
Replace quality value in a given code

Parameters:
  `code` -
  `newQuality` -
Returns:

### toBase

public char toBase(int code)
Decode a base using 2 bits

Overrides:
  `toBase` in class `DnaCoder`
Parameters:
  `c` -
Returns:

### toQuality

public int toQuality(int code)
Description copied from class: `Coder`
Decode a quality

Overrides:
  `toQuality` in class `Coder`
Returns: