|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object MakeFlipTable
public class MakeFlipTable
Class MakeFlipTable to flip a Table by either of two methods.
In both cases, it effectively transposes rows and columns but has other functionality as well. The first way is to do it in memory using an existing Table that contains tData. The second, for very large table files, is applicable when there are a small number of columns to be flipped. It works by using the Index-Map for the Table and then random accesses only the rows specified from the file rather than from memory for the data to flip.
Generate transposed files using random access file indexing to create a multi-line header (1 line for each column name in the list) using the list of columns previously specified when generating the index map file with the '-makeIndexMapFile:{colName1,colName2,...,colNameN}' command. It analyzes the index map Table and then uses all columns before the ("StartByte", "EndByte") columns to define the flipped Table header. See the '-flipColumnName:{flipColumnFile,flipColumnName}' or '-flipColumnName:{*LIST*,flipColumnName,v1,v2,...vn}' to restrict which flipped column data to use. See the '-flipRowFilterNames:{flipRowFilterNamesFile}' to restrict which flipped row data to use. It is set by '-flipTableByIndexMap:{flipDataFile,flipIndexMapFile}' switch.
List of Methods =================== MakeFlipTable() - Constructor setFlippedOutputFile() - set the dir and name for flipped output file. makeWorkingTables() - Initialize working Tables required for flipping data processData() - create the flipped data Table and write it out extractDataRowsByColumnFilters() - extract ftData rows by column-filters makeListOfSeekDataRowsByColumnFilters() filter rows from Index Map data matchColumnFilterData() - test a row of Index Map data to see if match Column lists matchRowFilterData() - test a String data row to for row name match. flip_ftRowsTo_ftFlippedTable() - create ftFlippedTable from ftRows Table saveFlipTableAsHTMLfile() - save flip Table as HTML file. saveFlipTableAsTextfile() - save flip Table as a tab-delimited text file. mapMultilineHdrHREFs() - create HTML for ftFlipped Table. List of Tables ================= ftData - MRR data Table ftIndex - index-map Table for the ftData Table file ftRows - extracted rows from the ftData table that will be flipped ftFlipped - flipped Table constructed from ftRows Table.List of Switches and Globals.java variables set by them ============================================================ -flipTableByIndexMap:{flipDataFile,flipIndexMapFile,(opt)maxRows} cvt.flipTableByIndexMapFlag cvt.flipDataFile cvt.flipIndexMapFile cvt.maxFlipSeekRowsToExtract -flipColumnName:{flipColumnFile,flipColumnNames} cvt.flipColumnFile[0:cvt.nFlipColumns-1] cvt.flipColumnName[0:cvt.nFlipColumns-1] cvt.flipColumnValues[0:cvt.nFlipColumns-1][] cvt.nFlipColumns -flipExcludeColumnName:{flipExcludeColumnName} cvt.flipExcludeColumnName[0:cvt.nFlipExcludeColumns-1] cvt.nFlipExcludeColumns -flipOrderHdrColNames:{colHdrName1,colHdrName2,...,colHdrNameN} cvt.flipOrderHdrColList[0:nFlipOrderHdrColList-1] cvt.nFlipOrderHdrColList -flipRowFilterNamesFile:{flipRowFilterNamesFile} cvt.flipRowFilterNamesFile cvt.flipRowFilterNames cvt.nFlipRowFilterNames
This code is available at the HTMLtools project on SourceForge at http://htmltools.sourceforge.org/ under the "Common Public License Version 1.0" http://www.opensource.org/licenses/cpl1.0.php.
It was derived and refactored from the open source MAExplorer (http://maexplorer.sourceforge.org/), and Open2Dprot (http://Open2Dprot.sourceforge.net/) Table modules.
$Date: 2009/12/02 11:45:56 $ $Revision: 1.38 $
Copyright 2008, 2009 by Peter Lemkin
E-Mail: lemkin@users.sourceforge.net
http://lemkingroup.com/
Field Summary | |
---|---|
HTMLtools |
cvt
Note all global variables are in Globals.java. |
boolean |
dataOK
Processing succeeded and ftFlipped Table is valid. |
long[] |
endSeekByte
List of end row byte seek pointers. |
FileTable |
fio
Global fileTable instance |
java.lang.String[][] |
flipColNameFilterData
These are the list of column name data for filtering each column to be used for the new flipped Table headers. |
java.lang.String |
flipDataPath
Input data file path. |
java.lang.String |
flipIndexMapPath
Input Index Map file path. |
private java.lang.String |
flipOutputFile
The output flip .txt file. |
FileTable |
ftData
Input data FileTable instance. |
FileTable |
ftFlipped
Flipped data FileTable instance constructed from ftRows Table |
FileTable |
ftIndex
Input data index-map FileTable instance mapping ftData file seeks (start,end) bytes. |
FileTable |
ftRows
Extracted subset of data rows FileTable instance from the ftData Table |
private int |
glbMaxRowIndex
Global max value index of name in table |
private java.lang.String |
glbMaxRowName
Global max value name in table |
private int |
glbMeanRowIndex
Global mean value index of name in table |
private java.lang.String |
glbMeanRowName
Global mean value name in table |
private int |
glbMinRowIndex
Global min value index of name in table |
private java.lang.String |
glbMinRowName
Global min value name in table |
private int |
glbStdDevRowIndex
Global stdDev value index of name in table |
private java.lang.String |
glbStdDevRowName
Global stdDev value name in table |
int[] |
idxColData
List of ftData.tField[] indexes of the column names. |
int[] |
idxColIMfilters
List of ftIndex.tField[] index of the column names. |
int |
idxEndByte
List of "EndByte" ftIndex.tField[] index of the column names |
int[] |
idxOrderedColHdrNames
Ordered List of ftData.tField[] indexes of the column names for the flipped table header. |
int |
idxStartByte
List of "StartByte" ftIndex.tField[] index of the column names |
int |
maxSeekRowsToExtract
Maximum size of start/endSeekByte[] lists for reallocation. |
int[] |
nFlipColNameFilterData
These are the sizes of the list of column name data for filtering each column to be used for the new flipped Table headers. |
int |
nSeekRows
Size of start/endSeekByte[] lists for reallocation. |
int[] |
rowNbrToSeek
List of row numbers corresponding to the seek pointers. |
java.lang.String |
sFlipTableReport
Computation Strings that can be added to the report. |
java.lang.String |
sFlipTableReportHTML
|
private java.lang.String |
sortTableTitle
Sort Table title if any |
long[] |
startSeekByte
List of start row byte seek pointers. |
Constructor Summary | |
---|---|
MakeFlipTable(HTMLtools cvt,
int maxSeekRowsToExtract)
MakeFlipTable() - Constructor |
Method Summary | |
---|---|
boolean |
calcReportFoldChangeABstatistics(FileTable ftFlipped)
calcReportFoldChangeABstatistics() - calc stats if cvt.reportFoldChangeFlag. |
private boolean |
extractDataRowsByColumnFilters()
extractDataRowsByColumnFilters() - extract ftData rows by column-filters saving the resulting rows in ftRows. |
private boolean |
flip_ftRowsTo_ftFlippedTable()
flip_ftRowsTo_ftFlippedTable() - create ftFlipped Table from ftRows Table |
private boolean |
getGlobalStatistics(FileTable ftIndex)
getGlobalStatistics() - Setup Global statistics if .sidx file, then get (Statistics Index Map), it has Global statistics in * header[0:1]. |
private void |
initClassVars()
initClassVars() - reset the class variables |
private boolean |
makeListOfSeekDataRowsByColumnFilters(int maxSeekRows)
makeListOfSeekDataRowsByColumnFilters() filter rows from Index Map data by filtering any of the flipColNameFilterData[] criteria in the index map (which has all of the fields we need to do the filtering) to generate a list of rows that we will actually random access read from the input data. |
boolean |
makeWorkingTables()
makeWorkingTables() - Initialize working Tables required for flipping data. |
java.lang.String |
mapMultilineHdrHREFs(java.lang.String htmlFilePath)
mapMultilineHdrHREFs() - create HTML for ftFlipped Table. |
private boolean |
matchColumnFilterData(java.lang.String[] rowData,
java.lang.String[] colNames,
java.lang.String[][] colNameFilterData,
int[] idxColNamesInRowData,
int nCols,
boolean useExactMatchFlag)
matchColumnFilterData() - test a row of Index-Map data to see if match Column lists. |
private boolean |
matchRowFilterData(java.lang.String sRowData,
java.lang.String[] rowFilterNames,
int nRowFilterNames)
matchRowFilterData() - test a String data row to for row name match. |
boolean |
processData()
processData() - create the flipped data Table and write it out by the following algorithm. |
boolean |
saveFlipTableAsHTMLfile(java.lang.String oDir,
java.lang.String oFile)
saveFlipTableAsHTMLfile() - save flip Table as HTML file. |
boolean |
saveFlipTableAsTextfile(java.lang.String oDir,
java.lang.String oFile)
saveFlipTableAsTextfile() - save flip Table as a tab-delimited text file. |
boolean |
setFlippedOutputFile(java.lang.String flipOutputFile)
setFlippedOutputFile() - set the dir and name for flipped output file. |
private boolean |
thresholdFoldChangeColumnsInFlipTable(FileTable ftF,
float fcThr,
double[] fcAB)
thresholdFoldChangeColumnsInFlipTable() - threshold columns < flipFCthreshold. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public HTMLtools cvt
public FileTable fio
private java.lang.String flipOutputFile
public FileTable ftData
public FileTable ftIndex
public FileTable ftRows
public FileTable ftFlipped
public java.lang.String[][] flipColNameFilterData
public int[] nFlipColNameFilterData
public int[] idxColIMfilters
public int[] idxOrderedColHdrNames
public int idxStartByte
public int idxEndByte
public int[] idxColData
public java.lang.String flipDataPath
public java.lang.String flipIndexMapPath
public boolean dataOK
public int maxSeekRowsToExtract
public int nSeekRows
public int[] rowNbrToSeek
public long[] startSeekByte
public long[] endSeekByte
private java.lang.String glbMinRowName
private java.lang.String glbMaxRowName
private java.lang.String glbMeanRowName
private java.lang.String glbStdDevRowName
private int glbMinRowIndex
private int glbMaxRowIndex
private int glbMeanRowIndex
private int glbStdDevRowIndex
private java.lang.String sortTableTitle
public java.lang.String sFlipTableReport
public java.lang.String sFlipTableReportHTML
Constructor Detail |
---|
public MakeFlipTable(HTMLtools cvt, int maxSeekRowsToExtract)
cvt
- is instance of HTMLtoolsmaxSeekRowsToExtract
- - max # of rows to extract for flipped TableMethod Detail |
---|
private void initClassVars()
public boolean setFlippedOutputFile(java.lang.String flipOutputFile)
outputDataDir
- - directory for saving the flipped Table .txt and
.html filesflipOutputFile
- - name of the output flipped Table file to be save
public boolean makeWorkingTables()
ftData - for the input data Table file ftIndex - for index map Table file corresponding to input data file rows ftRows - for the filtered data rows to be computed ftFlipped - for the flipped ftRows data to be computedIt also reads the '-flipColumnName:{flipColumnFile,flipColumnName}' or '-flipColumnName:{*LIST*,flipColumnName,v1,v2,...vn}' data, and it reads the '-flipRowFilterNamesFile:{flipRowNameFile}' filtered by "-flipRowGSPIDfilterSubstring:"{substring}".
FileTable
,
FileTable.readAndParseTableFieldsAndIndexMap(java.lang.String)
,
FileTable.readAndParseTable(java.lang.String)
,
FileIO.readFileAsString(java.lang.String)
,
FileTable.lookupFieldIdx(java.lang.String)
,
UtilCM.mapCRLF2space(java.lang.String)
,
UtilCM.replaceSubstrInString(java.lang.String, java.lang.String, java.lang.String)
,
UtilCM.cvs2Array(java.lang.String, java.lang.String)
,
UtilCM.logMsg(java.lang.String)
public boolean processData()
[1] Filter all rows into ftRows that match any of the flipColNameFilterData[] criteria in the index map (which has all of the fields we need to do the filtering) to generate a list of rows that we will actually random access read from the input data file. [2] Create the Flipped Table ftFlipped from the ftRows Table. [3] Create and write out the Flipped Table ftFlipped from the ftRows Table. [4] Create and write out the flipped HTML Table w/multi-line HREF mapped headers.
extractDataRowsByColumnFilters()
,
flip_ftRowsTo_ftFlippedTable()
,
mapMultilineHdrHREFs(java.lang.String)
,
FileTable.writeTableToTabDelimFile(java.lang.String, boolean)
,
FileIO.mapPathFileSeparators(java.lang.String)
,
FileIO.makePathSubDirs(java.lang.String)
,
FileIO.writeStringToFile(java.lang.String, java.lang.String)
,
UtilCM.logMsg(java.lang.String)
private boolean extractDataRowsByColumnFilters()
FileIO.readRandomAccessLine(java.lang.String, long)
,
FileTable.appendRowToTable(java.lang.String[])
,
UtilCM.cvs2ArrayNullFill(java.lang.String, java.lang.String, java.lang.String)
,
UtilCM.logMsg(java.lang.String)
private boolean makeListOfSeekDataRowsByColumnFilters(int maxSeekRows)
This creates the three arrays in these class variables: rowNbrToSeek[0:nSeekRows-1] startSeekByte[0:nSeekRows-1] endSeekByte[0:nSeekRows-1]
maxSeekRows
- - is the initial size of the seel table
#matchColumnFilterData()
,
UtilCM.cvs2l(java.lang.String, long)
private boolean matchColumnFilterData(java.lang.String[] rowData, java.lang.String[] colNames, java.lang.String[][] colNameFilterData, int[] idxColNamesInRowData, int nCols, boolean useExactMatchFlag)
rowData
- - row of the index-map data to test (size nCols)colNames
- - is list of column names to test (size nCols)colNameFilterData
- - is nCols array of arrays of column data
instances. If a particular array is null, do not test it.idxColNamesInRowData
- - indexes of colNames for rowData.nCols
- - # of columns to test in rowData[]useExactMatchFlag
- - use exact match flag, else match all substrings
private boolean matchRowFilterData(java.lang.String sRowData, java.lang.String[] rowFilterNames, int nRowFilterNames)
rowData
- - row StringflipRowNames
- - is list of row names to test (size nCols)it.nFlipRowFilterNames
- - number of for filter name to test.
private boolean flip_ftRowsTo_ftFlippedTable()
public boolean saveFlipTableAsHTMLfile(java.lang.String oDir, java.lang.String oFile)
oDir
- output file directoryoFile
- output file
public boolean saveFlipTableAsTextfile(java.lang.String oDir, java.lang.String oFile)
oDir
- output file directoryoFile
- output file
public java.lang.String mapMultilineHdrHREFs(java.lang.String htmlFilePath)
htmlFilePath
- is the name of the HTML file to writeprivate boolean getGlobalStatistics(FileTable ftIndex)
public boolean calcReportFoldChangeABstatistics(FileTable ftFlipped)
ftFlipped
- - completed ftFlipped table (before add statistics)
private boolean thresholdFoldChangeColumnsInFlipTable(FileTable ftF, float fcThr, double[] fcAB)
ftF
- is the ftFlipped tablefcThr
- is flipFCthresholdfcAB
- is the fold-change values for the corresponding columns as ftF
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |