-
Notifications
You must be signed in to change notification settings - Fork 1
/
pangenome.smk
81 lines (66 loc) · 1.56 KB
/
pangenome.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from pathlib import Path
ruleorder: annotate > pangenome
def annotated(wildcards):
pattern = 'annotations/{accession}/{accession}.gff'
accessions = [p.stem for p in Path('genomes').glob('*.fasta')]
return [pattern.format(accession=acc) for acc in accessions]
rule all:
input:
'pangenome/gene_presence_absence.Rtab'
rule annotate:
input:
'genomes/{accession}.fasta'
output:
'annotations/{accession}/{accession}.gff'
conda:
'envs/prokka.yaml'
threads:
8
shell:
'prokka '
'--force '
'--cpus 8 '
'--outdir annotations/{wildcards.accession} '
'--prefix {wildcards.accession} '
'{input}'
rule pangenome:
input:
annotated
output:
'accessory_binary_genes.fa',
'accessory_binary_genes.fa.newick',
'accessory_graph.dot',
'accessory.header.embl',
'accessory.tab',
'blast_identity_frequency.Rtab',
'clustered_proteins',
'core_accessory_graph.dot',
'core_accessory.header.embl',
'core_accessory.tab',
'gene_presence_absence.csv',
'gene_presence_absence.Rtab',
'number_of_conserved_genes.Rtab',
'number_of_genes_in_pan_genome.Rtab',
'number_of_new_genes.Rtab',
'number_of_unique_genes.Rtab',
'pan_genome_reference.fa',
'summary_statistics.txt'
conda:
'envs/roary.yaml'
threads:
144
shell:
'find annotations/ -name "*.gff" -exec roary -p {threads} -cd 99.9 "{{}}" +'
# 'roary '
# '-p {threads} '
# '-cd 99.9 '
#'{input}'
rule tidy_pangenome:
input:
rules.pangenome.output
output:
'pangenome/gene_presence_absence.Rtab'
params:
directory='pangenome/'
shell:
'mv -t {params.directory} {input}'