|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.data.Sequence
de.jstacs.data.sequences.DiscreteSequence
de.jstacs.data.sequences.SparseSequence
public final class SparseSequence
This class is an implementation for sequence on one alphabet with length 4. This implementation can be used for instance
for DNA sequences.
The symbols are encoded in the bits of the primitive type long
, which allows to save 32 symbols in
one long
. Therefore an instance of this class is more memory efficient than any other
DiscreteSequence
, e.g. ByteSequence
. But on the other hand side this class will be a little bit slower
when accessing single positions.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class de.jstacs.data.Sequence |
---|
Sequence.CompositeSequence, Sequence.SubSequence |
Field Summary |
---|
Fields inherited from class de.jstacs.data.Sequence |
---|
alphabetCon, annotation, rc |
Constructor Summary | |
---|---|
SparseSequence(AlphabetContainer alphCon,
String seq)
This constructor creates an instance from a String. |
|
SparseSequence(AlphabetContainer alphCon,
SymbolExtractor se)
This constructor creates an instance from a SymbolExtractor. |
Method Summary | |
---|---|
SparseSequence |
complement(int start,
int end)
This method returns a new instance of sequence containing a part of the complementary current sequence. |
int |
discreteVal(int pos)
Returns the discrete value of position pos . |
protected Sequence |
flatCloneWithoutAnnotation()
Works in analogy to Object.clone() , but does not clone the annotation. |
int |
getLength()
Returns the length of the sequence |
SparseSequence |
reverse(int start,
int end)
This method returns a new instance of sequence containing a part of the reverse current sequence. |
SparseSequence |
reverseComplement(int start,
int end)
This method returns a new sequence instance containing a part of the complementary current sequence. |
Methods inherited from class de.jstacs.data.sequences.DiscreteSequence |
---|
continuousVal |
Methods inherited from class de.jstacs.data.Sequence |
---|
annotate, compareTo, complement, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, reverse, reverseComplement, toDiscrete, toString, toString, toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SparseSequence(AlphabetContainer alphCon, String seq) throws WrongSequenceTypeException, WrongAlphabetException
alphCon
- the AlphabetContainerseq
- the sequence as String
WrongSequenceTypeException
- if the AlphabetContainer is not simple or the internal Alphabet has more than 4 symbols
WrongAlphabetException
- if the AlphabetContainer is not discretepublic SparseSequence(AlphabetContainer alphCon, SymbolExtractor se) throws WrongSequenceTypeException, WrongAlphabetException
alphCon
- the AlphabetContainerse
- the SymbolExtractor
WrongSequenceTypeException
- if the AlphabetContainer is not simple or the internal Alphabet has more than 4 symbols
WrongAlphabetException
- if the AlphabetContainer is not discreteMethod Detail |
---|
public int discreteVal(int pos)
Sequence
pos
.
discreteVal
in class Sequence
pos
- the position
pos
public int getLength()
Sequence
getLength
in class Sequence
public SparseSequence complement(int start, int end) throws OperationNotSupportedException
Sequence
AlphabetContainer
on
DNAAlphabet
returns "ATTAT".
complement
in class Sequence
start
- the start position (inclusive) in the original sequenceend
- the end position (exclusive) in the original sequence
OperationNotSupportedException
- if the current sequence is not based on a ComplementableDiscreteAlphabet
ComplementableDiscreteAlphabet
public SparseSequence reverse(int start, int end) throws OperationNotSupportedException
Sequence
reverse
in class Sequence
start
- the start position (inclusive) in the original sequenceend
- the end position (exclusive) in the original sequence
OperationNotSupportedException
- if the current sequence is based on an AlphabetContainer that is not simple.public SparseSequence reverseComplement(int start, int end) throws OperationNotSupportedException
Sequence
reverse()
and complement()
.
reverseComplement
in class Sequence
start
- the start position (inclusive) in the original sequenceend
- the end position (exclusive) in the original sequence
OperationNotSupportedException
- if the current sequence is not discrete and simpleSequence.reverse()
,
Sequence.complement()
,
ComplementableDiscreteAlphabet
protected Sequence flatCloneWithoutAnnotation()
Sequence
Object.clone()
, but does not clone the annotation. This method is used in Sequence.annotate(boolean, SequenceAnnotation...)
.
flatCloneWithoutAnnotation
in class Sequence
Sequence.CompositeSequence
without annotation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |