C
- each element of the matrix corresponds to a pair of Compound
s of type Cpublic class SimpleSubstitutionMatrix<C extends Compound> extends Object implements SubstitutionMatrix<C>, Serializable
Compound
in a sequence for another.Constructor and Description |
---|
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,
short match,
short replace)
Creates an identity substitution matrix from match and replace values.
|
SimpleSubstitutionMatrix(CompoundSet<C> compoundSet,
String matrixInput,
String name)
Creates a substitution matrix by parsing a String.
|
Modifier and Type | Method and Description |
---|---|
static SubstitutionMatrix<AminoAcidCompound> |
getBlosum62() |
Map<C,Short> |
getColumn(C column) |
CompoundSet<C> |
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 |
getMaxValue()
Returns the maximum value in this matrix.
|
short |
getMinValue()
Returns the minimum value in this matrix.
|
String |
getName()
Returns the name (short description) of this matrix.
|
Map<C,Short> |
getRow(C row) |
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(String description)
Sets the description of this matrix.
|
void |
setName(String name)
Sets the name (short description) of this matrix.
|
String |
toString()
Returns in a format similar to the standard NCBI files.
|
public SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, File fileInput) throws FileNotFoundException
compoundSet
- the CompoundSet
on which the matrix is definedfileInput
- file parsed for a substitution matrixFileNotFoundException
- if fileInput parameter cannot be readpublic SimpleSubstitutionMatrix(CompoundSet<C> compoundSet, Reader input, 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, String matrixInput, 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 static SubstitutionMatrix<AminoAcidCompound> getBlosum62()
public 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 String getDescription()
SubstitutionMatrix
getDescription
in interface SubstitutionMatrix<C extends Compound>
public short[][] getMatrix()
SubstitutionMatrix
getMatrix
in interface SubstitutionMatrix<C extends Compound>
public 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 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(String description)
SubstitutionMatrix
setDescription
in interface SubstitutionMatrix<C extends Compound>
description
- new descriptionpublic void setName(String name)
SubstitutionMatrix
setName
in interface SubstitutionMatrix<C extends Compound>
name
- new namepublic String toString()
public Map<C,Short> getRow(C row)
getRow
in interface SubstitutionMatrix<C extends Compound>
Copyright © 2000–2016 BioJava. All rights reserved.