-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
151 lines (123 loc) · 5.38 KB
/
Snakefile
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# stucture from https://github.com/alperyilmaz/conda-snakemake-gatk
from snakemake.utils import min_version
min_version("6.0")
import sys
print("Python version")
print(sys.executable)
# intialize all parameters
include: "rules/initialize.smk"
if RUNMODE in [RUNFULL, RUNSIM, RUNSIMTOSV]:
include: "rules/simulate.smk"
if RUNMODE in [RUNFULL]:
include: "rules/validate.smk"
if RUNMODE in [RUNFULL, RUNMAPPING, RUNSIMTOSV, RUNSIMPLE]:
if MAPPER == "ngmlr":
include: "rules/mapping_ngmlr.smk"
else:
include: "rules/mapping_winnowmap.smk"
include: "rules/filter.smk"
include: "rules/cov.smk"
if RUNMODE in [RUNFULL]:
include: "rules/assembly.smk"
if RUNMODE in [RUNFULL, RUNMAPPING, RUNSV, RUNSIMTOSV, RUNSIMPLE]:
include: "rules/sv.smk"
if RUNMODE in [RUNFULL, RUNCNV]:
include: "rules/cnv.smk"
if RUNMODE in [RUNFULL, RUNRECONSTRUCT, RUNSV, RUNMAPPING, RUNSIMPLE]:
include: "rules/reconstruct.smk"
# include: "rules/circlator.smk"
def get_files_simulation(run_mode):
if run_mode in [RUNFULL, RUNSIM, RUNSIMTOSV]:
return expand([
"{outdir}/{sample}/reads/circle-template.bed",
"{outdir}/{sample}/reads/circle-template.fa",
"{outdir}/{sample}/reads/circle-template.fa.fai",
"{outdir}/{sample}/reads/circle-template.fastq",
"{outdir}/{sample}/reads/circle-genomeref.bed",
"{outdir}/{sample}/reads/circle-genomeref.fa",
"{outdir}/{sample}/reads/circle-genomeref.fa.fai",
"{outdir}/{sample}/reads/circle-templatesplit.fa",
"{outdir}/{sample}/reads/circle-templatesplit.fa.fai",
],outdir=OUTPUTDIR,sample=SAMPLE,id=CIRCLES)
return []
def get_temp_files_simulation(run_mode):
output=[]
if run_mode in [RUNFULL, RUNSIM, RUNSIMTOSV]:
for s in SAMPLE:
for i in CIRCLES[s]:
istr = str(i)
output.append("""{}/{}/reads/circle-template-{}.fa""".format(OUTPUTDIR,s,istr))
output.append("""{}/{}/reads/circle-template-{}.bed""".format(OUTPUTDIR,s,istr))
output.append("""{}/{}/reads/circle-template-{}.fastq""".format(OUTPUTDIR,s,istr))
output.append("""{}/{}/logs/sim_fastq-{}.log""".format(OUTPUTDIR,s,istr))
output.append("""{}/{}/logs/circle_fasta-{}.log""".format(OUTPUTDIR,s,istr))
return output
return []
def get_file_mapping(run_mode):
if run_mode in [RUNFULL, RUNMAPPING, RUNSIMTOSV, RUNSIMPLE]:
return expand([
"{outdir}/{sample}/mapping/coverage.bw",
"{outdir}/{sample}/mapping/map.bam",
"{outdir}/{sample}/mapping/map.bam.bai",
"{outdir}/{sample}/logs/cov.log"
],outdir=OUTPUTDIR,sample=SAMPLE)
return []
def get_file_assembly(run_mode):
if run_mode in [RUNFULL]:
return expand(["{outdir}/{sample}/assembly/Assembly.fasta",
"{outdir}/{sample}/assembly_unicycler/assembly.fasta",
"{outdir}/{sample}/logs/assembly.log"
],outdir=OUTPUTDIR,sample=SAMPLE)
return []
def get_file_sv(run_mode):
if run_mode in [RUNFULL, RUNMAPPING, RUNSV, RUNSIMTOSV, RUNSIMPLE]:
return expand([
"{outdir}/{sample}/sv/sv.sniffles.vcf",
"{outdir}/{sample}/sv/sv.sniffles.bedpe",
"{outdir}/{sample}/logs/survivor.log"
],outdir=OUTPUTDIR,sample=SAMPLE)
return []
def get_files_reconstruction(run_mode):
if run_mode in [RUNFULL, RUNRECONSTRUCT, RUNMAPPING, RUNSV, RUNSIMPLE]:
return expand([
"{outdir}/{sample}/sv/sv.sniffles.filtered.vcf",
"{outdir}/{sample}/sv/sv.sniffles.filtered.bedpe",
"{outdir}/{sample}/reconstruct/reconstruct.ecDNA.fasta",
"{outdir}/{sample}/reconstruct/reconstruct.ecDNA.bed",
# "{outdir}/{sample}/reconstruct_v1/reconstruct.fasta",
# "{outdir}/{sample}/reconstruct_v1/reconstruct.bed",
# "{outdir}/{sample}/reconstruct_v2/reconstruct.fasta",
# "{outdir}/{sample}/reconstruct_v2/reconstruct.bed",
# "{outdir}/{sample}/reconstruct_v3/reconstruct.fasta",
# "{outdir}/{sample}/reconstruct_v3/reconstruct.bed",
"{outdir}/{sample}/logs/filter.log",
"{outdir}/{sample}/logs/reconstruct_v1.log",
# "{outdir}/{sample}/logs/reconstruct_v2.log",
# "{outdir}/{sample}/logs/reconstruct_v3.log",
"{outdir}/{sample}/logs/survivor_filtered.log"
],outdir=OUTPUTDIR,sample=SAMPLE)
return []
def get_files_validation(run_mode):
if run_mode == RUNFULL:
return expand(["{outdir}/{sample}/assembly_qc",
"{outdir}/{sample}/assembly_qc_ref",
"{outdir}/{sample}/assembly/assembly_bwa.sam",
"{outdir}/{sample}/assembly/assembly_minimap2_asm5.sam",
"{outdir}/{sample}/assembly/assembly_minimap2_spliced.sam",
"{outdir}/{sample}/validate/blast_decoil_v1.txt",
"{outdir}/{sample}/validate/blast_decoil_v2.txt",
"{outdir}/{sample}/validate/blast_shasta.txt",
"{outdir}/{sample}/validate/blast_unicycler.txt",
"{outdir}/{sample}/logs/assembly_against_ref_quast.log"],outdir=OUTPUTDIR,sample=SAMPLE)
return []
rule all:
input:
config=expand("{outdir}/{sample}/config.yaml", outdir=OUTPUTDIR, sample=SAMPLE),
simulate=get_files_simulation(RUNMODE),
simulate_temp=get_temp_files_simulation(RUNMODE),
assembly=get_file_assembly(RUNMODE),
mapping=get_file_mapping(RUNMODE),
sv=get_file_sv(RUNMODE),
reconstruct=get_files_reconstruction(RUNMODE),
validation=get_files_validation(RUNMODE)
# snakemake --cores 32 -n --use-conda --configfile configs/config.yaml --config batch=/data/gpfs-1/users/giurgium_c/Nanopore/Simulation/sim_all/batch_test outputdir=/data/gpfs-1/users/giurgium_c/Nanopore/Simulation/process/batch_test