de.jstacs.data
Class Sequence.SubSequence
java.lang.Object
de.jstacs.data.Sequence
de.jstacs.data.sequences.RecursiveSequence
de.jstacs.data.Sequence.SubSequence
- All Implemented Interfaces:
- Comparable<Sequence>
- Enclosing class:
- Sequence
protected static class Sequence.SubSequence
- extends RecursiveSequence
This class handles subsequences. Subsequences are often used to extract the sequence of a sliding window on a
long sequence. The class is implemented in such a way, that it avoids chains of SubSequences.
- Author:
- Jens Keilwagen
Constructor Summary |
Sequence.SubSequence(AlphabetContainer abc,
Sequence seq,
int start,
int length)
This constructor should be used if one wants to create a sample of subsequences of defined length. |
Sequence.SubSequence(Sequence seq,
int start,
int length)
This is an very efficient way to create a subsequence of defined length for sequences with a simple
AlphabetContainer. |
Methods inherited from class de.jstacs.data.Sequence |
annotate, compareTo, complement, complement, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, reverse, reverse, reverseComplement, toDiscrete, toString, toString, toString, toString |
Sequence.SubSequence
public Sequence.SubSequence(AlphabetContainer abc,
Sequence seq,
int start,
int length)
- This constructor should be used if one wants to create a sample of subsequences of defined length. With this
constructor you are enabled to create a Sample where every sequence has the same AlphabetContainer-instance.
Internally it is checked that the AlphabetContainer matches with the subsequence.
- Parameters:
abc
- the new AlphabetContainerseq
- the original sequencestart
- the index of the start positionlength
- the length of the new sequence
Sequence.SubSequence
public Sequence.SubSequence(Sequence seq,
int start,
int length)
- This is an very efficient way to create a subsequence of defined length for sequences with a simple
AlphabetContainer.
- Parameters:
seq
- the original sequencestart
- the index of the start positionlength
- the length of the new sequence
reverseComplement
public Sequence reverseComplement(int start,
int end)
throws OperationNotSupportedException
- Description copied from class:
Sequence
- This method returns a new sequence instance containing a part of the complementary current sequence. For more details
see the methods
reverse()
and complement()
.
- Overrides:
reverseComplement
in class Sequence
- Parameters:
start
- the start position (inclusive) in the original sequenceend
- the end position (exclusive) in the original sequence
- Returns:
- the reverse complementary sequence
- Throws:
OperationNotSupportedException
- if the current sequence is not discrete and simple- See Also:
Sequence.reverse()
,
Sequence.complement()
,
ComplementableDiscreteAlphabet
getIndex
protected int getIndex(int pos)
- Description copied from class:
RecursiveSequence
- Return the index in the internal sequence
- Specified by:
getIndex
in class RecursiveSequence
- Parameters:
pos
- the index in the external sequence
- Returns:
- the index in the internal sequence
getLength
public int getLength()
- Description copied from class:
Sequence
- Returns the length of the sequence
- Specified by:
getLength
in class Sequence
- Returns:
- the length
flatCloneWithoutAnnotation
protected Sequence flatCloneWithoutAnnotation()
- Description copied from class:
Sequence
- Works in analogy to
Object.clone()
, but does not clone the annotation. This method is used in Sequence.annotate(boolean, SequenceAnnotation...)
.
- Specified by:
flatCloneWithoutAnnotation
in class Sequence
- Returns:
- the cloned
Sequence.CompositeSequence
without annotation