O2Plib.db
Class DbPairSamples

java.lang.Object
  extended by O2Plib.db.DbPairSamples

public class DbPairSamples
extends java.lang.Object

Class DbPairSamples is the Sample Paired-spots File (SPF) state for spot pairing modules in Open2Dprot.

The data in the SPF instance, e.g., xxxx, could be a file xxxx-SPF.txt (tab-delimited) or xxxx-SPF.xml. It could later reside in the RDBMS. This class has readers and writers for both the tab-delimited and XML versions.

When creating the SPF data initially or in writing it out, the actual spot features are stored in DbSpot instances in the DbSample spotList entries for each sample in its corresponding DbSample objects. The DbSpot instances contain links to paired spots as well as the dP, dL, pairingCode and other pairing metrics. This pairing database instance contains global pairing data and statistics. It contains links to landmark set spot lists but does not contain individual paired links to paired spots between samples (these are in the spots themselves).

NOTE: When the SPF file is read back, it is stored in DbPspot objects that encode both the Rsample and the Sample values. This makes it possible to have more than one Rsample in a set of SPF data files.

This file is derived from Open2Dprot earilier CmpSpots's DbSPF.java and old GELLAB-II cmpgl2.c 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/10/21 16:01:38 $ $Revision: 1.34 $
Author:
P. Lemkin, NCI-Frederick, Frederick, MD, 21702

Nested Class Summary
(package private)  class DbPairSamples.SpfContentHandler
          This class implements the SAX ContentHandler interface and defines callback behavior for the SAX callbacks associated with an XML document's content, stuffing data structures with correct data from xml files.
(package private)  class DbPairSamples.SpfErrorHandler
          SpfErrorHandlerclass implements the SAX ErrorHandler interface and defines callback behavior for the SAX callbacks associated with an XML document's warnings and errors.
 
Field Summary
static int AP
          Ambiguous Pair - pairing program generated label
static int CP
          Composite Sample Database spot pair.
 java.lang.String dateSPF
          date read from SPF file
 DbLM dbLM
          Landmark database object
 DbSample dbRsample
          Rsample object
 DbSample dbSample
          Sample object
 boolean dbugEpilogueFlag
          epilogue debug flag
 boolean dbugFlag
          generic debug flag
 int dBugLMnbr
          -DEBUG:bits,LMset# (not letter)
 boolean dbugPairsFlag
          pairs of spots debug flag
 boolean dbugPrefaceFlag
          preface debug flag
 int defNbrAltLMs
          default # of alternate paired landmarks (N3).
 float dLmax
          Maximum dL of any spot in DB
static boolean DO_CLIP_DP_DL
          set true if clip max of dP and dL
static boolean DO_CLIP_DX_DY
          If true, then clip dX and dY
 float dPmax
          Maximum dP of any spot in DB
 float dPmTot
          global spot statistics: sum dP for Rsample only
 float dt1Threshold
          distance threshold T1 for determining SP pairs.
 float dt2Threshold
          distance threshold T2 for determining PP pairs.
static int EP
          Extrapolated Pair - by CSD database program
 java.lang.String globalStats
          global statistics generated by pairing analysis
static int GS
          Garbage Spot - generated by CSD database or editing programs
 int hAP1
          Histogram label statistics
 int hAP2
          Histogram label statistics
 int hCP1
          Histogram label statistics
 int hCP2
          Histogram label statistics
 int hEP1
          Histogram label statistics
 int hEP2
          Histogram label statistics
 int[] histCode
          Histogram [0:11] of SPF label frequencies:
 int hPP1
          Histogram label statistics
 int hPP2
          Histogram label statistics
 int hSP1
          Histogram label statistics
 int hSP2
          Histogram label statistics
 int hUS1
          Histogram label statistics
 int hUS2
          Histogram label statistics
 int idxRsample
          index of Rsample instance in CSD database.
 int idxSample
          Index of Sample instance in CSD database.
static int LM
          LandMark spot [could be virtual landmark] - by CSD database program
static int MAX_DL
          max dL value allowed if clip
static float MAX_DP
          max dP value allowed if clip
static int MAX_DX_DY
          |dX| and |dY| if clip
 float meanDP_SP_PP
          global spot statistics: mean dP for Rsample only
 float meanDPprime_SP_PP
          global spot statistics: adjusted mean meanDP_SP_PP for Rsample only
 int minNbrLMSspots
          Math.min(nbrRsampleSpotsInLMS,nbrSampleSpotsInLMS);
 int nbrRsampleSpotsInLMS
          total # spots we hold in the LM sets for Rsample
 int nbrRsampleSpotsInLMSPairedSPorPP
          # spots paired with the Rsample SP or PP label
 int nbrSampleSpotsInLMS
          total # spots we hold in the LM sets for Sample
 java.lang.String pairingStats
          Complete pairing statistics multiline string
static int PP
          Possible Pair - pairing program generated label
 float primary_SP_PP_pairRate
          Percentage: (50.0F*(hSP1+hPP1))/minNbrLMSspots Where minNbrLMSspots= min(nbrRsampleSpotsInLMS,nbrSampleSpotsInLMS)
 java.lang.String projDir
          Project directory set by main program
 java.lang.String projDirSPF
          Project directory read from SPF file
 int rAreaMax
           
 int rAreaMin
          Minimum Rsample area of any spot in DB
 float rDprimeMax
          Maximum Rsample dPrime (density) of any spot in DB
 float rDprimeMin
          Minimum Rsample dPrime (density) of any spot in DB
 float rMaxDmax
          Maximum Rsample maxD of any spot in DB
 float rMinDmax
          minimum Rsample minD of any spot in DB
static int RSAMPLE
          The index for the Rsample (Reference Sample)
 float rVolumeMax
          Maximum Rsample volume (density) of any spot in DB
 float rVolumeMin
          Minimum Rsample volume (density) of any spot in DB
static int SAMPLE
          The index for the Sample to be paired with the Rsample
 int sAreaMax
          Maximum Sample area of any spot in DB
 int sAreaMin
          Minimum Sample area of any spot in DB
 float sDprimeMax
          Maximum Sample dPrime (density) of any spot in DB
 float sDprimeMin
          Minimum Sample dPrime (density) of any spot in DB
 float secondary_SP_PP_pairRate
          Percentage: (50.0F*(hSP2+hPP2))/minNbrLMSspots Where minNbrLMSspots= min(nbrRsampleSpotsInLMS,nbrSampleSpotsInLMS)
static int shortSPFlmNbr
          Landmark number used for restricting SPF data read to Pspots belonging to Landmark shortSPFlmNbr.
 float sMaxDmax
          Maximum Sample maxD of any spot in DB
 float sMinDmax
          minimum Sample minD of any spot in DB
static int SP
          Sure Pair - pairing program generated label
static java.lang.String SPF_VERSION
          The Open2Dprot Sample Paired-spot File (SPF) version
 boolean spfCWSwitch
          Debugging switch.
 int spfCWX1
           
 int spfCWX2
           
 int spfCWY1
           
 int spfCWY2
           
 java.io.FileWriter spfFD
          output SPF file stream
 java.lang.String[] spfFieldNames
          SPF database fields for these samples if not null
 java.lang.String spfFile
          full path xml/ Sample Paired-Spotlist Files (SPF) full path input file.
 java.lang.String spfInputFile
          name of SPF input file from file [FUTURE]
 int spfInputFormatMode
          SPF input file mode: Allowed: FileIO.IO_FORMAT_TAB_DELIM, IO_FORMAT_XML
static java.lang.String spfOutputEpilogueFile
          full tab-delim EPILOGUE xml/ (Sample Pairs File) full path
 java.lang.String spfOutputFile
          SPF either tab-delim xml/ Sample Paired Spot-list File full path
 int spfOutputFormatMode
          SPF output ample Paired Spot-list File mode: Allowed: FileIO.IO_FORMAT_TAB_DELIM, IO_FORMAT_XML
static java.lang.String spfOutputPrefaceFile
          full tab-delim PREFACE xml/ (Sample Pairs File) full path
 java.lang.String[] spfRowData
          SPF database data for these samples if not null
 float sVolumeMax
          Maximum Sample volume (density) of any spot in DB
 float sVolumeMin
          Minimum Sample volume (density) of any spot in DB
 Table tspf
           
static int US
          Unresolved Spot - pairing program generated label
static boolean USE_DOM_XML_SPF
          Use DOM/JDOM/...
 boolean useCsampleFlag
          use Csample extensions to SPF file.
 boolean useInternalDTDflag
          Use internal "Open2Dprot-SPF.dtd" file in SPF XML output file.
 boolean usePercentDensitySwitch
          When generating SPF files, use percent of density D' rather than density D'.
static java.lang.String VERSION
          Version for this module
 java.lang.String versionSPF
          version read from SPF file
 
