Search code examples
snakemake

Why is my snakemake rule with wildcards turned into a localrule?


So, I made this simple Snakefile and I am wondering why my rule is interpreted as a localrule. Usually it's not a problem, but for my runs that need be submitted to SLURM it is. The only way I got it to work was writing the rule explicitly without wildcards. Then it was not interpreted as localrule. But then I obviously loose all the benefits of wildcards for my rules... I guess there is something I am missing here!

rule test:
  output: "bla4_out.txt",

rule test_wild:
  input: "bla{num}.txt",
  output: "bla{num}_out.txt",
  shell:
    """
touch {output}"
    """

This: snakemake -n -R test leads to

Building DAG of jobs...
Job stats:
job      count    min threads    max threads
-----  -------  -------------  -------------
test         1              1              1
total        1              1              1


[Mon May  9 13:02:41 2022]
localrule test:
    output: bla4_out.txt
    jobid: 0
    resources: tmpdir=/tmp

Job stats:
job      count    min threads    max threads
-----  -------  -------------  -------------
test         1              1              1
total        1              1              1

This was a dry-run (flag -n). The order of jobs does not reflect the order of execution.


Solution

  • If a rule doesn't have a directive that does something, like shell or run, then that rule is stamped as local. I guess it makes sense though... Try adding a dummy shell directive to your rule test and see what happens.