pacbio_nanopore.smk 2.67 KB
Newer Older
Raphael Müller's avatar
Raphael Müller committed
1
2
3
4
5
6
7
8
9
OF = WD+"assembly_pacbio_nanopore/perl/"
perl2nf = lambda s: s.replace(r"/perl/",r"/nextflow/")
NAME = "pana"
dir_outputs = [OF+"multiqc_data",*expand(OF+NAME+"{t}.sort_stats",t=[".pb",".ont"])]

rule assembly_pacbio_nanopore_perl:
  input:
    assembly = ASSEMBLY,
    pacbio = "data_prep/pacbio.10000.1.fastq",
10
    nanopore = "data_prep/nanopore.sim.1000.fastq",
Raphael Müller's avatar
Raphael Müller committed
11
12
13
14
15
16
17
18
19
20
21
  output:
    dirs = [directory(x) for x in dir_outputs],
    multiqc = multiext(OF + "multiqc",".err",".log","_report.html"),
    plot = multiext(OF + NAME + ".plot.all.","pdf"),
    pacbio = multiext(OF+NAME+".pb","1.bam",".bam",*multiext(".sort.bam","",*multiext(".cov-hist","",".pdf"), ".stats",".stats.err"),*multiext(".sort_stats_bamqc.","err","log")) + [OF+NAME+"_minimap_pb1.err"],
    nanopore = multiext(OF + NAME +  ".ont","1.bam",".bam", *multiext(".sort.bam","",*multiext(".cov-hist","",".pdf"), ".stats", ".stats.err"), *multiext(".sort_stats_bamqc.","err","log")) + [OF+NAME+"_minimap_ont1.err"],
  params:
    prefix=NAME,
    outdir=OF,
    prgm=config["original_perl_script"]
  threads: 16
22
  conda: "../envs/perl.yml"
Raphael Müller's avatar
Raphael Müller committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  benchmark: repeat("benchmarks/perl/{}.tsv".format(NAME), config["benchmark_repeats"])
  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 -a {input.assembly} -o {params.outdir} -pre {params.prefix} -t {threads} -pb {input.pacbio} -ont {input.nanopore} 1> {log.stdout} 2> {log.stderr}
    """

rule assembly_pacbio_nanopore_nextflow:
  input:
    assembly = rules.assembly_pacbio_nanopore_perl.input.assembly,
    nanopore = rules.assembly_pacbio_nanopore_perl.input.nanopore,
    pacbio = rules.assembly_pacbio_nanopore_perl.input.pacbio,
  output:
    [perl2nf(x) for x in rules.assembly_pacbio_nanopore_perl.output if x not in dir_outputs],
    [directory(perl2nf(x)) for x in dir_outputs],
  params:
    prefix=rules.assembly_pacbio_nanopore_perl.params.prefix,
    outdir=perl2nf(rules.assembly_pacbio_nanopore_perl.params.outdir),
    prgm=config["nextflow_script"]
  threads: 16
47
  conda: "../envs/nextflow.yml"
Raphael Müller's avatar
Raphael Müller committed
48
49
50
51
52
53
54
55
56
57
58
  benchmark: repeat("benchmarks/nextflow/{}.tsv".format(NAME), config["benchmark_repeats"])
  log:
    stdout = perl2nf(rules.assembly_pacbio_nanopore_perl.log.stdout),
    stderr = perl2nf(rules.assembly_pacbio_nanopore_perl.log.stderr),
  shell:
    """
    rm -rf {params.outdir};
    mkdir -p {params.outdir};
    {params.prgm} --keep-temporary --assembly {input.assembly} --output {params.outdir} --prefix {params.prefix} --pacbio {input.pacbio} --nanopore {input.nanopore} 1> {log.stdout} 2> {log.stderr}
    """