org.biojava3.alignment.aaindex
Class ScaledSubstitutionMatrix

java.lang.Object
  extended by org.biojava3.alignment.aaindex.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
ScaledSubstitutionMatrix()
           
 
Method Summary
 List<AminoAcidCompound> getCols()
           
static String getComment()
           
 CompoundSet<AminoAcidCompound> getCompoundSet()
          Returns the CompoundSet on which the matrix is defined.
 String getDescription()
          Returns the description of this matrix.
 short[][] getMatrix()
          Returns entire matrix.
 String getMatrixAsString()
          Returns this matrix as a formatted String with Compound labels along the axes.
 short getMax()
           
 short getMaxValue()
          Returns the maximum value in this matrix.
 short getMin()
           
 short getMinValue()
          Returns the minimum value in this matrix.
 String getName()
          Returns the name (short description) of this matrix.
 List<AminoAcidCompound> getRows()
           
 int getScale()
           
 short getValue(AminoAcidCompound from, AminoAcidCompound to)
          Returns value in matrix for conversion from first Compound to the second.
 SubstitutionMatrix<AminoAcidCompound> normalizeMatrix(short scale)
          Rescales the matrix so that to SubstitutionMatrix.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 setName(String name)
          Sets the name (short description) of this matrix.
 void setRows(List<AminoAcidCompound> rows)
           
 void setScale(int scale)
           
 String toString()
          Returns in a format similar to the standard NCBI files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScaledSubstitutionMatrix

public ScaledSubstitutionMatrix()
Method Detail

getScale

public int getScale()

setScale

public void setScale(int scale)

getDescription

public String getDescription()
Description copied from interface: SubstitutionMatrix
Returns the description of this matrix.

Specified by:
getDescription in interface SubstitutionMatrix<AminoAcidCompound>
Returns:
description

setDescription

public void setDescription(String description)
Description copied from interface: SubstitutionMatrix
Sets the description of this matrix.

Specified by:
setDescription in interface SubstitutionMatrix<AminoAcidCompound>
Parameters:
description - new description

getName

public String getName()
Description copied from interface: SubstitutionMatrix
Returns the name (short description) of this matrix.

Specified by:
getName in interface SubstitutionMatrix<AminoAcidCompound>
Returns:
name

setName

public void setName(String name)
Description copied from interface: SubstitutionMatrix
Sets the name (short description) of this matrix.

Specified by:
setName in interface SubstitutionMatrix<AminoAcidCompound>
Parameters:
name - new name

getMatrix

public short[][] getMatrix()
Description copied from interface: SubstitutionMatrix
Returns entire matrix.

Specified by:
getMatrix in interface SubstitutionMatrix<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

public List<AminoAcidCompound> getRows()

setRows

public void setRows(List<AminoAcidCompound> rows)

getCols

public List<AminoAcidCompound> getCols()

setCols

public void setCols(List<AminoAcidCompound> cols)

getComment

public static String getComment()

toString

public String toString()
Returns in a format similar to the standard NCBI files.

Overrides:
toString in class Object

getCompoundSet

public CompoundSet<AminoAcidCompound> getCompoundSet()
Description copied from interface: SubstitutionMatrix
Returns the CompoundSet on which the matrix is defined.

Specified by:
getCompoundSet in interface SubstitutionMatrix<AminoAcidCompound>
Returns:
the CompoundSet on which the matrix is defined

getMatrixAsString

public String getMatrixAsString()
Description copied from interface: SubstitutionMatrix
Returns this matrix as a formatted String with Compound labels along the axes.

Specified by:
getMatrixAsString in interface SubstitutionMatrix<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 interface SubstitutionMatrix<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 interface SubstitutionMatrix<AminoAcidCompound>
Returns:
the minimum value in this matrix

getValue

public short getValue(AminoAcidCompound from,
                      AminoAcidCompound to)
Description copied from interface: SubstitutionMatrix
Returns value in matrix for conversion from first 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().

Specified by:
getValue in interface SubstitutionMatrix<AminoAcidCompound>
Parameters:
from - original Compound
to - replacement Compound
Returns:
value in matrix for conversion from first Compound to the second

normalizeMatrix

public SubstitutionMatrix<AminoAcidCompound> normalizeMatrix(short scale)
Description copied from interface: SubstitutionMatrix
Rescales the matrix so that to SubstitutionMatrix.getMaxValue() - SubstitutionMatrix.getMinValue() = scale.

Specified by:
normalizeMatrix in interface SubstitutionMatrix<AminoAcidCompound>
Parameters:
scale - new normalization scale of this matrix