# Workflow Variables Rename Outputfile

**URL:** <https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435>\
**Category:** Uncategorized\
**Tags:** workflow\
**Created:** [November 10, 2019, 12:52pm UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435 "2019-11-10T12:52:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![roselucia](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/roselucia/32/986_2.png) [@roselucia](https://help.galaxyproject.org/u/roselucia)\
**Post date:** [November 10, 2019, 12:52pm UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/1 "2019-11-10T12:52:42Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![wm75](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/wm75/32/56_2.png) [@wm75](https://help.galaxyproject.org/u/wm75)\
**Post date:** [November 10, 2019, 8:41pm UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/2 "2019-11-10T20:41:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![roselucia](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/roselucia/32/986_2.png) [@roselucia](https://help.galaxyproject.org/u/roselucia)\
**Post date:** [November 13, 2019, 12:44pm UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/3 "2019-11-13T12:44:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vebaev](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/vebaev/32/843_2.png) [@vebaev](https://help.galaxyproject.org/u/vebaev)\
**Post date:** [November 23, 2023, 11:42am UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/4 "2023-11-23T11:42:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)\
**Post date:** [November 27, 2023, 8:40pm UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/5 "2023-11-27T20:40:34Z")

</div>

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](https://training.galaxyproject.org/training-material/topics/galaxy-interface/tutorials/group-tags/tutorial.html)

---

<div class="post-metadata">

**Author:** ![alpapan](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/alpapan/32/5073_2.png) [@alpapan](https://help.galaxyproject.org/u/alpapan)\
**Post date:** [January 13, 2024, 8:41am UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/6 "2024-01-13T08:41:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paulzierep](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/paulzierep/32/3968_2.png) [@paulzierep](https://help.galaxyproject.org/u/paulzierep)\
**Post date:** [March 11, 2024, 7:44am UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/7 "2024-03-11T07:44:49Z")

</div>

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:

 ![rename](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/8/8ac27c76e9cfa2aab2fb4d55e5e67d326a02830c.png)  
Output will be (#4):  
 ![collection](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/8/8c0d4b0349db844a480ca4310f09c5321ea8fec8.png)  
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](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/3/3f15fdc3c5ff56af6619496e809d5cf5399b7d4b.png)  
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](https://usegalaxy.eu/u/paulzierep/w/rename-collection-elements) and an example history to reproduce: [Galaxy](https://usegalaxy.eu/u/paulzierep/h/rename-dataset-in-workflow)

---

<div class="post-metadata">

**Author:** ![wm75](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/wm75/32/56_2.png) [@wm75](https://help.galaxyproject.org/u/wm75)\
**Post date:** [March 11, 2024, 8:09am UTC](https://help.galaxyproject.org/t/workflow-variables-rename-outputfile/2435/8 "2024-03-11T08:09:42Z")

</div>

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](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/4/42e938efe69d2afd512defb6ec2716f4768a7813.png)
