-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsbx_anvio.rules
More file actions
84 lines (78 loc) · 2.3 KB
/
sbx_anvio.rules
File metadata and controls
84 lines (78 loc) · 2.3 KB
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
75
76
77
78
79
80
81
82
83
84
# -*- mode: Snakemake -*-
#
# Binning-without-mapping-for-completeness
#
# Requires anvio=4
rule all_anvio_scg:
input:
expand(str(ASSEMBLY_FP/'anvio'/'{sample}'/'.savepdf'),
sample=Samples.keys())
rule simply_names:
input:
str(ASSEMBLY_FP/'contigs'/'{sample}-contigs.fa')
output:
str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.fa')
params:
str(ASSEMBLY_FP/'anvio'/'{sample}'/'simplify-names.txt')
conda:
"sbx_anvio_env.yml"
shell:
"""
anvi-script-reformat-fasta {input} -o {output} -l 2000 \
--simplify-name --report-file {params}
"""
rule gen_contigs_db:
input:
str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.fa')
output:
str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.db')
params:
sample="{sample}"
conda:
"sbx_anvio_env.yml"
shell:
"""
anvi-gen-contigs-database -f {input} -o {output} -n {params.sample} \
-L 2000 --skip-mindful-splitting
"""
rule run_hmm:
input:
str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.db')
output:
str(ASSEMBLY_FP/'anvio'/'{sample}'/'.DONEhmm')
threads:
Cfg['assembly']['threads']
conda:
"sbx_anvio_env.yml"
shell:
"""
anvi-run-hmms -c {input} --num-threads {threads} && \
touch {output}
"""
rule gen_stats_for_single_copy_genes:
input:
contigdb = str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.db'),
sentinel = str(ASSEMBLY_FP/'anvio'/'{sample}'/'.DONEhmm')
output:
hits = str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.db.hits'),
genes = str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.db.genes')
conda:
"sbx_anvio_env.yml"
shell:
"""
anvi-script-gen_stats_for_single_copy_genes.py {input.contigdb}
"""
## TODO: replace R script with `anvi-display-contigs-stats`
rule get_stats_pdf:
input:
hits = str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.db.hits'),
genes = str(ASSEMBLY_FP/'anvio'/'{sample}'/'contigs.db.genes')
output:
sentinel = str(ASSEMBLY_FP/'anvio'/'{sample}'/'.savepdf')
conda:
"sbx_anvio_env.yml"
shell:
"""
anvi-script-gen_stats_for_single_copy_genes.R {input.hits} {input.genes} \
&& touch {output.sentinel}
"""