snakemake error while running taxa barplot

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:
## 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
qiime_taxonomy_plot = expand("{results}/qiime_plotting/taxa-bar-plots.qzv", results={config["results_dir"]})
metadata_file = {config["metadata_file"]},
merged_metadata_file = {config["merged_metadata_file"]},
taxa_bar_plot_template = {config["taxa_bar_plot_template"]}
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


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!

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!


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

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