|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.data.Sequence<T>
T - the type of each positionpublic abstract class Sequence<T>
This is the main class for all sequences. All sequences are immutable.
| Nested Class Summary | |
|---|---|
protected static class |
Sequence.CompositeSequence<T>
The class handles composite Sequences. |
static class |
Sequence.RecursiveSequence<T>
This is the main class for subsequences, composite sequences, ... . |
protected static class |
Sequence.SubSequence<T>
This class handles subsequences. |
| Field Summary | |
|---|---|
protected AlphabetContainer |
alphabetCon
The underlying alphabets. |
protected SequenceAnnotation[] |
annotation
The annotation of the Sequence.RecursiveSequence. |
protected Sequence<T> |
rc
The pointer to the reverse complement of the Sequence.RecursiveSequence. |
| Constructor Summary | |
|---|---|
protected |
Sequence(AlphabetContainer container,
SequenceAnnotation[] annotation)
Creates a new Sequence.RecursiveSequence with the given AlphabetContainer
and the given annotation, but without the content. |
| Method Summary | |
|---|---|
protected abstract void |
addToRepresentation(Object representation,
int pos,
String delim)
This method adds the information of one position to the representation using the specified delimiter |
Sequence |
annotate(boolean add,
SequenceAnnotation... annotation)
This method allows to append annotation to a Sequence.RecursiveSequence. |
int |
compareTo(Sequence<T> s)
|
abstract int |
compareTo(T t1,
T t2)
This method compares to container and is used in compareTo(Sequence). |
Sequence |
complement()
This method returns a new instance of Sequence.RecursiveSequence containing the
complementary current Sequence.RecursiveSequence. |
Sequence |
complement(int start,
int end)
This method returns a new instance of Sequence.RecursiveSequence containing a part
of the complementary current Sequence.RecursiveSequence. |
abstract double |
continuousVal(int pos)
Returns the continuous value at position pos of the
Sequence.RecursiveSequence. |
static Sequence |
create(AlphabetContainer con,
SequenceAnnotation[] annotation,
String sequence,
String delim)
Creates a Sequence.RecursiveSequence from a String based on the given
AlphabetContainer using the given delimiter delim
and some annotation for the Sequence.RecursiveSequence. |
static Sequence |
create(AlphabetContainer con,
String sequence)
Creates a Sequence.RecursiveSequence from a String based on the given
AlphabetContainer using the standard delimiter for this
AlphabetContainer. |
static Sequence |
create(AlphabetContainer con,
String sequence,
String delim)
Creates a Sequence.RecursiveSequence from a String based on the given
AlphabetContainer using the given delimiter delim. |
abstract int |
discreteVal(int pos)
Returns the discrete value at position pos of the
Sequence.RecursiveSequence. |
boolean |
equals(Object o)
|
abstract void |
fillContainer(T container,
int pos)
The method fills the content of a specific position in to the container. |
protected abstract Sequence |
flatCloneWithoutAnnotation()
Works in analogy to Object.clone(), but does not clone the
annotation. |
AlphabetContainer |
getAlphabetContainer()
Return the alphabets, i.e. the AlphabetContainer, used in this
Sequence.RecursiveSequence. |
SequenceAnnotation[] |
getAnnotation()
Returns the annotation of the Sequence.RecursiveSequence. |
Sequence<T> |
getCompositeSequence(AlphabetContainer abc,
int[] starts,
int[] lengths)
This method should be used if one wants to create a Sample of
Sequence.CompositeSequences. |
Sequence |
getCompositeSequence(int[] starts,
int[] lengths)
This is a very efficient way to create a Sequence.CompositeSequence for
sequences with a simple AlphabetContainer. |
abstract T |
getEmptyContainer()
The method returns a container that can be used for accessing the symbols for each position. |
protected abstract Object |
getEmptyRepresentation()
Returns an empty representation which is used to create the String representation of this instance in the method toString(String, int, int). |
int |
getHammingDistance(Sequence seq)
This method returns the Hamming distance between the current Sequence.RecursiveSequence and seq. |
abstract int |
getLength()
Returns the length of the Sequence.RecursiveSequence. |
int |
getNumberOfSequenceAnnotationsByType(String type)
Returns the number of SequenceAnnotations of type type for this Sequence.RecursiveSequence. |
SequenceAnnotation |
getSequenceAnnotationByType(String type,
int idx)
Returns the SequenceAnnotation no. |
SequenceAnnotation |
getSequenceAnnotationByTypeAndIdentifier(String type,
String identifier)
Returns the SequenceAnnotation of this Sequence.RecursiveSequence that has type type and identifier identifier. |
protected abstract String |
getStringRepresentation(Object representation)
This method creates a String representation from the given representation. |
Sequence |
getSubSequence(AlphabetContainer abc,
int start)
This method should be used if one wants to create a Sample of
subsequences of defined length. |
Sequence |
getSubSequence(AlphabetContainer abc,
int start,
int length)
This method should be used if one wants to create a Sample of
subsequences of defined length. |
Sequence |
getSubSequence(int start)
This is a very efficient way to create a subsequence/suffix for Sequence.RecursiveSequences with a simple AlphabetContainer. |
Sequence |
getSubSequence(int start,
int length)
This is a very efficient way to create a subsequence of defined length for Sequence.RecursiveSequences with a simple AlphabetContainer. |
int |
hashCode()
|
protected abstract int |
hashCodeForPos(int pos)
This method is used in hashCode() and the hash code for one specific position. |
abstract boolean |
isMultiDimensional()
The method returns true if the sequence is multidimensional, otherwise . |
boolean |
matches(int maxHammingDistance,
Sequence shortSequence)
This method allows to answer the question whether there is a similar pattern find a match with a given maximal number of mismatches. |
Sequence |
reverse()
This method returns a new instance of Sequence.RecursiveSequence containing the
reverse current Sequence.RecursiveSequence. |
Sequence |
reverse(int start,
int end)
This method returns a new instance of Sequence.RecursiveSequence containing a part
of the reverse current Sequence.RecursiveSequence. |
Sequence |
reverseComplement()
This method returns a new instance of Sequence.RecursiveSequence containing the
reverse complementary current Sequence.RecursiveSequence. |
Sequence |
reverseComplement(int start,
int end)
This method returns a new instance of Sequence.RecursiveSequence containing a
reverse part of the complementary current Sequence.RecursiveSequence. |
protected int |
toDiscrete(int pos,
double content)
This method converts a continuous value at position pos of
the Sequence.RecursiveSequence into a discrete one. |
String |
toString()
Returns a String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original Alphabet). |
String |
toString(int start)
Returns a String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original Alphabet) beginning at
position start with a default delimiter as separator. |
String |
toString(int start,
int end)
Returns a String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original Alphabet) between
start and end with a default delimiter as
separator. |
String |
toString(String delim,
int start,
int end)
Returns a String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original alphabet) between start
and end with delim as separator. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected AlphabetContainer alphabetCon
protected Sequence<T> rc
Sequence.RecursiveSequence.
protected SequenceAnnotation[] annotation
Sequence.RecursiveSequence.
| Constructor Detail |
|---|
protected Sequence(AlphabetContainer container,
SequenceAnnotation[] annotation)
Sequence.RecursiveSequence with the given AlphabetContainer
and the given annotation, but without the content. The content has to be
set by the constructor of the extending class.
container - the AlphabetContainer of the Sequence.RecursiveSequenceannotation - the annotation of the Sequence.RecursiveSequence| Method Detail |
|---|
public abstract double continuousVal(int pos)
pos of the
Sequence.RecursiveSequence.
pos - the position of the Sequence.RecursiveSequence
pos of the
Sequence.RecursiveSequencepublic abstract int discreteVal(int pos)
pos of the
Sequence.RecursiveSequence.
pos - the position of the Sequence.RecursiveSequence
pos of the
Sequence.RecursiveSequencepublic boolean equals(Object o)
equals in class Objectpublic final AlphabetContainer getAlphabetContainer()
AlphabetContainer, used in this
Sequence.RecursiveSequence.
AlphabetContainer, used in this
Sequence.RecursiveSequencepublic final SequenceAnnotation[] getAnnotation()
Sequence.RecursiveSequence.
Sequence.RecursiveSequence (can be null)
public SequenceAnnotation getSequenceAnnotationByTypeAndIdentifier(String type,
String identifier)
SequenceAnnotation of this Sequence.RecursiveSequence that has type type and identifier identifier.
type - the chosen type of the SequenceAnnotationidentifier - the chosen identifier of the SequenceAnnotation
SequenceAnnotation that meets the criteria
public SequenceAnnotation getSequenceAnnotationByType(String type,
int idx)
SequenceAnnotation no. idx of this Sequence.RecursiveSequence that has type type
type - the chosen type of a subset of SequenceAnnotationsidx - the index of the returned SequenceAnnotation within this subset.
SequenceAnnotation no. idx with type typepublic int getNumberOfSequenceAnnotationsByType(String type)
SequenceAnnotations of type type for this Sequence.RecursiveSequence.
type - the type
public Sequence<T> getCompositeSequence(AlphabetContainer abc,
int[] starts,
int[] lengths)
Sample of
Sequence.CompositeSequences. With this constructor you are enabled to
create a Sample where every Sequence.RecursiveSequence has the same
AlphabetContainer instance.
AlphabetContainer matches with
the one of the Sequence.CompositeSequence.
abc - the new AlphabetContainerstarts - the start positions of the junkslengths - the length of each junk
Sequence.CompositeSequenceCompositeSequence#CompositeSequence(de.jstacs.data.AlphabetContainer,
de.jstacs.data.Sequence, int[], int[])
public Sequence getCompositeSequence(int[] starts,
int[] lengths)
Sequence.CompositeSequence for
sequences with a simple AlphabetContainer.
starts - the start positions of the junkslengths - the length of each junk
Sequence.CompositeSequenceCompositeSequence#CompositeSequence(de.jstacs.data.Sequence, int[], int[])
public final Sequence getSubSequence(AlphabetContainer abc,
int start)
Sample of
subsequences of defined length. With this constructor you are enabled to
create a Sample where every Sequence.RecursiveSequence has the same
AlphabetContainer instance.
AlphabetContainer matches with
the one of the subsequence.
abc - the new AlphabetContainerstart - the index of the start position
getSubSequence(de.jstacs.data.AlphabetContainer, int, int)
public Sequence getSubSequence(AlphabetContainer abc,
int start,
int length)
Sample of
subsequences of defined length. With this constructor you are enabled to
create a Sample where every Sequence.RecursiveSequence has the same
AlphabetContainer instance.
AlphabetContainer matches with
the one of the subsequence.
abc - the new AlphabetContainerstart - the index of the start positionlength - the length of the new Sequence.RecursiveSequence
SubSequence#SubSequence(de.jstacs.data.AlphabetContainer, de.jstacs.data.Sequence, int, int)public final Sequence getSubSequence(int start)
Sequence.RecursiveSequences with a simple AlphabetContainer.
start - the index of the start position
getSubSequence(int, int)
public Sequence getSubSequence(int start,
int length)
Sequence.RecursiveSequences with a simple AlphabetContainer.
start - the index of the start positionlength - the length of the new Sequence.RecursiveSequence
SubSequence#SubSequence(Sequence, int, int)
public Sequence annotate(boolean add,
SequenceAnnotation... annotation)
Sequence.RecursiveSequence.
add - indicates whether to add the new annotation to the existing or
notannotation - the new annotation
Sequence.RecursiveSequenceflatCloneWithoutAnnotation()protected abstract Sequence flatCloneWithoutAnnotation()
Object.clone(), but does not clone the
annotation. This method is used in
annotate(boolean, SequenceAnnotation...).
Sequence.RecursiveSequence without annotationpublic abstract int getLength()
Sequence.RecursiveSequence.
Sequence.RecursiveSequencepublic String toString()
String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original Alphabet).
toString in class ObjectSequence.RecursiveSequence as StringtoString(String, int, int)public String toString(int start)
String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original Alphabet) beginning at
position start with a default delimiter as separator.
start - the start index (inclusive)
Sequence.RecursiveSequence as StringtoString(String, int, int)
public String toString(int start,
int end)
String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original Alphabet) between
start and end with a default delimiter as
separator.
start - the start index (inclusive)end - the end index (exclusive)
Sequence.RecursiveSequence as StringtoString(String, int, int)public int compareTo(Sequence<T> s)
compareTo in interface Comparable<Sequence<T>>
public abstract int compareTo(T t1,
T t2)
compareTo(Sequence).
t1 - the first containert2 - the second container
getEmptyContainer(),
fillContainer(Object, int),
Comparable.compareTo(java.lang.Object)
protected int toDiscrete(int pos,
double content)
pos of
the Sequence.RecursiveSequence into a discrete one.
pos - the position of the Sequence.RecursiveSequencecontent - the value at this position
AlphabetContainer.toDiscrete(int, double)
public String toString(String delim,
int start,
int end)
String representation of the Sequence.RecursiveSequence (normally
the Sequence.RecursiveSequence in its original alphabet) between start
and end with delim as separator.
delim - the delimiter/separatorstart - the start index (inclusive)end - the end index (exclusive)
Sequence.RecursiveSequence as StringgetEmptyRepresentation(),
addToRepresentation(Object, int, String),
getStringRepresentation(Object)protected abstract Object getEmptyRepresentation()
String representation of this instance in the method toString(String, int, int).
String representationtoString(String, int, int)
protected abstract void addToRepresentation(Object representation,
int pos,
String delim)
representation - the representationpos - the positiondelim - the delimiter separating the information for different positionsgetEmptyRepresentation(),
toString(String, int, int)protected abstract String getStringRepresentation(Object representation)
representation - the representation instance (which should be created by getEmptyContainer() and filled by addToRepresentation(Object, int, String))
getEmptyRepresentation(),
addToRepresentation(Object, int, String),
toString(String, int, int)
public static Sequence create(AlphabetContainer con,
String sequence)
throws WrongAlphabetException,
IllegalArgumentException
Sequence.RecursiveSequence from a String based on the given
AlphabetContainer using the standard delimiter for this
AlphabetContainer.
con - the AlphabetContainersequence - the String containing the Sequence.RecursiveSequence
Sequence.RecursiveSequence instance
WrongAlphabetException - if sequence is not defined over con
IllegalArgumentException - if the delimiter is empty and the AlphabetContainer
is not discretecreate(AlphabetContainer, String, String)
public static Sequence create(AlphabetContainer con,
String sequence,
String delim)
throws WrongAlphabetException,
IllegalArgumentException
Sequence.RecursiveSequence from a String based on the given
AlphabetContainer using the given delimiter delim.
con - the AlphabetContainersequence - the String containing the Sequence.RecursiveSequencedelim - the given delimiter
Sequence.RecursiveSequence instance
WrongAlphabetException - if sequence is not defined over con
IllegalArgumentException - if the delimiter is empty and the AlphabetContainer
is not discretecreate(AlphabetContainer, SequenceAnnotation[], String,
String)
public static Sequence create(AlphabetContainer con,
SequenceAnnotation[] annotation,
String sequence,
String delim)
throws WrongAlphabetException,
IllegalArgumentException
Sequence.RecursiveSequence from a String based on the given
AlphabetContainer using the given delimiter delim
and some annotation for the Sequence.RecursiveSequence.
con - the AlphabetContainerannotation - the annotation for the Sequence.RecursiveSequencesequence - the String containing the Sequence.RecursiveSequencedelim - the given delimiter
Sequence.RecursiveSequence instance
WrongAlphabetException - if sequence is not defined over con
IllegalArgumentException - if the delimiter is empty and the AlphabetContainer
is not discrete
public final Sequence reverse()
throws OperationNotSupportedException
Sequence.RecursiveSequence containing the
reverse current Sequence.RecursiveSequence.
Sequence.RecursiveSequence
OperationNotSupportedException - if the current Sequence.RecursiveSequence is based on an
AlphabetContainer that is not simplereverse(int, int)
public Sequence reverse(int start,
int end)
throws OperationNotSupportedException
Sequence.RecursiveSequence containing a part
of the reverse current Sequence.RecursiveSequence.
start - the start position (inclusive) in the original
Sequence.RecursiveSequenceend - the end position (exclusive) in the original Sequence.RecursiveSequence
Sequence.RecursiveSequence of the part
OperationNotSupportedException - if the current Sequence.RecursiveSequence is based on an
AlphabetContainer that is not simple
public Sequence complement()
throws OperationNotSupportedException
Sequence.RecursiveSequence containing the
complementary current Sequence.RecursiveSequence.
AlphabetContainer on
DNAAlphabet returns "ATTAT".
Sequence.RecursiveSequence
OperationNotSupportedException - if the current Sequence.RecursiveSequence is not based on a
ComplementableDiscreteAlphabetComplementableDiscreteAlphabet,
complement(int, int)
public Sequence reverseComplement()
throws OperationNotSupportedException
Sequence.RecursiveSequence containing the
reverse complementary current Sequence.RecursiveSequence. For more details see the
methods reverse() and complement().
Sequence.RecursiveSequence
OperationNotSupportedException - if the current Sequence.RecursiveSequence is not discrete and simple
(not based on a ComplementableDiscreteAlphabet)reverse(),
complement(),
reverseComplement(int, int),
ComplementableDiscreteAlphabet
public Sequence complement(int start,
int end)
throws OperationNotSupportedException
Sequence.RecursiveSequence containing a part
of the complementary current Sequence.RecursiveSequence.
AlphabetContainer on
DNAAlphabet returns "ATTAT".
start - the start position (inclusive) in the original
Sequence.RecursiveSequenceend - the end position (exclusive) in the original Sequence.RecursiveSequence
Sequence.RecursiveSequence of the part
OperationNotSupportedException - if the current Sequence.RecursiveSequence is not based on a
ComplementableDiscreteAlphabetComplementableDiscreteAlphabet
public Sequence reverseComplement(int start,
int end)
throws OperationNotSupportedException
Sequence.RecursiveSequence containing a
reverse part of the complementary current Sequence.RecursiveSequence. For more
details see the methods reverse() and complement().
start - the start position (inclusive) in the original
Sequence.RecursiveSequenceend - the end position (exclusive) in the original Sequence.RecursiveSequence
Sequence.RecursiveSequence of the part
OperationNotSupportedException - if the current Sequence.RecursiveSequence is not discrete and simple
((not based on a ComplementableDiscreteAlphabet)reverse(),
complement(),
ComplementableDiscreteAlphabetpublic int hashCode()
hashCode in class Objectprotected abstract int hashCodeForPos(int pos)
hashCode() and the hash code for one specific position.
pos - the position
public int getHammingDistance(Sequence seq)
throws WrongAlphabetException
Sequence.RecursiveSequence and seq.
If the sequence have different length -1 is returned.
seq - the sequence to be compared
WrongAlphabetException - it the sequences have different AlphabetContainer
public boolean matches(int maxHammingDistance,
Sequence shortSequence)
throws WrongAlphabetException
maxHammingDistance - the maximal Hamming distanceshortSequence - the short sequence
true if a match with maximal Hamming distance smaller than maxHammingDistance exists, otherwise false
WrongAlphabetException - if the sequence have different AlphabetContainerpublic abstract boolean isMultiDimensional()
true if the sequence is multidimensional, otherwise .
- Returns:
true if the sequence is multidimensional, otherwise
public abstract T getEmptyContainer()
fillContainer(Object, int),
isMultiDimensional()
public abstract void fillContainer(T container,
int pos)
container - the container which is used for filling the content.pos - the positiongetEmptyContainer(),
isMultiDimensional()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||