|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object O2Plib.db.LMset O2Plib.db.DbLM
public class DbLM
Class DbLM is the Landmark database for Open2Dprot. It contains data for a subset of spots or virtual spots in two samples that are used to define local regions of congruence. These "spots" are called landmarks since they orient the local regions. The data is kept in a landmark database which could be a file landmark.txt (tab-delimited) or landmark.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 and refactored from Open2Dprot CmpSpots's DbLM.java
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 |
DbLM.LmsContentHandler
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 |
DbLM.LmsErrorHandler
LmsErrorHandler class 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 |
boolean |
commutativeLMSflag
flag to allow searching for commutative database entries |
static int |
CP
Composite Sample Database spot pair. |
static int |
EP
Extrapolated Pair - by CSD database program |
DbSpot[][] |
equivLMspotPtr
Linked list of latched DbSpots that correspond to landmarks in the LM set [nbrLandmarks][2]. |
static int |
GS
Garbage Spot - generated by CSD database or editing programs |
static java.lang.String[] |
helpList
Help list for the landmark table |
static int |
LM
LandMark spot [could be virtual landmark] - by CSD database program |
int |
lmNbrIdx
Landmark data Table tlm column field indices if tab-delimited tables are being used. |
DbSpot[][] |
lmSetPtr
Points to first spot of each LM set in each Sample [0:PARAM_MAXLANDMARKS-1][RSAMPLE:SAMPLE] |
static java.lang.String[] |
lmsFields
Landmark table fields |
java.lang.String |
lmsFile
|
int |
nUniquePairs
Size of list of all pairs of samples in the landmark DB samplePairList[RSAMPLE:SAMPLE][0:nUniquePairs-1] |
int |
nUniqueSamplesInLmsDBlist
Size of list of all pairs of samples in the landmark DB sampleInLmsDBlist[0:nUniqueSamplesInLmsDBlist-1] |
static int |
PAIRBIT_AP
Pairing Bit: Ambiguous Pair - pairing program generated label |
static int |
PAIRBIT_CP
|
static int |
PAIRBIT_EP
Pairing Bit: Extrapolated Pair - by CSD database program |
static int |
PAIRBIT_GS
Pairing Bit:Garbage Spot - generated by CSD database or editing programs. |
static int |
PAIRBIT_LM
Pairing Bit: LandMark spot [could be virtual LM] - by CSD program |
static int |
PAIRBIT_PP
Pairing Bit: Possible Pair - pairing program generated label |
static int |
PAIRBIT_SP
Pairing Bit: Sure Pair - pairing program generated label |
static int |
PAIRBIT_US
Pairing Bit: Unresolved Spot - pairing program generated label |
int |
pixRsampleIdx
Landmark data Table tlm column field indices if tab-delimited tables are being used. |
int |
pixSampleIdx
Landmark data Table tlm column field indices if tab-delimited tables are being used. |
static int |
PP
Possible Pair - pairing program generated label |
boolean |
processingXMLdataFlag
|
java.lang.String[] |
sampleInLmsDBlist
List of samples in the landmark DB that are in the accession DB. |
java.lang.String[][] |
samplePairList
List of all pairs of samples in the landmark DB. |
static int |
SP
Sure Pair - pairing program generated label |
Table |
tlm
Landmark database file table |
static int |
US
Unresolved Spot - pairing program generated label |
boolean |
useInternalDTDflag
Use internal "Open2Dprot-Landmark.dtd" file in Landmark.xml output file |
java.lang.String[] |
validLM
spot pair labels [nbrLandmarks]: "SM" - same spot in > 1 landmark "NG" - No Good, LM outside either/or Rsample or Sample CW "NL" - spot can't latch to LM (use LM DB coords) "OK" - landmark latched to spot. |
static java.lang.String |
VERSION
Version for this module |
java.lang.String |
xmlDate
XML landmark file date "Date" |
java.lang.String |
xmlDBname
XML landmark file database name "DatabaseName" |
int |
xRsampleIdx
Landmark data Table tlm column field indices if tab-delimited tables are being used. |
int |
xSampleIdx
Landmark data Table tlm column field indices if tab-delimited tables are being used. |
int |
yRsampleIdx
Landmark data Table tlm column field indices if tab-delimited tables are being used. |
int |
ySampleIdx
Landmark data Table tlm column field indices if tab-delimited tables are being used. |
Fields inherited from class O2Plib.db.LMset |
---|
DIST_THR_LANDMARK, distNearestLM, distNextNearestLM, editRsampleLMSFlag, lmErrDist, MAX_RATIO_ALT_DIST_THRESHOLD, maxLMS, minEffectiveRadius, nbrLandmarks, nearestLM, nextNearestLM, PARAM_DEF_NBR_ALT_LMS, PARAM_MAX_ALT_LMS, PARAM_MAXLANDMARKS, RSAMPLE, rsampleName, SAMPLE, sampleName, setSizeLM, useLM, xlm, ylm |
Constructor Summary | |
---|---|
DbLM()
DbLM() - set up lndmark part of the database of size nbrLandmarks. |
|
DbLM(int maxLMSallowed)
DbLM() - set up lndmark part of the database of size nbrLandmarks. |
Method Summary | |
---|---|
void |
createNewDbLMtable(java.lang.String lmsFile)
createNewDbLMtable() - create a new tlm Table. |
static java.lang.String |
cvCodes(int x)
cvCodes() - map landmark codes to 2 character String names for printing |
java.lang.String |
cvLMtoDetailedPrintStr(int k)
cvLMtoDetailedPrintStr() - get the full landmark data for a landmark k |
java.lang.String |
cvLMtoPrintStr(int k)
cvLMtoPrintStr() - get the basic landmark data for a landmark k with just xy coords and landmark name. |
static int |
cvPairingCodeName2Code(java.lang.String pairCodeStr)
cvPairingCodeName2Code() - convert pairing code string to pairing code. |
java.lang.String |
cvtLMsetSpotsToStr(java.lang.String msg,
int k,
int nsample)
cvtLMsetSpotsToStr() - convert ONLY k'throws LM set spots for specified sample to a readable formated string. |
java.lang.String |
cvtLMsetSpotsToStr(java.lang.String msg,
int k,
int nsample,
Roi dbugRoi,
boolean addXYcoordsFlag,
boolean addAltLMsetsFlag)
cvtLMsetSpotsToStr() - convert ONLY k'th LM set spots for specified sample to a readable formated string. |
static int |
cvtPairBit2PairCode(int pairBit)
cvtPairBit2PairCode() - convert pairing-bit to pairing label code US, SP, PP, AP, EP, CP, GS, LM |
static java.awt.Color |
cvtPairCode2Color(int code)
cvtPairCode2Color() - convert pairing label code to Color |
static int |
cvtPairCode2PairBit(int code)
cvtPairCode2PairBit() - convert pairing label code to pairing-bit |
boolean |
deleteLMsetFromLmsTable(DbSample dbRsample,
DbSample dbSample,
boolean clearBothSamplesFlag)
deleteLMsetFromLmsTable() - delete old landmark set from the landmark database table. |
java.lang.String |
getDumpLMsetSpotsStr(int k,
java.lang.String msg)
getDumpLMsetSpotsStr() - get a printable LM set k string of spots for both samples in readable format. |
java.lang.String |
getDumpLMsetSpotsStr(int k,
java.lang.String msg,
Roi rRoiDbug,
Roi sRoiDbug,
boolean addXYcoordsFlag,
boolean addAltLMsetsFlag)
getDumpLMsetSpotsStr() - get a printable LM set k string of spots for both samples in readable format. |
java.lang.String |
getLandmarkDBstr()
getLandmarkDBstr() - get the printable report for all landmarks |
java.lang.String |
getLMSDBstr(DbSample dbRsample,
DbSample dbSample)
getLMSDBstr() - get landmark set summary as a printable string. |
DbSpot[] |
getLMsetSpotList(DbSample dbS,
int k)
getLMsetSpotList() - get a list of spots in landmark set k for sample dbS if it exists. |
LMset |
getLmsSetEntryFromDBtable(java.lang.String rsampleName,
java.lang.String sampleName)
getLmsSetEntryFromDBtable() - lookup and get landmark set in the database table in memory. |
LMset |
getLmsSetEntryFromDBtable(java.lang.String rsampleName,
java.lang.String sampleName,
boolean forceSetBothFlag)
getLmsSetEntryFromDBtable() - lookup and get landmark set in the database table in memory. |
void |
init()
init() - reset the DbLM state for both samples. |
java.lang.String[][] |
listSamplePairs(DbAccession acc)
ListSamplePairs() - generate a unique list of sample pairs in the database. |
java.lang.String[] |
listUniqueSamplesInLandmarkDB(DbAccession acc)
listUniqueSamplesInLandmarkDB() - generate a unique list of sample pairs in the database. |
boolean |
loadLandmarkDatabase(java.lang.String lmsFile,
int lmsFormatMode)
loadLandmarkDatabase() - load landmarks database table |
boolean |
lookupLandmarkTableIndices()
lookupLandmarkTableIndices() - lookup SSF data table indices Note: the table contains (pixRsample,pixSample,lmNbr,xRsample,yRsample,xSample,ySample) So look for both field name sets. |
java.lang.String[] |
lookupPairedSamplesList(java.lang.String rName)
lookupPairedSamplesList() - lookup list of all pairs of (Rsample,Sample) pairs in the landmark database such that the Rsample is rName. |
boolean |
lookupSamplePairLMS(DbSample dbRsample,
DbSample dbSample,
boolean commutativeLMSflag)
lookupSamplePairLMS() - lookup specific LMset pair (Rsample,Sample) from landmarks data table. |
boolean |
readLandmarkDatabase(java.lang.String lmsFile,
int lmsFormatMode,
boolean commutativeLMSflag)
readLandmarkDatabase() - read landmark database data from tab-delimited data file or XML data file into the Table tlm. |
boolean |
readLandmarkDatabase(java.lang.String rsampleName,
java.lang.String sampleName,
java.lang.String lmsFile,
int lmsFormatMode,
boolean commutativeLMSflag)
readLandmarkDatabase() - read landmark database data from tab-delimited data file or XML data file into the Table tlm. |
boolean |
readLandmarksTable(int lmsFormatMode)
readLandmarksTable() - find (Rsample,Sample) in landmarks database table using the previously definedlmsFile path. |
Table |
readLandmarkXML(java.lang.String XMLfileName)
readLandmarkXML() - read landmark database data from XML file into Table. |
boolean |
saveLmsDB2DelimFile(java.lang.String lmsFile,
java.lang.String delim,
boolean makeBkupCopyFlag)
saveLmsDB2DelimFile() - save the landmark database into a delimited string file. |
boolean |
saveLmsDB2XMLfile(java.lang.String lmsXMLfile,
boolean makeBkupCopyFlag)
saveLmsDB2XMLfile() - save landmark database into an XML file file. |
boolean |
saveLMsetInDBtable(LMset c)
saveLMsetInDBtable() - save the LM set in the in-core landmark database table. |
boolean |
saveLMsetInDBtable(LMset c,
java.lang.String rsampleName,
java.lang.String sampleName)
saveLMsetInDBtable() - save the LM set in the in-core landmark database table. |
void |
setRsampleAndSampleNames(java.lang.String rsampleName,
java.lang.String sampleName)
setRsampleAndSampleNames() - set the Rsample and Sample names |
void |
setUseInternalDTDflag(boolean useInternalDTDflag)
setUseInternalDTDflag() - set the use internal DTD flag. |
boolean |
writeLandmarksTable(java.lang.String lmsFile,
int lmsFormatMode,
boolean makeBkupCopyFlag)
writeLandmarksTable() - write out the landmarks table in the specified format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
public static final int US
public static final int SP
public static final int PP
public static final int AP
public static final int EP
public static final int CP
public static final int GS
public static final int LM
public static final int PAIRBIT_US
public static final int PAIRBIT_SP
public static final int PAIRBIT_PP
public static final int PAIRBIT_AP
public static final int PAIRBIT_EP
public static final int PAIRBIT_CP
public static final int PAIRBIT_GS
public static final int PAIRBIT_LM
public java.lang.String lmsFile
public boolean commutativeLMSflag
public java.lang.String[] validLM
public DbSpot[][] equivLMspotPtr
public DbSpot[][] lmSetPtr
public java.lang.String[][] samplePairList
public int nUniquePairs
public java.lang.String[] sampleInLmsDBlist
public int nUniqueSamplesInLmsDBlist
public static java.lang.String[] helpList
public static java.lang.String[] lmsFields
public int pixRsampleIdx
public int pixSampleIdx
public int lmNbrIdx
public int xRsampleIdx
public int yRsampleIdx
public int xSampleIdx
public int ySampleIdx
public Table tlm
public java.lang.String xmlDBname
public java.lang.String xmlDate
public boolean processingXMLdataFlag
public boolean useInternalDTDflag
Constructor Detail |
---|
public DbLM()
public DbLM(int maxLMSallowed)
maxLMSallowed
- to change the default.Method Detail |
---|
public void init()
public void createNewDbLMtable(java.lang.String lmsFile)
lmsFile
- name of the landmark databasepublic static java.lang.String cvCodes(int x)
x
- is the code (SP, PP, AP, US, EP, GS, or LM)
public static int cvPairingCodeName2Code(java.lang.String pairCodeStr)
pairCodeStr
- is one of "SP", "PP", "AP", "US", "EP"
"CP", "GS", "LM"
public boolean readLandmarkDatabase(java.lang.String rsampleName, java.lang.String sampleName, java.lang.String lmsFile, int lmsFormatMode, boolean commutativeLMSflag)
rsampleName
- reference gel namesampleName
- sample to pair with the reference samplelmsFile
- name of the landmark databaselmsFormatMode
- - IO_FORMAT_xxx input modecommutativeLMSflag
- if true, search for either (Rsample,Sample)
or (Sample,Rsample) in the landmark database.
public void setRsampleAndSampleNames(java.lang.String rsampleName, java.lang.String sampleName)
rsampleName
- set default RsamplesampleName
- set default Samplepublic boolean readLandmarkDatabase(java.lang.String lmsFile, int lmsFormatMode, boolean commutativeLMSflag)
lmsFile
- lmsFormatMode
- - IO_FORMAT_xxx input modecommutativeLMSflag
-
setRsampleAndSampleNames(java.lang.String, java.lang.String)
public java.lang.String[][] listSamplePairs(DbAccession acc)
acc
- is Accession DB
public java.lang.String[] lookupPairedSamplesList(java.lang.String rName)
rName
- is name of the Rsample
public java.lang.String[] listUniqueSamplesInLandmarkDB(DbAccession acc)
acc
- is Accession DB
public void setUseInternalDTDflag(boolean useInternalDTDflag)
useInternalDTDflag
- status to setpublic boolean writeLandmarksTable(java.lang.String lmsFile, int lmsFormatMode, boolean makeBkupCopyFlag)
lmsFile
- - name of output landmark file to be generated.lmsFormatMode
- - Either IO_FORMAT_TAB_DELIM or IO_FORMAT_xml formatmakeBkupCopyFlag
- - first make backup copy of file w/.bak
extension.
public boolean saveLmsDB2XMLfile(java.lang.String lmsXMLfile, boolean makeBkupCopyFlag)
lmsXMLfile
- - name of XML file to be generated.makeBkupCopyFlag
- - first make backup copy of file with
a .bak extension.
public boolean saveLmsDB2DelimFile(java.lang.String lmsFile, java.lang.String delim, boolean makeBkupCopyFlag)
lmsFile
- - 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 lookupLandmarkTableIndices()
public boolean loadLandmarkDatabase(java.lang.String lmsFile, int lmsFormatMode)
lmsFile
- is name of landmark database file full pathlmsFormatMode
- - IO_FORMAT_xxx input mode
public boolean readLandmarksTable(int lmsFormatMode)
lmsFormatMode
- - IO_FORMAT_xxx input mode
public boolean lookupSamplePairLMS(DbSample dbRsample, DbSample dbSample, boolean commutativeLMSflag)
dbRsample
- - DBsample for RsampledbSample
- - DBsample for of SamplecommutativeLMSflag
- - set if can search on (Sample,Rsample)
as well as (Rsample,Sample).
public java.lang.String getLMSDBstr(DbSample dbRsample, DbSample dbSample)
dbRsample
- is RsampledbSample
- is Sample
public boolean saveLMsetInDBtable(LMset c)
c
- is LMset to update in the landmark database table.rsampleName
- reference gel namesampleName
- sample to pair with the reference sample
public boolean saveLMsetInDBtable(LMset c, java.lang.String rsampleName, java.lang.String sampleName)
c
- is LMset to update in the landmark database table.rsampleName
- reference gel namesampleName
- sample to pair with the reference sample
public LMset getLmsSetEntryFromDBtable(java.lang.String rsampleName, java.lang.String sampleName)
rsampleName
- reference gel namesampleName
- sample to pair with the reference sample
public LMset getLmsSetEntryFromDBtable(java.lang.String rsampleName, java.lang.String sampleName, boolean forceSetBothFlag)
rsampleName
- reference gel namesampleName
- sample to pair with the reference sampleforceSetBothFlag
- else use the edit flag
public boolean deleteLMsetFromLmsTable(DbSample dbRsample, DbSample dbSample, boolean clearBothSamplesFlag)
dbRsample
- is the RsampledbSample
- is the SampleclearBothSamplesFlag
- to clear xy values for both the Rsample
and the Sample
public java.lang.String getLandmarkDBstr()
E.g., LM[A]= (209,191, 228,177) LM[B]= (178,153, 197,142) . . . x y x y Rsample Sample
public java.lang.String cvLMtoPrintStr(int k)
E.g., LM[B]= (178,153, 197,142) x y x y Rsample Sample
public java.lang.String cvLMtoDetailedPrintStr(int k)
E.g., Min R[B]=18 distNLM[42,36] to NLMs[C,C], distNNLM[49,47] to NNLMs[A,A] i.e. radius dBtoC1 dBtoC2 dBtoA1 dBtoA2
cvLMtoDetailedPrintStr
in class LMset
public static java.awt.Color cvtPairCode2Color(int code)
code
- is pairing label code: US, SP, PP, AP, EP, etc.
public static int cvtPairCode2PairBit(int code)
code
- is pairing label code: US, SP, PP, AP, EP, CP, GS, LM
public static int cvtPairBit2PairCode(int pairBit)
pair
- bit PAIRBIT_xx where* xx is US, SP, PP, AP, EP, CP,
GS, LM
public java.lang.String cvtLMsetSpotsToStr(java.lang.String msg, int k, int nsample)
msg
- is optional msg to printk
- is Landmark set k to printnsample
- is either RSAMPLE or SAMPLE
public java.lang.String cvtLMsetSpotsToStr(java.lang.String msg, int k, int nsample, Roi dbugRoi, boolean addXYcoordsFlag, boolean addAltLMsetsFlag)
msg
- is optional msg to printk
- is Landmark set k to printnsample
- is either RSAMPLE or SAMPLEdbugRoi
- to filter data by (x,y) if not null (i.e. defined)addXYcoordsFlag
- to add thespot X,Y coordinatesaddAltLMsetsFlag
- to add the alternate landmark set lists
public java.lang.String getDumpLMsetSpotsStr(int k, java.lang.String msg)
k
- is the LM set to getmsg
- is message to print if not null
public java.lang.String getDumpLMsetSpotsStr(int k, java.lang.String msg, Roi rRoiDbug, Roi sRoiDbug, boolean addXYcoordsFlag, boolean addAltLMsetsFlag)
k
- is the LM set to getmsg
- is message to print if not nullrRoiDbug
- to filter data by Rsample(x,y) if not nullsRoiDbug
- to filter data by Sample(x,y) if not nulladdXYcoordsFlag
- to add the spots XY coordinatesaddAltLMsetsFlag
- to add the alternate landmark set lists
public DbSpot[] getLMsetSpotList(DbSample dbS, int k)
dbS
- is the sample to getk
- is the LM set to get
public Table readLandmarkXML(java.lang.String XMLfileName)
XMLfileName
- to read
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |