Error Accessing Values in Snakemake Config File
0
0
Entering edit mode
2.7 years ago
Sonny • 0

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 • 1.1k views
ADD COMMENT
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Thanks, file1.txt and file2.txt exist. In the linked example in the tutorial (https://snakemake.readthedocs.io/en/v7.22.0/tutorial/advanced.html#step-2-config-files), it appears that the value of the dictionary is used instead of the keys. Am I missing something with the difference between my example and the example in the docs?

ADD REPLY
0
Entering edit mode

your snakemake file change like this: enter image description here

ADD REPLY

Login before adding your answer.

Traffic: 3813 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6