snakemake / snakemake/snakemake

cannot specify functions as input files if there are rule dependencies

Open
#797 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
656
Avg merge
4d 12h
Merged PRs (30d)
9

Description

I cannot use the inputs of a rule as a dependency if any of those inputs are functions.

Reproducer:
Consider the following Snakefile:

rule one:
    input:
        a="a.txt",
        b=lambda wildcards: "b.txt",


rule two:
    input:
        rules.one.input.a,

When run like snakemake -n, rule two fails with error

TypeError in line 9 of /<path/to>/Snakefile:
expected string or bytes-like object
  File "/<path/to>/Snakefile", line 9, in <module>

Note that this happens even though two does not depend on the functional input b. The presence of one function as an input is enough to cause the failure.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduced Snakefile and run snakemake -n to confirm the TypeError at rules.one.input.a. Trace how rule input dependencies are resolved when another input is a function. Done means rule two can depend on rules.one.input.a without failing because rule one also has the functional input b.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.