de.jstacs.data.sequences
Class MappedDiscreteSequence

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

public class MappedDiscreteSequence
extends SimpleDiscreteSequence

This class allows to map a discrete Sequence to an new Sequence using some DiscreteAlphabetMappings.

Author:
Jens Keilwagen

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
protected  SimpleDiscreteSequence original
          The original Sequence.
protected  AlphabetContainer originalAlphabetContainer
          The original AlphabetContainer.
protected  DiscreteAlphabetMapping[] transformation
          The DiscreteAlphabetMappings used for mapping the original Sequence.
 
Fields inherited from class de.jstacs.data.sequences.Sequence
alphabetCon, annotation, rc
 
Constructor Summary
protected MappedDiscreteSequence(AlphabetContainer originalAlphabetContainer, SequenceAnnotation[] seqAn, DiscreteAlphabetMapping... transformation)
          This method allows to create an empty MappedDiscreteSequence.
  MappedDiscreteSequence(SimpleDiscreteSequence original, DiscreteAlphabetMapping... transformation)
          This method allows to create a MappedDiscreteSequence from a given Sequence and some given DiscreteAlphabetMappings.
 
Method Summary
 int discreteVal(int pos)
          Returns the discrete value at position pos of the Sequence.
 void fillContainer(int[] container, int pos)
          The method fills the content of a specific position in to the container.
protected  MappedDiscreteSequence flatCloneWithoutAnnotation()
          Works in analogy to Object.clone(), but does not clone the annotation.
 int[] getEmptyContainer()
          The method returns a container that can be used for accessing the symbols for each position.
 int getLength()
          Returns the length of the Sequence.
 double getLogNumberOfPossibleOriginalSequences()
          This method returns the logarithm of the number of original Sequences that yield the same mapped Sequence.
 double getLogNumberOfPossibleOriginalSequences(int start, int end)
          This method returns the logarithm of the number of original Sequences that yield the same mapped Sequence.
static AlphabetContainer getNewAlphabetContainer(AlphabetContainer original, DiscreteAlphabetMapping... transformation)
          This method allows to create a new AlphabetContainer given an old AlphabetContainer and some DiscreteAlphabetMappings.
 
Methods inherited from class de.jstacs.data.sequences.SimpleDiscreteSequence
addToRepresentation, compareTo, continuousVal, 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
 

Field Detail

original

protected SimpleDiscreteSequence original
The original Sequence.


originalAlphabetContainer

protected AlphabetContainer originalAlphabetContainer
The original AlphabetContainer.


transformation

protected DiscreteAlphabetMapping[] transformation
The DiscreteAlphabetMappings used for mapping the original Sequence.

Constructor Detail

MappedDiscreteSequence

protected MappedDiscreteSequence(AlphabetContainer originalAlphabetContainer,
                                 SequenceAnnotation[] seqAn,
                                 DiscreteAlphabetMapping... transformation)
                          throws WrongAlphabetException
This method allows to create an empty MappedDiscreteSequence. That is a MappedDiscreteSequence that contains no original Sequence.

Parameters:
originalAlphabetContainer - the original AlphabetContainer
seqAn - the SequenceAnnotations for the MappedDiscreteSequence
transformation - the DiscreteAlphabetMapping defining the mapping
Throws:
WrongAlphabetException - if the mapped AlphabetContainer is not discrete (should never happen)

MappedDiscreteSequence

public MappedDiscreteSequence(SimpleDiscreteSequence original,
                              DiscreteAlphabetMapping... transformation)
                       throws WrongAlphabetException
This method allows to create a MappedDiscreteSequence from a given Sequence and some given DiscreteAlphabetMappings.

Parameters:
original - the original Sequence
transformation - the DiscreteAlphabetMapping defining the mapping
Throws:
WrongAlphabetException - if the mapped AlphabetContainer is not discrete (should never happen)
Method Detail

getNewAlphabetContainer

public static final AlphabetContainer getNewAlphabetContainer(AlphabetContainer original,
                                                              DiscreteAlphabetMapping... transformation)
This method allows to create a new AlphabetContainer given an old AlphabetContainer and some DiscreteAlphabetMappings.

Parameters:
original - the original AlphabetContainer
transformation - the DiscreteAlphabetMappings defining the mapping
Returns:
a new AlphabetContainer

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

flatCloneWithoutAnnotation

protected MappedDiscreteSequence 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

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

getLogNumberOfPossibleOriginalSequences

public double getLogNumberOfPossibleOriginalSequences()
This method returns the logarithm of the number of original Sequences that yield the same mapped Sequence.

Returns:
the logarithm of the number of original Sequences that yield the same mapped Sequence

getLogNumberOfPossibleOriginalSequences

public double getLogNumberOfPossibleOriginalSequences(int start,
                                                      int end)
This method returns the logarithm of the number of original Sequences that yield the same mapped Sequence.

Parameters:
start - the start position (inclusive)
end - the end position (exclusive)
Returns:
the logarithm of the number of original Sequences that yield the same mapped Sequence

getEmptyContainer

public final int[] getEmptyContainer()
Description copied from class: Sequence
The method returns a container that can be used for accessing the symbols for each position. This is especially of interest for multidimensional sequences.

Overrides:
getEmptyContainer in class SimpleDiscreteSequence
Returns:
a container that can be used for accessing the symbols for each position
See Also:
Sequence.fillContainer(Object, int), Sequence.isMultiDimensional()

fillContainer

public final void fillContainer(int[] container,
                                int pos)
Description copied from class: Sequence
The method fills the content of a specific position in to the container. This is especially of interest for multidimensional sequences.

Overrides:
fillContainer in class SimpleDiscreteSequence
Parameters:
container - the container which is used for filling the content.
pos - the position
See Also:
Sequence.getEmptyContainer(), Sequence.isMultiDimensional()