Constructor Summary
DbPairSamples()
          DbPairSamples() - setup DbPairSamples database
DbPairSamples(DbSample dbRsample, DbSample dbSample, DbLM dbLM)
          DbPairSamples() - setup DbPairSamples instance of the database
 
Method Summary
 java.lang.String calcStatistics()
          calcStatistics() - compute the paired spot statistics
 java.lang.String getSampleSPFstr()
          getSampleSPFstr() - get printable data including SPF name/value row for this sample
 java.lang.String getSpotPairStr(DbSpot sp)
          getSpotPairStr() - get the paired spot string that identifies the samples, LM sets, LM coords,, dP, dL
 void init()
          init() - init the DbSPF state.
 void initMaxima()
          initMaxima() - initialize the feature maxima and minima
 boolean pushSpotPair(DbPspot sS)
          pushSpotPair() - push DbPspot spots pair of into spotLists and adjust spot pairing data.
 boolean pushSpotPair(DbSpot rS, DbSpot sS)
          pushSpotPair() - push DbSpot spots pair into spotLists and adjust spot pairing data.
 java.lang.String readSPFdata(java.lang.String projDir, java.lang.String spfInputFile, int spfInputFormatMode)
          readSPFdata() - Read sample Sample Paired-spotlist Files (SPF) into a linked list data base of DbPair objects.
 boolean readSPFpairedSpotsXML(java.lang.String XMLfileName, DbPairSamples dbPS)
          readSPFpairedSpotsXML() - read SPF sample paired spot-list data from XML file.
 boolean readSpfTabDelimTable(java.lang.String spfFile)
          readSpfTabDelimTable() - read SSF tab-delimited file data.
 void reset()
          reset() - reset the DbSPF state for current sample.
 boolean rmvSPFlistsAndTable()
          rmvSPFlistsAndTable() - remove the SSF and SPF spot lists and Tables if they exist.
 void setCsamplesFlag(boolean useCsampleFlag)
          setCsamplesFlag() - use Csample extensions to SPF file.
 void setDbugFlag(boolean dbugFlag)
          setDbugFlag() - set the generic dbugFlag
 void setEpilogueDbugFlag(boolean aDbugEpilogueFlag)
          setEpilogueDbugFlag() - set the epilogue dbugEpilogFlag
 void setPairingThresholds(float dt1Threshold, float dt2Threshold, int defNbrAltLMs)
          setPairingThresholds() - Set the default pairing thresholds: (dt1Threshold, dt2Threshold, defNbrAltLMs)
 void setPairSamples(DbSample dbRsample, DbSample dbSample, DbLM dbLM)
          setPairSamples() - setup DbSPF instance of the database and reset data
 void setPairsDbugFlag(boolean dbugPairsFlag, int dBugLMnbr)
          setPairsDbugFlag() - set the preface dbugPairsFlag
 void setPercentDensityFlag(boolean usePercentDensitySwitch)
          setPercentDensityFlag() - set flag used when generating SPF files, use percent of density D' rather than density D'.
 void setPercentDensityFlag(int lmNbr)
          setShortSPFbyLMnbr() - set flag used when reading SPF files.
 void setPrefaceDbugFlag(boolean dbugPrefaceFlag)
          setPrefaceDbugFlag() - set the preface dbugPrefaceFlag
 void setSPFdebugCW(boolean spfCWflag, int dbCWX1, int dbCWY1, int dbCWX2, int dbCWY2)
          setSPFdebugCW() - enable/disable debug computing window to restrict data read when test if dbRsample/dbSample p.(xMom,yMom) in SPF CW for debugging.
 void setSPFinputNames(java.lang.String projDir, java.lang.String spfInputFile, int spfInputFormatMode)
          setSPFinputNames() - set the DbPairSamples SPF input file names.
 void setSPFoutputNames(java.lang.String spfOutputFile, int spfOutputFormatMode, java.lang.String projDir)
          setSPFoutputNames() - set the DbPairSamples SPF output file names.
 void setUseInternalDTDflag(boolean useInternalDTDflag)
          setUseInternalDTDflag() - set the use internal DTD flag.
 boolean writeEntireDOM_XML(java.lang.String outputFile)
          writeEntireDOM_XML() - write the entire SPF file into an XML file using DOM/JDOM/...
 boolean writeEntireSPF(java.lang.String projDir, java.lang.String spfOutputFile, int spfOutputFormatMode)
          writeEntireSPF() - write the entirepaired-spots SPF file.
 boolean writeEntireSPF(java.lang.String bannerTitle, java.lang.String swStr, java.lang.String filesUsed, java.lang.String projDir, java.lang.String spfOutputFile, int spfOutputFormatMode)
          writeEntireSPF() - write the entirepaired-spots SPF file.
 boolean writeSPFfinish(java.lang.String filesUsed)
          writeSPFfinish() - finish and close the SPF output stream in spfFD.
 boolean writeSPFpairedSpots()
          writeSPFpairedSpots() - dump paired spot list data base into SPF output stream in spfFD.
 boolean writeSPFpreface(java.lang.String bannerTitle, java.lang.String swStr)
          writeSPFpreface() - Dump the SPF preface to the SPF output stream in spfFD.
 boolean writeStatisticsToSPFfile()
          writeStatisticsToSPFfile() - Dump the epilogue consisting of the paired spot statistics to the SPF output stream in spfFD.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

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

