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 ofCompounds 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 oneCompoundin a sequence for another.- Author:
- Mark Chapman, Daniel Cameron, Paolo Pavan
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleSubstitutionMatrix(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SubstitutionMatrix<AminoAcidCompound>getBlosum62()Map<C,Short>getColumn(C column)CompoundSet<C>getCompoundSet()Returns theCompoundSeton which the matrix is defined.StringgetDescription()Returns the description of this matrix.short[][]getMatrix()Returns entire matrix.StringgetMatrixAsString()Returns this matrix as a formatted String withCompoundlabels along the axes.shortgetMaxValue()Returns the maximum value in this matrix.shortgetMinValue()Returns the minimum value in this matrix.StringgetName()Returns the name (short description) of this matrix.Map<C,Short>getRow(C row)shortgetValue(C from, C to)Returns value in matrix for conversion from firstCompoundto the second.SubstitutionMatrix<C>normalizeMatrix(short scale)Rescales the matrix so that toSubstitutionMatrix.getMaxValue()-SubstitutionMatrix.getMinValue()= scale.voidsetDescription(String description)Sets the description of this matrix.voidsetName(String name)Sets the name (short description) of this matrix.StringtoString()Returns in a format similar to the standard NCBI files.
-
-
-
Constructor Detail
-
SimpleSubstitutionMatrix
public SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, File fileInput) throws FileNotFoundException
Creates a substitution matrix by reading in a file.- Parameters:
compoundSet- theCompoundSeton which the matrix is definedfileInput- file parsed for a substitution matrix- Throws:
FileNotFoundException- if fileInput parameter cannot be read
-
SimpleSubstitutionMatrix
public SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, Reader input, String name)
Creates a substitution matrix by parsing some input.- Parameters:
compoundSet- theCompoundSeton which the matrix is definedinput- input parsed for a substitution matrixname- the name (short description) of this matrix
-
SimpleSubstitutionMatrix
public SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, String matrixInput, String name)
Creates a substitution matrix by parsing a String.- Parameters:
compoundSet- theCompoundSeton which the matrix is definedmatrixInput- String parsed for a substitution matrixname- the name (short description) of this matrix
-
SimpleSubstitutionMatrix
public SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, short match, short replace)
Creates an identity substitution matrix from match and replace values.- Parameters:
compoundSet- theCompoundSeton which the matrix is definedmatch- matrix value used for equivalentCompoundsreplace- matrix value used for differingCompounds
-
-
Method Detail
-
getBlosum62
public static SubstitutionMatrix<AminoAcidCompound> getBlosum62()
-
getCompoundSet
public CompoundSet<C> getCompoundSet()
Description copied from interface:SubstitutionMatrixReturns theCompoundSeton which the matrix is defined.- Specified by:
getCompoundSetin interfaceSubstitutionMatrix<C extends Compound>- Returns:
- the
CompoundSeton which the matrix is defined
-
getDescription
public String getDescription()
Description copied from interface:SubstitutionMatrixReturns the description of this matrix.- Specified by:
getDescriptionin interfaceSubstitutionMatrix<C extends Compound>- Returns:
- description
-
getMatrix
public short[][] getMatrix()
Description copied from interface:SubstitutionMatrixReturns entire matrix.- Specified by:
getMatrixin interfaceSubstitutionMatrix<C extends Compound>- Returns:
- matrix
-
getMatrixAsString
public String getMatrixAsString()
Description copied from interface:SubstitutionMatrixReturns this matrix as a formatted String withCompoundlabels along the axes.- Specified by:
getMatrixAsStringin interfaceSubstitutionMatrix<C extends Compound>- Returns:
- this matrix as a formatted String
-
getMaxValue
public short getMaxValue()
Description copied from interface:SubstitutionMatrixReturns the maximum value in this matrix.- Specified by:
getMaxValuein interfaceSubstitutionMatrix<C extends Compound>- Returns:
- the maximum value in this matrix
-
getMinValue
public short getMinValue()
Description copied from interface:SubstitutionMatrixReturns the minimum value in this matrix.- Specified by:
getMinValuein interfaceSubstitutionMatrix<C extends Compound>- Returns:
- the minimum value in this matrix
-
getName
public String getName()
Description copied from interface:SubstitutionMatrixReturns the name (short description) of this matrix.- Specified by:
getNamein interfaceSubstitutionMatrix<C extends Compound>- Returns:
- name
-
getValue
public short getValue(C from, C to)
Description copied from interface:SubstitutionMatrixReturns value in matrix for conversion from firstCompoundto the second. If an argument does not belong to theCompoundSet, this could either throw anIllegalArgumentExceptionor it could returnSubstitutionMatrix.getMinValue().
-
normalizeMatrix
public SubstitutionMatrix<C> normalizeMatrix(short scale)
Description copied from interface:SubstitutionMatrixRescales the matrix so that toSubstitutionMatrix.getMaxValue()-SubstitutionMatrix.getMinValue()= scale.- Specified by:
normalizeMatrixin interfaceSubstitutionMatrix<C extends Compound>- Parameters:
scale- new normalization scale of this matrix
-
setDescription
public void setDescription(String description)
Description copied from interface:SubstitutionMatrixSets the description of this matrix.- Specified by:
setDescriptionin interfaceSubstitutionMatrix<C extends Compound>- Parameters:
description- new description
-
setName
public void setName(String name)
Description copied from interface:SubstitutionMatrixSets the name (short description) of this matrix.- Specified by:
setNamein interfaceSubstitutionMatrix<C extends Compound>- Parameters:
name- new name
-
getRow
public Map<C,Short> getRow(C row)
- Specified by:
getRowin interfaceSubstitutionMatrix<C extends Compound>
-
-