# Class DnaAndQualitySequence

java.lang.Object
org.snpeff.binseq.BinarySequence
org.snpeff.binseq.DnaAndQualitySequence

All Implemented Interfaces:
  `Serializable, Cloneable, Comparable<BinarySequence>`

Direct Known Subclasses:
  `DnaAndQualitySequenceWithId`

public class DnaAndQualitySequence extends BinarySequence
Binary packed DNA sequence and base calling quality Notes: - This is designed for short sequences (such as "short reads") - 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} - All bits are stored in an array of 'bytes'

Author:
  pcingola
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`DnaAndQualitySequence(String seqStr)`
`DnaAndQualitySequence(String seqStr, String qualityStr, org.biojava.nbio.genome.io.fastq.FastqVariant type)`
`DnaAndQualitySequence(org.biojava.nbio.genome.io.fastq.Fastq fastq)`

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(BinarySequence o)`
`static DnaAndQualitySequence`
`empty()`
`char`
`getBase(int index)`
Return the base at position 'index'
`int`
`getCode(int index)`
Return the code at position 'index'
`Coder`
`getCoder()`
Get sequence encoder invalid input: '&' decoder
`byte[]`
`getCodes()`
`String`
`getQuality()`
Get quality string (encoded FastQ-Sanger style)
`int`
`getQuality(int index)`
`String`
`getSequence()`
Get the sequence as a String
`int`
`hashCode()`
`int`
`indexOf(String seq)`
Find the position of 'seq' in this sequence
`int`
`lastIndexOf(String seq)`
Returns the index within this string of the rightmost occurrence of the specified substring
`int`
`length()`
Sequence lenth
`DnaAndQualitySequence`
`overlap(BinarySequence sequence, int start)`
Creates a new sequence by overlapping 'this' and 'sequence' E.g.
`DnaAndQualitySequence`
`read(DataInputStream dataInStream)`
Read data in binary format
`protected void`
`readDataStream(DataInputStream dataInStream)`
Read data in binary format
`DnaAndQualitySequence`
`reverseWc()`
Reverse Watson-Cricks complement
`void`
`set(String seqStr)`
Set sequence
`void`
`set(String seqStr, String qualityStr, org.biojava.nbio.genome.io.fastq.FastqVariant type)`
Set sequence
`String`
`toString()`
`void`
`write(DataOutputStream dataOutStream)`
Write data in binary format

### Methods inherited from class BinarySequence

`clone, setQuality`

### Methods inherited from class Object

`equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DnaAndQualitySequence

public DnaAndQualitySequence(org.biojava.nbio.genome.io.fastq.Fastq fastq)

### DnaAndQualitySequence

public DnaAndQualitySequence(String seqStr)

### DnaAndQualitySequence

public DnaAndQualitySequence(String seqStr, String qualityStr, org.biojava.nbio.genome.io.fastq.FastqVariant type)

## Method Details

### empty

public static DnaAndQualitySequence empty()

### compareTo

public int compareTo(BinarySequence o)

### getBase

public char getBase(int index)
Description copied from class: `BinarySequence`
Return the base at position 'index'

Overrides:
  `getBase` in class `BinarySequence`

### getCode

public int getCode(int index)
Description copied from class: `BinarySequence`
Return the code at position 'index'

Specified by:
  `getCode` in class `BinarySequence`

### getCoder

public Coder getCoder()
Description copied from class: `BinarySequence`
Get sequence encoder invalid input: '&' decoder

Specified by:
  `getCoder` in class `BinarySequence`

### getCodes

public byte[] getCodes()

### getQuality

public String getQuality()
Get quality string (encoded FastQ-Sanger style)

Returns:

### getQuality

public int getQuality(int index)

### getSequence

public String getSequence()
Description copied from class: `BinarySequence`
Get the sequence as a String

Specified by:
  `getSequence` in class `BinarySequence`

### hashCode

public int hashCode()

Specified by:
  `hashCode` in class `BinarySequence`

### indexOf

public int indexOf(String seq)
Find the position of 'seq' in this sequence

Parameters:
  `seq` - : String to be found
Returns:
  The position where 'seq' is found or '-1' if not found

### lastIndexOf

public int lastIndexOf(String seq)
Returns the index within this string of the rightmost occurrence of the specified substring

### length

public int length()
Sequence lenth

Specified by:
  `length` in class `BinarySequence`
Returns:

### overlap

public DnaAndQualitySequence overlap(BinarySequence sequence, int start)
Creates a new sequence by overlapping 'this' and 'sequence' E.g. this.sequence : |xxxxxxxxxxxxxxxxxxxxOOOOOOOOOOOOOOOOOOOOOOOO | other.sequence : | OOOOOOOOOOOOOOOOOOOOOOOOyyyyyyyyyyyyyyyyy| | |start=20 | result : |xxxxxxxxxxxxxxxxxxxxOOOOOOOOOOOOOOOOOOOOOOOOyyyyyyyyyyyyyyyyy| this.sequence : | OOOOOOOOOOOOOOOOOOOOOOOOxxxxxxxxxxxxxxxxxxxx| other.sequence : |yyyyyyyyyyyyyyyyyyyyyyyyOOOOOOOOOOOOOOOOOOOOOOOO | |start=-20 | result : |yyyyyyyyyyyyyyyyyyyyyyyyOOOOOOOOOOOOOOOOOOOOOOOOxxxxxxxxxxxxxxxxxxxx| Another case is when a sequence is fully included in the other sequence. In this case the result is just a copy of the longest sequence (with the quality updated) E.g. this.sequence : |xxxxxxxxxxxxxxxxxxxxOOOOOOOOOOOOOOOOOOOOOOOO| other.sequence : | OOOOOOOOOOOOOOO | | |start=20 | result : |xxxxxxxxxxxxxxxxxxxxOOOOOOOOOOOOOOOOOOOOOOOO| this.sequence : | OOOOOOOOOOO | other.sequence : |yyyyyyyyyyyyyyyyyyyyyyyyOOOOOOOOOOOOOOOOOOOOOOOO| |start=-20 | result : |yyyyyyyyyyyyyyyyyyyyyyyyOOOOOOOOOOOOOOOOOOOOOOOO|

Overrides:
  `overlap` in class `BinarySequence`
Parameters:
  `start` -
Returns:
  A new sequence

### read

public DnaAndQualitySequence read(DataInputStream dataInStream) throws IOException
Read data in binary format

Specified by:
  `read` in class `BinarySequence`
Parameters:
  `dataOutStream` -
Throws:
  `IOException`

### readDataStream

protected void readDataStream(DataInputStream dataInStream) throws IOException
Read data in binary format

Specified by:
  `readDataStream` in class `BinarySequence`
Parameters:
  `dataOutStream` -
Throws:
  `IOException`

### reverseWc

public DnaAndQualitySequence reverseWc()
Description copied from class: `BinarySequence`
Reverse Watson-Cricks complement

Specified by:
  `reverseWc` in class `BinarySequence`

### set

public void set(String seqStr)
Set sequence

Specified by:
  `set` in class `BinarySequence`
Parameters:
  `seqStr` -

### set

public void set(String seqStr, String qualityStr, org.biojava.nbio.genome.io.fastq.FastqVariant type)
Set sequence

Parameters:
  `seqStr` -

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### write

public void write(DataOutputStream dataOutStream) throws IOException
Write data in binary format

Specified by:
  `write` in class `BinarySequence`
Parameters:
  `dataOutStream` -
Throws:
  `IOException`