Cannot generate nested output directories and view them

I am adding a tool to a galaxy server. I want to take an input text file, create a directory named abc/, and run my script which will generate multiple files and nested directories with files within the abc/. The users should be able to enter the abc/ and view the files and directories on the server.

<tool id="your_tool_id" name="Your Tool Name" version="1.0.0">
    <description>Description of your tool</description>
    <command detect_errors="exit_code">
        mkdir abc;
        cp '$input_file' abc;
        mv abc '$output_directory';
    </command>
    <inputs>
        <param name="input_file" type="data" format="txt" label="Input Text File" />
    </inputs>
    <outputs>
        <collection name="output_directory" type="directory" label="Output Directory">
            <discover_datasets pattern="__name__" directory="abc" />
        </collection>
    </outputs>
</tool>

I uploaded an input text file and ran it, but the output (Output Directory, a nested list with dataset collections) was empty.
The real commands in the job description was:

mkdir abc; cp ‘/media/Data_3/galaxy/database/objects/1/8/0/dataset_1802c951-078f-478e-8c6e-761ce444bac9.dat’ abc; mv abc ‘<galaxy.tools.wrappers.DatasetCollectionWrapper object at 0x77605436f820>’;

Was anything in the xml wrong?

I kind of figured out that I cannot output nested directories on galaxy. There are only list and pair to output for collections, which only output a list of all files. I was expecting an output of file system where you can double click and enter each directory and open the directories and files under it.

1 Like

Hi @Renmao_Tian

Correct, the collection folders in Galaxy are used to group similar files together. These facilitate batch analysis. The nesting is for “lists of lists”, usually for paired-end read sets sub-grouped by an accession.

A history is more of a generalized type of “folder” like you are describing. People can have as many histories as they want, and copies of files between those are just references.

That said, I have seen a few tools (or maybe just one with different data?) that output different file types into a single list collection. One level only, and the datasets did have different datatypes. I can’t remember what exact tool that was but can look for it if you are interested in reviewing how the tool xml was modeled. This would be usual usage is Galaxy, so you would probably need to supply a really good Help section so people would know how to work with the outputs! Using that collection as an input with downstream tools … problematic … unless that downstream tool was specifically expecting that type of mixed input.

Anyway, thanks for posting back with the result! :slight_smile: