T
- the type of the internal sequencepublic class CyclicSequenceAdaptor<T> extends Sequence<T>
Sequence.CompositeSequence<T>, Sequence.RecursiveSequence<T>, Sequence.SubSequence<T>
alphabetCon, annotation, rc
Constructor and Description |
---|
CyclicSequenceAdaptor(Sequence<T> seq)
Creates a new cyclic sequence of the length of the original sequence.
|
CyclicSequenceAdaptor(Sequence<T> seq,
int extLength)
Creates a new cyclic sequence of given virtual length (i.e., the length reported by
getLength() ). |
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(Sequence<T> s) |
protected int |
compareTo(T t1,
T t2)
This method compares to container and is used in
Sequence.compareTo(Sequence) . |
CyclicSequenceAdaptor<T> |
complement()
|
CyclicSequenceAdaptor<T> |
complement(int start,
int end)
|
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(T container,
int pos)
The method fills the content of a specific position in to the container.
|
protected CyclicSequenceAdaptor<T> |
flatCloneWithoutAnnotation()
Works in analogy to
Object.clone() , but does not clone the
annotation. |
T |
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.
|
CyclicSequenceAdaptor<T> |
getSuperSequence(int length)
Returns a new cyclic sequence using the internal sequence of this
CyclicSequenceAdaptor but with
the supplied virtual length |
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 . |
CyclicSequenceAdaptor<T> |
reverse(int start,
int end)
|
CyclicSequenceAdaptor<T> |
reverseComplement()
|
CyclicSequenceAdaptor<T> |
reverseComplement(int start,
int end)
|
annotate, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getHammingDistance, getNumberOfSequenceAnnotationsByType, getSequenceAnnotationByType, getSequenceAnnotationByTypeAndIdentifier, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, matches, reverse, toDiscrete, toString, toString, toString, toString
public CyclicSequenceAdaptor(Sequence<T> seq, int extLength)
getLength()
).seq
- the original sequenceextLength
- the virtual lengthpublic double continuousVal(int pos)
Sequence
pos
of the
Sequence
.continuousVal
in class Sequence<T>
pos
- the position of the Sequence
pos
of the
Sequence
public int discreteVal(int pos)
Sequence
pos
of the
Sequence
.discreteVal
in class Sequence<T>
pos
- the position of the Sequence
pos
of the
Sequence
protected CyclicSequenceAdaptor<T> flatCloneWithoutAnnotation()
Sequence
Object.clone()
, but does not clone the
annotation. This method is used in
Sequence.annotate(boolean, SequenceAnnotation...)
.flatCloneWithoutAnnotation
in class Sequence<T>
Sequence
without annotationpublic int getLength()
Sequence
Sequence
.protected int compareTo(T t1, T t2)
Sequence
Sequence.compareTo(Sequence)
.compareTo
in class Sequence<T>
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<T>
String
representationSequence.toString(String, int, int)
protected void addToRepresentation(Object representation, int pos, String delim)
Sequence
addToRepresentation
in class Sequence<T>
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<T>
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<T>
pos
- the positionpublic boolean isMultiDimensional()
Sequence
true
if the sequence is multidimensional, otherwise false
.isMultiDimensional
in class Sequence<T>
true
if the sequence is multidimensional, otherwise false
public T getEmptyContainer()
Sequence
getEmptyContainer
in class Sequence<T>
Sequence.fillContainer(Object, int)
,
Sequence.isMultiDimensional()
public void fillContainer(T container, int pos)
Sequence
fillContainer
in class Sequence<T>
container
- the container which is used for filling the content.pos
- the positionSequence.getEmptyContainer()
,
Sequence.isMultiDimensional()
public CyclicSequenceAdaptor<T> reverse(int start, int end) throws OperationNotSupportedException
Sequence
reverse
in class Sequence<T>
start
- the start position (inclusive) in the original
Sequence
end
- the end position (exclusive) in the original Sequence
Sequence
of the partOperationNotSupportedException
- if the current Sequence
is based on an
AlphabetContainer
that is not simplepublic CyclicSequenceAdaptor<T> complement() throws OperationNotSupportedException
Sequence
Sequence
containing the
complementary current Sequence
.
AlphabetContainer
on
DNAAlphabet
returns "ATTAT".complement
in class Sequence<T>
Sequence
OperationNotSupportedException
- if the current Sequence
is not based on a
ComplementableDiscreteAlphabet
ComplementableDiscreteAlphabet
,
Sequence.complement(int, int)
public CyclicSequenceAdaptor<T> reverseComplement() throws OperationNotSupportedException
Sequence
Sequence
containing the
reverse complementary current Sequence
. For more details see the
methods Sequence.reverse()
and Sequence.complement()
.reverseComplement
in class Sequence<T>
Sequence
OperationNotSupportedException
- if the current Sequence
is not discrete and simple
(not based on a ComplementableDiscreteAlphabet
)Sequence.reverse()
,
Sequence.complement()
,
Sequence.reverseComplement(int, int)
,
ComplementableDiscreteAlphabet
public CyclicSequenceAdaptor<T> complement(int start, int end) throws OperationNotSupportedException
Sequence
Sequence
containing a part
of the complementary current Sequence
.
AlphabetContainer
on
DNAAlphabet
returns "ATTAT".complement
in class Sequence<T>
start
- the start position (inclusive) in the original
Sequence
end
- the end position (exclusive) in the original Sequence
Sequence
of the partOperationNotSupportedException
- if the current Sequence
is not based on a
ComplementableDiscreteAlphabet
ComplementableDiscreteAlphabet
public CyclicSequenceAdaptor<T> reverseComplement(int start, int end) throws OperationNotSupportedException
Sequence
Sequence
containing a
reverse part of the complementary current Sequence
. For more
details see the methods Sequence.reverse()
and Sequence.complement()
.reverseComplement
in class Sequence<T>
start
- the start position (inclusive) in the original
Sequence
end
- the end position (exclusive) in the original Sequence
Sequence
of the partOperationNotSupportedException
- if the current Sequence
is not discrete and simple
((not based on a ComplementableDiscreteAlphabet
)Sequence.reverse()
,
Sequence.complement()
,
ComplementableDiscreteAlphabet
public CyclicSequenceAdaptor<T> getSuperSequence(int length)
CyclicSequenceAdaptor
but with
the supplied virtual lengthlength
- the virtual lengthCyclicSequenceAdaptor(Sequence, int)