-
Notifications
You must be signed in to change notification settings - Fork 1
/
assemble.smk
53 lines (37 loc) · 1.18 KB
/
assemble.smk
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
import os
import shutil
include: 'illumina_reads.py'
def match_sample_to_fq(wildcards, path):
prepend = path.format(sample=wildcards.sample)
fwd = os.path.join(prepend, samples[wildcards.sample]['fwd'])
rev = os.path.join(prepend, samples[wildcards.sample]['rev'])
return {'r1': fwd, 'r2': rev}
rule assemble_genomes:
input:
expand('genomes/{sample}.fasta', sample=list(samples.keys()))
rule assemble:
input:
unpack(partial(match_sample_to_fq, path=os.path.join(config['fastqs'])))
output:
'{outdir}/{{sample}}/contigs.fa'.format(outdir=config['shovill_outdir'])
message:
'assemble {input} {output}'
threads:
4
shell:
"rmdir shovill_output/{wildcards.sample}; "
"mkdir -p tmp/{wildcards.sample}/fastqs; "
"rsync -L {input.r1} tmp/{wildcards.sample}/{input.r1}; "
"rsync -L {input.r2} tmp/{wildcards.sample}/{input.r2}; "
"shovill --R1 tmp/{wildcards.sample}/{input.r1} "
"--R2 tmp/{wildcards.sample}/{input.r2} "
"--outdir shovill_output/{wildcards.sample} "
"--trim --cpus {threads}; "
"rm -r tmp/{wildcards.sample} "
rule symlink_genome:
input:
'shovill_output/{sample}/contigs.fa'
output:
'genomes/{sample}.fasta'
shell:
'ln -sr {input} {output}'