|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.data.AlphabetContainer
public class AlphabetContainer
The container for Alphabets used in a Sequence,
DataSet, AbstractTrainableStatisticalModel or ... . The container
enables the user to have a different Alphabet at each position or at
least not the same Alphabet at all positions. This is impossible if
you use only instances of Alphabet. The container maps the given
Alphabet objects to the positions.
AlphabetContainer is immutable.
Alphabet| Nested Class Summary | |
|---|---|
static class |
AlphabetContainer.AbstractAlphabetContainerParameterSet<T extends AlphabetContainer>
This class is the super class of any InstanceParameterSet for AlphabetContainer. |
static class |
AlphabetContainer.AlphabetContainerType
This enum defines types of AlphabetContainers. |
| Field Summary | |
|---|---|
protected AlphabetContainer.AbstractAlphabetContainerParameterSet<?> |
parameters
The parameters for this instance. |
| Constructor Summary | |
|---|---|
AlphabetContainer(Alphabet... abc)
Creates a new AlphabetContainer with different Alphabets
for each position. |
|
AlphabetContainer(Alphabet abc)
Creates a new simple AlphabetContainer. |
|
AlphabetContainer(Alphabet[] abc,
int[] assignment)
Creates a new AlphabetContainer that uses different
Alphabets. |
|
AlphabetContainer(AlphabetContainer[] cons,
int[] lengths)
Creates an new sparse AlphabetContainer based on given
AlphabetContainers. |
|
AlphabetContainer(AlphabetContainerParameterSet parameters)
Creates a new AlphabetContainer from an
AlphabetContainerParameterSet that contains all necessary
parameters. |
|
AlphabetContainer(StringBuffer xml)
The standard constructor for the interface Storable. |
|
| Method Summary | |
|---|---|
boolean |
checkConsistency(AlphabetContainer abc)
Checks if this AlphabetContainer is consistent consistent with
another AlphabetContainer. |
int |
compareTo(AlphabetContainer abc)
|
Alphabet |
getAlphabetAt(int pos)
Returns the underlying Alphabet of position pos. |
int |
getAlphabetIndexForPosition(int pos)
This method returns the index of the Alphabet that is used for the given position. |
double |
getAlphabetLengthAt(int pos)
Returns the length of the underlying Alphabet of position
pos. |
double |
getCode(int pos,
String sym)
Returns the encoded symbol for sym of the Alphabet
of position pos of this AlphabetContainer. |
AlphabetContainer |
getCompositeContainer(int[] start,
int[] length)
Returns an AlphabetContainer of Alphabets e.g. for
composite motifs/sequences. |
AlphabetContainer.AbstractAlphabetContainerParameterSet<? extends AlphabetContainer> |
getCurrentParameterSet()
Returns the InstanceParameterSet that has been used to
instantiate the current instance of the implementing class. |
String |
getDelim()
Returns the delimiter that should be used (for writing e.g. a sequence). |
int[] |
getIndexForAlphabets()
This method returns an object that is used for assigning the positions of the Sequences to specific Alphabets. |
double |
getMaximalAlphabetLength()
Returns the maximal Alphabet length of this
AlphabetContainer. |
double |
getMin(int pos)
Returns the minimal value of the underlying Alphabet of position
pos. |
double |
getMinimalAlphabetLength()
Returns the minimal Alphabet length of this
AlphabetContainer. |
int |
getNumberOfAlphabets()
This method returns the number of Alphabets used in the current AlphabetContainer. |
int |
getPossibleLength()
Returns the possible length for Sequences using this
AlphabetContainer. |
static AlphabetContainer |
getSimplifiedAlphabetContainer(Alphabet[] abc,
int[] assignment)
This method creates a new AlphabetContainer that uses as less as
possible Alphabets to describe the container. |
AlphabetContainer |
getSubContainer(int start,
int length)
Returns a sub-container with the Alphabets for the positions
starting at start and with length length. |
String |
getSymbol(int pos,
double val)
Returns a String representation of the encoded symbol
val of the Alphabet of position pos of
this AlphabetContainer. |
AlphabetContainer.AlphabetContainerType |
getType()
Returns the type of this AlphabetContainer. |
boolean |
ignoresCase()
Indicates if all used Alphabets ignore the case. |
static AlphabetContainer |
insertAlphabet(AlphabetContainer aC,
Alphabet a,
boolean[] useNewAlphabet)
This method may be used to construct a new AlphabetContainer by
incorporating additional Alphabets into an existing
AlphabetContainer. |
boolean |
isDiscrete()
Indicates if all positions use discrete Alphabets. |
boolean |
isDiscreteAt(int pos)
Indicates if position pos is a discrete random variable,
i.e. if the Alphabet of position pos is discrete. |
boolean |
isEncodedSymbol(int pos,
double continuous)
Indicates if continuous is a symbol of the Alphabet
used at position pos of the AlphabetContainer. |
boolean |
isReverseComplementable()
This method helps to determine if the AlphabetContainer also
computes the reverse complement of a Sequence. |
boolean |
isSimple()
Indicates whether all random variables are defined over the same range, i.e. if the AlphabetContainer is simple and all positions use the
same (fixed) Alphabet. |
int |
toDiscrete(int pos,
double val)
Returns the discrete value for val of the Alphabet
of position pos in the AlphabetContainer. |
String |
toString()
|
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected AlphabetContainer.AbstractAlphabetContainerParameterSet<?> parameters
| Constructor Detail |
|---|
public AlphabetContainer(Alphabet abc)
AlphabetContainer. All positions use the
same Alphabet and therefore sequences of arbitrary length can be
handled.
abc - the Alphabet for all positionspublic AlphabetContainer(Alphabet... abc)
AlphabetContainer with different Alphabets
for each position. The assignment of the Alphabets to the
positions is given by the order in the Alphabet array. This
constructor should only be used if all Alphabets are pairwise
different.
abc - the different Alphabets for each positionAlphabetContainer(Alphabet[], int[])
public AlphabetContainer(AlphabetContainer[] cons,
int[] lengths)
throws IllegalArgumentException
AlphabetContainer based on given
AlphabetContainers.
cons - the given AlphabetContainerslengths - the corresponding lengths of each AlphabetContainer
that is used
IllegalArgumentException - if the given length for an AlphabetContainer is not
possible
public AlphabetContainer(Alphabet[] abc,
int[] assignment)
throws IllegalArgumentException
AlphabetContainer that uses different
Alphabets. The Alphabets can be used more than once. The
assignment for the Alphabets to the positions is given by the
array assignment.
abc - the Alphabetsassignment - the assignment array
IllegalArgumentException - if the assignment of the Alphabets to the positions
is not correct
public AlphabetContainer(AlphabetContainerParameterSet parameters)
throws IllegalArgumentException,
DoubleSymbolException,
ParameterSetParser.NotInstantiableException
AlphabetContainer from an
AlphabetContainerParameterSet that contains all necessary
parameters.
parameters - the parameter set
IllegalArgumentException - if something is wrong with the parameters in the
AlphabetContainerParameterSet
DoubleSymbolException - if the definitions within parameters contains a
symbol twice
ParameterSetParser.NotInstantiableException - if an instance could not be created
public AlphabetContainer(StringBuffer xml)
throws NonParsableException
Storable.
Creates a new AlphabetContainer out of its XML representation.
xml - the XML representation as StringBuffer
NonParsableException - if the AlphabetContainer could not be reconstructed
out of the XML representation (the StringBuffer could
not be parsed)Storable| Method Detail |
|---|
public static AlphabetContainer getSimplifiedAlphabetContainer(Alphabet[] abc,
int[] assignment)
AlphabetContainer that uses as less as
possible Alphabets to describe the container. So, if possible,
Alphabets will be reused.
abc - the Alphabetsassignment - the assignment of the Alphabets to the positions
AlphabetContainer that uses as less as possible
AlphabetsAlphabetContainer(Alphabet[], int[])
public static AlphabetContainer insertAlphabet(AlphabetContainer aC,
Alphabet a,
boolean[] useNewAlphabet)
throws IllegalArgumentException
AlphabetContainer by
incorporating additional Alphabets into an existing
AlphabetContainer.
aC - the AlphabetContainer used as template for the
returned AlphabetContainera - the Alphabet that should be inserteduseNewAlphabet - an array to define, which Alphabets are used for which
positions Sequences the returned AlphabetContainer is
capable to handle
false forces to use the
Alphabet given by the given AlphabetContainer
true forces to use the
given Alphabet
Alphabet must be
understood as defining new additional positions for which the
given Alphabet should be used. For example: let the
given AlphabetContainer contain three Alphabet
s A0,A1,A2 (Ai for position
i) and therefore have a possible length of three.
Calling this method using this AlphabetContainer, an
additional Alphabet A3 and an assignment
array of [false, true,
true, false, false]
returns a new AlphabetContainer having a possible
length of five and using the following alphabets for those
positions: A0,A3,A3,A1,A2. If the given
AlphabetContainer has a possible length not equal
zero, then the assignment array must contain as many
false-values as the length of the given
AlphabetContainer.
AlphabetContainer as described above
IllegalArgumentException - if useNewAlphabet is null or has
length 0AlphabetContainer(Alphabet[], int[])public boolean checkConsistency(AlphabetContainer abc)
AlphabetContainer is consistent consistent with
another AlphabetContainer.
abc - the second AlphabetContainer
true if the AlphabetContainers are
consistent, false otherwiseComparable.compareTo(Object)public int compareTo(AlphabetContainer abc)
compareTo in interface Comparable<AlphabetContainer>public Alphabet getAlphabetAt(int pos)
Alphabet of position pos.
Please note that the Alphabet is returned as reference, so take
care of what you are doing with it!
pos - the position
Alphabet of the given positionpublic double getAlphabetLengthAt(int pos)
Alphabet of position
pos.
pos - the position
Alphabet of position
pos
public double getCode(int pos,
String sym)
throws WrongAlphabetException
sym of the Alphabet
of position pos of this AlphabetContainer.
pos - the position of the Alphabetsym - the symbol that should be returned encoded
WrongAlphabetException - if the symbol is not defined in the Alphabet of the
given positiongetAlphabetAt(int)
public AlphabetContainer getCompositeContainer(int[] start,
int[] length)
AlphabetContainer of Alphabets e.g. for
composite motifs/sequences.
start - the array of start indiceslength - the array of lengths
AlphabetContainergetSubContainer(int, int)
public AlphabetContainer.AbstractAlphabetContainerParameterSet<? extends AlphabetContainer> getCurrentParameterSet()
throws Exception
InstantiableFromParameterSetInstanceParameterSet that has been used to
instantiate the current instance of the implementing class. If the
current instance was not created using an InstanceParameterSet,
an equivalent InstanceParameterSet should be returned, so that an
instance created using this InstanceParameterSet would be in
principle equal to the current instance.
getCurrentParameterSet in interface InstantiableFromParameterSetInstanceParameterSet
Exception - if the InstanceParameterSet could not be returnedpublic String getDelim()
public double getMaximalAlphabetLength()
Alphabet length of this
AlphabetContainer.
Alphabet lengthpublic double getMin(int pos)
Alphabet of position
pos.
pos - the given position
Alphabet of the given positionAlphabet.getMin()public double getMinimalAlphabetLength()
Alphabet length of this
AlphabetContainer.
Alphabet length of this
AlphabetContainerpublic int getPossibleLength()
Sequences using this
AlphabetContainer. If 0 (zero) is returned, all lengths are
possible.
AlphabetContainer
public AlphabetContainer getSubContainer(int start,
int length)
Alphabets for the positions
starting at start and with length length. The
method can be used for subsequences, ... .
start - the index of the start positionlength - the length
AlphabetsgetCompositeContainer(int[], int[])
public String getSymbol(int pos,
double val)
String representation of the encoded symbol
val of the Alphabet of position pos of
this AlphabetContainer.
pos - the position of the Alphabetval - the value of the encoded symbol
String representation for the encoded symbol
val of the Alphabet of position
pospublic final boolean ignoresCase()
Alphabets ignore the case.
true if all used alphabets ignore the case,
false otherwisepublic final boolean isDiscrete()
Alphabets.
true if all positions use discrete Alphabets,
otherwise falsepublic boolean isDiscreteAt(int pos)
pos is a discrete random variable,
i.e. if the Alphabet of position pos is discrete.
pos - the position
true if position pos is a discrete
random variable, false otherwise
public boolean isEncodedSymbol(int pos,
double continuous)
continuous is a symbol of the Alphabet
used at position pos of the AlphabetContainer.
pos - the positioncontinuous - the continuous value
true if continuous is a symbol of the
Alphabet used in position pos,
false otherwisepublic final boolean isSimple()
AlphabetContainer is simple and all positions use the
same (fixed) Alphabet.
AlphabetContainer is simplepublic final boolean isReverseComplementable()
AlphabetContainer also
computes the reverse complement of a Sequence.
true if the AlphabetContainer also computes
the reverse complement of a Sequence, false
otherwise
public int toDiscrete(int pos,
double val)
val of the Alphabet
of position pos in the AlphabetContainer.
pos - the positionval - the value
val of the Alphabet
of position posisDiscreteAt(int)public String toString()
toString in class Objectpublic StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.
toXML in interface Storablepublic final AlphabetContainer.AlphabetContainerType getType()
AlphabetContainer.
AlphabetContainer.AlphabetContainerTypepublic int getAlphabetIndexForPosition(int pos)
Alphabet that is used for the given position.
pos - the position
Alphabetpublic int getNumberOfAlphabets()
Alphabets used in the current AlphabetContainer.
Alphabetspublic int[] getIndexForAlphabets()
Sequences to specific Alphabets.
null or an int array
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||