public abstract class R_Module extends ScriptModuleImpl
Modifier and Type | Field and Description |
---|---|
static String |
EXE_RSCRIPT
Config property "exe.Rscript" defines the command line executable to call RScript |
protected static String |
P_VAL_CUTOFF
Config property "r.pvalCutoff" defines the p-value cutoff for significance |
protected static String |
R_COLOR_BASE
Config property "r.colorBase" defines the base label color |
protected static String |
R_COLOR_HIGHLIGHT
Config property "r.colorHighlight" defines the highlight label color |
protected static String |
R_COLOR_PALETTE
Config property "r.colorPalette" defines the color palette for PDF plots |
protected static String |
R_COLOR_POINT
Config property "r.colorPoint" defines the pch point colors for PDF plots |
protected static String |
R_DEBUG
Config boolean property "r.debug" sets the debug log function endabled |
protected static String |
R_FUNCTION_LIB
This library script contains helper functions used in the R scripts: "BioLockJ_Lib.R"
|
protected static String |
R_MAIN_SCRIPT
This main R script that sources helper libraries and calls modules main method function: "BioLockJ_MAIN.R"
|
protected static String |
R_PCH
Config property "r.pch" defines the plot point shape for PDF plots |
protected static String |
R_RARE_OTU_THRESHOLD
Config Double property "r.rareOtuThreshold" defines number OTUs needed to includ in
reports |
protected static String |
R_SAVE_R_DATA
Config boolean property "r.saveRData" enables the .RData file to save. |
protected static String |
R_TIMEOUT
Config property "r.timeout" defines the number of minutes before R script fails due to
timeout. |
GZIP_EXT, LOG_EXT, PDF_EXT, RETURN, SH_EXT, TAB_DELIM, TSV_EXT, TXT_EXT
SCRIPT_BATCH_SIZE, SCRIPT_DEFAULT_HEADER, SCRIPT_NUM_THREADS, SCRIPT_PERMISSIONS, SCRIPT_TIMEOUT
MAIN_SCRIPT_PREFIX, OUTPUT_DIR, TEMP_DIR
Constructor and Description |
---|
R_Module() |
Modifier and Type | Method and Description |
---|---|
List<List<String>> |
buildDockerBashScript()
Run R script in docker.
|
List<List<String>> |
buildScript(List<File> files)
Not needed for R script modules.
|
void |
checkDependencies()
|
void |
executeTask()
Builds an R script by calling sub-methods to builds the BaseScript and creates the MAIN script shell that sources
the BaseScript, calls runProgram(), reportStatus() and main() which can only be implemented in a subclass.
|
String[] |
getJobParams()
If running Docker, run the Docker bash script, otherwise:
Run Config ."exe.Rscript" command on the generated R Script:
ScriptModuleImpl.getMainScript() . |
static File |
getMainR()
Get the main R script
|
protected String |
getMetaMergedModule()
Get correct meta-merged BioModule type for the give module.
|
File |
getModuleScript()
Get the Module script
|
List<String> |
getPreRequisiteModules()
Require combined count-metadata tables as input.
|
File |
getPrimaryScript()
Get the primary R script
|
static String |
getRTemplateDir()
Get the BioLockJ resource R directory.
|
protected List<String> |
getStatPreReqs()
Add
R_CalculateStats to standard getPreRequisiteModules() |
String |
getSummary()
Produce summary file counts for each file extension in the output directory and the number of log files in the
temp directory.
|
Integer |
getTimeout()
The R Script should run quickly, timeout = 10 minutes appears to work well.
|
List<String> |
getWorkerScriptFunctions()
This method generates the bash function that calls the R script: runScript.
|
static void |
writeNewScript(String path,
String rCode)
This method generates an R script with the given rCode saved to the given path.
|
protected void |
writePrimaryScript()
Initialize the R script by creating the MAIN R script that calls source on the BaseScript and adds the R code for
the runProgarm() method.
|
protected static void |
writeScript(BufferedWriter writer,
String rCode)
This method formats the rCode to indent code blocks surround by curly-braces "{ }"
|
buildScriptForPairedReads, getMainScript, getRuntimeParams, getScriptDir, getScriptErrors, hasScripts
cacheInputFiles, cleanUp, compareTo, equals, findModuleInputFiles, getFileCache, getID, getInputFiles, getModuleDir, getOutputDir, getPostRequisiteModules, getTempDir, init, isValidInputModule, toString, validateFileNameUnique
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
cleanUp, getID, getInputFiles, getModuleDir, getOutputDir, getPostRequisiteModules, getTempDir, init, isValidInputModule
public static final String EXE_RSCRIPT
Config
property "exe.Rscript" defines the command line executable to call RScriptprotected static final String P_VAL_CUTOFF
Config
property "r.pvalCutoff" defines the p-value cutoff for significanceprotected static final String R_COLOR_BASE
Config
property "r.colorBase" defines the base label colorprotected static final String R_COLOR_HIGHLIGHT
Config
property "r.colorHighlight" defines the highlight label colorprotected static final String R_COLOR_PALETTE
Config
property "r.colorPalette" defines the color palette for PDF plotsprotected static final String R_COLOR_POINT
Config
property "r.colorPoint" defines the pch point colors for PDF plotsprotected static final String R_DEBUG
Config
boolean property "r.debug" sets the debug log function endabledprotected static final String R_FUNCTION_LIB
protected static final String R_MAIN_SCRIPT
protected static final String R_PCH
Config
property "r.pch" defines the plot point shape for PDF plotsprotected static final String R_RARE_OTU_THRESHOLD
Config
Double property "r.rareOtuThreshold" defines number OTUs needed to includ in
reportsprotected static final String R_SAVE_R_DATA
Config
boolean property "r.saveRData" enables the .RData file to save.protected static final String R_TIMEOUT
Config
property "r.timeout" defines the number of minutes before R script fails due to
timeout. If undefined, no timeout is used.public List<List<String>> buildDockerBashScript()
public List<List<String>> buildScript(List<File> files) throws Exception
buildScript
in interface ScriptModule
buildScript
in class ScriptModuleImpl
files
- Files in the input directory that contain only forward readsException
- if unable to generate script linespublic void checkDependencies() throws Exception
ScriptModuleImpl
checkDependencies
in interface BioModule
checkDependencies
in class ScriptModuleImpl
Exception
- thrown if missing or invalid dependencies are foundpublic void executeTask() throws Exception
executeTask
in interface BioModule
executeTask
in class ScriptModuleImpl
Exception
- thrown if the module is unable to complete is taskpublic String[] getJobParams() throws Exception
Config
."exe.Rscript" command on the generated R Script:
ScriptModuleImpl.getMainScript()
.getJobParams
in interface ScriptModule
getJobParams
in class ScriptModuleImpl
Runtime.exec(String)
parametersException
- if unable to build the job parameterspublic File getModuleScript() throws Exception
Exception
- if errors occurpublic List<String> getPreRequisiteModules() throws Exception
getPreRequisiteModules
in interface BioModule
getPreRequisiteModules
in class BioModuleImpl
Exception
- if invalid Class names are returned as prerequisitespublic File getPrimaryScript()
public String getSummary() throws Exception
getSummary
in interface BioModule
getSummary
in class ScriptModuleImpl
Exception
- if any error occurspublic Integer getTimeout()
getTimeout
in interface ScriptModule
getTimeout
in class ScriptModuleImpl
public List<String> getWorkerScriptFunctions() throws Exception
getWorkerScriptFunctions
in interface ScriptModule
getWorkerScriptFunctions
in class ScriptModuleImpl
Exception
- if errors occurprotected String getMetaMergedModule() throws Exception
Exception
- if errors occurprotected List<String> getStatPreReqs() throws Exception
R_CalculateStats
to standard getPreRequisiteModules()
Exception
- if errors occur determining eligibilityprotected void writePrimaryScript() throws Exception
Exception
- if unable to build the R script stubpublic static File getMainR() throws Exception
Exception
- if errors occurpublic static String getRTemplateDir() throws Exception
Exception
- if errors occurpublic static void writeNewScript(String path, String rCode) throws Exception
path
- Path to new R ScriptrCode
- R script codeException
- if I/O errors occurprotected static void writeScript(BufferedWriter writer, String rCode) throws Exception
writer
- BufferedWriter writes to the filerCode
- R codeException
- if I/O errors occur