Custom galaxy tool specifying working directory

Hello,

What you can do is make use of bash, zip (optional) and temporary folders and upload a zip file.
So you start your script like something like this:

<command>
<![CDATA[
bash '$__tool_directory__/yourbashwrapperscript.sh $input $output $param1 $param2
]]>
</command>

The bash wrapper (with zip) looks something like this:

    outlocation=$(mktemp -d your_path/galaxy/database/XXXXXX)
    mkdir $outlocation"/outputfolder"
    mkdir $outlocation"/inputfolder"
    unzip $1 -d $outlocation"/inputfolder" 
    mytool.py -input [inputfolder files] -param $3 -param2 $4 -outputfolder $outlocation"/outputfolder"
    zip -r -j $outlocation"/output.zip" $outlocation"/outputfolder"
    mv  $outlocation"/output.zip" $2
    rm -rf $outlocation

You can also just move all the output files to galaxy instead of zipping it. To do this you need more
mv commands and output locations in your xml. I have a tool where I can choose my output files with the help of a boolean parameter and a output filter. You can find it in the manual and if necessarily I can explain it but it is out of the scope of your question :blush:
You can not literally copy paste this code, it is just for inspiration.

EDIT:
Forgot the docker part. You can mount the tempfolder in your docker.

2 Likes