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 String
DEFAULT_R_LANG
protected static String
LANG_ENVIRONMENT_VARIABLE
static String
REXECUTOR_NAME
static String
RSCRIPT_EXECUTABLE
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProcessRExecutor(File outputDirectory, File temporaryDirectory)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static File
changeFileExtension(File file, String newExtension)
Change the extendsion of a filevoid
closeConnection()
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.SimpleProcess
createSimpleProcess()
Create the process that will execute the R Script.protected void
executeRScript(File rScriptFile, boolean sweave, String sweaveOuput, File workflowOutputDir, String... scriptArguments)
Execute a R script.String
getName()
Get the name of the RExecutor.protected static boolean
isSameLocalPath(DataFile a, DataFile b)
Check if two file have the same local pathprotected void
putFile(DataFile inputFile, String outputFilename)
Put a file for the analysis.protected void
removeFile(String filename)
Remove a file of the analysis.void
writerFile(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:RExecutor
Get 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:AbstractRExecutor
Put a file for the analysis.- Specified by:
putFile
in 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:RExecutor
Write 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:AbstractRExecutor
Remove a file of the analysis.- Specified by:
removeFile
in 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 IOException
Create 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:AbstractRExecutor
Execute a R script.- Specified by:
executeRScript
in 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 IOException
Description copied from interface:RExecutor
Close the connection.- Specified by:
closeConnection
in interfaceRExecutor
- Overrides:
closeConnection
in classAbstractRExecutor
- Throws:
IOException
- if an error occurs while closing the connection
-
-