|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.alignment.SubstitutionMatrix
public class SubstitutionMatrix
This object is able to read a substitution matrix file and constructs an int matrix to
store the matrix. Every single element of the matrix can be accessed by the method
getValueAt
with the parameters being tow biojava symbols. This is why it is
not necessary to access the matrix directly. If there is no value for the two specified
Symbol
s an Exception
is thrown.
Substitution matrix files, are available at The NCBI FTP directory.
Field Summary | |
---|---|
protected FiniteAlphabet |
alphabet
|
protected Map |
colSymbols
|
protected String |
description
|
protected int[][] |
matrix
|
protected int |
max
|
protected int |
min
|
protected String |
name
|
protected Map |
rowSymbols
|
Constructor Summary | |
---|---|
SubstitutionMatrix(FiniteAlphabet alpha,
File matrixFile)
This constructs a SubstitutionMatrix -object that contains two
Map data structures having biojava symbols as key and the value
being the index of the matrix containing the substitution score. |
|
SubstitutionMatrix(FiniteAlphabet alpha,
int match,
int replace)
Constructs a SubstitutionMatrix with every Match and every Replace having the same expenses given by the parameters. |
|
SubstitutionMatrix(FiniteAlphabet alpha,
String matrixString,
String name)
With this constructor it is possible to construct a SubstitutionMatrix object from a substitution matrix file. |
Method Summary | |
---|---|
FiniteAlphabet |
getAlphabet()
Gives the alphabet used by this matrix. |
String |
getDescription()
This gives you the description of this matrix if there is one. |
int |
getMax()
The maximum score in this matrix. |
int |
getMin()
The minimum score of this matrix. |
String |
getName()
Every substitution matrix has a name like "BLOSUM30" or "PAM160". |
int |
getValueAt(Symbol row,
Symbol col)
There are some substitution matrices containing more columns than lines. |
SubstitutionMatrix |
normalizeMatrix()
With this method you can get a "normalized" SubstitutionMatrix object;
however, since this implementation uses an int matrix, the normalized matrix will
be scaled by ten. |
protected int[][] |
parseMatrix(String matString)
Reads a String representing the contents of a substitution matrix file. |
void |
printMatrix()
Just to perform some test. |
void |
setDescription(String desc)
Sets the description to the given value. |
String |
stringnifyDescription()
Stringnifies the description of the matrix. |
String |
stringnifyMatrix()
Creates a String representation of this matrix. |
String |
toString()
Overides the inherited method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Map rowSymbols
protected Map colSymbols
protected int[][] matrix
protected int min
protected int max
protected FiniteAlphabet alphabet
protected String description
protected String name
Constructor Detail |
---|
public SubstitutionMatrix(FiniteAlphabet alpha, File matrixFile) throws IOException, BioException
SubstitutionMatrix
-object that contains two
Map
data structures having biojava symbols as key and the value
being the index of the matrix containing the substitution score.
alpha
- the alphabet of the matrix (DNA, RNA or PROTEIN, or PROTEIN-TERM)matrixFile
- the file containing the substitution matrix. Lines starting with
'#
' are comments. The line starting with a white space, is the table head.
Every line has to start with the one letter representation of the Symbol and then
the values for the exchange.
IOException
BioException
public SubstitutionMatrix(FiniteAlphabet alpha, String matrixString, String name) throws BioException
\n
. Everything else is the same than for the constructor above.
alpha
- The FiniteAlphabet
to usematrixString
- name
- of the matrix.
BioException
public SubstitutionMatrix(FiniteAlphabet alpha, int match, int replace)
alpha
- match
- replace
- Method Detail |
---|
protected int[][] parseMatrix(String matString) throws BioException
matString
-
BioException
public int getValueAt(Symbol row, Symbol col) throws BioException
row
- Symbol of the linecol
- Symbol of the column
BioException
public String getDescription()
public String getName()
public int getMin()
public int getMax()
public void setDescription(String desc)
desc
- a description. This doesn't have to start with '#'.public FiniteAlphabet getAlphabet()
public String stringnifyMatrix()
String
representation of this matrix.
public String stringnifyDescription()
\n
. Every line starts with #
.public String toString()
toString
in class Object
public void printMatrix()
public SubstitutionMatrix normalizeMatrix()
SubstitutionMatrix
object;
however, since this implementation uses an int matrix, the normalized matrix will
be scaled by ten. If you need values between zero and one, you have to devide every
value returnd by getValueAt
by ten.
SubstitutionMatrix
object given by this
substitution matrix. Because this uses an int
matrix, all values are
skaled by 10.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |