Class SimpleSubstitutionMatrix<C extends Compound>
java.lang.Object
org.biojava.nbio.core.alignment.matrices.SimpleSubstitutionMatrix<C>
- Type Parameters:
C
- each element of the matrix corresponds to a pair ofCompound
s of type C
- All Implemented Interfaces:
Serializable
,SubstitutionMatrix<C>
public class SimpleSubstitutionMatrix<C extends Compound>
extends Object
implements SubstitutionMatrix<C>, Serializable
Implements a data structure which holds the score (penalty or bonus) given during alignment for the exchange of one
Compound
in a sequence for another.- Author:
- Mark Chapman, Daniel Cameron, Paolo Pavan
- See Also:
-
Constructor Summary
ConstructorDescriptionSimpleSubstitutionMatrix
(CompoundSet<C> compoundSet, short match, short replace) Creates an identity substitution matrix from match and replace values.SimpleSubstitutionMatrix
(CompoundSet<C> compoundSet, File fileInput) Creates a substitution matrix by reading in a file.SimpleSubstitutionMatrix
(CompoundSet<C> compoundSet, Reader input, String name) Creates a substitution matrix by parsing some input.SimpleSubstitutionMatrix
(CompoundSet<C> compoundSet, String matrixInput, String name) Creates a substitution matrix by parsing a String. -
Method Summary
Modifier and TypeMethodDescriptionstatic SubstitutionMatrix<AminoAcidCompound>
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
Returns the maximum value in this matrix.short
Returns the minimum value in this matrix.getName()
Returns the name (short description) of this matrix.short
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
setDescription
(String description) Sets the description of this matrix.void
Sets the name (short description) of this matrix.toString()
Returns in a format similar to the standard NCBI files.
-
Constructor Details
-
SimpleSubstitutionMatrix
public SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, File fileInput) throws FileNotFoundException Creates a substitution matrix by reading in a file.- Parameters:
compoundSet
- theCompoundSet
on which the matrix is definedfileInput
- file parsed for a substitution matrix- Throws:
FileNotFoundException
- if fileInput parameter cannot be read
-
SimpleSubstitutionMatrix
Creates a substitution matrix by parsing some input.- Parameters:
compoundSet
- theCompoundSet
on which the matrix is definedinput
- input parsed for a substitution matrixname
- the name (short description) of this matrix
-
SimpleSubstitutionMatrix
Creates a substitution matrix by parsing a String.- Parameters:
compoundSet
- theCompoundSet
on which the matrix is definedmatrixInput
- String parsed for a substitution matrixname
- the name (short description) of this matrix
-
SimpleSubstitutionMatrix
Creates an identity substitution matrix from match and replace values.- Parameters:
compoundSet
- theCompoundSet
on which the matrix is definedmatch
- matrix value used for equivalentCompound
sreplace
- matrix value used for differingCompound
s
-
-
Method Details
-
getBlosum62
-
getCompoundSet
Description copied from interface:SubstitutionMatrix
Returns theCompoundSet
on which the matrix is defined.- Specified by:
getCompoundSet
in interfaceSubstitutionMatrix<C extends Compound>
- Returns:
- the
CompoundSet
on which the matrix is defined
-
getDescription
Description copied from interface:SubstitutionMatrix
Returns the description of this matrix.- Specified by:
getDescription
in interfaceSubstitutionMatrix<C extends Compound>
- Returns:
- description
-
getMatrix
public short[][] getMatrix()Description copied from interface:SubstitutionMatrix
Returns entire matrix.- Specified by:
getMatrix
in interfaceSubstitutionMatrix<C extends Compound>
- Returns:
- matrix
-
getMatrixAsString
Description copied from interface:SubstitutionMatrix
Returns this matrix as a formatted String withCompound
labels along the axes.- Specified by:
getMatrixAsString
in interfaceSubstitutionMatrix<C extends Compound>
- 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<C extends Compound>
- 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<C extends Compound>
- Returns:
- the minimum value in this matrix
-
getName
Description copied from interface:SubstitutionMatrix
Returns the name (short description) of this matrix.- Specified by:
getName
in interfaceSubstitutionMatrix<C extends Compound>
- Returns:
- name
-
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()
. -
normalizeMatrix
Description copied from interface:SubstitutionMatrix
Rescales the matrix so that toSubstitutionMatrix.getMaxValue()
-SubstitutionMatrix.getMinValue()
= scale.- Specified by:
normalizeMatrix
in interfaceSubstitutionMatrix<C extends Compound>
- Parameters:
scale
- new normalization scale of this matrix
-
setDescription
Description copied from interface:SubstitutionMatrix
Sets the description of this matrix.- Specified by:
setDescription
in interfaceSubstitutionMatrix<C extends Compound>
- Parameters:
description
- new description
-
setName
Description copied from interface:SubstitutionMatrix
Sets the name (short description) of this matrix.- Specified by:
setName
in interfaceSubstitutionMatrix<C extends Compound>
- Parameters:
name
- new name
-
toString
Returns in a format similar to the standard NCBI files. -
getRow
- Specified by:
getRow
in interfaceSubstitutionMatrix<C extends Compound>
-
getColumn
- Specified by:
getColumn
in interfaceSubstitutionMatrix<C extends Compound>
-