org.strbio.mol.lib
Class PSIBlastMatrices

java.lang.Object
  extended by org.strbio.mol.lib.PSIBlastMatrices

public class PSIBlastMatrices
extends java.lang.Object

Matrix used in PSIBlast comparisons. See NCBI's posit.c and blastool.c for more info.

  Version 2.11, 3/28/1 - fixed bug in checkpoint loading under linux
  Version 2.1, 11/20/00 - added support for little endian computers
    when loading and saving the checkpoint file
  Version 2.0, 7/13/00 - added checkpoint writing functions
  Version 1.1, 1/29/99 - cleaned up and documented code better,
    added load, save and stringToScores
  Version 1.0, 1/25/99 - original version
  

Version:
2.11, 3/28/1
Author:
JMC

Field Summary
 DMatrix posFreqs
          N x 20 matrix of frequencies at each position.
 IMatrix posMatrix
          Position-specific scoring matrix, N x 20.
 
Constructor Summary
PSIBlastMatrices()
          Create an empty matrix; need to call setQuery.
PSIBlastMatrices(Protein query)
          Create with given protein as query.
PSIBlastMatrices(java.lang.String query)
          Create with given query sequence.
 
Method Summary
 boolean isInitialized()
          Has the matrix been properly loaded/initialized?
 void load(java.io.BufferedReader infile)
          Load scoring matrix from a BufferedReader.
 void load(java.lang.String filename)
          Load scoring matrix from a file.
 void loadCheckpoint(java.io.DataInputStream infile)
          Load everything out of a file, created by 'blastpgp -C filename'.
 void loadCheckpoint(java.lang.String filename)
          Load everything out of a file with a given name.
 void loadFreqs(java.io.DataInputStream infile)
          Load frequencies from checkpoint file.
 void makeScoreMatrix()
          Convert pseudo-count frequencies to a score matrix.
 void posToFreqs()
          Convert pseudo-count frequencies to a score matrix.
 void printFreqs(Printf outfile)
          Print frequencies for debugging.
 void printScores(Printf outfile)
          Print scores for debugging.
 void save(Printf outfile)
          Save scoring matrix to a file.
 void save(java.lang.String filename)
          Save scoring matrix to a file.
 void saveCheckpoint(java.io.DataOutputStream outfile)
          Save everything to a file, to be used with 'blastpgp -R filename'.
 void saveCheckpoint(java.lang.String filename)
          Save everything to a file with a given name.
 void setQuery(Protein p)
          Set the query sequence to a given string.
 void setQuery(java.lang.String q)
          Set the query sequence to a given string.
 void stringToScores(java.lang.String codedScores)
          Get frequencies out of a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

posFreqs

public DMatrix posFreqs
N x 20 matrix of frequencies at each position.


posMatrix

public IMatrix posMatrix
Position-specific scoring matrix, N x 20.

Constructor Detail

PSIBlastMatrices

public PSIBlastMatrices()
Create an empty matrix; need to call setQuery.


PSIBlastMatrices

public PSIBlastMatrices(java.lang.String query)
Create with given query sequence.


PSIBlastMatrices

public PSIBlastMatrices(Protein query)
Create with given protein as query.

Method Detail

setQuery

public void setQuery(java.lang.String q)
Set the query sequence to a given string.


setQuery

public void setQuery(Protein p)
Set the query sequence to a given string.


isInitialized

public boolean isInitialized()
Has the matrix been properly loaded/initialized?


loadFreqs

public void loadFreqs(java.io.DataInputStream infile)
               throws java.io.IOException
Load frequencies from checkpoint file.

Throws:
java.io.IOException

printFreqs

public void printFreqs(Printf outfile)
                throws java.io.IOException
Print frequencies for debugging.

Throws:
java.io.IOException

printScores

public void printScores(Printf outfile)
                 throws java.io.IOException
Print scores for debugging.

Throws:
java.io.IOException

makeScoreMatrix

public void makeScoreMatrix()
Convert pseudo-count frequencies to a score matrix. This does not do that funky rescaling of lambda thing which is in the original blast code... looks like lambda always stays close to the default anyway. If in doubt, use the web server version, which grabs the score matrix directly from the server output.


posToFreqs

public void posToFreqs()
Convert pseudo-count frequencies to a score matrix. This does not do that funky rescaling of lambda thing which is in the original blast code... looks like lambda always stays close to the default anyway. If in doubt, use the web server version, which grabs the score matrix directly from the server output.


loadCheckpoint

public void loadCheckpoint(java.io.DataInputStream infile)
                    throws java.io.IOException
Load everything out of a file, created by 'blastpgp -C filename'.

Throws:
java.io.IOException

saveCheckpoint

public void saveCheckpoint(java.io.DataOutputStream outfile)
                    throws java.io.IOException
Save everything to a file, to be used with 'blastpgp -R filename'.

Throws:
java.io.IOException

loadCheckpoint

public void loadCheckpoint(java.lang.String filename)
                    throws java.io.IOException
Load everything out of a file with a given name.

Throws:
java.io.IOException

saveCheckpoint

public void saveCheckpoint(java.lang.String filename)
                    throws java.io.IOException
Save everything to a file with a given name.

Throws:
java.io.IOException

load

public void load(java.lang.String filename)
          throws java.io.IOException
Load scoring matrix from a file.

Throws:
java.io.IOException

load

public void load(java.io.BufferedReader infile)
          throws java.io.IOException
Load scoring matrix from a BufferedReader.

Throws:
java.io.IOException

save

public void save(java.lang.String filename)
          throws java.io.IOException
Save scoring matrix to a file.

Throws:
java.io.IOException

save

public void save(Printf outfile)
          throws java.io.IOException
Save scoring matrix to a file.

Throws:
java.io.IOException

stringToScores

public void stringToScores(java.lang.String codedScores)
Get frequencies out of a string.