Class MaHPquantTable

java.lang.Object
  |
  +--SimpleTable
        |
        +--Table
              |
              +--MaHPquantTable

class MaHPquantTable
extends Table

The class is only used to read a .quant file (File or URL) into an mae.ms instance. The temporary data structures are then garbage collected. It parses data from a quantified microarray tab-delimited file. The data might be from the analysis by various microarray image quantification programs including (Axon's GenePix, Scanarray, R.G.'s Pathways 2.01, MolDyn ImageQuant-NT, etc). Since the data is a tab-delimited format, any program which can generate this type of data could be used. Most quantitative data formats use integers for (grid,row,col) values. However, some formats use letters [A:Z] for the first 26 (i.e. [1:26]), and [a:z] for the next 26 (i.e. [27:52]) values. Sometimes only lower case letters are used - in which case we must map [a:z] to [1:26]. When MAExplorer first sees a letter in reading the data, it checks to see if it is an upper or lowercase letter and generates the proper offset needed to generate the mapping.

HISTORICAL NOTES: The fields were initially derived from the Research Genetics microarray quantitation .txt table for the corresponding microarray. This whole file is a tab delimited file consisting of some of the following fields:

ALL R.G. Pathways 2.01 fields: "TableName" "FilterType_Description" "ShortName" "Header_Description" "Date" "Researcher" "SampleGrid" "BGLow" "BGAvg" "BGRms" "X" "Y" "RawIntensity" "field" "grid" "grid col" "grid row" "release" "plate" "release row" "release col" "clone id" "type" "norm"

NOTE: we do not use the following since we get it from the GeneTable. "release" "plate" "release row" "release col" "clone id"

The .quant file subset of fields that we try to parse are: "X" "Y" "RawIntensity" "field" "grid" "grid col" "grid row"

Additional global data is saved in the SamplesDB file (@see #SampleTable) that contains a row for each sample with the remaining data: "TableName" "FilterType_Description" "ShortName" "Header_Description" "Date" "Researcher" "SampleGrid" "BGLow" "BGAvg" "BGRms"

where "BGLow" "BGAvg" "BGRms" are global background values such as that defined by a R.G. Pathways 2.01 analysis.

NOTE: if you are using the symbolic ImageQuant GIPO symbol "NAME_GRC", it has the grid #, row# and column# specified as follows:

 e.g. in following (grid,row,column) = (8,12,11)
       "GRID-   8-R12C11". 
When the field # is not explicitly specified, the data may be vertically stacked. We handle multiple (vertically stacked) occurances by replicating the GIPO entry for each field for intensity data (not cy3/cy5 ratio data) if maxFIELDS > 1. If "field" exists, then use "RawIntensity", else for each field [1:maxFIELDS] look for "RawIntensity1", "RawIntensity2" when we do the field 1 and field passes of the file.
 We use the QualCheck field derived from the Becker/NIA QualCheck codes:
  1 = analyzable gene (clone or oligo) on array, good clone id.
  2 = analyzable gene (clone or oligo) on array, bad clone id, good gene name.
  3 = non-analyzable gene (clone or oligo) on array, e.g. empty spots, or
      filled with internal testing material.
  4 = analyzable gene (clone or oligo), duplicated genes on the microarray,
      only one duplicate is flagged with the "4".
 We define the legal QualCheck codes in Gene.C_XXXXX properties bits.
NOTE: (6/8/00) - use of "Location"

The optional "Location" entry may be the identifier for some databases.] It might also indicate that a gene is 'good' since bad genes on the array may be missing from both the GIPO and the .quant data files. This missing data is used in Cvt2Mae to synthesize missing genes by creating spot entrys with 0 density.

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. 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. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/04/03 21:03:28 $ $Revision: 1.10 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home, MaHybridSample

Field Summary
private  int allocSize
          number of spots allocated as map.maxSpots+1.
private  CompositeDatabase cdb
          link to global CompositeDatabase instance
private  Config cfg
          link to global Config instance
(package private) static int DELTA_X_SPACING
          (opt) Horiz.
(package private) static int DELTA_Y_SPACING
          Vert.
private  boolean doRatioFlag
          flag: if maxFIELD==1 && useRatioDataFlag
private  FileIO fio
          link to global FileIO vinstance
private  char gridCharOffset
          Grid alphabetic offset for Uppercase ('A') or Lowercase ('a') if using letters
private  char gridColCharOffset
          Grid Column alphabetic offset for Uppercase ('A') or Lowercase ('a') if using letters
private  char gridRowCharOffset
          Grid Row alphabetic offset for Uppercase ('A') or Lowercase ('a') if using letters
(package private) static int GUARD_REGION
          # pixels in target image on each edge
private  int idxBkgrd
          background raw intensity spot data
private  int idxBkgrd1
          background raw intensity channel 1, if code mult fields in each row
private  int idxBkgrd2
          background raw intensity channel 2, if code mult fields in each row
private  int idxDetValue
          Opt.
private  int idxfield
          opt.
private  int idxgrid
          separate GRC spec.
private  int idxgrid_col
          separate GRC spec.
private  int idxgrid_row
          separate GRC spec.
private  int idxLocation
          opt.
private  int idxNameGridIdx
          MolDyn GRC coding for (grid,grid-row,grid-column) as "NAME_GRC" e.g.
private  int idxQualCheck
          Opt.
private  int idxRawIntens
          raw intensity spot data
private  int idxRawIntens1
          raw intensity spot data for channel 1, if code mult fields in each row
private  int idxRawIntens2
          raw intensity spot data for channel 2, if code mult fields in each row
private  int idxX
          opt.
private  int idxY
          opt.
private  boolean isGridColDigitFlag
          flag: Grid-Col value is coded as digit else alpha
private  boolean isGridDigitFlag
          flag: Grid value is coded as digit else alpha
private  boolean isGridRowDigitFlag
          flag: Grid-Row value is coded as digit else alpha
private  boolean learnGRCcodingFlag
          flag: once only code when analyze for MolDyn "NAME_GRC" coding
private  MAExplorer mae
          link to global MAExplorer instance
private  java.lang.String maeTbl
          name of remap Table
private  Maps map
          link to global Maps instance
private  int maxFIELDS
          maximum number of fields allowed
private  int maxGCOLS
          maximum number of grid cols allowed
private  int maxGRIDS
          maximum number of grids allowed
private  int maxGROWS
          maximum number of grid rows allowed
static float maxHsize
           
static float maxVsize
           
private  MaHybridSample ms
          HP sample that owns this table instance
private  int nGenes
          # of genes
private  int nSpots
          number of spots read.
private  boolean screenGoodGenesFlag
          flag: if calc glob-stats on only GoodGenes
(package private) static int SPACING_BETWEEN_SPOTS
          (opt) spacing between spots
private  boolean swapCy5Cy3DataFlag
           
(package private) static int X_GRID_OFFSET
          value to add to orig data coords to draw GRID labels
(package private) static int X_SPOTQ_OFFSET
          value to add to orig data coords x_textQ[].
private  int xRmax
          max X coordinate from orig .quant data
private  int xRmin
          min X coordinate from orig .quant data
(package private) static int Y_SPOTQ_OFFSET
          value to add to orig data coords y_textQ[] AND to grid coords so they match spots
private  int yRmax
          max Y coordinate from orig .quant data
private  int yRmin
          min Y coordinate from orig .quant data
 
Fields inherited from class Table
bufSize, fileOKflag
 
Fields inherited from class SimpleTable
fileName, msg, tCols, tData, tFields, title, tRows
 
Constructor Summary
(package private) MaHPquantTable(MAExplorer mae, MaHybridSample ms, java.lang.String fileName, java.lang.String hpName, boolean swapCy5Cy3DataFlag)
          MaHPquantTable() - constructor to read the .quant file table and setup MaHybridSample
 
Method Summary
private  float cvtQualCheckStrToFloat(java.lang.String sQualCheck)
          cvtQualCheckStrToFloat() - do conversion from QualCheck string to float value.
private  GridCoords cvtTblRowDataToFGRC(int f, java.lang.String[] data)
          cvtTblRowDataToFGRC() - convert table row data to GridCoord data by setting (f,g,r,c) in the mae.grcd object.
private  boolean initFGRCtoGTidxMap()
          initFGRCtoGTidxMap() - create FGRC to quant table row index lookup table.
private  boolean parseGidQmapLookupTable()
          parseGidQmapLookupTable()- parse FGRC tData[][] to ms.gidMapQ[].
private  boolean parseQuantTableToQarrays()
          parseQuantTableToQarrays() - cvt Table data to quant xxxC[] arrays data.
private  void setupFieldIndexes()
          setupFieldIndexes() - setup indexes for common Table fields for speedups.
private  void setupQuantImageTextQGridCoords()
          setupQuantImageTextQGridCoords() - for .quant data to draw in PseudoImage
private  boolean setupXYQandCorrectSkew()
          setupXYQandCorrectSkew() - set XY coords and correct XY skew if actual xy coords.
 
Methods inherited from class Table
copyTable, createFileTable, getArrayOfTabDelimitedTokens, getData, getTableRowsSubset, getTableRowsSubset, insertTblInULHCtable, lookupFieldIdxAndRemapFieldName, makeTabDelimReport, readTable, storeDataBufParser
 
Methods inherited from class SimpleTable
freeTable, getTableRowFieldByRowIdx, getTableRowFieldIdxByRowIdx, lookupFieldIdx, setFieldData, setRowData, trimWhitespace
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mae

private MAExplorer mae
link to global MAExplorer instance

map

private Maps map
link to global Maps instance

cfg

private Config cfg
link to global Config instance

cdb

private CompositeDatabase cdb
link to global CompositeDatabase instance

fio

private FileIO fio
link to global FileIO vinstance

ms

private MaHybridSample ms
HP sample that owns this table instance

SPACING_BETWEEN_SPOTS

static final int SPACING_BETWEEN_SPOTS
(opt) spacing between spots

DELTA_X_SPACING

static final int DELTA_X_SPACING
(opt) Horiz. spacing between spots. old value was 11

DELTA_Y_SPACING

static final int DELTA_Y_SPACING
Vert. spacing between spots. old value was 11

X_GRID_OFFSET

static final int X_GRID_OFFSET
value to add to orig data coords to draw GRID labels

X_SPOTQ_OFFSET

static final int X_SPOTQ_OFFSET
value to add to orig data coords x_textQ[]. OLD values:40,50

Y_SPOTQ_OFFSET

static final int Y_SPOTQ_OFFSET
value to add to orig data coords y_textQ[] AND to grid coords so they match spots

GUARD_REGION

static final int GUARD_REGION
# pixels in target image on each edge

maeTbl

private final java.lang.String maeTbl
name of remap Table

maxVsize

public static float maxVsize

maxHsize

public static float maxHsize

idxLocation

private int idxLocation
opt. array Location index

idxX

private int idxX
opt. array image X coord

idxY

private int idxY
opt. array image Y coord

idxfield

private int idxfield
opt. explicit "field"

idxgrid

private int idxgrid
separate GRC spec. "grid"

idxgrid_col

private int idxgrid_col
separate GRC spec. "grid col"

idxgrid_row

private int idxgrid_row
separate GRC spec. "grid row"

idxNameGridIdx

private int idxNameGridIdx
MolDyn GRC coding for (grid,grid-row,grid-column) as "NAME_GRC" e.g. "GRID- 8-R12C11".

idxRawIntens

private int idxRawIntens
raw intensity spot data

idxRawIntens1

private int idxRawIntens1
raw intensity spot data for channel 1, if code mult fields in each row

idxRawIntens2

private int idxRawIntens2
raw intensity spot data for channel 2, if code mult fields in each row

idxBkgrd

private int idxBkgrd
background raw intensity spot data

idxBkgrd1

private int idxBkgrd1
background raw intensity channel 1, if code mult fields in each row

idxBkgrd2

private int idxBkgrd2
background raw intensity channel 2, if code mult fields in each row

idxDetValue

private int idxDetValue
Opt. Detection value for spot

idxQualCheck

private int idxQualCheck
Opt. quality code for spot validity

learnGRCcodingFlag

private boolean learnGRCcodingFlag
flag: once only code when analyze for MolDyn "NAME_GRC" coding

isGridDigitFlag

private boolean isGridDigitFlag
flag: Grid value is coded as digit else alpha

isGridRowDigitFlag

private boolean isGridRowDigitFlag
flag: Grid-Row value is coded as digit else alpha

isGridColDigitFlag

private boolean isGridColDigitFlag
flag: Grid-Col value is coded as digit else alpha

gridCharOffset

private char gridCharOffset
Grid alphabetic offset for Uppercase ('A') or Lowercase ('a') if using letters

gridRowCharOffset

private char gridRowCharOffset
Grid Row alphabetic offset for Uppercase ('A') or Lowercase ('a') if using letters

gridColCharOffset

private char gridColCharOffset
Grid Column alphabetic offset for Uppercase ('A') or Lowercase ('a') if using letters

screenGoodGenesFlag

private boolean screenGoodGenesFlag
flag: if calc glob-stats on only GoodGenes

doRatioFlag

private boolean doRatioFlag
flag: if maxFIELD==1 && useRatioDataFlag

swapCy5Cy3DataFlag

private boolean swapCy5Cy3DataFlag

maxFIELDS

private int maxFIELDS
maximum number of fields allowed

maxGRIDS

private int maxGRIDS
maximum number of grids allowed

maxGROWS

private int maxGROWS
maximum number of grid rows allowed

maxGCOLS

private int maxGCOLS
maximum number of grid cols allowed

allocSize

private int allocSize
number of spots allocated as map.maxSpots+1. Handles dangling null problem

nSpots

private int nSpots
number of spots read. Set to tRows, or map.maxSpots if maxFIELDS>1

nGenes

