bams_illumina_pacbio_nanopore.smk 7.34 KB
Newer Older
1
2
OF = WD+"bams_illumina_pacbio_nanopore/perl/"
perl2nf = lambda s: s.replace(r"/perl/",r"/nextflow/")
Raphael Müller's avatar
typo    
Raphael Müller committed
3
perl2nfa = lambda s: s.replace(r"/perl/",r"/nextflow_assembly/")
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
NAME = "ba_illpana"
dir_outputs = [OF+"multiqc_data",*expand(OF+NAME+"{t}.sort_stats",t=["",".pb",".ont"])]

rule bams_illumina_paired_pacbio_nanopore_perl:
  input:
    illumina = "data_prep_bams/illumina.100.1.bam",
    pacbio = "data_prep_bams/pacbio.1000.1.pb.bam",
    nanopore = "data_prep_bams/nanopore.1000.ont.bam"
  output:
    multiext(OF,
        "illumina.100.1.sort.bam.cov-hist",
        "illumina.100.1.sort.bam.cov-hist.err",
        "illumina.100.1.sort.bam.cov-hist.log",
        "illumina.100.1.sort.bam.cov-hist.pdf",
        "illumina.100.1.sort.bam.cov-hist.plot.r",
        "illumina.100.1.sort_stats_bamqc.err",
        "illumina.100.1.sort_stats_bamqc.log",
        "multiqc.err",
        "multiqc.log",
        "multiqc_report.html",
        "nanopore.1000.ont.sort.bam.cov-hist",
        "nanopore.1000.ont.sort.bam.cov-hist.err",
        "nanopore.1000.ont.sort.bam.cov-hist.log",
        "nanopore.1000.ont.sort.bam.cov-hist.pdf",
        "nanopore.1000.ont.sort.bam.cov-hist.plot.r",
        "nanopore.1000.ont.sort_stats_bamqc.err",
        "nanopore.1000.ont.sort_stats_bamqc.log",
        "pacbio.1000.1.pb.sort.bam.cov-hist",
        "pacbio.1000.1.pb.sort.bam.cov-hist.err",
        "pacbio.1000.1.pb.sort.bam.cov-hist.log",
        "pacbio.1000.1.pb.sort.bam.cov-hist.pdf",
        "pacbio.1000.1.pb.sort.bam.cov-hist.plot.r",
        "pacbio.1000.1.pb.sort_stats_bamqc.err",
        "pacbio.1000.1.pb.sort_stats_bamqc.log",
        "plot.all.pdf",
        "plot.all.r",
        "plot.all.r.err",
        "plot.all.r.log"),
    directory(OF+"illumina.100.1.sort_stats/"),
    directory(OF+"multiqc_data/"),
    directory(OF+"nanopore.1000.ont.sort_stats/"),
    directory(OF+"pacbio.1000.1.pb.sort_stats/"),
  benchmark: repeat("benchmarks/perl/{}.tsv".format(NAME), config["benchmark_repeats"])
  threads: 16
48
  conda: "../envs/perl.yml"
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
  params:
    prefix=NAME,
    outdir=OF,
    prgm=config["original_perl_script"]
  log:
    stdout = "{folder}{name}.stdout.log".format(folder=OF, name=NAME),
    stderr = "{folder}{name}.stderr.log".format(folder=OF, name=NAME)
  shell:
    """
    rm -rf {params.outdir};
    mkdir -p {params.outdir};
    {params.prgm} -kt -v -b {input.illumina} -b {input.pacbio} -b {input.nanopore} -o {params.outdir} -sort -t {threads} 1> {log.stdout} 2> {log}.stderr
    """

rule bams_illumina_paired_pacbio_nanopore_nextflow:
  input:
    illumina = "data_prep_bams/illumina.100.1.bam",
    pacbio = "data_prep_bams/pacbio.1000.1.pb.bam",
    nanopore = "data_prep_bams/nanopore.1000.ont.bam"
  output:
    perl2nf(OF+"ba_illpana.bam"),
    perl2nf(OF+"ba_illpana.ont.bam"),
    perl2nf(OF+"ba_illpana.ont.sort.bam"),
    perl2nf(OF+"ba_illpana.ont.sort.bam.cov-hist"),
    perl2nf(OF+"ba_illpana.ont.sort.bam.cov-hist.pdf"),
    perl2nf(OF+"ba_illpana.ont.sort.bam.stats"),
    perl2nf(OF+"ba_illpana.ont.sort.bam.stats.err"),
    perl2nf(OF+"ba_illpana.ont.sort_stats_bamqc.err"),
    perl2nf(OF+"ba_illpana.ont.sort_stats_bamqc.log"),
    perl2nf(OF+"ba_illpana.pb.bam"),
    perl2nf(OF+"ba_illpana.pb.sort.bam"),
    perl2nf(OF+"ba_illpana.pb.sort.bam.cov-hist"),
    perl2nf(OF+"ba_illpana.pb.sort.bam.cov-hist.pdf"),
    perl2nf(OF+"ba_illpana.pb.sort.bam.stats"),
    perl2nf(OF+"ba_illpana.pb.sort.bam.stats.err"),
    perl2nf(OF+"ba_illpana.pb.sort_stats_bamqc.err"),
    perl2nf(OF+"ba_illpana.pb.sort_stats_bamqc.log"),
    perl2nf(OF+"ba_illpana.plot.all.pdf"),
    perl2nf(OF+"ba_illpana.sort.bam"),
    perl2nf(OF+"ba_illpana.sort.bam.cov-hist"),
    perl2nf(OF+"ba_illpana.sort.bam.cov-hist.pdf"),
    perl2nf(OF+"ba_illpana.sort.bam.stats"),
    perl2nf(OF+"ba_illpana.sort.bam.stats.err"),
    perl2nf(OF+"ba_illpana.sort_stats_bamqc.err"),
    perl2nf(OF+"ba_illpana.sort_stats_bamqc.log"),
    perl2nf(OF+"multiqc.err"),
    perl2nf(OF+"multiqc.log"),
    perl2nf(OF+"multiqc_report.html"),
    directory(perl2nf(OF+"ba_illpana.ont.sort_stats/")),
    directory(perl2nf(OF+"ba_illpana.pb.sort_stats/")),
    directory(perl2nf(OF+"ba_illpana.sort_stats/")),
    directory(perl2nf(OF+"multiqc_data/")),
  benchmark: repeat("benchmarks/nextflow/{}.tsv".format(NAME), config["benchmark_repeats"])
  threads: 16
