Creating tool which requires specific input file extension

Hello everyone!

I am working on developing some Galaxy tools.

A problem I have come across a couple of times is programs requiring input files with specific file extensions e.g. .JPG.

This is challenging for me as it is my understanding that the Galaxy representation of uploaded files is arbitrarily named with the .dat extension.

Is there a way I can control the extension of uploaded files? Can I rewrite my tool XML to work around this?

I would really appreciate any thoughts or suggestions :slight_smile:

All the best and many thanks,

Oliver

I think you can do something with a symlink. See here for an example: Wrapping a script which implicitly expects a local file - #6 by astrov

If it is a python script you could do something like (no working code just an idea):

    if os.path.splitext(galaxyinputfile)[1] == ".dat":
        cwd = os.getcwd()
        jpginputFile=cwd+os.path.splitext(os.path.basename(galaxyinputfile))[0]+".jpg"
        shutil.copy(galaxyinputfile, jpginputFile)

There may be better ways but this could give some inspiration already

2 Likes

Thank you very much @gbbio! That got me going in the right direction :slight_smile:

All the best, Oliver