|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--RevalBase | +--Reval
Class Reval is used to evaluate R scripts with data supplied from MAExplorer via the MJAReval API. Each R analysis is defined by a R LayOut (RLO). Each RLO is saved in an internal RLO database managed by the MJAReval class (see addRLO() method for details on the RLO).
This is an instantiation of the RevalBase class where the Client is MAExplorer. When we refer to the Client in this class we mean MAExplorer. If the code were used with another cliet, then this instantiation must be (heavily) modified.
R is an extensible language and envirnment for statistical computing and graphics. R is Open Source (GNU public license) and is available for download at www.r-project.org.
NOTE: This class's methods contain a command interpreter, and support methods and data structures to enable you to execute R program .R scripts using client (MAExplorer) data. The Client-R library used by R is RLORlibr and for MAExplorer is called "MAERlibr".
It is intended to be used when writing MAEPlugins that need to access the R program to execute .R scripts with MAExplorer data. This may generate reports and plots (PDF, JPG, PNG, Postscript, SVG). Some of these reports may be used to pass the R results back into the MAExplorer state (Gene Sets, Filter gene sets, Normalization gene sets, Condition Lists, OCL, etc.).
This class evaluates R scripts with data supplied from the client via the MJAReval API. Each R analysis is defined by a R LayOut (RLO). Each RLO is saved in an internal RLO database managed by the MJAReval class. (see class variable definitions and addRLO() method for details on the RLO). The RLOs specify the evaluation environment for the .R script when evaluated by R. The R program is then run as a separate process using a System.exec()
The client-R interface library "MAERlibr" (the instance of RLORlibr) is kept in the Client {installation directory}/lib/RLORlibr/ and contains the standard R library format subdirectories including R/ (separate files) and R-ex/ (single file). When an RLO script is evaluated, we copy the .R script with a "tmp-" prefix to the project Temp/ and prepend the following 2 lines: setwd("...Temp/") library(RLORlibr,lib.loc="{installation directory}/lib") which are required for the .R script to access the data generated by the client program and to access the library.
When executed, an R script is allowed to generate multiple output files that may include the following formats: text, tab-delimited text, PDF and JPG. There may be also multiple data input files requested by the R script. These are generated by mjaReval class methods as specified by the RLO database entry. Note: during R execution, all files are read and written from the {project}/Temp directory, the R current working directory. They may be copied to or from this directory from or to other directories as required.
1. data is exported from the client to tab-delimited data input files {Project}/Temp/. These will then be read by R when your script is evaluated. 2. The output of R is saved to any number of files into {project}/Temp and then moved to {Project}/Report/ where they may then be displayed or read by the client if required. 3. The .R scripts are shared with all instances of the client and are kept in {Client installation}/R/ 4. The .rlo files are shared by all instances of the client and are kept in {Client installation}/RLO/ directory. 5. The startup script is generated by an mjaReval method and placed in the {project}/Temp directory where it will be used by a System.exec() call.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 MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.
RevalBase
,
RLO
Field Summary | |
private boolean[] |
activeGeneList
list [0:maxGenes-1] booleans for genes passing data Filter |
(package private) static MAExplorer |
mae
Global link |
private static int |
maxGenes
current active genes lists for generating export data |
private static int[] |
midList
current active genes lists for generating export data |
(package private) static MaeJavaAPI |
mja
MaeJavaAPI classes |
(package private) MJAcluster |
mjaCluster
|
(package private) MJAcondition |
mjaCondition
|
(package private) MJAfilter |
mjaFilter
|
(package private) MJAgeneList |
mjaGeneList
|
(package private) MJAgeometry |
mjaGeometry
|
(package private) MJAplot |
mjaPlot
|
(package private) MJAproperty |
mjaProperty
|
(package private) MJAreport |
mjaReport
|
(package private) MJAsampleList |
mjaSampleList
|
(package private) MJAsampleList |
mjaSL
|
(package private) MJAstate |
mjaState
|
(package private) MJAutil |
mjaUtil
|
private static int |
nCondsInOCL
current active genes lists for generating export data |
private static int |
nFiltered
current active genes lists for generating export data |
private static int |
nGenes
current active genes lists for generating export data |
private boolean |
useBkgrdFlag
status of (a.processBits & lookupProcessBitsDBvalue("Use-background-data"))!=0) |
private boolean |
useF1F2dataFlag
status of (a.processBits & lookupProcessBitsDBvalue("Use-F1-F2-channels"))!=0) |
private boolean |
useFilterFlag
status of (a.processBits & lookupProcessBitsDBvalue("Use-filter")) |
private boolean |
useHPsetsFlag
|
private boolean |
useMeanHPeListDataFlag
|
private boolean |
useRawDataFlag
status of (a.processBits & lookupProcessBitsDBvalue("Use-raw-data")) |
private boolean |
verticallyStackedFlag
status of (a.processBits & lookupProcessBitsDBvalue("Use-vert-stacked-data"))!=0) |
Constructor Summary | |
(package private) |
Reval(MaeJavaAPI mja,
int maxAnalyses)
Reval() - constructor for initial database allocation |
Method Summary | |
(package private) boolean |
copyFile(java.lang.String srcName,
java.lang.String dstName,
java.lang.String optUpdateMsg,
int optEstInputFileLth)
copyFile() - binary copy of one file or URL toa local file |
(package private) boolean |
createInputDataFiles(java.lang.String inputFilesBasePath)
createInputDataFiles() - create any input data files required for current analysis. |
private SimpleTable |
cvtFloatArrayData2Table(RLO a,
SimpleTable st,
float[][] xData,
float[][] yData,
float[][] xBkgrd,
float[][] yBkgrd,
int nX,
int nY,
int nFiltered,
boolean[] activeGeneList,
java.lang.String[] fieldNames,
java.lang.String[] classNames)
cvtFloatArrayData2Table() - convert xData,yData nX,nY expression data for nGenes active genes to SimpleTable. |
private SimpleTable |
cvtStringArrayData2Table(RLO a,
SimpleTable st,
java.lang.String[][] sData,
int nRows,
int nCols,
java.lang.String[] fieldNames)
cvtStringArrayData2Table() - convert sData, nS, nRows to SimpleTable. |
(package private) boolean |
deleteLocalFile(java.lang.String fileName)
deleteLocalFile() - delete local file. |
private boolean |
genCurAnnotationDataFile(RLO a,
SimpleTable st)
genCurAnnotationDataFile() - generate exported input data file for current gene annotation data. |
private boolean |
genCurHPdataFile(RLO a,
SimpleTable st)
genCurHPdataFile() - generate exported input data file for current HP. |
private boolean |
genCurHPsetDataFile(RLO a,
SimpleTable st,
int inputType)
genCurHPsetDataFile() - generate exported input data file for current HP set data (including: HP-X set, HP-Y set, HP-E list, current condition list). |
private boolean |
genCurHPXYdataFile(RLO a,
SimpleTable st,
boolean useHPsetsFlag)
genCurHPXYdataFile() - generate exported input data file for current HP-X and HP-Y or mean (HP-X set and mean HP-Y set). |
private boolean |
genCurHPXYsetsDataFile(RLO a,
SimpleTable st)
genCurHPXYsetsDataFile() - generate exported input data file for current HP-X and HP-Y sets data. |
private boolean |
genCurOCLdataFile(RLO a,
SimpleTable st)
genCurOCLdataFile() - generate exported input data file for current Ordered Condition List data. |
private boolean |
genCurStateThresholdsFile(RLO a,
SimpleTable st)
genCurStateThresholdsFile() - generate exported input data file for current state thresholds data. |
private boolean |
genCurStateValuesFile(RLO a,
SimpleTable st)
genCurStateValuesFile() - generate exported input data file for current state flags and names values data. |
(package private) java.lang.String |
popupDialog(java.lang.String promptMsg,
java.lang.String defaultAnswer)
popupDialog() prompt with message and return response. |
(package private) java.lang.String |
readTextFromFile(java.lang.String textFileName,
java.lang.String loadingMsg)
readTextFromFile() - read text from text file. |
(package private) boolean |
setRoutput2ClientObjects()
setRoutput2ClientObjects() - copy data for any R2Mae Action entries in the RLO. |
void |
setupNameTypeDB()
setupNameTypeDB() - setup the RLO (name,type) input, output, action, processBits database |
(package private) void |
setWaitCursor(boolean flag)
setWaitCursor() - turn wait cursor on and off |
(package private) void |
showMsg(java.lang.String msg)
showMsg() - display message in client GUI |
(package private) java.lang.String |
toString(int rloID,
java.lang.String optGenRbitsStr)
toString() - create string representing the R LayOut (RLO) of the instance. |
private boolean |
writeRdataTableFile(SimpleTable st,
java.lang.String fileName)
writeRdataTableFile() - write the MAE table data as R input file |
(package private) boolean |
writeTextToFile(java.lang.String textFileName,
java.lang.String textReport)
writeTextToFile() - save text string as text file. |
Methods inherited from class java.lang.Object |
|
Field Detail |
static MAExplorer mae
static MaeJavaAPI mja
MJAcluster mjaCluster
MJAcondition mjaCondition
MJAfilter mjaFilter
MJAgeneList mjaGeneList
MJAgeometry mjaGeometry
MJAplot mjaPlot
MJAproperty mjaProperty
MJAreport mjaReport
MJAsampleList mjaSampleList
MJAsampleList mjaSL
MJAstate mjaState
MJAutil mjaUtil
private boolean useFilterFlag
private boolean useRawDataFlag
private boolean verticallyStackedFlag
private boolean useBkgrdFlag
private boolean useF1F2dataFlag
private boolean useHPsetsFlag
private boolean useMeanHPeListDataFlag
private boolean[] activeGeneList
private static int maxGenes
private static int nFiltered
private static int[] midList
private static int nGenes
private static int nCondsInOCL
Constructor Detail |
Reval(MaeJavaAPI mja, int maxAnalyses)
mja
- is instance of MaeJavaAPImaxAnalyses
- to set up the databaseMethod Detail |
public void setupNameTypeDB()
boolean setRoutput2ClientObjects()
If the useRLOloggingFlag is set, then use RLO Report logging by creating subdirectory in {project}/Report/{RLOname}-yymmdd.hhmmss/ to store the RLO output files copied to Report/.
setRoutput2ClientObjects
in class RevalBase
RevalBase.getSetR2ClientFileNames()
,
RevalBase.getSetR2ClientObjNames()
,
RevalBase.getSetR2ClientObjTypes()
void showMsg(java.lang.String msg)
showMsg
in class RevalBase
msg
- message to displayvoid setWaitCursor(boolean flag)
setWaitCursor
in class RevalBase
flag
- to turn wait cursor on or offjava.lang.String readTextFromFile(java.lang.String textFileName, java.lang.String loadingMsg)
readTextFromFile
in class RevalBase
textFileName
- full path name of text fileloadingMsg
- to display while loading, null if no messageboolean writeTextToFile(java.lang.String textFileName, java.lang.String textReport)
writeTextToFile
in class RevalBase
textFileName
- full path name of text filetextReport
- text to save in fileboolean copyFile(java.lang.String srcName, java.lang.String dstName, java.lang.String optUpdateMsg, int optEstInputFileLth)
copyFile
in class RevalBase
srcName
- is either a full path local file name or
a http:// prefixed URL string of the source file.dstName
- is the full path of the local destination file nameoptUpdateMsg
- (opt) will display message in showMsg() and
increasing ... in showMsg2(). One '.' for every 10K bytes read.
This only is used when reading a URL. Set to null if not used.optEstInputFileLth
- is the estimate size of the in;ut file if
known else 0. Used in progress bar.boolean deleteLocalFile(java.lang.String fileName)
deleteLocalFile
in class RevalBase
fileName
- to be deleted on the local file system.java.lang.String popupDialog(java.lang.String promptMsg, java.lang.String defaultAnswer)
popupDialog
in class RevalBase
promptMsg
- is prompt messagedefault
- if press cancelboolean createInputDataFiles(java.lang.String inputFilesBasePath)
createInputDataFiles
in class RevalBase
inputFilesBasePath
- where to put generated filesSimpleTable
,
Table
,
Table.makeTabDelimReport(java.lang.String)
,
MJACondition#getCurCondition
,
MJACondition#getSamplesInCondList
,
MJACondition#getCondListLength
,
MJACondition#getCurOCL
,
MJACondition#getConditionsInOrderedCondList
,
MJACondition#getSamplesInCondList
,
MJAfilter.getNbrGenesPassingFilter()
,
MJAreport.writeTextToFile(java.lang.String, java.lang.String)
,
MJAsampleList.getCurrent_HP_index()
,
MJAsampleList.getCurrent_HP_X_index()
,
MJAsampleList.getCurrent_HP_Y_index()
,
MJAsampleList.getF1F2dataForSample(float[], float[], int[], int, java.lang.String)
,
MJAsampleList.getHPdataForSample(float[], int[], int, java.lang.String)
,
MJAsampleList.getHP_XandYsetDataForSample(float[], float[], int[], java.lang.String)
,
MJAsampleList.getSizeOf_HP_X_set()
,
MJAsampleList.getSizeOf_HP_Y_set()
,
MJAsampleList.getSizeOf_HP_E_set()
,
MJAsampleList.getListOfHPXsampleIndices()
,
MJAsampleList.getListOfHPYsampleIndices()
,
MJAsampleList.getListOfHPEsampleIndices()
,
MJAsampleList.getCurrent_HP_X_name(boolean)
,
MJAsampleList.getCurrent_HP_Y_name(boolean)
,
MJAsampleList.getClassXname()
,
MJAsampleList.getClassYname()
,
MJAsampleList.getHP_Xset_SampleNames()
,
MJAsampleList.getHP_Yset_SampleNames()
,
MJAsampleList.getHP_Elist_SampleNames()
,
MJAstate.get_useHPxySetsDataFlag()
,
MJAstate.get_useHP_E_ListDataFlag()
,
cvtFloatArrayData2Table(RLO, SimpleTable, float[][], float[][], float[][], float[][], int, int, int, boolean[], java.lang.String[], java.lang.String[])
,
cvtStringArrayData2Table(RLO, SimpleTable, java.lang.String[][], int, int, java.lang.String[])
,
RevalBase.getCurrentRLO()
private boolean genCurHPdataFile(RLO a, SimpleTable st)
a
- is the current RLO to usest
- is the current SimpleTable to generatecreateInputDataFiles(java.lang.String)
private boolean genCurHPXYdataFile(RLO a, SimpleTable st, boolean useHPsetsFlag)
a
- is the current RLO to usest
- is the current SimpleTable to generateuseHPsetsFlag
- to get means of HP-X(Y) 'sets' means if true,
else get single HP-X and HP-Y samples.createInputDataFiles(java.lang.String)
private boolean genCurHPXYsetsDataFile(RLO a, SimpleTable st)
a
- is the current RLO to usest
- is the current SimpleTable to generatecreateInputDataFiles(java.lang.String)
private boolean genCurHPsetDataFile(RLO a, SimpleTable st, int inputType)
a
- is the current RLO to usest
- is the current SimpleTable to generatecreateInputDataFiles(java.lang.String)
private boolean genCurOCLdataFile(RLO a, SimpleTable st)
a
- is the current RLO to usest
- is the current SimpleTable to generatecreateInputDataFiles(java.lang.String)
private boolean genCurAnnotationDataFile(RLO a, SimpleTable st)
a
- is the current RLO to usest
- is the current SimpleTable to generatecreateInputDataFiles(java.lang.String)
private boolean genCurStateThresholdsFile(RLO a, SimpleTable st)
a
- is the current RLO to usest
- is the current SimpleTable to generatecreateInputDataFiles(java.lang.String)
private boolean genCurStateValuesFile(RLO a, SimpleTable st)
a
- is the current RLO to usest
- is the current SimpleTable to generatecreateInputDataFiles(java.lang.String)
private boolean writeRdataTableFile(SimpleTable st, java.lang.String fileName)
st
- is the Simple table to write outsMod
- is the file name modifierprivate SimpleTable cvtFloatArrayData2Table(RLO a, SimpleTable st, float[][] xData, float[][] yData, float[][] xBkgrd, float[][] yBkgrd, int nX, int nY, int nFiltered, boolean[] activeGeneList, java.lang.String[] fieldNames, java.lang.String[] classNames)
a
- is the RLO instancest
- is the SimpleTable instance to populatexData[nX][nGenes]
- is the set of X column datayData[nY][nGenes]
- is the set of Y column data if not nullxBkgrd[nX][nGenes]
- is set of X column background data if not nullyBkgrd[nY][nGenes]
- is set of Y column background data if not nullnX
- is the number of X columnsnY
- is the number of Y columns if not 0nFiltered
- is the number of rows in each column in the input data.
If we are filtering, then it is the # (subset) of filtered genes
contained in activeGeneList - not the maxGenes.activeGeneList
- is the [maxGenes] boolean list of active filtered
genes. If this is null, then nFiltered is maxGenesfieldNames[]
- is the optional field names from xData followed
by yData if nY>0. It does NOT contain "mid".
However, if null, use "mid", "f1", "f2", ...classNames
- is list of class names [nX+nY] which get written
out in row 2 if the list exists. It is required for vertical
stacking.private SimpleTable cvtStringArrayData2Table(RLO a, SimpleTable st, java.lang.String[][] sData, int nRows, int nCols, java.lang.String[] fieldNames)
a
- is the RLO instancest
- is the SimpleTable instance to populatesData[nS][nRows]
- is the set of column datanRows
- is the number of rows in each columnnCols
- is the number of columnsfieldNames[]
- is the optional field names from xData followed
by yData if nY>0. If null, use "f1", "f2", ...java.lang.String toString(int rloID, java.lang.String optGenRbitsStr)
rloID
- is the index of the RLO to convertoptGenRbitsStr
- optional genRbits representation computed
elsewhere. The GenR bits are only used with the client
specific demos (if nay).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |