# Class Substitution

java.lang.Object
htsjdk.samtools.cram.encoding.readfeatures.Substitution

All Implemented Interfaces:
  `ReadFeature, Serializable`

public class Substitution extends Object implements Serializable, ReadFeature
A substitution event captured in read coordinates. It is characterized by position in read, read base and reference base. The class is also responsible for converting combinations of read base and reference base into a byte value (code). Both reference and read bases must be ACGTN only.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`NO_CODE`
`static final byte`
`operator`

## Constructor Summary

Constructors
Constructor
Description
`Substitution(int position, byte code)`
`Substitution(int position, byte base, byte referenceBase)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`byte`
`getBase()`
`byte`
`getCode()`
`byte`
`getOperator()`
Read features are distinguished by operator, similar to cigar operator.
`int`
`getPosition()`
`byte`
`getReferenceBase()`
`int`
`hashCode()`
`void`
`setCode(byte code)`
`String`
`toString()`

### Methods inherited from class Object

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

## Field Details

### NO_CODE

public static final int NO_CODE

See Also:
  - Constant Field Values

### operator

public static final byte operator

See Also:
  - Constant Field Values

## Constructor Details

### Substitution

public Substitution(int position, byte code)

### Substitution

public Substitution(int position, byte base, byte referenceBase)

## Method Details

### getCode

public byte getCode()

### setCode

public void setCode(byte code)

### getOperator

public byte getOperator()
Description copied from interface: `ReadFeature`
Read features are distinguished by operator, similar to cigar operator.

Specified by:
  `getOperator` in interface `ReadFeature`
Returns:
  type of the read feature

### getPosition

public int getPosition()

Specified by:
  `getPosition` in interface `ReadFeature`
Returns:
  zero-based position in the read

### getBase

public byte getBase()

### getReferenceBase

public byte getReferenceBase()

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`