C
- each element of the matrix corresponds to a pair of Compound
s of type Cpublic class SimpleSubstitutionMatrix<C extends Compound> extends java.lang.Object implements SubstitutionMatrix<C>
Compound
in a sequence for another.Constructor and Description |
---|
SimpleSubstitutionMatrix()
Creates a substitution matrix using the defaults (BLOSUM 62).
|
SimpleSubstitutionMatrix(CompoundSet<C> compoundSet,
java.io.File fileInput)
Creates a substitution matrix by reading in a file.
|
SimpleSubstitutionMatrix(CompoundSet<C> compoundSet,
java.io.Reader input,
java.lang.String name)
Creates a substitution matrix by parsing some input.
|
SimpleSubstitutionMatrix(CompoundSet<C> compoundSet,
short match,
short replace)
Creates an identity substitution matrix from match and replace values.
|
SimpleSubstitutionMatrix(CompoundSet<C> compoundSet,
java.lang.String matrixInput,
java.lang.String name)
Creates a substitution matrix by parsing a String.
|
Modifier and Type | Method and Description |
---|---|
CompoundSet<C> |
getCompoundSet()
Returns the
CompoundSet on which the matrix is defined. |
java.lang.String |
getDescription()
Returns the description of this matrix.
|
short[][] |
getMatrix()
Returns entire matrix.
|
java.lang.String |
getMatrixAsString()
Returns this matrix as a formatted String with
Compound labels along the axes. |
short |
getMaxValue()
Returns the maximum value in this matrix.
|
short |
getMinValue()
Returns the minimum value in this matrix.
|
java.lang.String |
getName()
Returns the name (short description) of this matrix.
|
short |
getValue(C from,
C to)
Returns value in matrix for conversion from first
Compound to the second. |
SubstitutionMatrix<C> |
normalizeMatrix(short scale)
Rescales the matrix so that to
SubstitutionMatrix.getMaxValue() - SubstitutionMatrix.getMinValue() = scale. |
void |
setDescription(java.lang.String description)
Sets the description of this matrix.
|
void |
setName(java.lang.String name)
Sets the name (short description) of this matrix.
|
java.lang.String |
toString()
Returns in a format similar to the standard NCBI files.
|
public SimpleSubstitutionMatrix()
java.lang.ClassCastException
- if type parameter C is not AminoAcidCompound
public SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, java.io.File fileInput) throws java.io.FileNotFoundException
compoundSet
- the CompoundSet
on which the matrix is definedfileInput
- file parsed for a substitution matrixjava.io.FileNotFoundException
- if fileInput parameter cannot be readpublic SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, java.io.Reader input, java.lang.String name)
compoundSet
- the CompoundSet
on which the matrix is definedinput
- input parsed for a substitution matrixname
- the name (short description) of this matrixpublic SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, java.lang.String matrixInput, java.lang.String name)
compoundSet
- the CompoundSet
on which the matrix is definedmatrixInput
- String parsed for a substitution matrixname
- the name (short description) of this matrixpublic SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, short match, short replace)
compoundSet
- the CompoundSet
on which the matrix is definedmatch
- matrix value used for equivalent Compound
sreplace
- matrix value used for differing Compound
spublic CompoundSet<C> getCompoundSet()
SubstitutionMatrix
CompoundSet
on which the matrix is defined.getCompoundSet
in interface SubstitutionMatrix<C extends Compound>
CompoundSet
on which the matrix is definedpublic java.lang.String getDescription()
SubstitutionMatrix
getDescription
in interface SubstitutionMatrix<C extends Compound>
public short[][] getMatrix()
SubstitutionMatrix
getMatrix
in interface SubstitutionMatrix<C extends Compound>
public java.lang.String getMatrixAsString()
SubstitutionMatrix
Compound
labels along the axes.getMatrixAsString
in interface SubstitutionMatrix<C extends Compound>
public short getMaxValue()
SubstitutionMatrix
getMaxValue
in interface SubstitutionMatrix<C extends Compound>
public short getMinValue()
SubstitutionMatrix
getMinValue
in interface SubstitutionMatrix<C extends Compound>
public java.lang.String getName()
SubstitutionMatrix
getName
in interface SubstitutionMatrix<C extends Compound>
public short getValue(C from, C to)
SubstitutionMatrix
Compound
to the second. If an argument does not
belong to the CompoundSet
, this could either throw an IllegalArgumentException
or it could
return SubstitutionMatrix.getMinValue()
.public SubstitutionMatrix<C> normalizeMatrix(short scale)
SubstitutionMatrix
SubstitutionMatrix.getMaxValue()
- SubstitutionMatrix.getMinValue()
= scale.normalizeMatrix
in interface SubstitutionMatrix<C extends Compound>
scale
- new normalization scale of this matrixpublic void setDescription(java.lang.String description)
SubstitutionMatrix
setDescription
in interface SubstitutionMatrix<C extends Compound>
description
- new descriptionpublic void setName(java.lang.String name)
SubstitutionMatrix
setName
in interface SubstitutionMatrix<C extends Compound>
name
- new namepublic java.lang.String toString()
toString
in class java.lang.Object