103
  conda: "../envs/nextflow.yml"
104
105
106
107
108
109
110
111
112
113
114
115
116
  params:
    prefix=NAME,
    outdir=perl2nf(OF),
    prgm=config["nextflow_script"]
  log:
    stdout = perl2nf("{folder}{name}.stdout.log".format(folder=OF, name=NAME)),
    stderr = perl2nf("{folder}{name}.stderr.log".format(folder=OF, name=NAME))
  shell:
    """
    rm -rf {params.outdir};
    mkdir -p {params.outdir};
    {params.prgm} --keep-temporary --output {params.outdir} --prefix {params.prefix} --illumina-bam-files {input.illumina} --pacbio-bam-files {input.pacbio} --nanopore-bam-files {input.nanopore} 1> {log.stdout} 2> {log.stderr}
    """
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

rule bams_with_assembly_illumina_paired_pacbio_nanopore_nextflow:
  input:
    assembly = ASSEMBLY,
    illumina = "data_prep_bams/illumina.100.1.bam",
    pacbio = "data_prep_bams/pacbio.1000.1.pb.bam",
    nanopore = "data_prep_bams/nanopore.1000.ont.bam"
  output:
    perl2nfa(OF+"ba_illpana.bam"),
    perl2nfa(OF+"ba_illpana.ont.bam"),
    perl2nfa(OF+"ba_illpana.ont.sort.bam"),
    perl2nfa(OF+"ba_illpana.ont.sort.bam.cov-hist"),
    perl2nfa(OF+"ba_illpana.ont.sort.bam.cov-hist.pdf"),
    perl2nfa(OF+"ba_illpana.ont.sort.bam.stats"),
    perl2nfa(OF+"ba_illpana.ont.sort.bam.stats.err"),
    perl2nfa(OF+"ba_illpana.ont.sort_stats_bamqc.err"),
    perl2nfa(OF+"ba_illpana.ont.sort_stats_bamqc.log"),
    perl2nfa(OF+"ba_illpana.pb.bam"),
    perl2nfa(OF+"ba_illpana.pb.sort.bam"),
    perl2nfa(OF+"ba_illpana.pb.sort.bam.cov-hist"),
    perl2nfa(OF+"ba_illpana.pb.sort.bam.cov-hist.pdf"),
    perl2nfa(OF+"ba_illpana.pb.sort.bam.stats"),
    perl2nfa(OF+"ba_illpana.pb.sort.bam.stats.err"),
    perl2nfa(OF+"ba_illpana.pb.sort_stats_bamqc.err"),
    perl2nfa(OF+"ba_illpana.pb.sort_stats_bamqc.log"),
    perl2nfa(OF+"ba_illpana.plot.all.pdf"),
    perl2nfa(OF+"ba_illpana.sort.bam"),
    perl2nfa(OF+"ba_illpana.sort.bam.cov-hist"),
    perl2nfa(OF+"ba_illpana.sort.bam.cov-hist.pdf"),
    perl2nfa(OF+"ba_illpana.sort.bam.stats"),
    perl2nfa(OF+"ba_illpana.sort.bam.stats.err"),
    perl2nfa(OF+"ba_illpana.sort_stats_bamqc.err"),
    perl2nfa(OF+"ba_illpana.sort_stats_bamqc.log"),
    perl2nfa(OF+"multiqc.err"),
    perl2nfa(OF+"multiqc.log"),
    perl2nfa(OF+"multiqc_report.html"),
    directory(perl2nfa(OF+"ba_illpana.ont.sort_stats/")),
    directory(perl2nfa(OF+"ba_illpana.pb.sort_stats/")),
    directory(perl2nfa(OF+"ba_illpana.sort_stats/")),
    directory(perl2nfa(OF+"multiqc_data/")),
  benchmark: repeat("benchmarks/nextflow_assembly/{}.tsv".format(NAME), config["benchmark_repeats"])
  threads: 16
  conda: "../envs/nextflow.yml"
  params:
    prefix=NAME,
    outdir=perl2nfa(OF),
    prgm=config["nextflow_script"]
  log:
    stdout = perl2nfa("{folder}{name}.stdout.log".format(folder=OF, name=NAME)),
    stderr = perl2nfa("{folder}{name}.stderr.log".format(folder=OF, name=NAME))
  shell:
    """
    rm -rf {params.outdir};
    mkdir -p {params.outdir};
    {params.prgm} --assembly {input.assembly} --keep-temporary --output {params.outdir} --prefix {params.prefix} --illumina-bam-files {input.illumina} --pacbio-bam-files {input.pacbio} --nanopore-bam-files {input.nanopore} 1> {log.stdout} 2> {log.stderr}
    """