File: Snakefile

package info (click to toggle)
snakemake 7.32.4-8.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,836 kB
  • sloc: python: 32,846; javascript: 1,287; makefile: 247; sh: 163; ansic: 57; lisp: 9
file content (77 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from pathlib import Path

# Untested:
# ancient
# subworkflows
# directory

OUTDIR = Path("outdir")
existing_file = Path("existing_file.txt")

rule all:
	input:
		OUTDIR / "output_existing",
		OUTDIR / "output_temp",
		OUTDIR / "output_protected",
		OUTDIR / "output_other_rule_output_existing",
		OUTDIR / "function_unpacking/output_function_unpacking",


rule input_Path:
	input: Path("{sample}_file.txt")
	output: OUTDIR / "output_{sample}"
	log: OUTDIR / "log_{sample}"
	shell:
		"""
		cat {input} > {output}
		echo log {wildcards.sample} > {log}
		"""

rule input_Path_output_temp:
	input: existing_file
	output: temp(OUTDIR / "output_temp")
	log: OUTDIR / "log_temp"
	shell:
		"""
		cat {input} > {output}
		echo log temp > {log}
		"""

rule input_Path_output_protected:
	input: existing_file
	output: protected(OUTDIR / "output_protected")
	log: OUTDIR / "log_protected"
	shell:
		"""
		cat {input} > {output}
		echo log protected > {log}
		"""

rule input_other_rule_output:
	input: rules.input_Path.output
	output: OUTDIR / "output_other_rule_output_{sample}"
	log: OUTDIR / "log_other_rule_output_{sample}"
	shell:
		"""
		cat {input} > {output}
		echo log protected > {log}
		"""

def myfunc1():
    return [existing_file]

def myfunc2():
    return {'existing_file2': existing_file}

rule input_function_unpacking:
	input:
		*myfunc1(),
		**myfunc2(),
	output: OUTDIR / "function_unpacking/output_function_unpacking"
	log: OUTDIR / "log_function_unpacking"
	shell:
		"""
		echo {input[0]} > {output}
		echo {input.existing_file2} >> {output}
		echo log function unpacking > {log}
		"""