snakemake: AmbiguousRuleException

error - 图2

  1. pairs = {"P1" : "P1", "P2" : "P2"}
  2. samples = {
  3. "sample1": "sample1",
  4. "sample2": "sample2"
  5. }
  6. wildcard_constraints:
  7. pair = "|".join(pairs),
  8. sample = "|".join(samples),
  9. rule all:
  10. input: expand("data/{sample}/{sample}_concatenated.txt", sample = samples)
  11. rule get_txt_files:
  12. output:
  13. "data/{sample}_{pair}.txt"
  14. shell:
  15. """
  16. echo 1 > {output}
  17. """
  18. rule reorganise:
  19. input:
  20. expand("data/{{sample}}_{pair}.txt", \
  21. pair=pairs)
  22. output:
  23. "data/{sample}/{sample}_{pair}.txt"
  24. shell:
  25. "mv {input} data/{wildcards.sample}/."
  26. rule concat:
  27. input:
  28. expand("data/{{sample}}/{{sample}}_{pair}.txt", \
  29. pair=pairs)
  30. output:
  31. "data/{sample}/{sample}_concatenated.txt"
  32. shell:
  33. "cat {input} > {output}"