from snakemake import shell

chromosomes = [1,2,3,4,5]


localrules: all


rule all:
	input: 'test.predictions', 'test.2.inter2'

rule compute1:
	input: '{name}.in'
	output: ['{name}.%s.inter'%c for c in chromosomes]
	run:
		for out in output:
			shell('(cat {input[0]} && echo "Part {out}") > {out}')

rule compute2:
	input: '{name}.{chromosome}.inter'
	output: '{name}.{chromosome}.inter2'
	params: test="a=b"
	shell: 'echo copy; 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]))