See Also:
Constant Field Values

SPF_VERSION

public static final java.lang.String SPF_VERSION
The Open2Dprot Sample Paired-spot File (SPF) version

See Also:
Constant Field Values

USE_DOM_XML_SPF

public static boolean USE_DOM_XML_SPF
Use DOM/JDOM/... XML SPF output writer instead of print statements


RSAMPLE

public static final int RSAMPLE
The index for the Rsample (Reference Sample)

See Also:
Constant Field Values

SAMPLE

public static final int SAMPLE
The index for the Sample to be paired with the Rsample

See Also:
Constant Field Values

US

public static final int US
Unresolved Spot - pairing program generated label

See Also:
Constant Field Values

SP

public static final int SP
Sure Pair - pairing program generated label

See Also:
Constant Field Values

PP

public static final int PP
Possible Pair - pairing program generated label

See Also:
Constant Field Values

AP

public static final int AP
Ambiguous Pair - pairing program generated label

See Also:
Constant Field Values

EP

public static final int EP
Extrapolated Pair - by CSD database program

See Also:
Constant Field Values

CP

public static final int CP
Composite Sample Database spot pair. The CSD' is a statistical representation of a set of effective sample replicates generated by the database program.

See Also:
Constant Field Values

GS

public static final int GS
Garbage Spot - generated by CSD database or editing programs

See Also:
Constant Field Values

LM

public static final int LM
LandMark spot [could be virtual landmark] - by CSD database program

See Also:
Constant Field Values

DO_CLIP_DP_DL

public static boolean DO_CLIP_DP_DL
set true if clip max of dP and dL


MAX_DP

public static float MAX_DP
max dP value allowed if clip


MAX_DL

public static int MAX_DL
max dL value allowed if clip


DO_CLIP_DX_DY

public static boolean DO_CLIP_DX_DY
If true, then clip dX and dY


MAX_DX_DY

public static int MAX_DX_DY
|dX| and |dY| if clip


dbRsample

public DbSample dbRsample
Rsample object


dbSample

public DbSample dbSample
Sample object


idxSample

public int idxSample
Index of Sample instance in CSD database.


idxRsample

public int idxRsample
index of Rsample instance in CSD database.


spfFile

public java.lang.String spfFile
full path xml/ Sample Paired-Spotlist Files (SPF) full path input file.


spfInputFile

public java.lang.String spfInputFile
name of SPF input file from file [FUTURE]


spfInputFormatMode

public int spfInputFormatMode
SPF input file mode: Allowed: FileIO.IO_FORMAT_TAB_DELIM, IO_FORMAT_XML


useInternalDTDflag

public boolean useInternalDTDflag
Use internal "Open2Dprot-SPF.dtd" file in SPF XML output file.


useCsampleFlag

public boolean useCsampleFlag
use Csample extensions to SPF file. This is normally off since it takes a lot of space and is not often used.


shortSPFlmNbr

public static int shortSPFlmNbr
Landmark number used for restricting SPF data read to Pspots belonging to Landmark shortSPFlmNbr. It does not restrict the SPF if it is -1. NOTE: this is used primarily for DEBUGGING.


spfOutputFile

public java.lang.String spfOutputFile
SPF either tab-delim xml/ Sample Paired Spot-list File full path


spfOutputPrefaceFile

public static java.lang.String spfOutputPrefaceFile
full tab-delim PREFACE xml/ (Sample Pairs File) full path


spfOutputEpilogueFile

