Constructor and Description |
---|
WorkSheet() |
WorkSheet(Collection<String> rows,
Collection<String> columns) |
WorkSheet(CompactCharSequence[][] values) |
WorkSheet(String[][] values) |
Modifier and Type | Method and Description |
---|---|
void |
addCell(String row,
String col,
String value)
Add data to a cell
|
void |
addColumn(String column,
String defaultValue) |
void |
addColumns(ArrayList<String> columns,
String defaultValue)
Add columns to worksheet and set default value
|
void |
addRow(String row,
String defaultValue) |
void |
addRows(ArrayList<String> rows,
String defaultValue)
Add rows to the worksheet and fill in default value
|
void |
appendWorkSheetColumns(WorkSheet worksheet)
Add columns from a second worksheet to be joined by common row.
|
void |
appendWorkSheetRows(WorkSheet worksheet)
Add rows from a second worksheet to be joined by common column.
|
void |
applyColumnFilter(String column,
ChangeValue changeValue)
Apply filter to a column to change values from say numberic to nominal
based on some range
|
void |
changeColumnHeader(ChangeValue changeValue) |
void |
changeColumnHeader(String col,
String newCol) |
void |
changeColumnsHeaders(LinkedHashMap<String,String> newColumnValues)
Change the columns in the HashMap Key to the name of the value
|
void |
changeRowHeader(ChangeValue changeValue) |
void |
changeRowHeader(String row,
String newRow) |
void |
clear()
See if we can free up memory
|
ArrayList<String> |
getAllColumns()
Get the list of column names including those that may be hidden
|
ArrayList<String> |
getAllRows()
Get all rows including those that may be hidden
|
String |
getCell(String row,
String col)
Get cell value
|
Double |
getCellDouble(String row,
String col) |
Integer |
getColumnIndex(String column) |
LinkedHashMap<String,HeaderInfo> |
getColumnLookup() |
ArrayList<String> |
getColumns()
Get the list of column names.
|
static WorkSheet |
getCopyWorkSheet(WorkSheet copyWorkSheet)
Create a copy of a worksheet.
|
static WorkSheet |
getCopyWorkSheetSelectedRows(WorkSheet copyWorkSheet,
ArrayList<String> rows)
Create a copy of a worksheet.
|
ArrayList<String> |
getDataColumns() |
ArrayList<String> |
getDataRows()
Get the list of row names
|
ArrayList<String> |
getDiscreteColumnValues(String column)
Get back a list of unique values in the column
|
ArrayList<String> |
getDiscreteRowValues(String row)
Get back a list of unique values in the row
|
String |
getIndexColumnName() |
WorkSheet |
getLogScale(double base)
Get the log scale of this worksheet where a zero value will be set to .1
as Log(0) is undefined
|
WorkSheet |
getLogScale(double base,
double zeroValue)
Get the log scale of this worksheet
|
ArrayList<String> |
getMetaDataColumns() |
LinkedHashMap<String,String> |
getMetaDataColumnsHashMap() |
ArrayList<String> |
getMetaDataRows() |
LinkedHashMap<String,String> |
getMetaDataRowsHashMap() |
ArrayList<String> |
getRandomDataColumns(int number) |
ArrayList<String> |
getRandomDataColumns(int number,
ArrayList<String> columns) |
String |
getRowHeader() |
Integer |
getRowIndex(String row) |
LinkedHashMap<String,HeaderInfo> |
getRowLookup() |
ArrayList<String> |
getRows()
Get the list of row names.
|
void |
hideColumn(String column,
boolean hide) |
void |
hideEmptyColumns() |
void |
hideEmptyRows() |
void |
hideMetaDataColumns(boolean value) |
void |
hideMetaDataRows(boolean value) |
void |
hideRow(String row,
boolean hide) |
boolean |
isMetaDataColumn(String column) |
boolean |
isMetaDataRow(String row) |
boolean |
isValidColumn(String col) |
boolean |
isValidRow(String row) |
void |
markMetaDataColumn(String column) |
void |
markMetaDataColumns(ArrayList<String> metaDataColumns)
marks columns as containing meta data
|
void |
markMetaDataRow(String row) |
void |
randomlyDivideSave(double percentage,
String fileName1,
String fileName2)
Split a worksheet randomly.
|
static WorkSheet |
readCSV(File f,
char delimiter) |
static WorkSheet |
readCSV(InputStream is,
char delimiter)
Read a CSV/Tab delimited file where you pass in the delimiter
|
static WorkSheet |
readCSV(String fileName,
char delimiter)
Read a CSV/Tab delimitted file where you pass in the delimiter
|
void |
replaceColumnValues(String column,
HashMap<String,String> values)
Change values in a column where 0 = something and 1 = something different
|
void |
save(OutputStream outputStream,
char delimitter,
boolean quoteit) |
void |
saveCSV(String fileName)
Save the worksheet as a csv file
|
void |
saveTXT(String fileName) |
void |
setCacheDoubleValues(boolean value) |
void |
setIndexColumnName(String indexColumnName) |
void |
setMetaDataColumns(ArrayList<String> metaDataColumns)
Clears existing meta data columns and sets new ones
|
void |
setMetaDataColumnsAfterColumn() |
void |
setMetaDataColumnsAfterColumn(String column) |
void |
setMetaDataRows(ArrayList<String> metaDataRows) |
void |
setMetaDataRowsAfterRow() |
void |
setMetaDataRowsAfterRow(String row) |
void |
setRowHeader(String value) |
void |
shuffleColumnsAndThenRows(ArrayList<String> columns,
ArrayList<String> rows)
Randomly shuffle the columns and rows.
|
void |
shuffleColumnValues(ArrayList<String> columns)
Need to shuffle column values to allow for randomized testing.
|
void |
shuffleRowValues(ArrayList<String> rows)
Need to shuffle rows values to allow for randomized testing.
|
WorkSheet |
swapRowAndColumns()
Swap the row and columns returning a new worksheet
|
String |
toString() |
static WorkSheet |
unionWorkSheetsRowJoin(String w1FileName,
String w2FileName,
char delimitter,
boolean secondSheetMetaData)
Combine two work sheets where you join based on rows.
|
static WorkSheet |
unionWorkSheetsRowJoin(WorkSheet w1,
WorkSheet w2,
boolean secondSheetMetaData)
* Combine two work sheets where you join based on rows.
|
public WorkSheet()
public WorkSheet(Collection<String> rows, Collection<String> columns) throws Exception
rows
- columns
- Exception
public WorkSheet(CompactCharSequence[][] values)
values
- public void clear()
public void randomlyDivideSave(double percentage, String fileName1, String fileName2) throws Exception
percentage
- fileName1
- fileName2
- Exception
public static WorkSheet getCopyWorkSheetSelectedRows(WorkSheet copyWorkSheet, ArrayList<String> rows) throws Exception
copyWorkSheet
- rows
- Exception
public static WorkSheet getCopyWorkSheet(WorkSheet copyWorkSheet) throws Exception
copyWorkSheet
- Exception
public ArrayList<String> getMetaDataColumns()
public ArrayList<String> getMetaDataRows()
public ArrayList<String> getDataColumns()
public void shuffleColumnsAndThenRows(ArrayList<String> columns, ArrayList<String> rows) throws Exception
columns
- rows
- Exception
public void shuffleColumnValues(ArrayList<String> columns) throws Exception
columns
- Exception
public void shuffleRowValues(ArrayList<String> rows) throws Exception
rows
- Exception
public void hideMetaDataColumns(boolean value)
value
- public void hideMetaDataRows(boolean value)
value
- public void setMetaDataRowsAfterRow()
public void setMetaDataColumnsAfterColumn()
public void setMetaDataRowsAfterRow(String row)
row
- public void setMetaDataColumnsAfterColumn(String column)
column
- public void setMetaDataColumns(ArrayList<String> metaDataColumns)
metaDataColumns
- public void markMetaDataColumns(ArrayList<String> metaDataColumns)
metaDataColumns
- public void markMetaDataColumn(String column)
column
- public boolean isMetaDataColumn(String column)
column
- public boolean isMetaDataRow(String row)
row
- public void markMetaDataRow(String row)
row
- public void setMetaDataRows(ArrayList<String> metaDataRows)
metaDataRows
- public void hideEmptyRows() throws Exception
Exception
public void hideEmptyColumns() throws Exception
Exception
public void hideColumn(String column, boolean hide)
column
- hide
- public void replaceColumnValues(String column, HashMap<String,String> values) throws Exception
column
- values
- Exception
public void applyColumnFilter(String column, ChangeValue changeValue) throws Exception
column
- changeValue
- Exception
public void addColumn(String column, String defaultValue)
column
- defaultValue
- public void addColumns(ArrayList<String> columns, String defaultValue)
columns
- defaultValue
- public void addRows(ArrayList<String> rows, String defaultValue)
rows
- defaultValue
- public void addCell(String row, String col, String value) throws Exception
row
- col
- value
- Exception
public boolean isValidRow(String row)
row
- public boolean isValidColumn(String col)
col
- public void setCacheDoubleValues(boolean value)
value
- public Double getCellDouble(String row, String col) throws Exception
row
- col
- Exception
public String getCell(String row, String col) throws Exception
row
- col
- Exception
public void changeRowHeader(ChangeValue changeValue)
changeValue
- public void changeColumnHeader(ChangeValue changeValue)
changeValue
- public void changeRowHeader(String row, String newRow) throws Exception
row
- newRow
- Exception
public void changeColumnsHeaders(LinkedHashMap<String,String> newColumnValues) throws Exception
newColumnValues
- Exception
public void changeColumnHeader(String col, String newCol) throws Exception
col
- newCol
- Exception
public Integer getColumnIndex(String column) throws Exception
column
- Exception
public Integer getRowIndex(String row) throws Exception
row
- Exception
public ArrayList<String> getRandomDataColumns(int number)
number
- public ArrayList<String> getRandomDataColumns(int number, ArrayList<String> columns)
number
- columns
- public ArrayList<String> getAllColumns()
public ArrayList<String> getColumns()
public ArrayList<String> getDiscreteColumnValues(String column) throws Exception
column
- Exception
public ArrayList<String> getDiscreteRowValues(String row) throws Exception
row
- Exception
public ArrayList<String> getAllRows()
public ArrayList<String> getRows()
public ArrayList<String> getDataRows()
public WorkSheet getLogScale(double base) throws Exception
base
- Exception
public WorkSheet getLogScale(double base, double zeroValue) throws Exception
base
- Exception
public WorkSheet swapRowAndColumns() throws Exception
Exception
public static WorkSheet unionWorkSheetsRowJoin(String w1FileName, String w2FileName, char delimitter, boolean secondSheetMetaData) throws Exception
w1FileName
- w2FileName
- delimitter
- secondSheetMetaData
- Exception
public static WorkSheet unionWorkSheetsRowJoin(WorkSheet w1, WorkSheet w2, boolean secondSheetMetaData) throws Exception
w1
- w2
- secondSheetMetaData
- Exception
public static WorkSheet readCSV(String fileName, char delimiter) throws Exception
fileName
- delimiter
- Exception
public static WorkSheet readCSV(InputStream is, char delimiter) throws Exception
f
- delimiter
- Exception
public void saveCSV(String fileName) throws Exception
fileName
- Exception
public void saveTXT(String fileName) throws Exception
fileName
- Exception
public void setRowHeader(String value)
value
- public void appendWorkSheetColumns(WorkSheet worksheet) throws Exception
worksheet
- Exception
public void appendWorkSheetRows(WorkSheet worksheet) throws Exception
worksheet
- Exception
public void save(OutputStream outputStream, char delimitter, boolean quoteit) throws Exception
outputStream
- delimitter
- quoteit
- Exception
public String getIndexColumnName()
public void setIndexColumnName(String indexColumnName)
indexColumnName
- the indexColumnName to setpublic LinkedHashMap<String,HeaderInfo> getColumnLookup()
public LinkedHashMap<String,HeaderInfo> getRowLookup()
public LinkedHashMap<String,String> getMetaDataColumnsHashMap()
public LinkedHashMap<String,String> getMetaDataRowsHashMap()
public String getRowHeader()
Copyright © 2000–2018 BioJava. All rights reserved.