Class MaeSampleData

java.lang.Object
  |
  +--MaeSampleData

public class MaeSampleData
extends java.lang.Object

This class tracks the SampleDB.txt file data containing the list of samples. It contains methods to read and write the Sample DB file. Note: the data is kept in MaeConfigData mcd.

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.

Version:
$Date: 2002/10/14 19:22:30 $ $Revision: 1.4 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), B. Stephens(SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home

Field Summary
private  int idxDatabase_File
          idx of "Database_File" field
private  int idxProject
          idx of "Project" field
private  int idxSample_ID
          idx of "Sample_ID" field
 MaeConfigData mcd
          link to global MaeConfigData database
private  int tCols
          # of columns in the table
private  java.lang.String[][] tData
          [0:tRows-1][0:tCols-1] table data that is actually a 1D array [0:tRows-1] of rowData[0:tCols-1]
private  java.lang.String[] tFields
          Field names in the table
private  int tRows
          # of rows in the table
 
Constructor Summary
MaeSampleData(MaeConfigData mcd)
          MaeSampleData() - constructor
 
Method Summary
private  boolean findSampleFields()
          findSampleFields() - find SampleDB fields in the first row.
private  int lookupFieldIndex(java.lang.String field)
          lookupFieldIndex() - lookup field index in the tFields[0:tCols-1] data.
 boolean readSamplesFile()
          readSamplesFile() - read Config/SamplesDB-fn.txt file into mcd state.
 boolean writeSamplesFile()
          writeSamplesFile() - create Config/SamplesDB-fn.txt file As a minimum it writes the following to mcd.samplesFile:
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mcd

public MaeConfigData mcd
link to global MaeConfigData database

tFields

private java.lang.String[] tFields
Field names in the table

tData

private java.lang.String[][] tData
[0:tRows-1][0:tCols-1] table data that is actually a 1D array [0:tRows-1] of rowData[0:tCols-1]

tRows

private int tRows
# of rows in the table

tCols

private int tCols
# of columns in the table

idxSample_ID

private int idxSample_ID
idx of "Sample_ID" field

idxProject

private int idxProject
idx of "Project" field

idxDatabase_File

private int idxDatabase_File
idx of "Database_File" field
Constructor Detail

MaeSampleData

public MaeSampleData(MaeConfigData mcd)
MaeSampleData() - constructor
Parameters:
mcd - is instance of MaeConfigData
Method Detail

lookupFieldIndex

private int lookupFieldIndex(java.lang.String field)
lookupFieldIndex() - lookup field index in the tFields[0:tCols-1] data.
Parameters:
field - to lookup
Returns:
index value >=0 if found, else return -1.

findSampleFields

private boolean findSampleFields()
findSampleFields() - find SampleDB fields in the first row.
Returns:
true if all fields are present.
See Also:
lookupFieldIndex(java.lang.String)

readSamplesFile

public boolean readSamplesFile()
readSamplesFile() - read Config/SamplesDB-fn.txt file into mcd state. As a minimum it reads the following from mcd.samplesFile:
  File Field            MaeConfigData (mcd) variable
  ============          ============================
  "Sample_ID"           mcd.quantName[0:mcd.nQuantFiles-1]
  "Project"             mcd.prjName[0:mcd.nQuantFiles-1)
  "Database_File"       mcd.quantName[0:mcd.nQuantFiles-1]
Returns:
true if succeed.

writeSamplesFile

public boolean writeSamplesFile()
writeSamplesFile() - create Config/SamplesDB-fn.txt file As a minimum it writes the following to mcd.samplesFile:
  File Field            MaeConfigData (mcd) variable
  ============          ============================
  "Sample_ID"           mcd.quantName[0:mcd.nQuantFiles-1]
  "Project"             mcd.prjName[0:mcd.nQuantFiles-1]
  "Database_File"       mcd.quantName[0:mcd.nQuantFiles-1]
Returns:
true if succeed.