# snakemake error while running taxa barplot

**URL:** https://forum.qiime2.org/t/snakemake-error-while-running-taxa-barplot/21179
**Category:** Other Bioinformatics Tools
**Tags:** taxonomy, barplot
**Created:** [October 27, 2021, 12:16am UTC](https://forum.qiime2.org/t/snakemake-error-while-running-taxa-barplot/21179 "2021-10-27T00:16:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bobbieshaban](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/b/57b2e6/32.png) [@bobbieshaban](https://forum.qiime2.org/u/bobbieshaban)
#### Post date: [October 27, 2021, 12:16am UTC](https://forum.qiime2.org/t/snakemake-error-while-running-taxa-barplot/21179/1 "2021-10-27T00:16:03Z")

</div>

Hi All,

I am having running an issue creating a taxa barplot using qiime2/2021.2 from within a snakemake workflow

Here is my task  
'''  
rule qiime\_taxa\_plot:  
input:  
## if statement for taxonomy and tax\_training classifier  
qiime\_taxa\_for\_plots = rules.qiime\_feature\_classifier\_taxonomy.output.qiime\_feature\_classifier\_output,  
qiime\_feature\_table\_for\_plots = rules.qiime\_taxa\_filter\_remove\_eukaryota.output.qiime\_taxa\_filter\_no\_eukaryota  
output:  
qiime\_taxonomy\_plot = expand("{results}/qiime\_plotting/taxa-bar-plots.qzv", results={config["results\_dir"]})  
log:  
"logs/qiime\_taxa\_plot.log.txt"  
benchmark:  
"benchmarks/qiime\_taxa\_plot.bm.txt"  
params:  
metadata\_file = {config["metadata\_file"]},  
merged\_metadata\_file = {config["merged\_metadata\_file"]},  
taxa\_bar\_plot\_template = {config["taxa\_bar\_plot\_template"]}  
shell:  
'''  
module load qiime2/2021.2  
sh {params.taxa\_bar\_plot\_template} {input.qiime\_feature\_table\_for\_plots} {input.qiime\_taxa\_for\_plots} {params.merged\_metadata\_file} {output.qiime\_taxonomy\_plot} \>& {log}  
'''  
'''  
The workflow calls a template which contains the taxa barplot command

```auto
ITABLE = $1
TAXONOMY = $2
METADATA = $3
RESULTS = $4

qiime taxa barplot \
             --i-table $ITABLE \
             --i-taxonomy $TAXONOMY \
             --m-metadata-file $METADATA \
             --o-visualization $RESULTS

```

The issue is that within the workflow I get this error:

“NameError: The name "'Female', 'Male'" is unknown in this context. Please make sure that you defined that variable. Also note that braces not used for variable access have to be escaped by repeating them, i.e. {{print $1}}”

But when I run the command manually using the files created by the workflow it works fine. There is no mention of Male, Female or even Sex in any parameters I am using, though they are in the metadata file.

Has anyone come across this error before or something similar? Thank you for your help!

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [October 27, 2021, 1:50am UTC](https://forum.qiime2.org/t/snakemake-error-while-running-taxa-barplot/21179/2 "2021-10-27T01:50:47Z")

</div>

Hi @bobbieshaban! I moved your post over to "Other Bioinformatics Tools" - that error message is not coming from QIIME 2, my guess is that its coming from snakemake. Good luck and keep us posted!

---

<div class="post-metadata">

### Author: ![the\_dummy](https://forum.qiime2.org/user_avatar/forum.qiime2.org/the_dummy/32/5626_2.png) [@the\_dummy](https://forum.qiime2.org/u/the_dummy)
#### Post date: [October 27, 2021, 2:19pm UTC](https://forum.qiime2.org/t/snakemake-error-while-running-taxa-barplot/21179/3 "2021-10-27T14:19:58Z")

</div>

Hello,

First thing that came to my mind is there should be a problem with the metadata file or the way snakemake handling it since "Female" and "Male" is in that file. Could you post it, too?

Best wishes

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [November 27, 2021, 8:20pm UTC](https://forum.qiime2.org/t/snakemake-error-while-running-taxa-barplot/21179/4 "2021-11-27T20:20:35Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
