O2Plib.db.CSD
Class CSDio

java.lang.Object
  extended by O2Plib.db.CSD.CSDglb
      extended by O2Plib.db.CSD.CSDio

public class CSDio
extends CSDglb

Class CSDio contains the I/O methods for the Composite Samples Database (CSD).

 [TODO] Redo the paradigm to use CSDcache methods etc.
 Needs major refactoring to resolve old cgelp2 virtual
 paging of single page file with multiple paging files that
 are finally saved into the single CSD database.
This file is derived from Open2Dprot, MAExplorer and GELLAB-II cgelp2 code.

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 Open2Dprot Mozilla and Legal files are available on http://Open2Dprot.sourceforge.net/.

Version:
$Date: 2005/12/15 22:35:48 $ $Revision: 1.13 $
Author:
P. Lemkin, NCI-Frederick, Frederick, MD, 21702

Field Summary
 int actualSubHeaders
          actual# of CSD DB subheaders and it should be LEQ MAXSUBHEADERS.
 boolean corruptedFlag
          normally set false.
 java.lang.String csdBINfile
          full path CSD binary random access database file (.csd)
 java.io.RandomAccessFile csdFD
          Random access file descriptor for the bindary CSD
 long csdLength
          size of the file when opened
 java.lang.String csdRDBMSname
          Name of the CSD RDBMS database
 java.lang.String csdURL
          [FUTURE] optional URL path to relational database
 int firstERspot
          Rspot index of first eRspot if not 0
 int lastCacheBlock
          last block in CSD cache file
 int maxSubHeaders
          # of CSD DB subheaders and it should be equal to MAXSUBHEADERS
 int nbrRspotSets
          # of R-spot sets (ie==> max file size)
 boolean readOnlyCSDflag
          may not write CSD
 int rsetBlocks
          # blocks/Rset - from nSamples, (multiple of #nodes/block).
 int rSpotBaseBlock
          Base address of the Rspot Node part of the CSD DB
static java.lang.String VERSION
          Version for this module
 int zSpot
           
 
Fields inherited from class O2Plib.db.CSD.CSDglb
allSetSamples, AP, batchDir, BF_IS_LMS_SPOT, BF_ISVALIDSPOT, cacheDir, cdbIsOpenFlag, condListDB, CONSOLE_FLAG, CP, CSD_DBTYPE_CACHE, CSD_DBTYPE_RDBMS, CSD_DBTYPE_TAB_DELIM, CSD_DBTYPE_UNKNOWN, CSD_DBTYPE_XML, csdAcc, csdCache, csdCacheFile, csdDatabaseFile, csdFormatMode, csdIO, csdLMS, csdName, csdRdbmsFile, csdSizes, csdTabDelimFile, csdTotals, CSDversion, csdXMLfile, dataFiltersListDB, dateCreation, dateLastSession, dbRsample, dbSample, dbSamplesListDB, dbSPFlistsDB, dBugLMsetNbr, dBugPspotNbr, dBugRspotNbr, dBugSampleNbr, EP, epSetSamples, exprListsDB, GS, LM, MAX_NODE_SAFTY_FACTOR, mrl, nbrTimesInitialized, nCondListDB, nDataFiltersDB, needToSaveCSDdataFlag, NEVER, nExprListsDB, nOclDB, nodeSaftyFactor, normListDB, nRmapsDB, nRspotListsDB, nSamplesDB, nSPFfilesUsedDB, nSPFlistsDB, oclListDB, oclNameDB, PP, ppxDir, projDir, rdbmsDir, rMapsListDB, RSAMPLE, rspotListsDB, SAMPLE, sampleNamesDB, sampleNamesUsedDB, SP, tmpDir, US, useInternalDTDflag, wrkAnotation, wrkCalib, wrkERspot, wrkExpr, wrkSetSamples, xmlDir, xSetSamples, ySetSamples
 
Constructor Summary
CSDio()
          CSDio() - Constructor for new CSDio.
 
Method Summary
 boolean closeCSD()
          closeCSD() - flush the database and close it.
 boolean flushBinCSD()
          flushBinCSD() - flush the CSD if it is open and clear the state.
 boolean openBinCSD(java.lang.String csdName, java.lang.String csdBINfile, boolean readOnlyFlag)
          openBinCSD() - open a new CSD file.
 boolean setBinCSDfile(java.lang.String csdBINfile)
          setBinCSDfile() - change the current CSD
 java.lang.String toString()
          toString() - get a pretty-print string representation of this instance
 boolean writeCacheFiles(boolean useAnnotationFlag, boolean useNormFlag)
          writeCacheFiles() - Write out the CSD database as cache files into the csdCACHEfile file that should already be set up.
 boolean writeRDBMS(boolean useAnnotationFlag, boolean useNormFlag)
          writeRDBMS() - Write out the CSD database into the RDBMS using the the csdRDBMSfile file that should already be set up.
 java.lang.String[][] writeTabDelimitedFiles(boolean useAnnotationFlag, boolean useNormFlag)
          writeTabDelimitedFiles() - Write out the database as a set of tab-delimited files used the CSD database name as the prefix followed by the type of data followed by .txt.
 boolean writeXMLfile(boolean useAnnotationFlag, boolean useNormFlag)
          writeXMLfile() - Write out the CSD database as an XML file into the csdXMLfile file that should already be set up.
 
