de.jstacs.data.sequences
Class ShortSequence

java.lang.Object
  extended by de.jstacs.data.sequences.Sequence<int[]>
      extended by de.jstacs.data.sequences.SimpleDiscreteSequence
          extended by de.jstacs.data.sequences.ShortSequence
All Implemented Interfaces:
Comparable<Sequence<int[]>>

public class ShortSequence
extends SimpleDiscreteSequence

This class is for sequences with the alphabet symbols encoded as shortss and can therefore be used for discrete AlphabetContainers with alphabets that use many different symbols.

Author:
Jens Keilwagen, Jan Grau

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.data.sequences.Sequence
Sequence.CompositeSequence<T>, Sequence.RecursiveSequence<T>, Sequence.SubSequence<T>
 
Field Summary
 
Fields inherited from class de.jstacs.data.sequences.Sequence
alphabetCon, annotation, rc
 
Constructor Summary
ShortSequence(AlphabetContainer alphabetContainer, SequenceAnnotation[] annotation, String sequence, String delim)
          Creates a new ShortSequence from a String representation using the delimiter delim.
ShortSequence(AlphabetContainer alphabetContainer, SequenceAnnotation[] annotation, SymbolExtractor extractor)
          Creates a new ShortSequence from a SymbolExtractor.
ShortSequence(AlphabetContainer alphabetContainer, short[] content)
          Creates a new ShortSequence from an array of short- encoded alphabet symbols.
ShortSequence(AlphabetContainer alphabetContainer, String sequence)
          Creates a new ShortSequence from a String representation using the default delimiter.
 
Method Summary
 int discreteVal(int pos)
          Returns the discrete value at position pos of the Sequence.
protected  ShortSequence flatCloneWithoutAnnotation()
          Works in analogy to Object.clone(), but does not clone the annotation.
 int getLength()
          Returns the length of the Sequence.
 
Methods inherited from class de.jstacs.data.sequences.SimpleDiscreteSequence
addToRepresentation, compareTo, continuousVal, fillContainer, getEmptyContainer, getEmptyRepresentation, getStringRepresentation, hashCodeForPos, isMultiDimensional
 
Methods inherited from class de.jstacs.data.sequences.Sequence
annotate, compareTo, complement, complement, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getHammingDistance, getNumberOfSequenceAnnotationsByType, getSequenceAnnotationByType, getSequenceAnnotationByTypeAndIdentifier, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, matches, reverse, reverse, reverseComplement, reverseComplement, toDiscrete, toString, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShortSequence

public ShortSequence(AlphabetContainer alphabetContainer,
                     short[] content)
              throws WrongAlphabetException,
                     WrongSequenceTypeException
Creates a new ShortSequence from an array of short- encoded alphabet symbols. This constructor is designed for the method StatisticalModel.emitDataSet(int, int...).

Parameters:
alphabetContainer - the AlphabetContainer for the sequence
content - an array containing the encoded symbols
Throws:
WrongAlphabetException - if the sequence is not defined over alphabetContainer
WrongSequenceTypeException - if alphabetContainer contains alphabets that can not be encoded with shorts
See Also:
StatisticalModel.emitDataSet(int, int...), SimpleDiscreteSequence.SimpleDiscreteSequence(AlphabetContainer, SequenceAnnotation[])

ShortSequence

public ShortSequence(AlphabetContainer alphabetContainer,
                     String sequence)
              throws WrongAlphabetException,
                     WrongSequenceTypeException
Creates a new ShortSequence from a String representation using the default delimiter.

Parameters:
alphabetContainer - the AlphabetContainer for the sequence
sequence - a String representation of the sequence
Throws:
WrongAlphabetException - if the sequence is not defined over alphabetContainer
WrongSequenceTypeException - if alphabetContainer contains alphabets that can not be encoded with shorts
See Also:
ShortSequence(AlphabetContainer, SequenceAnnotation[], String, String)

ShortSequence

public ShortSequence(AlphabetContainer alphabetContainer,
                     SequenceAnnotation[] annotation,
                     String sequence,
                     String delim)
              throws WrongAlphabetException,
                     WrongSequenceTypeException
Creates a new ShortSequence from a String representation using the delimiter delim. Annotations for this sequence are considered by annotation.

Parameters:
alphabetContainer - the AlphabetContainer for the sequence
annotation - the annotation for this sequence
sequence - a String representation of the sequence
delim - the delimiter, a String that separates the symbols
Throws:
WrongAlphabetException - if the sequence is not defined over alphabetContainer
WrongSequenceTypeException - if alphabetContainer contains alphabets that can not be encoded with shorts
See Also:
ShortSequence(AlphabetContainer, SequenceAnnotation[], SymbolExtractor)

ShortSequence

public ShortSequence(AlphabetContainer alphabetContainer,
                     SequenceAnnotation[] annotation,
                     SymbolExtractor extractor)
              throws WrongAlphabetException,
                     WrongSequenceTypeException
Creates a new ShortSequence from a SymbolExtractor. Annotations for this sequence are considered by annotation.

Parameters:
alphabetContainer - the AlphabetContainer for the sequence
annotation - the annotation for this sequence
extractor - the SymbolExtractor
Throws:
WrongAlphabetException - if the sequence is not defined over alphabetContainer
WrongSequenceTypeException - if alphabetContainer contains alphabets that can not be encoded with shorts
See Also:
SimpleDiscreteSequence.SimpleDiscreteSequence(AlphabetContainer, SequenceAnnotation[])
Method Detail

discreteVal

public int discreteVal(int pos)
Description copied from class: Sequence
Returns the discrete value at position pos of the Sequence.

Specified by:
discreteVal in class Sequence<int[]>
Parameters:
pos - the position of the Sequence
Returns:
the discrete value at position pos of the Sequence

getLength

public int getLength()
Description copied from class: Sequence
Returns the length of the Sequence.

Specified by:
getLength in class Sequence<int[]>
Returns:
the length of the Sequence

flatCloneWithoutAnnotation

protected ShortSequence 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<int[]>
Returns:
the cloned Sequence without annotation