Class ReadPRP

java.lang.Object
  |
  +--ReadPRP

public class ReadPRP
extends java.lang.Object

Class ReadPRP.java - read a .prp file and set up data structures. This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government and Djamel Medjahed (SAIC-Frederick). As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file.

Version:
$Date: 2002/10/14 20:17:17 $ $Revision: $
Author:
P. Lemkin (NCI), Djamel Medjahed (SAIC), NCI-Frederick, Frederick, MD
See Also:
ProtPlot Home

This work was derived from MAExplorer under the Mozilla 1.1 Open Source Public License by Peter Lemkin of the National Cancer Institute, an agency of the United States Government subject to the limitations noted in the accompanying LEGAL file. See licence info on http://maexplorer.sourceforge.org/


Field Summary
 java.lang.String dataFile
          full name of data file to use
 java.lang.String[] field
          fields [0:nFields]
 int idx_estExpr
          index for field name max EST expression
 int idx_FamilyName
          index for field name Family Name
 int idx_GenBankID
          index for field name GenBank ID
 int idx_MW
          index for field name MW
 int idx_pI
          index for field name pI
 int idx_SwissProtAcc
          index for field name SwissProt Acc
 int idx_SwissProtId
          index for field name SwissProt ID
 int idx_TissueName
          index for field name Tissue Name
static int MAX_COLS
          max # cols in data file
 int maxCols
          max size of token array
 float maxData_MW
          range of MW data
 float maxData_pI
          range of pI data
 int maxProteins
          max # of proteins
 float minData_MW
          range of MW data
 float minData_pI
          range of pI data
 int nCols
          actual # of tokens found
 int nFields
          # of fields in actual data file
 int nProteins
          actual # of proteins found
 Protein[] protList
          [0:nProteins-1] list of all proteins
private  ProtPlot prp
          instance of ProtPlot
 java.lang.String prpDir
          Directory of the .prp data file to use
 java.lang.String prpFile
          File of the .prp data file to use
 java.lang.String prpName
          Name of the .prp data file without .prp and cvt '_' to " "
 int sampleNbr
          The sampleNbr for the sample being read
 boolean strictDataFormatFlag
          Flag determines whether strict parsing is used.
private  java.lang.String[] tokArray
          token parse array [0:nCols-1] return all tokens/row
private  char[] tokBuf
          token buffer for parsing a line
private  UtilPRP util
          instance of UtilPRP
 
Constructor Summary
(package private) ReadPRP(ProtPlot prp, java.lang.String prpDir, java.lang.String prpFile, int sampleNbr, int maxProteins, java.lang.String msg, boolean strictDataFormatFlag)
          ReadPRP() - constructor to read and build a sample data structure.
 
Method Summary
 int getArrayOfTabDelimTokens(char[] lineBuf, int bufSize, java.lang.String[] tokArray)
          getArrayOfTabDelimTokens() - get array of tab-delim tokens The number of expected columns is specified and if there is no more data, it will leave those cells null.
 int lookupPIDfromMPID(int mPid)
          lookupPIDfromMPID() - lookup the pid given the mPid
private  boolean parseRows(java.lang.String sData, int nCols)
          parseRows() - parse & save a rows of data in rd.protList[] data structures.
 boolean readDataFile(java.lang.String msg)
          readDataFile() - read (pI,mw,SP-ID) into data structure
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MAX_COLS

public static final int MAX_COLS
max # cols in data file

prp

private ProtPlot prp
instance of ProtPlot

util

private UtilPRP util
instance of UtilPRP

prpDir

public java.lang.String prpDir
Directory of the .prp data file to use

prpFile

public java.lang.String prpFile
File of the .prp data file to use

prpName

public java.lang.String prpName
Name of the .prp data file without .prp and cvt '_' to " "

dataFile

public java.lang.String dataFile
full name of data file to use

strictDataFormatFlag

public boolean strictDataFormatFlag
Flag determines whether strict parsing is used. If the strictDataFormatFlag is true it requires the following fields: (pI, Mw, SP-ID, SP-ACC, expression, tissue). If it is false, it only requires (SP-ID, expression) since it will get the rest of the missing data from Master Protein Index entry.

field

public java.lang.String[] field
fields [0:nFields]

maxCols

public int maxCols
max size of token array

nCols

public int nCols
actual # of tokens found

sampleNbr

public int sampleNbr
The sampleNbr for the sample being read

maxProteins

public int maxProteins
max # of proteins

nProteins

public int nProteins
actual # of proteins found

protList

public Protein[] protList
[0:nProteins-1] list of all proteins

minData_pI

public float minData_pI
range of pI data

maxData_pI

public float maxData_pI
range of pI data

minData_MW

public float minData_MW
range of MW data

maxData_MW

public float maxData_MW
range of MW data

nFields

public int nFields
# of fields in actual data file

idx_pI

public int idx_pI
index for field name pI

idx_MW

public int idx_MW
index for field name MW

idx_SwissProtAcc

public int idx_SwissProtAcc
index for field name SwissProt Acc

idx_SwissProtId

public int idx_SwissProtId
index for field name SwissProt ID

idx_GenBankID

public int idx_GenBankID
index for field name GenBank ID

idx_FamilyName

public int idx_FamilyName
index for field name Family Name

idx_TissueName

public int idx_TissueName
index for field name Tissue Name

idx_estExpr

public int idx_estExpr
index for field name max EST expression

tokArray

private java.lang.String[] tokArray
token parse array [0:nCols-1] return all tokens/row

tokBuf

private char[] tokBuf
token buffer for parsing a line
Constructor Detail

ReadPRP

ReadPRP(ProtPlot prp,
        java.lang.String prpDir,
        java.lang.String prpFile,
        int sampleNbr,
        int maxProteins,
        java.lang.String msg,
        boolean strictDataFormatFlag)
ReadPRP() - constructor to read and build a sample data structure. It will merge the data into the Master Protein Index. If the strictDataFormatFlag is true it requires the following fields: (pI, Mw, SP-ID, SP-ACC, expression, tissue). If it is false, it only requires (SP-ID, expression) since it will get the rest of the missing data from Master Protein Index entry.
Parameters:
prp - instance of ProtPlot
prpDir - is the directory for the .prp file to read
prpFile - for the .prp file to read
sampleNbr - for the current sample
maxProteins - to read
msg - to display while reading
strictDataFormatFlag - to perform strict parsing (see above)
Method Detail

readDataFile

public boolean readDataFile(java.lang.String msg)
readDataFile() - read (pI,mw,SP-ID) into data structure
Parameters:
msg - to display while reading
Returns:
true if succeed

getArrayOfTabDelimTokens

public int getArrayOfTabDelimTokens(char[] lineBuf,
                                    int bufSize,
                                    java.lang.String[] tokArray)
getArrayOfTabDelimTokens() - get array of tab-delim tokens The number of expected columns is specified and if there is no more data, it will leave those cells null. If the token is "", it returns "" not null. Store the data in tokArray[].
Parameters:
lineBuf - is the source data
bufSize - is the # chars
tokArray - where data is teturned
Returns:
number of tokens/row else 0 if there is no more data.

parseRows

private boolean parseRows(java.lang.String sData,
                          int nCols)
parseRows() - parse & save a rows of data in rd.protList[] data structures.
Parameters:
sData - to parse
nCols - to look for in data
Returns:
true if ok.

lookupPIDfromMPID

public int lookupPIDfromMPID(int mPid)
lookupPIDfromMPID() - lookup the pid given the mPid
Parameters:
mPid - to lookup
Returns:
-1 if failed, else the corresponding pid if it exists.