|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object O2Plib.db.DbAccession
public class DbAccession
Class DbAccession accesses the Open2Dprot accession database. The accession database is used to hold information about samples - one entry per sample. It contains two types of information: required information (see accFieldsRequired[]) and dynamic information that is not required or could be added from another source such as MIAPE data. The required data includes Sample name, the Rsample it was possibly paired with, the computing window (cwx1:cwx2, cwy1:cwy2), etc.
The data is kept in an accession database which could be a file accession.txt (tab-delimited) or accession.xml. It could later reside in the RDBMS. This class has readers and writers for both the tab-delimited and XML versions.
This file is derived from GELLAB-II code. as of "Version November 9, 1999" and code from Open2Dprot and MAExplorer projects.
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/.
Nested Class Summary | |
---|---|
(package private) class |
DbAccession.AccContentHandler
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 |
DbAccession.AccErrorHandler
AccErrorHandlerclass 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 java.lang.String[] |
accFields
Accession database table fields. |
static java.lang.String[] |
accFieldsDynamic
Dynamic accession database table fields. |
java.lang.String[] |
accFieldsNames
Sample accession fields if available in accession database |
static java.lang.String[] |
accFieldsRequired
Required accession database table fields |
int |
accFormatModeA
accession file data mode IO_FORMAT_xxxx |
java.lang.String[] |
accRowData
Sample accession data if available in accession database |
int |
calCWx1A
ULHC X computing window for input sample image wedge if any, else -1 |
int |
calCWx1Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
calCWx2A
LRHC X computing window for input sample image wedge if any, else -1 |
int |
calCWx2Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
calCWy1A
ULHC Y computing window for input sample image wedge if any, else -1 |
int |
calCWy1Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
calCWy2A
LRHC Y computing window for input sample image wedge if any, else -1 |
int |
calCWy2Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
cwx1A
ULHC X computing window for entire input sample image |
int |
cwx1Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
cwx2A
LRHC X computing window for entire input sample image |
int |
cwx2Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
cwy1A
ULHC Y computing window for entire input sample image |
int |
cwy1Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
cwy2A
LRHC Y computing window for entire input sample image |
int |
cwy2Idx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
static java.lang.String[] |
defLegalImageFileExtens
List of legal gel image file extensions |
static boolean |
DYNAMIC_FIELDS
Use hash table for dynamic fields |
java.lang.String |
errMsg
Error message if not null |
java.util.Hashtable |
fieldsIdxHT
Hashtable for field names for accession database. |
boolean |
hasCalMapAFlag
has valid mapGrayToCalA[] data |
static java.lang.String[] |
helpList
Accession table help list |
static java.lang.String[] |
helpListDynamic
Dynamic accession table fields help list |
static java.lang.String[] |
helpListRequired
Required accession table fields help list |
int |
lastTaTableRowIdx
Last row found with lookupAccEntry() |
java.lang.String[] |
legalImageFileExtensA
List of legal input image file extensions. |
float[] |
mapGrayToCalA
Gray to calibration value calibration map if it exists. |
int |
maxCalStepsA
Number of wedge list calibration values if not 0 |
int |
maxGrayPixelA
max gray value allowed |
int |
maxPeaksA
Number of wedge list gray values if not 0 |
int |
pixHeightA
Input sample image size: height |
int |
PixHeightIdx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
pixRsampleIdx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
pixSampleIdx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int |
pixWidthA
Input sample image size: width |
int |
PixWidthIdx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
java.lang.String |
ppxDirA
Directory where input images are kept |
boolean |
processingXMLdataFlag
Processing the XML file |
java.lang.String |
sampleFileNameA
Accession sample name (without file extension) |
java.lang.String |
simpleSampleFileNameA
Simple sample file name with file extension |
Table |
ta
Accession database file table |
java.lang.String |
unitsA
calibration units |
java.lang.String |
unitsAbbrevA
calibration units abbreviation |
boolean |
useInternalDTDflag
Use internal "Open2Dprot-Accession.dtd" file in Accession.xml output file |
static java.lang.String |
VERSION
Version for this module |
int |
wedgeCalIdx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
float[] |
wedgeCalValuesA
list of calibration wedge calibration values if any |
int |
wedgeGrayIdx
Required accession database Table ta column field indices if tab-delimited tables are being used. |
int[] |
wedgeGrayValuesA
list of calibration wedge gray values if any |
java.lang.String |
xmlDate
XML accession file date "Date" |
java.lang.String |
xmlDBname
XML accession file database name value for "DatabaseName" |
Constructor Summary | |
---|---|
DbAccession()
Accession() - constructor for Accession |
Method Summary | |
---|---|
boolean |
addNewEntry(java.lang.String datum,
java.lang.String fieldName,
java.lang.String fillStr)
addNewEntry() - add a new row of data to accession table. |
boolean |
appendRowToTable(java.lang.String[] rowData)
appendRowToTable() - append accRowData[] data to accession table. |
void |
buildFullFieldLists()
buildFullFieldLists() - build full accFields[] and helpList[] arrays [TODO] Big time add MIAPE fields here... |
java.lang.String |
getAccEntryValueByFieldName(java.lang.String[] accRowData,
java.lang.String accFieldName)
getAccEntryValueByFieldName() - lookup accession entry data by field name (prefix) in the current ta. |
java.lang.String |
getAccEntryValueByIndex(java.lang.String[] rowData,
int fieldIdx)
getAccEntryValueByFieldIndex() - lookup entry in row data by field index in the current table. |
boolean |
initAccTblDynamicIndices()
initAccTblDynamicIndices() - init dynamic indices for accession table. |
boolean |
initAccTblIndices()
initAccTblIndices() - init the indices for the accession table. |
boolean |
initAccTblRequiredIndices()
initAccTblRequiredIndices() - init required indices for accession table. |
boolean |
isDynamicField(java.lang.String fName)
isDynamicField() - lookup dynamic Accession DB field data that is required (not dynamic) |
boolean |
isRequiredField(java.lang.String fName)
isRequiredField() - lookup required Accession DB field data that is required (not dynamic) |
java.lang.String[] |
listSamples()
listSamples() - list samples (one/line) in the accession file |
boolean |
loadAccessionDatabase(java.lang.String accFile,
java.lang.String ppxDir,
java.lang.String[] legalImageFileExtens,
int accFormatMode)
loadAccessionDatabase() - lookup and load the accession database. |
java.lang.String[] |
lookupAccEntry(java.lang.String accNameData,
java.lang.String accFieldName)
lookupAccEntry() - lookup accession row entry data in the accession database specified by the accFile. |
java.lang.String[] |
lookupAccEntryNoExtn(java.lang.String accNameData,
java.lang.String accFieldName)
lookupAccEntryNoExtn () - lookup accession row entry data in the accession database specified by the accFieldName's value of accNameData. |
boolean |
lookupAccessionTableIndices()
lookupAccessionTableIndices() - lookup SSF data table indices There may be additional fields. |
java.lang.String[] |
lookupAccTableFields()
lookupAccTableFields() - lookup accession database fields |
boolean |
lookupDynamicAccTableIndices()
lookupDynamicAccTableIndices() - lookup dynamic SSF data table indices There may be additional fields. |
int |
lookupFieldIdxFromHT(java.lang.String fName)
lookupFieldIdxFromHT() - lookup accession database field column index. |
boolean |
lookupRequiredAccTableIndices()
lookupRequiredAccTableIndices() - lookup required SSF data table indices. |
boolean |
lookupSampleInAccDB(java.lang.String accNameData,
java.lang.String accFieldName,
java.lang.String accFile)
lookupSampleInAccDB() - lookup the sample accNameData in the accession DB by the accession database accFieldName key. |
private boolean |
readAccessionXML(java.lang.String XMLfileName)
readAccessionXML() - read accession database data from XML file |
Table |
readAccTable(java.lang.String accFile)
readAccTable() - read the accession table from accFile |
boolean |
saveAccDB2DelimFile(java.lang.String accFile,
java.lang.String delim,
boolean makeBkupCopyFlag)
saveAccDB2DelimFile() - save the accession database into a delimited string file. |
boolean |
saveAccDB2XMLfile(java.lang.String accXMLfile,
boolean makeBkupCopyFlag)
saveAccDB2XMLfile() - save the accession database into an XML file. |
boolean |
saveAccDB2XMLfile(java.lang.String accXMLfile,
java.lang.String xmlDBname,
boolean makeBkupCopyFlag)
saveAccDB2XMLfile() - save the accession database into an XML file. |
boolean |
saveAccEntry(java.lang.String[] rowData,
java.lang.String accNameData,
java.lang.String accFieldName)
saveAccEntry() - save accession row entry data in the accession database. |
void |
setUseInternalDTDflag(boolean useInternalDTDflag)
setUseInternalDTDflag() - set the use internal DTD flag. |
boolean |
writeAccessionTable(java.lang.String accFile,
int accFormatMode,
boolean makeBkupCopyFlag)
writeAccessionTable() - write out the landmarks table in the specified format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
public static final boolean DYNAMIC_FIELDS
public static java.lang.String[] helpList
public static java.lang.String[] helpListRequired
public static java.lang.String[] helpListDynamic
public java.util.Hashtable fieldsIdxHT
public int pixSampleIdx
public int pixRsampleIdx
public int wedgeCalIdx
public int wedgeGrayIdx
public int cwx1Idx
public int cwx2Idx
public int cwy1Idx
public int cwy2Idx
public int calCWx1Idx
public int calCWx2Idx
public int calCWy1Idx
public int calCWy2Idx
public int PixWidthIdx
public int PixHeightIdx
public static java.lang.String[] accFieldsRequired
public static java.lang.String[] accFieldsDynamic
public static java.lang.String[] accFields
public Table ta
public int lastTaTableRowIdx
public java.lang.String[] accFieldsNames
public java.lang.String[] accRowData
public java.lang.String sampleFileNameA
public java.lang.String simpleSampleFileNameA
public int pixWidthA
public int pixHeightA
public int cwx1A
public int cwx2A
public int cwy1A
public int cwy2A
public int calCWx1A
public int calCWx2A
public int calCWy1A
public int calCWy2A
public float[] mapGrayToCalA
public float[] wedgeCalValuesA
public int[] wedgeGrayValuesA
public int maxGrayPixelA
public int maxCalStepsA
public int maxPeaksA
public java.lang.String unitsA
public java.lang.String unitsAbbrevA
public boolean hasCalMapAFlag
public java.lang.String xmlDBname
public java.lang.String xmlDate
public boolean processingXMLdataFlag
public boolean useInternalDTDflag
public java.lang.String ppxDirA
public java.lang.String[] legalImageFileExtensA
public int accFormatModeA
public static java.lang.String[] defLegalImageFileExtens
public java.lang.String errMsg
Constructor Detail |
---|
public DbAccession()
Method Detail |
---|
public void buildFullFieldLists()
public boolean loadAccessionDatabase(java.lang.String accFile, java.lang.String ppxDir, java.lang.String[] legalImageFileExtens, int accFormatMode)
accFile
- is the name of the accession fileppxDir
- directory holds the original imageslegalImageFileExtens
- is list of legal file extensions. If null,
then the default list will be used.accFormatMode
- is the format mode to use:
IO_FORMAT_XML or IO_FORMAT_TAB_DELIM
public boolean lookupSampleInAccDB(java.lang.String accNameData, java.lang.String accFieldName, java.lang.String accFile)
accNameData
- is the sample name data to search for.
If this is the sample image name, do not
specify the file extension.accFieldName
- is the accession field name keyaccFile
- is the name of the accession file
public Table readAccTable(java.lang.String accFile)
public java.lang.String[] listSamples()
public void setUseInternalDTDflag(boolean useInternalDTDflag)
useInternalDTDflag
- status to setpublic boolean writeAccessionTable(java.lang.String accFile, int accFormatMode, boolean makeBkupCopyFlag)
accFile
- - name of output accession file to be generated.accFormatMode
- - IO_FORMAT_TAB_DELIM or IO_FORMAT_XML formatmakeBkupCopyFlag
- - first make backup copy of file
with a .bak extension.
public boolean saveAccDB2XMLfile(java.lang.String accXMLfile, boolean makeBkupCopyFlag)
accXMLfile
- - name of XML file to be generated.makeBkupCopyFlag
- - make backup copy of file first with
.bak extension.
public boolean saveAccDB2XMLfile(java.lang.String accXMLfile, java.lang.String xmlDBname, boolean makeBkupCopyFlag)
accXMLfile
- - name of XML file to be generated.makeBkupCopyFlag
- - make backup copy of file first with
.bak extension.
public boolean saveAccDB2DelimFile(java.lang.String accFile, java.lang.String delim, boolean makeBkupCopyFlag)
accFile
- - name of delimted file to be generated.delim
- is the delimiter string (or character)makeBkupCopyFlag
- - make backup copy of file first with
.bak extension.
public boolean initAccTblIndices()
public boolean initAccTblRequiredIndices()
public boolean initAccTblDynamicIndices()
public boolean lookupAccessionTableIndices()
public boolean lookupRequiredAccTableIndices()
public boolean lookupDynamicAccTableIndices()
public int lookupFieldIdxFromHT(java.lang.String fName)
fName
- is field name to lookup in hashtable
public boolean isRequiredField(java.lang.String fName)
fName
- to test
public boolean isDynamicField(java.lang.String fName)
fName
- to test
public java.lang.String[] lookupAccTableFields()
public java.lang.String[] lookupAccEntry(java.lang.String accNameData, java.lang.String accFieldName)
accNameData
- is the accession value to search foraccFieldName
- is the accession field name
public boolean saveAccEntry(java.lang.String[] rowData, java.lang.String accNameData, java.lang.String accFieldName)
rowData
- is the data to be stored.accNameData
- is the accession value to search foraccFieldName
- is the accession field name
public java.lang.String[] lookupAccEntryNoExtn(java.lang.String accNameData, java.lang.String accFieldName)
accNameData
- is the accession value to search foraccFieldName
- is the accession field name
public java.lang.String getAccEntryValueByFieldName(java.lang.String[] accRowData, java.lang.String accFieldName)
accRowData
- is row of data to accessaccFieldName
- is the accession field name to get associated
data.public java.lang.String getAccEntryValueByIndex(java.lang.String[] rowData, int fieldIdx)
rowData
- is data row to usefieldIdx
- is the table field index to usepublic boolean appendRowToTable(java.lang.String[] rowData)
rowData
- is the row of data to append to the table.
public boolean addNewEntry(java.lang.String datum, java.lang.String fieldName, java.lang.String fillStr)
datum
- is the unique name to save in the fieldfieldName
- is the field to save the datumfillStr
- to use for the rest of the fields
private boolean readAccessionXML(java.lang.String XMLfileName)
XMLfileName
- to read
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |