forked from snakemake/snakemake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a877aa5
commit f0f275e
Showing
1 changed file
with
43 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,58 @@ | ||
from snakemake import shell | ||
|
||
# Only effects for tests on Win | ||
shell.executable("bash") | ||
|
||
|
||
chromosomes = [1,2,3] | ||
chromosomes = [1, 2, 3] | ||
|
||
# shell('rm test.*.inter 2> /dev/null | true') | ||
|
||
#shell('rm test.*.inter 2> /dev/null | true') | ||
|
||
rule all: | ||
input: 'test.predictions' | ||
input: | ||
"test.predictions", | ||
|
||
|
||
rule compute1: | ||
input: '{name}.in' | ||
output: inter=expand('{{name}}.{chr}.inter', chr=chromosomes) | ||
resources: gpu=1 | ||
run: | ||
assert len(output.inter) > 0 | ||
print(output.inter) | ||
for out in output: | ||
shell('(cat {input[0]} && echo "Part {out}") > {out}') | ||
input: | ||
"{name}.in", | ||
output: | ||
inter=expand("{{name}}.{chr}.inter", chr=chromosomes), | ||
resources: | ||
gpu=1, | ||
run: | ||
assert len(output.inter) > 0 | ||
print(output.inter) | ||
for out in output: | ||
shell('(cat {input[0]} && echo "Part {out}") > {out}') | ||
|
||
|
||
rule compute2: | ||
input: '{name}.{chromosome}.inter', 'other.txt' | ||
output: '{name}.{chromosome}.inter2' | ||
threads: 2 | ||
resources: io=1 | ||
shell: 'cp {input[0]} {output[0]}' | ||
input: | ||
"{name}.{chromosome}.inter", | ||
"other.txt", | ||
output: | ||
"{name}.{chromosome}.inter2", | ||
threads: 2 | ||
resources: | ||
io=1, | ||
shell: | ||
"cp {input[0]} {output[0]}" | ||
|
||
|
||
rule gather: | ||
input: ['{name}.%s.inter2'%c for c in chromosomes] | ||
output: '{name}.predictions' | ||
run: | ||
shell('cat {} > {}'.format(' '.join(input), output[0])) | ||
input: | ||
["{name}.%s.inter2" % c for c in chromosomes], | ||
output: | ||
"{name}.predictions", | ||
run: | ||
shell("cat {} > {}".format(" ".join(input), output[0])) | ||
|
||
|
||
rule other: | ||
output: 'other.txt' | ||
priority: 50 | ||
resources: gpu=1 | ||
shell: 'touch other.txt' | ||
output: | ||
"other.txt", | ||
priority: 50 | ||
resources: | ||
gpu=1, | ||
shell: | ||
"touch other.txt" |