Wrapping a script which implicitly expects a local file

I am wrapping a script and getting an error.
The script requires 2 files of different types in order to run, and these files are required to have the same name (prefix).
This common name of the two files is passed into the script as a command line argument and the script looks in the local dir for these two files. These two files are outputs from a previous tool.

How can I ensure that these two files are in the local environment for this wrapped script?


1 Like

Welcome, @sdunc !
I can’t help much because I sorta have no experience in wrapping at all, and you probably will get a better answer from someone else from Galaxy team, but let me ask you, please

Are you expecting it to look in a local dir, like as if it literally works only in a local Galaxy installation manner, or this can be “look for files in a Galaxy history” ?

Hey David, Thank you for the reply.

I will be more exhaustive in my explanation. Running the script looks something like:

% EmmaScript -t <prefix>

The program ‘EmmaScript’ needs two files of different filetypes but identical prefix (the argument passed to the program).

When I test this on my local galaxy instance I encounter this error:

ERROR: Cannot open file /home/step/galaxy/database/objects/0/f/e/dataset_0fef377a-b8fd-4029-a29d-f6cecd094a57.dat.tfam for writing

I understand this to mean that the files are not located in the environment in which the tool is executing (which I think Galaxy refers to as the job working directory?)

The two files are outputs from a previous tool and appear in my history, however I am not able to pass them as to this script (the one I am trying to wrap) since they are not exactly called as arguments- only the shared prefix is passed and the files are expected to be there.

Is it possible to make these files available in the working directory of this tool without explicitly passing them in as arguments?

Thanks again!

Continuing the discussion from Wrapping a script which implicitly expects a local file:


I was able to get this to work by changing the command a bit.

<previous step>
EmmaScript -t <prefix>

Now the required files, the output of the previous step are available in the working dir.
However… I would rather keep these tools and steps separate. So my questions still stands.

Is it possible to do something similar to rename variables like we do in the workflows in order to control the output datasets’ names?

@sdunc in this case, we would normally symlink the files at the start of the command. If the steps are running as part of the same script, you can always mkdir and mv files as they are generated in the working directory.


mkdir new_dir &&
ln -s $input_1_varname new_dir/prefix_I_want.ext &&
ln -s $input_2_varname new_dir/prefix_I_want.ext2 &&
EmmaScript -t new_dir/<prefix>
1 Like