de.jstacs.data.sequences
Class ArbitrarySequence

java.lang.Object
  extended by de.jstacs.data.Sequence
      extended by de.jstacs.data.sequences.ArbitrarySequence
All Implemented Interfaces:
Comparable<Sequence>

public class ArbitrarySequence
extends Sequence

This class is for any continuous or hybrid sequence.

Author:
Jens Keilwagen

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.data.Sequence
Sequence.CompositeSequence, Sequence.SubSequence
 
Field Summary
 
Fields inherited from class de.jstacs.data.Sequence
alphabetCon, annotation, rc
 
Constructor Summary
ArbitrarySequence(AlphabetContainer alphabetContainer, double[] content)
          Creates a new ArbitrarySequence from an array of double-encoded alphabet symbols.
ArbitrarySequence(AlphabetContainer alphabetContainer, SequenceAnnotation[] annotation, String sequence, String delim)
          Creates a new ArbitrarySequence from a String representation using the delimiter delim.
ArbitrarySequence(AlphabetContainer alphabetContainer, SequenceAnnotation[] annotation, SymbolExtractor extractor)
          Creates a new ArbitrarySequence from a SymbolExtractor.
ArbitrarySequence(AlphabetContainer alphabetContainer, String sequence)
          Creates a new ArbitrarySequence from a String representation using the default delimiter.
 
Method Summary
 double continuousVal(int pos)
          Returns the continuous value at position pos of the Sequence.CompositeSequence.
 int discreteVal(int pos)
          Returns the discrete value at position pos of the Sequence.CompositeSequence.
protected  Sequence flatCloneWithoutAnnotation()
          Works in analogy to Object.clone(), but does not clone the annotation.
 int getLength()
          Returns the length of the Sequence.CompositeSequence.
 
Methods inherited from class de.jstacs.data.Sequence
annotate, compareTo, complement, complement, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getHammingDistance, getNumberOfSequenceAnnotationsByType, getSequenceAnnotationByType, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, 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

ArbitrarySequence

public ArbitrarySequence(AlphabetContainer alphabetContainer,
                         double[] content)
                  throws WrongAlphabetException,
                         WrongSequenceTypeException
Creates a new ArbitrarySequence from an array of double-encoded alphabet symbols. This constructor is designed for the method AbstractModel.emitSample(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 doubles
See Also:
AbstractModel.emitSample(int, int...), Sequence.Sequence(AlphabetContainer, SequenceAnnotation[])

ArbitrarySequence

public ArbitrarySequence(AlphabetContainer alphabetContainer,
                         String sequence)
                  throws WrongAlphabetException,
                         WrongSequenceTypeException
Creates a new ArbitrarySequence 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 doubles
See Also:
ArbitrarySequence(AlphabetContainer, SequenceAnnotation[], SymbolExtractor)

ArbitrarySequence

public ArbitrarySequence(AlphabetContainer alphabetContainer,
                         SequenceAnnotation[] annotation,
                         String sequence,
                         String delim)
                  throws WrongAlphabetException,
                         WrongSequenceTypeException,
                         IllegalArgumentException
Creates a new ArbitrarySequence 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 doubles
IllegalArgumentException - if the delimiter is empty and the alphabet container is not discrete
See Also:
ArbitrarySequence(AlphabetContainer, SequenceAnnotation[], SymbolExtractor)

ArbitrarySequence

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

Parameters:
alphabetContainer - the alphabet container 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 doubles
See Also:
Sequence.Sequence(AlphabetContainer, SequenceAnnotation[])
Method Detail

continuousVal

public double continuousVal(int pos)
Description copied from class: Sequence
Returns the continuous value at position pos of the Sequence.CompositeSequence.

Specified by:
continuousVal in class Sequence
Parameters:
pos - the position of the Sequence.CompositeSequence
Returns:
the continuous value at position pos of the Sequence.CompositeSequence

discreteVal

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

Specified by:
discreteVal in class Sequence
Parameters:
pos - the position of the Sequence.CompositeSequence
Returns:
the discrete value at position pos of the Sequence.CompositeSequence

getLength

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

Specified by:
getLength in class Sequence
Returns:
the length of the Sequence.CompositeSequence

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