Python/R Script Not Integrating with Galaxy Correctly
Hello Galaxy-Dev List, I am having some issues in getting a script to work correctly in Galaxy. My script is written in Python, uses RPy2 to pass some data to the R environment and then calls a custom R function; the output of this function, and of the greater Python/R tool, is a file. I am having 2 problems: the first is that R cannot find the R file holding the function, and the second is that Galaxy cannot find the output file. Before I elaborate on these issues, I should point out that when called from the command line this script executes exactly as I intend it to. First issue: When called by Galaxy, the Python portion of the script runs fine, and the RPy2 portion devoted to setting up the R environment so that the script can run seems to execute just fine. The script fails when it tells R to call the custom function, with the following output: Python output: Traceback (most recent call last): File "/Users/kipperfletez-brant/galaxy-dist/tools/myTools/svm_enh/svm_train_classify_cv.py", line 865, in <module> if __name__=='__main__': main() File "/Users/kipperfletez-brant/galaxy-dist/tools/myTools/svm_enh/svm_train_classify_cv.py", line 851, in main robjects.r.source(current) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/rpy2/robjects/functions.py", line 82, in __call__ return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/rpy2/robjects/functions.py", line 34, in __call__ res = super(Function, self).__call__(*new_args, **new_kwargs) rpy2.rinterface.RRuntimeError: Error in file(file, "r", encoding = encoding) : cannot open the connection R output: /Users/kipperfletez-brant/galaxy-dist/database/job_working_directory/106/rocprc.R [1] "/Users/kipperfletez-brant/galaxy-dist/database/job_working_directory/106" Error in file(file, "r", encoding = encoding) : cannot open the connection In addition: Warning message: In file(file, "r", encoding = encoding) : cannot open file '/Users/kipperfletez-brant/galaxy-dist/database/job_working_directory/106/rocprc.R': No such file or directory The first line of the R output is the return of a call to the Python function os.path.abspath('rocprc.R') (note that os.path.realpath('rocprc.R') returns the same path), while the second line, for comparison, is a call to R's getwd() - the R file is in the same directory as the R environment's setting, but for some reason R cannot find the file. Because this works from the command line, I suspect that I am not taking some Galaxy setting into account. Second issue: Trying to identify even the kind of error, I hard-coded the directory in which I know the R file to reside in a call to R's setwd(). This time, the script runs correctly, but there is no file returned by Galaxy. The script execution ends with the following output message: empty format: pdf, database: ? Info: [1] "/Users/kipperfletez-brant/galaxy-dist/tools/myTools/svm_enh" Watching the file in which the R script is held, I know that the output PDF is saved in the same file as that specified in my tool's XML, which, for other tools I've written, has resulted in an output file. Looking at the log, the following DEBUG message is written: galaxy.jobs DEBUG 2012-01-09 10:16:49,899 finish(): Could not move /Users/kipperfletez-brant/galaxy-dist/database/job_working_directory/111/rocprc.pdf to /Users/kipperfletez-brant/galaxy-dist/database/files/000/dataset_111.dat as directed by from_work_dir As with the first issue, I suspect there is some sort of Galaxy setting I am unaware of. Generally, because both issues relate to finding files not directly created/referenced by the caller Python script, I suspect that there will be some commonality between the resolutions of the two issues, but I am need help to see that. Thank you for reading, Kipper Fletez-Brant
participants (1)
-
Christopher Fletez-Brant