public static java.lang.String spfOutputEpilogueFile
full tab-delim EPILOGUE xml/ (Sample Pairs File) full path


spfOutputFormatMode

public int spfOutputFormatMode
SPF output ample Paired Spot-list File mode: Allowed: FileIO.IO_FORMAT_TAB_DELIM, IO_FORMAT_XML


spfFD

public java.io.FileWriter spfFD
output SPF file stream


projDir

public java.lang.String projDir
Project directory set by main program


projDirSPF

public java.lang.String projDirSPF
Project directory read from SPF file


dateSPF

public java.lang.String dateSPF
date read from SPF file


versionSPF

public java.lang.String versionSPF
version read from SPF file


dbLM

public DbLM dbLM
Landmark database object


globalStats

public java.lang.String globalStats
global statistics generated by pairing analysis


nbrRsampleSpotsInLMS

public int nbrRsampleSpotsInLMS
total # spots we hold in the LM sets for Rsample


nbrSampleSpotsInLMS

public int nbrSampleSpotsInLMS
total # spots we hold in the LM sets for Sample


minNbrLMSspots

public int minNbrLMSspots
Math.min(nbrRsampleSpotsInLMS,nbrSampleSpotsInLMS);


nbrRsampleSpotsInLMSPairedSPorPP

public int nbrRsampleSpotsInLMSPairedSPorPP
# spots paired with the Rsample SP or PP label


primary_SP_PP_pairRate

public float primary_SP_PP_pairRate
Percentage: (50.0F*(hSP1+hPP1))/minNbrLMSspots Where minNbrLMSspots= min(nbrRsampleSpotsInLMS,nbrSampleSpotsInLMS)


secondary_SP_PP_pairRate

public float secondary_SP_PP_pairRate
Percentage: (50.0F*(hSP2+hPP2))/minNbrLMSspots Where minNbrLMSspots= min(nbrRsampleSpotsInLMS,nbrSampleSpotsInLMS)


hUS1

public int hUS1
Histogram label statistics


hSP1

public int hSP1
Histogram label statistics


hPP1

public int hPP1
Histogram label statistics


hAP1

public int hAP1
Histogram label statistics


hCP1

public int hCP1
Histogram label statistics


hEP1

public int hEP1
Histogram label statistics


hUS2

public int hUS2
Histogram label statistics


hSP2

public int hSP2
Histogram label statistics


hPP2

public int hPP2
Histogram label statistics


hAP2

public int hAP2
Histogram label statistics


hCP2

public int hCP2
Histogram label statistics


hEP2

public int hEP2
Histogram label statistics


pairingStats

public java.lang.String pairingStats
Complete pairing statistics multiline string


meanDP_SP_PP

public float meanDP_SP_PP
global spot statistics: mean dP for Rsample only


dPmTot

public float dPmTot
global spot statistics: sum dP for Rsample only


meanDPprime_SP_PP

public float meanDPprime_SP_PP
global spot statistics: adjusted mean meanDP_SP_PP for Rsample only


histCode

public int[] histCode
Histogram [0:11] of SPF label frequencies:
   where: 0:5 are primary US,SP,PP,AP,EP,CP
          6:11 are secondary US,SP,PP,AP,EP,CP.
 
NOTE: the two CC# spots in a legitimate pair such as SP, PP etc are counted TWICE - once for each sample. This should be reset to 0 values at the start of each run.


rAreaMax

public int rAreaMax

sAreaMax

public int sAreaMax
Maximum Sample area of any spot in DB


rAreaMin

public int rAreaMin
Minimum Rsample area of any spot in DB


sAreaMin

public int sAreaMin
Minimum Sample area of any spot in DB


dLmax

public float dLmax
Maximum dL of any spot in DB


dPmax

public float dPmax
Maximum dP of any spot in DB


rDprimeMax

public float rDprimeMax
Maximum Rsample dPrime (density) of any spot in DB


sDprimeMax

public float sDprimeMax
Maximum Sample dPrime (density) of any spot in DB


rDprimeMin

public float rDprimeMin
Minimum Rsample dPrime (density) of any spot in DB


sDprimeMin

public float sDprimeMin
Minimum Sample dPrime (density) of any spot in DB


rVolumeMax

public float rVolumeMax
Maximum Rsample volume (density) of any spot in DB


sVolumeMax

public float sVolumeMax
Maximum Sample volume (density) of any spot in DB


rVolumeMin

