OpenMS
2.4.0
|
R-Wrapper Class. More...
#include <OpenMS/SYSTEM/RWrapper.h>
Static Public Member Functions | |
static String | findScript (const String &script_file, bool verbose=true) |
Look for an R script in the share/OpenMS/SCRIPT folder. More... | |
static bool | findR (const QString &executable=QString("Rscript"), bool verbose=true) |
Check for presence of 'Rscript'. More... | |
static bool | runScript (const String &script_file, const QStringList &cmd_args, const QString &executable=QString("Rscript"), bool find_R=false, bool verbose=true) |
Run an R script with certain arguments on the command line. More... | |
R-Wrapper Class.
Call R scripts from OpenMS, mainly to produce plots.
|
static |
Check for presence of 'Rscript'.
verbose | Print failure information? |
Look for an R script in the share/OpenMS/SCRIPT folder.
The script filename can be an absolute filename (in which case the filename is returned unchanged), or a relative filename or just a filename. In the latter cases, the script will be searched in the OpenMS 'SCRIPTS' path (share/OpenMS/SCRIPTS) and the full filename will be returned.
An exception will be thrown if the file cannot be found.
script_file | Name of the R script |
verbose | Print error message to LOG_ERROR upon FileNotFound |
Exception::FileNotFound |
|
static |
Run an R script with certain arguments on the command line.
The following checks are done before running the script: 1) [optional] 'Rscript' executable is searched (see findR() – set find_R
to true) 2) The script_file is searched in 'OpenMS/share/SCRIPTS' (see findScript()). 3) The script is run as $ Rscript <path/to/script> <arg1> <arg2> ...
If any of the above steps fail, an error message is printed and false is returned.
The 'cmd_args' are passed via commandline and should be read by the R script using R' commandArgs() function. Usually, the args are input and output filenames.
script_file | Filename of the R script |
cmd_args | Command line arguments to the script |
find_R | Run findR()? May be skipped if runScript() is run repeatedly |
verbose | Print status information; also passed internally to findR() and findScript(). |