Class ScaledSubstitutionMatrix
java.lang.Object
org.biojava.nbio.core.alignment.matrices.ScaledSubstitutionMatrix
- All Implemented Interfaces:
SubstitutionMatrix<AminoAcidCompound>
public class ScaledSubstitutionMatrix
extends Object
implements SubstitutionMatrix<AminoAcidCompound>
The biojava-alignment module represents substitution matrices with short
values. This is for performance reasons. Some substitution matrices, however,
are provided as float values with up to 2 decimal places.
In order to be able to use them in the alignment module these are scaled in
order to be able to represent as short values.
The method getScale()
provides access to the scaling factor.
- Author:
- Andreas Prlic
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetCols()
getColumn
(AminoAcidCompound column) static String
Returns theCompoundSet
on which the matrix is defined.Returns the description of this matrix.short[][]
Returns entire matrix.Returns this matrix as a formatted String withCompound
labels along the axes.short
getMax()
short
Returns the maximum value in this matrix.short
getMin()
short
Returns the minimum value in this matrix.getName()
Returns the name (short description) of this matrix.getRow
(AminoAcidCompound row) getRows()
int
getScale()
short
getValue
(AminoAcidCompound from, AminoAcidCompound to) Returns value in matrix for conversion from firstCompound
to the second.normalizeMatrix
(short scale) Rescales the matrix so that toSubstitutionMatrix.getMaxValue()
-SubstitutionMatrix.getMinValue()
= scale.void
setCols
(List<AminoAcidCompound> cols) void
setDescription
(String description) Sets the description of this matrix.void
setMatrix
(short[][] matrix) void
setMax
(short max) void
setMin
(short min) void
Sets the name (short description) of this matrix.void
setRows
(List<AminoAcidCompound> rows) void
setScale
(int scale) toString()
Returns in a format similar to the standard NCBI files.
-
Constructor Details
-
ScaledSubstitutionMatrix
public ScaledSubstitutionMatrix()
-
-
Method Details
-
getScale
public int getScale() -
setScale
public void setScale(int scale) -
getDescription
Description copied from interface:SubstitutionMatrix
Returns the description of this matrix.- Specified by:
getDescription
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Returns:
- description
-
setDescription
Description copied from interface:SubstitutionMatrix
Sets the description of this matrix.- Specified by:
setDescription
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Parameters:
description
- new description
-
getName
Description copied from interface:SubstitutionMatrix
Returns the name (short description) of this matrix.- Specified by:
getName
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Returns:
- name
-
setName
Description copied from interface:SubstitutionMatrix
Sets the name (short description) of this matrix.- Specified by:
setName
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Parameters:
name
- new name
-
getMatrix
public short[][] getMatrix()Description copied from interface:SubstitutionMatrix
Returns entire matrix.- Specified by:
getMatrix
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Returns:
- matrix
-
setMatrix
public void setMatrix(short[][] matrix) -
getMax
public short getMax() -
setMax
public void setMax(short max) -
getMin
public short getMin() -
setMin
public void setMin(short min) -
getRows
-
setRows
-
getCols
-
setCols
-
getComment
-
toString
Returns in a format similar to the standard NCBI files. -
getCompoundSet
Description copied from interface:SubstitutionMatrix
Returns theCompoundSet
on which the matrix is defined.- Specified by:
getCompoundSet
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Returns:
- the
CompoundSet
on which the matrix is defined
-
getMatrixAsString
Description copied from interface:SubstitutionMatrix
Returns this matrix as a formatted String withCompound
labels along the axes.- Specified by:
getMatrixAsString
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Returns:
- this matrix as a formatted String
-
getMaxValue
public short getMaxValue()Description copied from interface:SubstitutionMatrix
Returns the maximum value in this matrix.- Specified by:
getMaxValue
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Returns:
- the maximum value in this matrix
-
getMinValue
public short getMinValue()Description copied from interface:SubstitutionMatrix
Returns the minimum value in this matrix.- Specified by:
getMinValue
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Returns:
- the minimum value in this matrix
-
getValue
Description copied from interface:SubstitutionMatrix
Returns value in matrix for conversion from firstCompound
to the second. If an argument does not belong to theCompoundSet
, this could either throw anIllegalArgumentException
or it could returnSubstitutionMatrix.getMinValue()
.- Specified by:
getValue
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Parameters:
from
- originalCompound
to
- replacementCompound
- Returns:
- value in matrix for conversion from first
Compound
to the second
-
normalizeMatrix
Description copied from interface:SubstitutionMatrix
Rescales the matrix so that toSubstitutionMatrix.getMaxValue()
-SubstitutionMatrix.getMinValue()
= scale.- Specified by:
normalizeMatrix
in interfaceSubstitutionMatrix<AminoAcidCompound>
- Parameters:
scale
- new normalization scale of this matrix
-
getRow
- Specified by:
getRow
in interfaceSubstitutionMatrix<AminoAcidCompound>
-
getColumn
- Specified by:
getColumn
in interfaceSubstitutionMatrix<AminoAcidCompound>
-