public float rVolumeMin
Minimum Rsample volume (density) of any spot in DB


sVolumeMin

public float sVolumeMin
Minimum Sample volume (density) of any spot in DB


rMaxDmax

public float rMaxDmax
Maximum Rsample maxD of any spot in DB


sMaxDmax

public float sMaxDmax
Maximum Sample maxD of any spot in DB


rMinDmax

public float rMinDmax
minimum Rsample minD of any spot in DB


sMinDmax

public float sMinDmax
minimum Sample minD of any spot in DB


usePercentDensitySwitch

public boolean usePercentDensitySwitch
When generating SPF files, use percent of density D' rather than density D'.


dt1Threshold

public float dt1Threshold
distance threshold T1 for determining SP pairs. Set by -thrSP:


dt2Threshold

public float dt2Threshold
distance threshold T2 for determining PP pairs. Set by -thrPP:


defNbrAltLMs

public int defNbrAltLMs
default # of alternate paired landmarks (N3). Set by -altLandmarks:.


dbugFlag

public boolean dbugFlag
generic debug flag


dbugPrefaceFlag

public boolean dbugPrefaceFlag
preface debug flag


dbugPairsFlag

public boolean dbugPairsFlag
pairs of spots debug flag


dbugEpilogueFlag

public boolean dbugEpilogueFlag
epilogue debug flag


dBugLMnbr

public int dBugLMnbr
-DEBUG:bits,LMset# (not letter)


spfCWSwitch

public boolean spfCWSwitch
Debugging switch. Test if dbRsample/dbSample p.(xMom,yMom) in SPF CW for debugging. In which case limit spots to those within the CW.


spfCWX1

public int spfCWX1

spfCWY1

public int spfCWY1

spfCWX2

public int spfCWX2

spfCWY2

public int spfCWY2

tspf

public Table tspf

spfFieldNames

public java.lang.String[] spfFieldNames
SPF database fields for these samples if not null


spfRowData

public java.lang.String[] spfRowData
SPF database data for these samples if not null

Constructor Detail

DbPairSamples

public DbPairSamples()
DbPairSamples() - setup DbPairSamples database


DbPairSamples

public DbPairSamples(DbSample dbRsample,
                     DbSample dbSample,
                     DbLM dbLM)
DbPairSamples() - setup DbPairSamples instance of the database

Parameters:
dbRsample - is Rsample
dbSample - is Sample
dbLM - is landmark set being used
Method Detail

setPairSamples

public void setPairSamples(DbSample dbRsample,
                           DbSample dbSample,
                           DbLM dbLM)
setPairSamples() - setup DbSPF instance of the database and reset data

Parameters:
dbRsample - is Rsample
dbSample - is Sample
dbLM - is landmark set being used

setSPFinputNames

public void setSPFinputNames(java.lang.String projDir,
                             java.lang.String spfInputFile,
                             int spfInputFormatMode)
setSPFinputNames() - set the DbPairSamples SPF input file names.

Parameters:
projDir - is the project directory
spfInputFile - is the SPF input file name
spfInputFormatMode - is the FileIO.IO_FORMAT_xxx mode.

setSPFoutputNames

public void setSPFoutputNames(java.lang.String spfOutputFile,
                              int spfOutputFormatMode,
                              java.lang.String projDir)
setSPFoutputNames() - set the DbPairSamples SPF output file names.

Parameters:
spfOutputFile - is the SPF output file name
spfOutputFormatMode - is the FileIO.IO_FORMAT_xxx mode.
projDir - is the project directory

setPercentDensityFlag

public void setPercentDensityFlag(int lmNbr)
setShortSPFbyLMnbr() - set flag used when reading SPF files. This landmark number is used for restricting XML SPF data read to Pspots belonging to Landmark shortSPFlmNbr. It does not restrict the SPF if it is -1. NOTE: this is used primarily for DEBUGGING.

Parameters:
lmNbr - to use in filtering Pspots

setPercentDensityFlag

public void setPercentDensityFlag(boolean usePercentDensitySwitch)
setPercentDensityFlag() - set flag used when generating SPF files, use percent of density D' rather than density D'.

Parameters:
usePercentDensitySwitch - status to set

setPairingThresholds

public void setPairingThresholds(float dt1Threshold,
                                 float dt2Threshold,
                                 int defNbrAltLMs)
setPairingThresholds() - Set the default pairing thresholds: (dt1Threshold, dt2Threshold, defNbrAltLMs)