private int nGenes
# of genes

xRmax

private int xRmax
max X coordinate from orig .quant data

yRmax

private int yRmax
max Y coordinate from orig .quant data

xRmin

private int xRmin
min X coordinate from orig .quant data

yRmin

private int yRmin
min Y coordinate from orig .quant data
Constructor Detail

MaHPquantTable

MaHPquantTable(MAExplorer mae,
               MaHybridSample ms,
               java.lang.String fileName,
               java.lang.String hpName,
               boolean swapCy5Cy3DataFlag)
MaHPquantTable() - constructor to read the .quant file table and setup MaHybridSample
Parameters:
mae - is instance of MAExplorer
ms - is the MaHybridSample instance
fileName - is the .quant file full path name
hpName - the sample name
swapCy5Cy3DataFlag - indicates that swap (Cy3,Cy5) data
See Also:
MAExplorer.logDRYROTerr(java.lang.String), MaHybridSample, MaHybridSample.clearHPglobalStats(), MaHybridSample.cvtRawQdataToMAEdata(boolean), Util.popupDryrotMsgsAndQuit(), Util.showMsg2(java.lang.String), initFGRCtoGTidxMap(), parseQuantTableToQarrays(), setupFieldIndexes(), setupQuantImageTextQGridCoords(), setupXYQandCorrectSkew()
Method Detail

setupFieldIndexes

private void setupFieldIndexes()
setupFieldIndexes() - setup indexes for common Table fields for speedups. Any fields not found are set to -1.
See Also:
Table.lookupFieldIdxAndRemapFieldName(java.lang.String, java.lang.String)

initFGRCtoGTidxMap

private boolean initFGRCtoGTidxMap()
initFGRCtoGTidxMap() - create FGRC to quant table row index lookup table.
Returns:
true if succeed
See Also:
Util.checkImagesDirExists(), parseGidQmapLookupTable()

cvtTblRowDataToFGRC

private GridCoords cvtTblRowDataToFGRC(int f,
                                       java.lang.String[] data)
cvtTblRowDataToFGRC() - convert table row data to GridCoord data by setting (f,g,r,c) in the mae.grcd object. Pick out the fields to assemble the GridCoords obj.
Parameters:
f - is the field number
data - is the full row of table data
Returns:
instance of GridCoords with data from this row, else null if there is a problem.
See Also:
GridCoords.cvtNAME_GCR2FGRC(int, java.lang.String), MAExplorer.logDRYROTerr(java.lang.String), Util.popupDryrotMsgsAndQuit()

parseGidQmapLookupTable

private boolean parseGidQmapLookupTable()
parseGidQmapLookupTable()- parse FGRC tData[][] to ms.gidMapQ[]. Find (f,g,r,c) and then set ms.gidMapQ[row] to map.fgrc2gid[f][g][r][c]. Note: if there is no "field", we compute field value f based on maxFIELDS.
Returns:
true if succeed.
See Also:
FileIO.logMsgln(java.lang.String), MAExplorer.logDRYROTerr(java.lang.String), Util.popupDryrotMsgsAndQuit(), cvtTblRowDataToFGRC(int, java.lang.String[])

setupQuantImageTextQGridCoords

private void setupQuantImageTextQGridCoords()
setupQuantImageTextQGridCoords() - for .quant data to draw in PseudoImage
See Also:
Maps

setupXYQandCorrectSkew

private boolean setupXYQandCorrectSkew()
setupXYQandCorrectSkew() - set XY coords and correct XY skew if actual xy coords. The ms.(xC,yC) are actual or pseudo image coordinates. This data has the same ranges as the image data so it can be used interchangeably (more or less) with the analysis fcts..
Returns:
true if successful.

cvtQualCheckStrToFloat

private float cvtQualCheckStrToFloat(java.lang.String sQualCheck)
cvtQualCheckStrToFloat() - do conversion from QualCheck string to float value.
Parameters:
sQualCheck - is table string value for QualCheck
Returns:
QualCheck value. If there is no QualCheck data then return Gene.C_GOOD_MID.
See Also:
Util.cvs2f(java.lang.String), Util.cvs2i(java.lang.String)

parseQuantTableToQarrays

private boolean parseQuantTableToQarrays()
parseQuantTableToQarrays() - cvt Table data to quant xxxC[] arrays data. Compute min and max of data for use when we convert to std xxxC[] data.
Returns:
true if succeed.
See Also:
MaInfoTable.getTableRowByMaInfoId(java.lang.String), Util.cvs2f(java.lang.String), Util.cvs2i(java.lang.String), Util.showMsg(java.lang.String), cvtQualCheckStrToFloat(java.lang.String), cvtTblRowDataToFGRC(int, java.lang.String[])