Package org.snpeff.binseq
Class DnaAndQualitySequence
java.lang.Object
org.snpeff.binseq.BinarySequence
org.snpeff.binseq.DnaAndQualitySequence
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<BinarySequence>
- Direct Known Subclasses:
DnaAndQualitySequenceWithId
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} <=> {0, 1, 2, 3}
- All bits are stored in an array of 'bytes'
- Author:
- pcingola
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDnaAndQualitySequence(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 TypeMethodDescriptionintstatic DnaAndQualitySequenceempty()chargetBase(int index) Return the base at position 'index'intgetCode(int index) Return the code at position 'index'getCoder()Get sequence encoder & decoderbyte[]getCodes()Get quality string (encoded FastQ-Sanger style)intgetQuality(int index) Get the sequence as a StringinthashCode()intFind the position of 'seq' in this sequenceintlastIndexOf(String seq) Returns the index within this string of the rightmost occurrence of the specified substringintlength()Sequence lenthoverlap(BinarySequence sequence, int start) Creates a new sequence by overlapping 'this' and 'sequence' E.g.read(DataInputStream dataInStream) Read data in binary formatprotected voidreadDataStream(DataInputStream dataInStream) Read data in binary formatReverse Watson-Cricks complementvoidSet sequencevoidSet sequencetoString()voidwrite(DataOutputStream dataOutStream) Write data in binary formatMethods inherited from class org.snpeff.binseq.BinarySequence
clone, setQuality
-
Constructor Details
-
DnaAndQualitySequence
public DnaAndQualitySequence(org.biojava.nbio.genome.io.fastq.Fastq fastq) -
DnaAndQualitySequence
-
DnaAndQualitySequence
-
-
Method Details
-
empty
-
compareTo
-
getBase
public char getBase(int index) Description copied from class:BinarySequenceReturn the base at position 'index'- Overrides:
getBasein classBinarySequence
-
getCode
public int getCode(int index) Description copied from class:BinarySequenceReturn the code at position 'index'- Specified by:
getCodein classBinarySequence
-
getCoder
Description copied from class:BinarySequenceGet sequence encoder & decoder- Specified by:
getCoderin classBinarySequence
-
getCodes
public byte[] getCodes() -
getQuality
Get quality string (encoded FastQ-Sanger style)- Returns:
-
getQuality
public int getQuality(int index) -
getSequence
Description copied from class:BinarySequenceGet the sequence as a String- Specified by:
getSequencein classBinarySequence
-
hashCode
public int hashCode()- Specified by:
hashCodein classBinarySequence
-
indexOf
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
Returns the index within this string of the rightmost occurrence of the specified substring -
length
public int length()Sequence lenth- Specified by:
lengthin classBinarySequence- Returns:
-
overlap
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:
overlapin classBinarySequence- Parameters:
start-- Returns:
- A new sequence
-
read
Read data in binary format- Specified by:
readin classBinarySequence- Parameters:
dataOutStream-- Throws:
IOException
-
readDataStream
Read data in binary format- Specified by:
readDataStreamin classBinarySequence- Parameters:
dataOutStream-- Throws:
IOException
-
reverseWc
Description copied from class:BinarySequenceReverse Watson-Cricks complement- Specified by:
reverseWcin classBinarySequence
-
set
Set sequence- Specified by:
setin classBinarySequence- Parameters:
seqStr-
-
set
public void set(String seqStr, String qualityStr, org.biojava.nbio.genome.io.fastq.FastqVariant type) Set sequence- Parameters:
seqStr-
-
toString
-
write
Write data in binary format- Specified by:
writein classBinarySequence- Parameters:
dataOutStream-- Throws:
IOException
-