Parameters:
dt1Threshold - limit is upper DP limit for SP labels
dt2Threshold - limit is upper DP limit for PP labels
defNbrAltLMs - is # of alternate landmark sets to check

setDbugFlag

public void setDbugFlag(boolean dbugFlag)
setDbugFlag() - set the generic dbugFlag

Parameters:
dbugFlag - status to set

setUseInternalDTDflag

public void setUseInternalDTDflag(boolean useInternalDTDflag)
setUseInternalDTDflag() - set the use internal DTD flag. This is used to decide if add internal "Open2Dprot-SPF.dtd" file in SPF XML output file.

Parameters:
useInternalDTDflag - status to set

setPrefaceDbugFlag

public void setPrefaceDbugFlag(boolean dbugPrefaceFlag)
setPrefaceDbugFlag() - set the preface dbugPrefaceFlag

Parameters:
dbugPrefaceFlag - status to set

setPairsDbugFlag

public void setPairsDbugFlag(boolean dbugPairsFlag,
                             int dBugLMnbr)
setPairsDbugFlag() - set the preface dbugPairsFlag

Parameters:
dbugPairsFlag - status to set
dBugLMnbr - is the landmark set to debug

setEpilogueDbugFlag

public void setEpilogueDbugFlag(boolean aDbugEpilogueFlag)
setEpilogueDbugFlag() - set the epilogue dbugEpilogFlag

Parameters:
dbugEpilogFlag - status to set

setCsamplesFlag

public void setCsamplesFlag(boolean useCsampleFlag)
setCsamplesFlag() - use Csample extensions to SPF file. This is normally off since the Csample data for each spot takes a lot of space and is not often used.

Parameters:
useCsampleFlag - status to set

setSPFdebugCW

public void setSPFdebugCW(boolean spfCWflag,
                          int dbCWX1,
                          int dbCWY1,
                          int dbCWX2,
                          int dbCWY2)
setSPFdebugCW() - enable/disable debug computing window to restrict data read when test if dbRsample/dbSample p.(xMom,yMom) in SPF CW for debugging. In which case limit spots to those within the CW.

Parameters:
spfCWSflag - is debugging switch.
dbWX1 - is debug window X1
dbCWY1 - is debug window Y1
dbCWX2 - is debug window X2
dbCWY2 - is debug window Y2

reset

public void reset()
reset() - reset the DbSPF state for current sample. This should be called at the start of a new session.


init

public void init()
init() - init the DbSPF state.


rmvSPFlistsAndTable

public boolean rmvSPFlistsAndTable()
rmvSPFlistsAndTable() - remove the SSF and SPF spot lists and Tables if they exist. We may want to call this from the CSD after the data has been copied to the CSD Rspot database. The G.C. should be called separately. Do not G.C. the Rsample lists.

Returns:
true if succeed.

pushSpotPair

public boolean pushSpotPair(DbSpot rS,
                            DbSpot sS)
pushSpotPair() - push DbSpot spots pair into spotLists and adjust spot pairing data. This pushes the spots into separate spot lists associated with each sample (i.e., dbRsample and dbSample).

Parameters:
rs - is Rsample DbSpot spot to push
ss - is Sample DbSpot spot to push
Returns:
true if succeed.

initMaxima

public void initMaxima()
initMaxima() - initialize the feature maxima and minima


pushSpotPair

public boolean pushSpotPair(DbPspot sS)
pushSpotPair() - push DbPspot spots pair of into spotLists and adjust spot pairing data. This pushes the spots into a paired spot list associated with dbSample (not with dbRsample). Note: the DbPspot encodes data for both the spots in the pair.

Parameters:
ss - is Sample DbPspot to push
Returns:
true if succeed.

calcStatistics

public java.lang.String calcStatistics()
calcStatistics() - compute the paired spot statistics

Returns:
the pairingStats of the statistics

getSampleSPFstr

public java.lang.String getSampleSPFstr()
getSampleSPFstr() - get printable data including SPF name/value row for this sample

Returns:
printable string

getSpotPairStr

public java.lang.String getSpotPairStr(DbSpot sp)
getSpotPairStr() - get the paired spot string that identifies the samples, LM sets, LM coords,, dP, dL

Parameters:
DbSpot - sp
Returns:
string if succeed

readSPFdata

public java.lang.String readSPFdata(java.lang.String projDir,
                                    java.lang.String spfInputFile,
                                    int spfInputFormatMode)
