Question: How To Create A Tool From A Script That Loads Additional Source Code Files?
0
gravatar for Samuel Lampa
5.8 years ago by
Samuel Lampa20
European Union
Samuel Lampa20 wrote:
Hi, I have aGalaxy toolwith some R code which is split up into a few files, which are loaded by a "master R script", which orcestrates and executes the whole thing. I realize that when the master script ("run.R" in my case) is run, it will not find the other files, since it is itself moved away to a temporary working directory (something like ".../galaxy/database/job_working_directory/000/165"). Is there any "standard way" of dealing with this, any special toolconfig syntax etc? ... or do I have to just hard code the absolute paths to the extra files in my script? :| Best Regards // Samuel -- Developer at SNIC-UPPMAX www.uppmax.uu.se Developer at Dept of Pharm Biosciences www.farmbio.uu.se
galaxy • 830 views
ADD COMMENTlink modified 5.8 years ago by Peter Cock1.4k • written 5.8 years ago by Samuel Lampa20
0
gravatar for Peter Cock
5.8 years ago by
Peter Cock1.4k
European Union
Peter Cock1.4k wrote:
Presumably all the child R scripts will be in the same folder as your master R script (or you know the relative path if not). So all you need to do is workout the path of the master R script, and from that compute the path to the child R scripts. I guess you can do this in R using commandArgs(). For future reference, queries about writing tools and extending Galaxy should go to the galaxy-dev list (CC'd), not galaxy-users. Peter
ADD COMMENTlink written 5.8 years ago by Peter Cock1.4k
Hi, thanks for the quick reply! True. And yes, I do keep the other scripts in the same folder. But since the main script is moved away to the job_working_directory (but not the other scripts, as far as I can tell), they will not be in the same folder anymore, so then in order to get from the job_working_directory back to the tools folder, I would need to go something like: [main R script folder]../../../../tools/[mytool]/r/[script file] I was thinking that it might be a bit fragile, but of course, if the directory depth of the job_working_directory path will keep quite constant it will surely not be a big problem. Ah, true! I always tend to forget that I'm not the true end-user of galaxy, although I'm in a way "using" it :) Best Regards // Samuel
ADD REPLYlink written 5.8 years ago by Samuel Lampa20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 177 users visited in the last hour