Class ProcessRExecutor
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.util.r.AbstractRExecutor
-
- fr.ens.biologie.genomique.eoulsan.util.r.ProcessRExecutor
-
- All Implemented Interfaces:
RExecutor
- Direct Known Subclasses:
DockerRExecutor
public class ProcessRExecutor extends AbstractRExecutor
This class define a standard RExecutor using a system process.- Since:
- 2.0
- Author:
- Laurent Jourdren
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringDEFAULT_R_LANGprotected static StringLANG_ENVIRONMENT_VARIABLEstatic StringREXECUTOR_NAMEstatic StringRSCRIPT_EXECUTABLE
-
Constructor Summary
Constructors Modifier Constructor Description protectedProcessRExecutor(File outputDirectory, File temporaryDirectory)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static FilechangeFileExtension(File file, String newExtension)Change the extendsion of a filevoidcloseConnection()Close the connection.protected List<String>createCommand(File rScriptFile, boolean sweave, String sweaveOuput, String... scriptArguments)Create R command.protected fr.ens.biologie.genomique.kenetre.util.process.SimpleProcesscreateSimpleProcess()Create the process that will execute the R Script.protected voidexecuteRScript(File rScriptFile, boolean sweave, String sweaveOuput, File workflowOutputDir, String... scriptArguments)Execute a R script.StringgetName()Get the name of the RExecutor.protected static booleanisSameLocalPath(DataFile a, DataFile b)Check if two file have the same local pathprotected voidputFile(DataFile inputFile, String outputFilename)Put a file for the analysis.protected voidremoveFile(String filename)Remove a file of the analysis.voidwriterFile(String content, String outputFilename)Write a file.-
Methods inherited from class fr.ens.biologie.genomique.eoulsan.util.r.AbstractRExecutor
executeRScript, getOutputDirectory, getOutputFiles, getTemporaryDirectory, openConnection, putInputFile, putInputFile, removeInputFiles
-
-
-
-
Field Detail
-
REXECUTOR_NAME
public static final String REXECUTOR_NAME
- See Also:
- Constant Field Values
-
RSCRIPT_EXECUTABLE
public static final String RSCRIPT_EXECUTABLE
- See Also:
- Constant Field Values
-
LANG_ENVIRONMENT_VARIABLE
protected static final String LANG_ENVIRONMENT_VARIABLE
- See Also:
- Constant Field Values
-
DEFAULT_R_LANG
protected static final String DEFAULT_R_LANG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProcessRExecutor
protected ProcessRExecutor(File outputDirectory, File temporaryDirectory) throws IOException
Constructor.- Parameters:
outputDirectory- the output directorytemporaryDirectory- the temporary directory- Throws:
IOException- if an error occurs while creating the object
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:RExecutorGet the name of the RExecutor.- Returns:
- the name of the RExecutor
-
putFile
protected void putFile(DataFile inputFile, String outputFilename) throws IOException
Description copied from class:AbstractRExecutorPut a file for the analysis.- Specified by:
putFilein classAbstractRExecutor- Parameters:
inputFile- the input fileoutputFilename- the output filename- Throws:
IOException- if an error occurs while putting the file
-
writerFile
public void writerFile(String content, String outputFilename) throws IOException
Description copied from interface:RExecutorWrite a file.- Parameters:
content- the content of the fileoutputFilename- the output filename- Throws:
IOException- if an exception occurs while writing a file
-
removeFile
protected void removeFile(String filename) throws IOException
Description copied from class:AbstractRExecutorRemove a file of the analysis.- Specified by:
removeFilein classAbstractRExecutor- Parameters:
filename- the filename of the file to remove- Throws:
IOException- if the removing of the file fails
-
createCommand
protected List<String> createCommand(File rScriptFile, boolean sweave, String sweaveOuput, String... scriptArguments)
Create R command.- Parameters:
rScriptFile- the R script file to executesweave- true if the script is a Sweave filescriptArguments- script arguments- Returns:
- the R command as a list
-
createSimpleProcess
protected fr.ens.biologie.genomique.kenetre.util.process.SimpleProcess createSimpleProcess() throws IOExceptionCreate the process that will execute the R Script.- Returns:
- a SimpleProcess object
- Throws:
IOException- if an error occurs when creation the process object
-
executeRScript
protected void executeRScript(File rScriptFile, boolean sweave, String sweaveOuput, File workflowOutputDir, String... scriptArguments) throws IOException
Description copied from class:AbstractRExecutorExecute a R script.- Specified by:
executeRScriptin classAbstractRExecutor- Parameters:
rScriptFile- The R script filesweave- execute the R using SweavesweaveOuput- sweave output filescriptArguments- script arguments- Throws:
IOException- if an error occurs while executing the script
-
changeFileExtension
protected static File changeFileExtension(File file, String newExtension)
Change the extendsion of a file- Parameters:
file- the filenewExtension- the new extension of the file- Returns:
- a file object
-
closeConnection
public void closeConnection() throws IOExceptionDescription copied from interface:RExecutorClose the connection.- Specified by:
closeConnectionin interfaceRExecutor- Overrides:
closeConnectionin classAbstractRExecutor- Throws:
IOException- if an error occurs while closing the connection
-
-