|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.data.Sequence
public abstract class Sequence
This is the main class for all sequences. All sequences are immutable.
| Nested Class Summary | |
|---|---|
protected static class |
Sequence.CompositeSequence
The class handles composite Sequences. |
protected static class |
Sequence.SubSequence
This class handles subsequences. |
| Field Summary | |
|---|---|
protected AlphabetContainer |
alphabetCon
The underlying alphabets. |
protected SequenceAnnotation[] |
annotation
The annotation of the Sequence.CompositeSequence. |
protected Sequence |
rc
The pointer to the reverse complement of the Sequence.CompositeSequence. |
| Constructor Summary | |
|---|---|
protected |
Sequence(AlphabetContainer container,
SequenceAnnotation[] annotation)
Creates a new Sequence.CompositeSequence with the given AlphabetContainer
and the given annotation, but without the content. |
| Method Summary | |
|---|---|
Sequence |
annotate(boolean add,
SequenceAnnotation... annotation)
This method allows to append annotation to a Sequence.CompositeSequence. |
int |
compareTo(Sequence s)
|
Sequence |
complement()
This method returns a new instance of Sequence.CompositeSequence containing the
complementary current Sequence.CompositeSequence. |
Sequence |
complement(int start,
int end)
This method returns a new instance of Sequence.CompositeSequence containing a part
of the complementary current Sequence.CompositeSequence. |
abstract double |
continuousVal(int pos)
Returns the continuous value at position pos of the
Sequence.CompositeSequence. |
static Sequence |
create(AlphabetContainer con,
SequenceAnnotation[] annotation,
String sequence,
String delim)
Creates a Sequence.CompositeSequence from a String based on the given
AlphabetContainer using the given delimiter delim
and some annotation for the Sequence.CompositeSequence. |
static Sequence |
create(AlphabetContainer con,
String sequence)
Creates a Sequence.CompositeSequence 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.CompositeSequence 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.CompositeSequence. |
boolean |
equals(Object o)
|
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.CompositeSequence. |
SequenceAnnotation[] |
getAnnotation()
Returns the annotation of the Sequence.CompositeSequence. |
Sequence |
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 int |
getLength()
Returns the length of the Sequence.CompositeSequence. |
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.CompositeSequences 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.CompositeSequences with a simple AlphabetContainer. |
int |
hashCode()
|
Sequence |
reverse()
This method returns a new instance of Sequence.CompositeSequence containing the
reverse current Sequence.CompositeSequence. |
Sequence |
reverse(int start,
int end)
This method returns a new instance of Sequence.CompositeSequence containing a part
of the reverse current Sequence.CompositeSequence. |
Sequence |
reverseComplement()
This method returns a new instance of Sequence.CompositeSequence containing the
reverse complementary current Sequence.CompositeSequence. |
Sequence |
reverseComplement(int start,
int end)
This method returns a new instance of Sequence.CompositeSequence containing a
reverse part of the complementary current Sequence.CompositeSequence. |
protected int |
toDiscrete(int pos,
double content)
This method converts a continuous value at position pos of
the Sequence.CompositeSequence into a discrete one. |
String |
toString()
Returns a String representation of the Sequence.CompositeSequence (normally
the Sequence.CompositeSequence in its original Alphabet). |
String |
toString(int start)
Returns a String representation of the Sequence.CompositeSequence (normally
the Sequence.CompositeSequence 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.CompositeSequence (normally
the Sequence.CompositeSequence 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.CompositeSequence (normally
the Sequence.CompositeSequence 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 rc
Sequence.CompositeSequence.
protected SequenceAnnotation[] annotation
Sequence.CompositeSequence.
| Constructor Detail |
|---|
protected Sequence(AlphabetContainer container,
SequenceAnnotation[] annotation)
Sequence.CompositeSequence 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.CompositeSequenceannotation - the annotation of the Sequence.CompositeSequence| Method Detail |
|---|
public abstract double continuousVal(int pos)
pos of the
Sequence.CompositeSequence.
pos - the position of the Sequence.CompositeSequence
pos of the
Sequence.CompositeSequencepublic abstract int discreteVal(int pos)
pos of the
Sequence.CompositeSequence.
pos - the position of the Sequence.CompositeSequence
pos of the
Sequence.CompositeSequencepublic boolean equals(Object o)
equals in class Objectpublic final AlphabetContainer getAlphabetContainer()
AlphabetContainer, used in this
Sequence.CompositeSequence.
AlphabetContainer, used in this
Sequence.CompositeSequencepublic final SequenceAnnotation[] getAnnotation()
Sequence.CompositeSequence.
Sequence.CompositeSequence (can be null)
public Sequence getCompositeSequence(AlphabetContainer abc,
int[] starts,
int[] lengths)
Sample of
Sequence.CompositeSequences. With this constructor you are enabled to
create a Sample where every Sequence.CompositeSequence 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.CompositeSequence 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.CompositeSequence 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.CompositeSequence
SubSequence#SubSequence(de.jstacs.data.AlphabetContainer, de.jstacs.data.Sequence, int, int)public final Sequence getSubSequence(int start)
Sequence.CompositeSequences with a simple AlphabetContainer.
start - the index of the start position
getSubSequence(int, int)
public Sequence getSubSequence(int start,
int length)
Sequence.CompositeSequences with a simple AlphabetContainer.
start - the index of the start positionlength - the length of the new Sequence.CompositeSequence
SubSequence#SubSequence(Sequence, int, int)
public Sequence annotate(boolean add,
SequenceAnnotation... annotation)
Sequence.CompositeSequence.
add - indicates whether to add the new annotation to the existing or
notannotation - the new annotation
Sequence.CompositeSequenceSequence.CompositeSequence.flatCloneWithoutAnnotation()protected abstract Sequence flatCloneWithoutAnnotation()
Object.clone(), but does not clone the
annotation. This method is used in
annotate(boolean, SequenceAnnotation...).
Sequence.CompositeSequence without annotationpublic abstract int getLength()
Sequence.CompositeSequence.
Sequence.CompositeSequencepublic String toString()
String representation of the Sequence.CompositeSequence (normally
the Sequence.CompositeSequence in its original Alphabet).
toString in class ObjectSequence.CompositeSequence as StringtoString(String, int, int)public String toString(int start)
String representation of the Sequence.CompositeSequence (normally
the Sequence.CompositeSequence in its original Alphabet) beginning at
position start with a default delimiter as separator.
start - the start index (inclusive)
Sequence.CompositeSequence as StringtoString(String, int, int)
public String toString(int start,
int end)
String representation of the Sequence.CompositeSequence (normally
the Sequence.CompositeSequence 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.CompositeSequence as StringtoString(String, int, int)public int compareTo(Sequence s)
compareTo in interface Comparable<Sequence>
protected int toDiscrete(int pos,
double content)
pos of
the Sequence.CompositeSequence into a discrete one.
pos - the position of the Sequence.CompositeSequencecontent - the value at this position
AlphabetContainer.toDiscrete(int, double)
public String toString(String delim,
int start,
int end)
String representation of the Sequence.CompositeSequence (normally
the Sequence.CompositeSequence 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.CompositeSequence as String
public static Sequence create(AlphabetContainer con,
String sequence)
throws WrongAlphabetException,
IllegalArgumentException
Sequence.CompositeSequence from a String based on the given
AlphabetContainer using the standard delimiter for this
AlphabetContainer.
con - the AlphabetContainersequence - the String containing the Sequence.CompositeSequence
Sequence.CompositeSequence 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.CompositeSequence from a String based on the given
AlphabetContainer using the given delimiter delim.
con - the AlphabetContainersequence - the String containing the Sequence.CompositeSequencedelim - the given delimiter
Sequence.CompositeSequence 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.CompositeSequence from a String based on the given
AlphabetContainer using the given delimiter delim
and some annotation for the Sequence.CompositeSequence.
con - the AlphabetContainerannotation - the annotation for the Sequence.CompositeSequencesequence - the String containing the Sequence.CompositeSequencedelim - the given delimiter
Sequence.CompositeSequence 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.CompositeSequence containing the
reverse current Sequence.CompositeSequence.
Sequence.CompositeSequence
OperationNotSupportedException - if the current Sequence.CompositeSequence is based on an
AlphabetContainer that is not simplereverse(int, int)
public Sequence reverse(int start,
int end)
throws OperationNotSupportedException
Sequence.CompositeSequence containing a part
of the reverse current Sequence.CompositeSequence.
start - the start position (inclusive) in the original
Sequence.CompositeSequenceend - the end position (exclusive) in the original Sequence.CompositeSequence
Sequence.CompositeSequence of the part
OperationNotSupportedException - if the current Sequence.CompositeSequence is based on an
AlphabetContainer that is not simple
public Sequence complement()
throws OperationNotSupportedException
Sequence.CompositeSequence containing the
complementary current Sequence.CompositeSequence.
AlphabetContainer on
DNAAlphabet returns "ATTAT".
Sequence.CompositeSequence
OperationNotSupportedException - if the current Sequence.CompositeSequence is not based on a
ComplementableDiscreteAlphabetComplementableDiscreteAlphabet,
complement(int, int)
public Sequence complement(int start,
int end)
throws OperationNotSupportedException
Sequence.CompositeSequence containing a part
of the complementary current Sequence.CompositeSequence.
AlphabetContainer on
DNAAlphabet returns "ATTAT".
start - the start position (inclusive) in the original
Sequence.CompositeSequenceend - the end position (exclusive) in the original Sequence.CompositeSequence
Sequence.CompositeSequence of the part
OperationNotSupportedException - if the current Sequence.CompositeSequence is not based on a
ComplementableDiscreteAlphabetComplementableDiscreteAlphabet
public Sequence reverseComplement()
throws OperationNotSupportedException
Sequence.CompositeSequence containing the
reverse complementary current Sequence.CompositeSequence. For more details see the
methods reverse() and complement().
Sequence.CompositeSequence
OperationNotSupportedException - if the current Sequence.CompositeSequence is not discrete and simple
(not based on a ComplementableDiscreteAlphabet)reverse(),
complement(),
reverseComplement(int, int),
ComplementableDiscreteAlphabet
public Sequence reverseComplement(int start,
int end)
throws OperationNotSupportedException
Sequence.CompositeSequence containing a
reverse part of the complementary current Sequence.CompositeSequence. For more
details see the methods reverse() and complement().
start - the start position (inclusive) in the original
Sequence.CompositeSequenceend - the end position (exclusive) in the original Sequence.CompositeSequence
Sequence.CompositeSequence of the part
OperationNotSupportedException - if the current Sequence.CompositeSequence is not discrete and simple
((not based on a ComplementableDiscreteAlphabet)reverse(),
complement(),
ComplementableDiscreteAlphabetpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||