public class ArbitrarySequence extends Sequence<double[]>
Sequence.CompositeSequence<T>, Sequence.RecursiveSequence<T>, Sequence.SubSequence<T>
alphabetCon, annotation, rc
Constructor and Description |
---|
ArbitrarySequence(AlphabetContainer alphabetContainer,
double... content)
Creates a new
ArbitrarySequence from an array of
double -encoded alphabet symbols. |
ArbitrarySequence(AlphabetContainer alphabetContainer,
SequenceAnnotation[] annotation,
String sequence,
String delim)
|
ArbitrarySequence(AlphabetContainer alphabetContainer,
SequenceAnnotation[] annotation,
SymbolExtractor extractor)
Creates a new
ArbitrarySequence from a SymbolExtractor . |
ArbitrarySequence(AlphabetContainer alphabetContainer,
String sequence)
Creates a new
ArbitrarySequence from a String
representation using the default delimiter. |
Modifier and Type | Method and Description |
---|---|
protected void |
addToRepresentation(Object representation,
int pos,
String delim)
This method adds the information of one position to the representation using the specified delimiter
|
int |
compareTo(double[] t1,
double[] t2)
This method compares to container and is used in
Sequence.compareTo(Sequence) . |
double |
continuousVal(int pos)
Returns the continuous value at position
pos of the
Sequence . |
int |
discreteVal(int pos)
Returns the discrete value at position
pos of the
Sequence . |
void |
fillContainer(double[] container,
int pos)
The method fills the content of a specific position in to the container.
|
protected ArbitrarySequence |
flatCloneWithoutAnnotation()
Works in analogy to
Object.clone() , but does not clone the
annotation. |
double[] |
getEmptyContainer()
The method returns a container that can be used for accessing the symbols for each position.
|
protected Object |
getEmptyRepresentation()
Returns an empty representation which is used to create the
String representation of this instance in the method Sequence.toString(String, int, int) . |
int |
getLength()
Returns the length of the
Sequence . |
protected String |
getStringRepresentation(Object representation)
This method creates a String representation from the given representation.
|
protected int |
hashCodeForPos(int pos)
This method is used in
Sequence.hashCode() and the hash code for one specific position. |
boolean |
isMultiDimensional()
The method returns
true if the sequence is multidimensional, otherwise false . |
annotate, compareTo, complement, complement, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getHammingDistance, getNumberOfSequenceAnnotationsByType, getSequenceAnnotationByType, getSequenceAnnotationByTypeAndIdentifier, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, matches, reverse, reverse, reverseComplement, reverseComplement, toDiscrete, toString, toString, toString, toString
public ArbitrarySequence(AlphabetContainer alphabetContainer, double... content) throws WrongAlphabetException, WrongSequenceTypeException
ArbitrarySequence
from an array of
double
-encoded alphabet symbols. This constructor is
designed for the method
StatisticalModel.emitDataSet(int, int...)
.alphabetContainer
- the AlphabetContainer
for the sequencecontent
- an array containing the encoded symbolsWrongAlphabetException
- if the sequence is not defined over
alphabetContainer
WrongSequenceTypeException
- if alphabetContainer
contains alphabets that can
not be encoded with double
sStatisticalModel.emitDataSet(int, int...)
,
Sequence.Sequence(AlphabetContainer, SequenceAnnotation[])
public ArbitrarySequence(AlphabetContainer alphabetContainer, String sequence) throws WrongAlphabetException, WrongSequenceTypeException
ArbitrarySequence
from a String
representation using the default delimiter.alphabetContainer
- the AlphabetContainer
for the sequencesequence
- a String
representation of the sequenceWrongAlphabetException
- if the sequence is not defined over
alphabetContainer
WrongSequenceTypeException
- if alphabetContainer
contains alphabets that can
not be encoded with double
sArbitrarySequence(AlphabetContainer,
SequenceAnnotation[], SymbolExtractor)
public ArbitrarySequence(AlphabetContainer alphabetContainer, SequenceAnnotation[] annotation, String sequence, String delim) throws WrongAlphabetException, WrongSequenceTypeException, IllegalArgumentException
ArbitrarySequence
from a String
representation using the delimiter delim
. Annotations for
this sequence are considered by annotation
.alphabetContainer
- the AlphabetContainer
for the sequenceannotation
- the annotation for this sequencesequence
- a String
representation of the sequencedelim
- the delimiter, a String
that separates the symbolsWrongAlphabetException
- if the sequence is not defined over
alphabetContainer
WrongSequenceTypeException
- if alphabetContainer
contains alphabets that can
not be encoded with double
sIllegalArgumentException
- if the delimiter is empty and the alphabet container is not
discreteArbitrarySequence(AlphabetContainer,
SequenceAnnotation[], SymbolExtractor)
public ArbitrarySequence(AlphabetContainer alphabetContainer, SequenceAnnotation[] annotation, SymbolExtractor extractor) throws WrongAlphabetException, WrongSequenceTypeException
ArbitrarySequence
from a SymbolExtractor
.
Annotations for this sequence are considered by annotation
.alphabetContainer
- the alphabet container for the sequenceannotation
- the annotation for this sequenceextractor
- the SymbolExtractor
WrongAlphabetException
- if the sequence is not defined over
alphabetContainer
WrongSequenceTypeException
- if alphabetContainer
contains alphabets that can
not be encoded with double
sSequence.Sequence(AlphabetContainer, SequenceAnnotation[])
public double continuousVal(int pos)
Sequence
pos
of the
Sequence
.continuousVal
in class Sequence<double[]>
pos
- the position of the Sequence
pos
of the
Sequence
public int discreteVal(int pos)
Sequence
pos
of the
Sequence
.discreteVal
in class Sequence<double[]>
pos
- the position of the Sequence
pos
of the
Sequence
public int getLength()
Sequence
Sequence
.protected ArbitrarySequence flatCloneWithoutAnnotation()
Sequence
Object.clone()
, but does not clone the
annotation. This method is used in
Sequence.annotate(boolean, SequenceAnnotation...)
.flatCloneWithoutAnnotation
in class Sequence<double[]>
Sequence
without annotationpublic boolean isMultiDimensional()
Sequence
true
if the sequence is multidimensional, otherwise false
.isMultiDimensional
in class Sequence<double[]>
true
if the sequence is multidimensional, otherwise false
public double[] getEmptyContainer()
Sequence
getEmptyContainer
in class Sequence<double[]>
Sequence.fillContainer(Object, int)
,
Sequence.isMultiDimensional()
public void fillContainer(double[] container, int pos)
Sequence
fillContainer
in class Sequence<double[]>
container
- the container which is used for filling the content.pos
- the positionSequence.getEmptyContainer()
,
Sequence.isMultiDimensional()
public int compareTo(double[] t1, double[] t2)
Sequence
Sequence.compareTo(Sequence)
.compareTo
in class Sequence<double[]>
t1
- the first containert2
- the second containerSequence.getEmptyContainer()
,
Sequence.fillContainer(Object, int)
,
Comparable.compareTo(java.lang.Object)
protected Object getEmptyRepresentation()
Sequence
String
representation of this instance in the method Sequence.toString(String, int, int)
.getEmptyRepresentation
in class Sequence<double[]>
String
representationSequence.toString(String, int, int)
protected void addToRepresentation(Object representation, int pos, String delim)
Sequence
addToRepresentation
in class Sequence<double[]>
representation
- the representationpos
- the positiondelim
- the delimiter separating the information for different positionsSequence.getEmptyRepresentation()
,
Sequence.toString(String, int, int)
protected String getStringRepresentation(Object representation)
Sequence
getStringRepresentation
in class Sequence<double[]>
representation
- the representation instance (which should be created by Sequence.getEmptyContainer()
and filled by Sequence.addToRepresentation(Object, int, String)
)Sequence.getEmptyRepresentation()
,
Sequence.addToRepresentation(Object, int, String)
,
Sequence.toString(String, int, int)
protected int hashCodeForPos(int pos)
Sequence
Sequence.hashCode()
and the hash code for one specific position.hashCodeForPos
in class Sequence<double[]>
pos
- the position