File: Snakefile

package info (click to toggle)
snakemake 7.32.4-8.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 25,836 kB
  • sloc: python: 32,846; javascript: 1,287; makefile: 247; sh: 163; ansic: 57; lisp: 9
file content (74 lines) | stat: -rw-r--r-- 1,259 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

from snakemake.utils import min_version

from snakemake import __version__
print(__version__, file=sys.stderr)

shell.prefix("source ~/.bashrc; ")

#min_version("2.1")

TEST = "abc"


onstart:
    print("Workflow starting")
    print("Log:")
    print(log)

onsuccess:
    print("Workflow finished")
    print("Log:")
    print(log)


onerror:
    print("Workflow failed")
    print("Log:")
    print(log)




ruleorder: rule2 > rule4

def testin(wildcards):
	return "test.in"

def version():
	return "3.3"

rule rule1:
	# This rule creates an intermediate file.
	input: 
		'test.inter'
	output: 'dir/test.out'
	log:    a='log/logfile.log'
	version: version()
	threads: 3
	shell: 
		'if [ {threads} -ne 3 ]; then echo "This test has to be run with -j3 in order to succeed!"; exit 1; fi; ' \
		'echo {TEST}; echo {version}; cp {input[0]} {output[0]}; ' # append a comment
		'echo test > {log.a}'

rule rule2:
	input: testin
	output: 'test.inter'
	message: 'Copying {input[0]} to {output[0]}'
	shell: 
		'''
		cp {input[0]} {output[0]}
		'''

rule rule4:
	input: "test.in"
	output: "test.inter"
	shell: "cp {input} {output}"


# this should be ignored since test.in is present
rule rule3:
	input: "dir/{a}.out"
	output: "{a}.in"
	shell: "cp {input} {output}"