This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error Accessing Values in Snakemake Config File

Hello,

I am trying to load some files from a config file in snakemake. I'm using snakemake 7.22 on MacOS Monterey with M1 chip. My config file is:

files:
  A: file1.txt
  B: file2.txt

My Snakemake file is:

configfile: "config.yaml"

rule all:
    input:
        expand("{file}", file=config["files"])
    output:
        "summary.txt"
    shell:
        "ls {input} > {output}"

When running with:

snakemake --cores 1

I get:

MissingInputException in rule all in file projects/data-science/test/Snakefile, line 3:
Missing input files for rule all:
    output: summary.txt
    affected files:
        B
        A

The keys of the config dictionary appear to be used instead of the values. I was working based on the example in the Snakemake tutorial:

https://snakemake.readthedocs.io/en/v7.22.0/tutorial/advanced.html#step-2-config-files

I can't see how my example differs from the example in the docs. I should point out that I am aware that the problem can be solved by changing the config file to:

files:
  - file1.txt
  - file2.txt

However, I'm curious why the dictionary approach is not working for me. Any help would be appreciated.

snakemake

in config.yaml, file A and B must be exists,

your snakemake file change like this: enter image description here

0 answers

No answers yet.

Log in to answer this question.