snakemake / snakemake/snakemake

Nondeterministic AmbiguousRuleException

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

Nobody has claimed this yet.

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

Description

Snakemake version
5.26.1

Describe the bug
I have two ambiguous rules, subset_label_unsupervised and subset_label. Because I know they are ambiguous, I added the
line ruleorder: subset_label_unsupervised > subset_label to my Snakefile. Adding the ruleorder line allows me to run the code sometimes, but I now get successful runs 50% of the time and an AmbiguousRuleException 50% of the time.

Logs
On running snakemake -n, I get the following error:

Building DAG of jobs...
AmbiguousRuleException:
Rules subset_label_unsupervised and subset_label are ambiguous for the file results/subset_label.sepsis.PCA.pytorch_supervised.refinebio_labeled_dataset.0.tsv.
Consider starting rule output with a unique prefix, constrain your wildcards, or use the ruleorder directive.
Wildcards:
subset_label_unsupervised: dataset=refinebio_labeled_dataset,label=sepsis,seed=0,supervised=pytorch_supervised,unsupervised=PCA
subset_label: dataset=refinebio_labeled_dataset,label=sepsis.PCA,seed=0,supervised=pytorch_supervised
Expected input files:
subset_label_unsupervised: data/subset_compendium.pkl model_configs/supervised/pytorch_supervised.yml dataset_configs/refinebio_labeled_dataset.yml model_configs/unsupervised/PCA.yml
subset_label: data/subset_compendium.pkl model_configs/supervised/pytorch_supervised.yml dataset_configs/refinebio_labeled_dataset.ymlExpected output files:
subset_label_unsupervised: results/subset_label.sepsis.PCA.pytorch_supervised.refinebio_labeled_dataset.0.tsv
subset_label: results/subset_label.sepsis.PCA.pytorch_supervised.refinebio_labeled_dataset.0.tsv

Minimal example
The file that causes the error is here. I tried to create a minimal example by stripping away all rules except subset_label_unsupervised and subset_label, but when I did so the error went away.

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 by reproducing the nondeterministic result with snakemake -n using the linked Snakefile, focusing on the subset_label_unsupervised and subset_label rules and their ruleorder directive. Determine why the same output is alternately accepted and rejected as ambiguous, then verify that repeated dry runs resolve consistently without changing the reported rule behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.