readSPFdata() - Read sample Sample Paired-spotlist Files (SPF) into a linked list data base of DbPair objects. It also reads the parameters and summary info that is stored in this class instance. This method will read the file as either a tab-delimited file or as a .xml file.

Parameters:
projDir - is the project directory
spfInputFile - to read
spfInputFormatMode - is data file mode FileIO.IO_FORMAT_xxxx.
Returns:
report string containing printable spot counts if succeed, else null if a problem
See Also:
#readAllSsfSpotlistTables, #readSsfSpotlistXML

readSpfTabDelimTable

public boolean readSpfTabDelimTable(java.lang.String spfFile)
readSpfTabDelimTable() - read SSF tab-delimited file data. Note: this tab-delimited file input mode is depricated and the use of XML encouraged to implement the Open2Dprot data-exchange paradigm.
    xml/sample-SPF.txt  the spotlist data  
 which is equivalent to the data
    xml/sample-SPF.xml  
[TODO] return false until implemented.

Parameters:
spfFile - to read
Returns:
true if succeed

readSPFpairedSpotsXML

public boolean readSPFpairedSpotsXML(java.lang.String XMLfileName,
                                     DbPairSamples dbPS)
readSPFpairedSpotsXML() - read SPF sample paired spot-list data from XML file.
    xml/sample-SPF.xml  
[TODO]

Parameters:
XMLfileName - to read
Returns:
true if succeed

writeEntireSPF

public boolean writeEntireSPF(java.lang.String projDir,
                              java.lang.String spfOutputFile,
                              int spfOutputFormatMode)
writeEntireSPF() - write the entirepaired-spots SPF file. The data mode is determined by the spfFormatMode. This should only be called AFTER the spot pairing is finished and all data and spot statistics are available.

Parameters:
projDir - is the project directory
spfOutputFile - is the SPF output file name
spfOutputFormatMode - is the FileIO.IO_FORMAT_xxx mode.
Returns:
true if succeed

writeEntireSPF

public boolean writeEntireSPF(java.lang.String bannerTitle,
                              java.lang.String swStr,
                              java.lang.String filesUsed,
                              java.lang.String projDir,
                              java.lang.String spfOutputFile,
                              int spfOutputFormatMode)
writeEntireSPF() - write the entirepaired-spots SPF file. The data mode is determined by the spfFormatMode. This should only be called AFTER the spot pairing is finished and all data and spot statistics are available.

Parameters:
bannerTitle - - optional banner title for SPF file IO_FORMAT_FULL only
swStr - - optional switch list string SPF file IO_FORMAT_FULL only
filesUsed - is optional list of files used in generating the SPF.
projDir - is the project directory
spfOutputFile - is the SPF output file name
spfOutputFormatMode - is the FileIO.IO_FORMAT_xxx mode.
Returns:
true if succeed

writeEntireDOM_XML

public boolean writeEntireDOM_XML(java.lang.String outputFile)
writeEntireDOM_XML() - write the entire SPF file into an XML file using DOM/JDOM/... etc. This should only be called AFTER the spot pairing is finished and all data and spot statistics are available. [TODO] add DOM/JDOM ... code

Returns:
true if succeed

writeSPFpreface

public boolean writeSPFpreface(java.lang.String bannerTitle,
                               java.lang.String swStr)
writeSPFpreface() - Dump the SPF preface to the SPF output stream in spfFD.

Parameters:
bannerTitle - - optional banner title for SPF file IO_FORMAT_FULL only
swStr- - optional switch list string SPF file IO_FORMAT_FULL only
Returns:
true if succeed.

writeSPFpairedSpots

public boolean writeSPFpairedSpots()
writeSPFpairedSpots() - dump paired spot list data base into SPF output stream in spfFD. This writes out the paired sample data in terms of landmark sets. For each landmark set, it first writes out the (SP,PP,AP,US) for the Rsample (G1), then it writes out the (AP,US) for the Sample (G2).

Returns:
true if succeed.

writeStatisticsToSPFfile

public boolean writeStatisticsToSPFfile()
writeStatisticsToSPFfile() - Dump the epilogue consisting of the paired spot statistics to the SPF output stream in spfFD.

Returns:
true if succeed.

writeSPFfinish

public boolean writeSPFfinish(java.lang.String filesUsed)
writeSPFfinish() - finish and close the SPF output stream in spfFD.

Parameters:
filesUsed - is optional list of files used in generating the SPF.
Returns:
true if succeed