Question: how to define multiple outputs in galaxy
0
gravatar for inspiresnehal
3.0 years ago by
inspiresnehal20 wrote:

I am developing tool that uses the <repeat> tag in the xml file to gather an  number of inputs files from the user. The tool gathers all the inputs create output files for each one of them. Is it possible to create a new output for each of the corresponding inputs?  How to define multiple output files in the xml?

multiple outputs galaxy • 1.7k views
ADD COMMENTlink modified 2.9 years ago • written 3.0 years ago by inspiresnehal20
3
gravatar for Hotz, Hans-Rudolf
3.0 years ago by
Switzerland
Hotz, Hans-Rudolf1.8k wrote:

...well, it doesn't matter, whether you have a python, perl, bash, R, etc script. In the xml file you provide a "command line"  which will execute your script(s) and/or any commands.

Unfortunately, you don't provide much details, what you have already tried, and what kind of errors you got so far. Hence, I recommend you go step by step:

First: try the provided example (http://bit.ly/gxdiscovereddatasetexample).

  - Does this work for you? How many history items do you get?

Second: make it interactive, i.e variable number of outputs

 exchange the  <command> tag with:  <command interpreter="bash"> multi_output_configured_2.sh $num_param $report </command>

and (just as an example) provide this script - multi_output_configured_2.sh:

#!/bin/bash
echo "Hello" > $2;
mkdir subdir1
let i=1
while ((i<=$1))

    do
     echo "Welcome $i times" > subdir1/this$i.txt;
     let i++
    done

 

- does this work for you? do you get different number of history items depending on the number you provide

Third: use the <repeat> tag

 exchange the  <command> tag with:

  <command interpreter="bash"> multi_output_configured_3.sh $report        
        #for $q in $queries
            ${q.input2}
        #end for
  </command>

exchange the  <inputs> tag with:

  <inputs>
    <repeat name="queries" title="Dataset">
            <param name="input2" type="data" label="Select" />
    </repeat>
  </inputs>

 

and (just as an example) provide this script - multi_output_configured_3.sh:

#!/bin/bash
echo "Hello" > $1;
mkdir subdir1
let i=1
while ((i<$#))

    do
     echo "Welcome $i times" > subdir1/this$i.txt;
     let i++
    done

- does this work for you? do you get different number of history items depending on how many files you provide?

 

So, these are just "quick and dirty" changes to the provided example, which need a  lot more polishing. Nevertheless, I hope you can now continue incorporating your python script.

 

Hans-Rudolf

 

 

ADD COMMENTlink written 3.0 years ago by Hotz, Hans-Rudolf1.8k

The link to your first suggestion seems to be broken, do you have another link to it by any chance?

ADD REPLYlink written 2.4 years ago by katherine.beaulieu01480
1

make sure you do not include the ")" at the end of the link

ADD REPLYlink written 2.4 years ago by Hotz, Hans-Rudolf1.8k
2
gravatar for inspiresnehal
3.0 years ago by
inspiresnehal20 wrote:

hello Hans-Rudolf:

 

I refereed to the link you provided but i couldn't understand the example they provided. E.g they provided says

 

 echo "Hello" > $report;
    echo  subdir1 > $report
    mkdir subdir1;
    echo "This" > subdir1/this.txt;
    echo "That" > subdir1/that.txt;
    mkdir subdir2;
    echo "1" > subdir2/CUSTOM_1.txt;
    echo "2" > subdir2/CUSTOM_2.tabular;
    echo "3" > subdir2/CUSTOM_3.txt;
    mkdir subdir3;
    echo "Foo" > subdir3/Foo;
    echo "mapped reads" > split_bam_.MAPPED.bam;
    echo "unmapped reads" > split_bam_.UNMAPPED.bam;
    echo "1" > sample1.report.tsv;
    echo "2" > sample2.report.tsv;
    echo "3" > sample3.report.tsv;

 

 

But in my case I have python command. So where should I save files and how should I name them ? I was planning to use __new_file_path__ as temp file holder but they mention in the manual This is not very scalable and $__new_file_path__ should generally not be used..This tool will be my intermediate step in the workflow..

 

ADD COMMENTlink written 3.0 years ago by inspiresnehal20
1
gravatar for Hotz, Hans-Rudolf
3.0 years ago by
Switzerland
Hotz, Hans-Rudolf1.8k wrote:

Hi

Have a look at the wiki: https://wiki.galaxyproject.org/Admin/Tools/Multiple%20Output%20Files

 

Hans-Rudolf

ADD COMMENTlink written 3.0 years ago by Hotz, Hans-Rudolf1.8k
1
gravatar for Bjoern Gruening
3.0 years ago by
Bjoern Gruening5.1k
Germany
Bjoern Gruening5.1k wrote:

If you want to create a collection (one dataset with many subdatasets) please have a look at these test tools to get an impression how this all works: https://github.com/galaxyproject/galaxy/tree/dev/test/functional/tools

ADD COMMENTlink written 3.0 years ago by Bjoern Gruening5.1k
1
gravatar for inspiresnehal
2.9 years ago by
inspiresnehal20 wrote:

Hello Hans-Rudolf:

 

Thank you for your reply  and sorry for not taking so long to reply .

I applied yr solution it creates files in the subdir but doesn't creates output link in history ..

 

Below is the input form :

<tool id="align" name="PullDown_Sample_Alignemnt" version="0.0" force_history_refresh="True">
<description>Process pulldown allignmetn</description>    
<version_command>bowtie2 --version</version_command>
<requirements>
        <requirement type="package" version="2.2.5">bowtie2</requirement>
        <requirement type="package" version="0.1.19">samtools</requirement>
 </requirements>
 <command interpreter="bash">
    multi_output_configured_3.sh $report ${projectname}
         #for $q in $queries
               ${q.sampleid}   
               ${q.data_file.file_name}
              ${q.humanid}       
        #end for
 </command>
 <inputs>
   <param name="projectname" type="text" size="30" optional="true" value="" label="Project Name" help="Label    to   use in the output. If not given the dataset name will be used instead."/>
<repeat name="queries" title="Input files" min="2">   
    <param name="sampleid" type="text" size="30" optional="true" value="" label="Sample id/Name of the sample" help="Label to use in the output. If not given the dataset name will be used instead."/>
    <param name="data_file" type="data" format="fasta,fa,fastq.gz,fastq.bz2" label="Read file" help="Sequence data" />
    <param name="humanid" type="text" size="30" optional="true" value="" label="Individual ID (must be unique within each type of data)" help="This ID will be used to match samples across data types. e.g RRBS and hMeDIP-seq from the         same person."/>
   </repeat>
   </inputs>
    <outputs>      
         <data format="txt" name="report">
        <data format="txt" name="report" />
        </data>
  </outputs>

 

So I have multiple repeat format in the loop: If I create output file like

echo "Hello" > $report;

echo "World Contents" > '${__new_file_path__}/primary_${report.id}_world_visible_?'

at xml file it creates link in history but if I try to create link inside multi_output_configured_3.sh file then its doesn't work?

 

 

 

 

 

 

ADD COMMENTlink written 2.9 years ago by inspiresnehal20

Hi

The 'outputs' tag in your xml file doesn't seem right: You have nested 'data' tags, and there is no 'discover_datasets' tag.

Are the three simple examples, I provided, working for you? You haven't answered my questions. Hence it is difficult to help you you.

Hans-Rudolf

 

ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by Hotz, Hans-Rudolf1.8k
0
gravatar for inspiresnehal
2.9 years ago by
inspiresnehal20 wrote:

I applied yr solution it creates files in the subdir but doesn't creates output link in history ..

ADD COMMENTlink written 2.9 years ago by inspiresnehal20

What do you mean by "I applied yr solution"?

are you referring to the comments I made about your xml file earlier today?

or are you referring to my mail ~19 days ago in which I did not provide a solution. I suggested to go through three cases. The first was an example from Nate. The second, and third were modifications which should bring you closer to a solution for your particular task.

I am happy to help you further, but you have to tell what is working and what is not working. Please go through the three cases and answer the questions one by one.

 

Hans-Rudolf

ADD REPLYlink written 2.9 years ago by Hotz, Hans-Rudolf1.8k
0
gravatar for inspiresnehal
2.9 years ago by
inspiresnehal20 wrote:

Hello Hans:

I applied yr solutions means the toy example you provided .. I tried implementing them . These example created text files (this$i.txt) at the back-end but didnt create the links in the history..As u mentioned I was missing that 'discover_datasets' tag. I thought i dodnt need them for this eg. But after adding those tags eventing is working. Thanks for yr input.

ADD COMMENTlink written 2.9 years ago by inspiresnehal20

Hi! If Hans-Rudolf's aid solved the issue, it would be great to accept the answer (hover over the left of the post and a checkmark will appear - then click on it). Only the original user posting the question can do this and it will help any others who later have the same issue have an easier time finding the detailed help.  Thanks for helping! Jen, Galaxy team

ADD REPLYlink written 2.9 years ago by Jennifer Hillman Jackson25k
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: 182 users visited in the last hour