-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmob-recon.smk
64 lines (48 loc) · 1.15 KB
/
mob-recon.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
52
53
54
55
56
57
58
59
60
61
62
63
64
from pathlib import Path
fastas = [fasta.stem for fasta in Path('genomes').glob('*.fasta')]
rule all:
input:
'plasmid_counts.txt',
'plasmid_summary.txt'
rule mobinit:
output:
touch('.mob_init_databases')
conda:
'envs/mob-suite.yaml'
shell:
'mob_init'
rule mobrecon:
input:
db=rules.mobinit.output,
genome='genomes/{name}.fasta'
params:
outdir='plasmid_reconstructions/{name}'
output:
'plasmid_reconstructions/{name}/contig_report.txt'
conda:
'envs/mob-suite.yaml'
threads:
8
shell:
'mob_recon -n {threads} -i {input.genome} -o {params.outdir}'
rule mobtyper:
input:
'plasmid_reconstructions/{name}/contig_report.txt'
output:
touch('plasmid_reconstructions/{name}/.mob_typer')
conda:
'envs/mob-suite.yaml'
threads:
8
shell:
'for i in plasmid_reconstructions/{wildcards.name}/plasmid_*.fasta; do '
' mob_typer -n {threads} --infile $i --outdir plasmid_reconstructions/{wildcards.name}; '
'done'
rule summarize:
input:
expand('plasmid_reconstructions/{name}/.mob_typer', name=fastas)
output:
'plasmid_counts.txt',
'plasmid_summary.txt'
script:
'scripts/tabulate_plasmids.py'