|
||||||||||
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. |
protected Sequence |
rc
The pointer to the reverse complement |
Constructor Summary | |
---|---|
protected |
Sequence(AlphabetContainer container,
SequenceAnnotation[] annotation)
This constructor creates an instance with the AlphabetContainer and the annotation, but without the content. |
Method Summary | |
---|---|
Sequence |
annotate(boolean add,
SequenceAnnotation... annotation)
This method allows to append annotation to a sequence. |
int |
compareTo(Sequence s)
|
Sequence |
complement()
This method returns a new instance of sequence containing the complementary current sequence. |
Sequence |
complement(int start,
int end)
This method returns a new instance of sequence containing a part of the complementary current sequence. |
abstract double |
continuousVal(int pos)
Returns the continuous value of position pos . |
static Sequence |
create(AlphabetContainer con,
SequenceAnnotation[] annotation,
String sequence,
String delim)
Creates a sequence from a string based on the given AlphabetContainer using the given delimiter. |
static Sequence |
create(AlphabetContainer con,
String sequence)
Creates a sequence 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 from a string based on the given AlphabetContainer using the given delimiter. |
abstract int |
discreteVal(int pos)
Returns the discrete value of position pos . |
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 used in this sequence. |
SequenceAnnotation[] |
getAnnotation()
Returns the annotation of the sequence. |
Sequence |
getCompositeSequence(AlphabetContainer abc,
int[] starts,
int[] lengths)
This constructor should be used if one wants to create a sample of composite sequences. |
Sequence |
getCompositeSequence(int[] starts,
int[] lengths)
This is an very efficient way to create a composite sequence for sequences with a simple AlphabetContainer. |
abstract int |
getLength()
Returns the length of the sequence |
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 an very efficient way to create a subsequence/suffix for sequences with a simple AlphabetContainer. |
Sequence |
getSubSequence(int start,
int length)
This is an very efficient way to create a subsequence of defined length for sequences with a simple AlphabetContainer. |
int |
hashCode()
|
Sequence |
reverse()
This method returns a new instance of sequence containing the reverse current sequence. |
Sequence |
reverse(int start,
int end)
This method returns a new instance of sequence containing a part of the reverse current sequence. |
Sequence |
reverseComplement()
This method returns a new sequence instance containing the complementary current sequence. |
Sequence |
reverseComplement(int start,
int end)
This method returns a new sequence instance containing a part of the complementary current sequence. |
protected int |
toDiscrete(int pos,
double content)
This method converts a continuous value in a discrete one. |
String |
toString()
Returns a String representation of the sequence (normally the sequence in its original alphabet) |
String |
toString(int start)
Returns a string representation of the sequence (normally the sequence in its original alphabet) with default delimiter as separator. |
String |
toString(int start,
int end)
Returns a string representation of the sequence (normally the sequence in its original alphabet) with default delimiter as separator. |
String |
toString(String delim,
int start,
int end)
Returns a string representation of the sequence (normally the sequence in its original alphabet) 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
protected SequenceAnnotation[] annotation
Constructor Detail |
---|
protected Sequence(AlphabetContainer container, SequenceAnnotation[] annotation)
container
- the AlpahbetContainer of the sequenceannotation
- the annotation of the sequenceMethod Detail |
---|
public abstract double continuousVal(int pos)
pos
.
pos
- the position
pos
public abstract int discreteVal(int pos)
pos
.
pos
- the position
pos
public boolean equals(Object o)
equals
in class Object
public final AlphabetContainer getAlphabetContainer()
public final SequenceAnnotation[] getAnnotation()
public Sequence getCompositeSequence(AlphabetContainer abc, int[] starts, int[] lengths)
abc
- the new AlphabetContainerstarts
- the start positions of the junkslengths
- the length for each junk
public Sequence getCompositeSequence(int[] starts, int[] lengths)
starts
- the index of the start positionlengths
- the length of the new sequence
public final Sequence getSubSequence(AlphabetContainer abc, int start)
abc
- the new AlphabetContainerstart
- the index of the start position
public Sequence getSubSequence(AlphabetContainer abc, int start, int length)
abc
- the new AlphabetContainerstart
- the index of the start positionlength
- the length of the new sequence
public final Sequence getSubSequence(int start)
start
- the index of the start position
public Sequence getSubSequence(int start, int length)
start
- the index of the start positionlength
- the length of the new sequence
public Sequence annotate(boolean add, SequenceAnnotation... annotation)
add
- whether to add the new annotation to the existing or notannotation
- the new annotation
Sequence.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()
public String toString()
toString
in class Object
String
public String toString(int start)
start
- the start index (inclusive)
String
toString(String, int, int)
public String toString(int start, int end)
start
- the start index (inclusive)end
- the end index (exclusive)
String
toString(String, int, int)
public int compareTo(Sequence s)
compareTo
in interface Comparable<Sequence>
protected int toDiscrete(int pos, double content)
pos
- the positioncontent
- the value at this position
public String toString(String delim, int start, int end)
delim
as
separator.
delim
- the delimiter/separatorstart
- the start index (inclusive)end
- the end index (exclusive)
String
public static Sequence create(AlphabetContainer con, String sequence) throws WrongAlphabetException, IllegalArgumentException
con
- the AlphabetContainersequence
- the string containing the sequence
WrongAlphabetException
- if the sequence
is not defined over alphabetContainer
IllegalArgumentException
- if the delimiter is empty and the AlphabetContainer is not discretepublic static Sequence create(AlphabetContainer con, String sequence, String delim) throws WrongAlphabetException, IllegalArgumentException
con
- the AlphabetContainersequence
- the string containing the sequencedelim
- the delimiter
WrongAlphabetException
- if the sequence
is not defined over alphabetContainer
IllegalArgumentException
- if the delimiter is empty and the alphabetContainer is not discretepublic static Sequence create(AlphabetContainer con, SequenceAnnotation[] annotation, String sequence, String delim) throws WrongAlphabetException, IllegalArgumentException
con
- the AlphabetContainerannotation
- the annotation for the sequencesequence
- the string containing the sequencedelim
- the delimiter
WrongAlphabetException
- if the sequence
is not defined over alphabetContainer
IllegalArgumentException
- if the delimiter is empty and the alphabetContainer is not discretepublic final Sequence reverse() throws OperationNotSupportedException
OperationNotSupportedException
- if the current sequence is based on an AlphabetContainer that is not simple.public Sequence reverse(int start, int end) throws OperationNotSupportedException
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 Sequence complement() throws OperationNotSupportedException
AlphabetContainer
on
DNAAlphabet
returns "ATTAT".
OperationNotSupportedException
- if the current sequence is not based on a ComplementableDiscreteAlphabet
ComplementableDiscreteAlphabet
public Sequence complement(int start, int end) throws OperationNotSupportedException
AlphabetContainer
on
DNAAlphabet
returns "ATTAT".
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 Sequence reverseComplement() throws OperationNotSupportedException
reverse()
and complement()
.
OperationNotSupportedException
- if the current sequence is not discrete and simplereverse()
,
complement()
,
ComplementableDiscreteAlphabet
public Sequence reverseComplement(int start, int end) throws OperationNotSupportedException
reverse()
and complement()
.
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 simplereverse()
,
complement()
,
ComplementableDiscreteAlphabet
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |