0
votes

I am trying to run snakemake code using.json file as input. While checking the dry run i got foloowing error

InputFunctionException in line 172 of /home/Snakefile_ChIPseq_pe:
KeyError: '130241_1'
Wildcards:
library=130241_1

This is the part of snakemake code

rule findPeaks:
    input:
        sample = os.path.join(HOMERTAG_DIR, "{library}"),
        input = lambda wildcards: os.path.join(HOMERTAG_DIR, config['lib_input'][wildcards.library])
    output:
        os.path.join(HOMERPEAK_DIR, "{library}.all.hpeaks")
    params:
        config['homer_findPeaks_params']
    shell:
        "findPeaks {input.sample} -i {input.input} {params} -o {output}"

There is single quote around input sample which is missing in the 'lib_input' part. How to add that single quote ahead of variable?

Also library names are like 12345_1, 12345_2 etc., never had this problem before however for the first time I have libraries with "underscore" in the names. Snakemake will first try to interpret the given value as number. Only if that fails, it will interpret the value as string. Here, it does not fail, because the underscore _ is interpreted as thousand separator.

1

1 Answers

0
votes

My guess is that in your json file the library IDs are not quoted. E.g. you have this:

{
    "lib_input": {1234_1: "input.txt"}
}

Instead of:

{
    "lib_input": {"1234_1": "input.txt"}
}

Or maybe library 130241_1 is not in the json at all?