Workflow Variables Rename Outputfile

Hi,

I would like to rename the final outputs of my workflow with the name of the very first input file (input to the workflow at the beginning) and add some additional information.
I read the tutorial (https://galaxyproject.org/learn/advanced-workflow/variables/) and used #{input_name}_SnpEffAnnotation to rename the dataset. However the output file has the following filename now: “-SnpEffAnnotaiton”. (I also added two tags to the first input file #TST170_32a (which is the name of the first input file) and #originalannotation and delete the tag #originalannotation in the output of tool in the middle of the workflow and only kept #TST170_32a.)
Is there a possibility to not rename every output from every step of the workflow but just the output of the last tool and rename it to the name of the very first input to the workflow with some information added (e.g._SnpEffAnnotation).
Thanks for the help!
All the best,
Rose

Hi Rose,
each step in a workflow only has access to its own inputs, so no, what you imagine is not possible.
You may try workflow parameters though: use ${name_of_your_choice} in the new output name (or anywhere else in the workflow) and this will create a workflow parameter (displayed in a small box in the upper right corner of the editor window).
You can reuse this parameter throughout the workflow and will be prompted to provide an actual value for it at the top of the workflow run dialogue.

1 Like

Hi Wolfgang,

thanks a lot for your answer. Your option worked very well. If I understand you correct, there is no option to somehow keep the samplename throughout the process in order to not have to not down the sample names for each sample when running the workflow for various samples, is there? If not, no problem, then I will use the option you mentioned.

Thanks a lot!

All the best Rose

I also tried to make a workflow and to make the final file to have the same name as the first input file, but I failed. I tries to input in the rename option on each tool #{input_name} or #{input} or #{input1}, but nothing hapens…

Can somebody advise?

@roselucia did you find easy solution?

1 Like

Hi @vebaev

Did you already try the parameter method as wm75 advised?

Using group tags is another method that we’ve added in more recently. This doesn’t rename the dataset itself – but does keep track of all files associated with a particular sample, and does that through all steps. See Group tags for complex experimental designs

Confirming that I also cannot use #{var} to provide custom names. It’s possible this 2019 option no longer works.

The rename feature works for me on EU (v 23.1).
You need to make sure, that you use exactly the var name proposed.
Here is an Example:
In the workflow renaming fastQC output based on the input, using the basename:


Output will be (#4):
collection
Keep in mind that this will rename the collection, not the elements in the collection.
But it also works for single file (#17):
single_file
But unfortunately if you have an extension such as bla.fastq.gz; the base name will be bla.fastq … this is not ideal. But still, the file name can be used as var.

Here is the workflow: https://usegalaxy.eu/u/paulzierep/w/rename-collection-elements and an example history to reproduce: Galaxy

2 Likes

Thanks @paulzierep for the detailed example.

Note: the other syntax with the $ sign is indeed no longer supported since workflow variables have been replaced with workflow input parameters (see the following screenshot of the Inputs section of the workflow editor tools bar.

Screenshot from 2024-03-11 09-07-09

1 Like