Class 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
    • Constructor Detail

      • ProcessRExecutor

        protected ProcessRExecutor​(File outputDirectory,
                                   File temporaryDirectory)
                            throws IOException
        Constructor.
        Parameters:
        outputDirectory - the output directory
        temporaryDirectory - 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
      • writerFile

        public void writerFile​(String content,
                               String outputFilename)
                        throws IOException
        Description copied from interface: RExecutor
        Write a file.
        Parameters:
        content - the content of the file
        outputFilename - the output filename
        Throws:
        IOException - if an exception occurs while writing a file
      • createCommand

        protected List<String> createCommand​(File rScriptFile,
                                             boolean sweave,
                                             String sweaveOuput,
                                             String... scriptArguments)
        Create R command.
        Parameters:
        rScriptFile - the R script file to execute
        sweave - true if the script is a Sweave file
        scriptArguments - 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 class AbstractRExecutor
        Parameters:
        rScriptFile - The R script file
        sweave - execute the R using Sweave
        sweaveOuput - sweave output file
        scriptArguments - 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 file
        newExtension - the new extension of the file
        Returns:
        a file object
      • isSameLocalPath

        protected static boolean isSameLocalPath​(DataFile a,
                                                 DataFile b)
        Check if two file have the same local path
        Parameters:
        a - first file
        b - second file
        Returns:
        true if the file have the same local file