Methods inherited from class O2Plib.db.CSD.CSDglb
initGlb
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
Version for this module

See Also:
Constant Field Values

csdBINfile

public java.lang.String csdBINfile
full path CSD binary random access database file (.csd)


csdRDBMSname

public java.lang.String csdRDBMSname
Name of the CSD RDBMS database


csdURL

public java.lang.String csdURL
[FUTURE] optional URL path to relational database


csdFD

public java.io.RandomAccessFile csdFD
Random access file descriptor for the bindary CSD


csdLength

public long csdLength
size of the file when opened


readOnlyCSDflag

public boolean readOnlyCSDflag
may not write CSD


corruptedFlag

public boolean corruptedFlag
normally set false. It is set true by lockCSD(true) and false by lockCSD(false), and tested by setCurrentCSD()


zSpot

public int zSpot

rsetBlocks

public int rsetBlocks
# blocks/Rset - from nSamples, (multiple of #nodes/block).


nbrRspotSets

public int nbrRspotSets
# of R-spot sets (ie==> max file size)


firstERspot

public int firstERspot
Rspot index of first eRspot if not 0


lastCacheBlock

public int lastCacheBlock
last block in CSD cache file


actualSubHeaders

public int actualSubHeaders
actual# of CSD DB subheaders and it should be LEQ MAXSUBHEADERS. This would only be NEQ 0 if we keep the state in the same cache as the Rspot sets.


maxSubHeaders

public int maxSubHeaders
# of CSD DB subheaders and it should be equal to MAXSUBHEADERS


rSpotBaseBlock

public int rSpotBaseBlock
Base address of the Rspot Node part of the CSD DB

Constructor Detail

CSDio

public CSDio()
CSDio() - Constructor for new CSDio.

Method Detail

setBinCSDfile

public boolean setBinCSDfile(java.lang.String csdBINfile)
setBinCSDfile() - change the current CSD

Parameters:
csdBINfile - is the full path name of the new CSD database

flushBinCSD

public boolean flushBinCSD()
flushBinCSD() - flush the CSD if it is open and clear the state.

Returns:
true if successful

closeCSD

public boolean closeCSD()
closeCSD() - flush the database and close it.

Returns:
true if succeed

openBinCSD

public boolean openBinCSD(java.lang.String csdName,
                          java.lang.String csdBINfile,
                          boolean readOnlyFlag)
openBinCSD() - open a new CSD file. It sets csdFD and csdLength.

Parameters:
csdName - is the name of the new CSD database
csdBINfile - is the full path name of the new binary CSD database
readOnlyFlag - is true if read only, else read,write
Returns:
true if successful

toString

public java.lang.String toString()
toString() - get a pretty-print string representation of this instance

Overrides:
toString in class java.lang.Object
Returns:
string representation of this instance

writeTabDelimitedFiles

public java.lang.String[][] writeTabDelimitedFiles(boolean useAnnotationFlag,
                                                   boolean useNormFlag)
writeTabDelimitedFiles() - Write out the database as a set of tab-delimited files used the CSD database name as the prefix followed by the type of data followed by .txt.
Data types include: TOTALS, SIZES, RSL (Rspots list), COND (Condition list of samples), RMAP (Rmap list). There may be multiple RSL and COND objects.

Parameters:
useAnnotationFlag - - to add annotation fields
useNormFlag - - to add normalization fields
Returns:
a list of the file names if succeed, else null. The fields are assigned as [0] data type, [1] Name, [2] baseFile, [3] full file path.

writeXMLfile

public boolean writeXMLfile(boolean useAnnotationFlag,
                            boolean useNormFlag)
writeXMLfile() - Write out the CSD database as an XML file into the csdXMLfile file that should already be set up.

Parameters:
useAnnotationFlag - - to add annotation fields
useNormFlag - - to add normalization fields
Returns:
true if successful

writeCacheFiles

public boolean writeCacheFiles(boolean useAnnotationFlag,
                               boolean useNormFlag)
writeCacheFiles() - Write out the CSD database as cache files into the csdCACHEfile file that should already be set up.
[TODO]

Parameters:
useAnnotationFlag - - to add annotation fields
useNormFlag - - to add normalization fields
Returns:
true if successful

writeRDBMS

public boolean writeRDBMS(boolean useAnnotationFlag,
                          boolean useNormFlag)
writeRDBMS() - Write out the CSD database into the RDBMS using the the csdRDBMSfile file that should already be set up.
[TODO]

Parameters:
useAnnotationFlag - - to add annotation fields
useNormFlag - - to add normalization fields
Returns:
true if successful