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

rule assembly_nanopore_perl:
  input:
    assembly = ASSEMBLY,
9
    nanopore = "data_prep/nanopore.sim.1000.fastq",
Raphael Müller's avatar
Raphael Müller committed
10
11
12
13
14
15
16
17
  output:
    dirs = [directory(x) for x in dir_outputs],
    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
18
  conda: "../envs/perl.yml"
Raphael Müller's avatar
Raphael Müller committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  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} -ont {input.nanopore} 1> {log.stdout} 2> {log.stderr}
    """

rule assembly_nanopore_nextflow:
  input:
    assembly = rules.assembly_nanopore_perl.input.assembly,
    nanopore = rules.assembly_nanopore_perl.input.nanopore,
  output:
    [perl2nf(x) for x in rules.assembly_nanopore_perl.output if x not in dir_outputs],
    [directory(perl2nf(x)) for x in dir_outputs],
  params:
    prefix=rules.assembly_nanopore_perl.params.prefix,
    outdir=perl2nf(rules.assembly_nanopore_perl.params.outdir),
    prgm=config["nextflow_script"]
  threads: 16
42
  conda: "../envs/nextflow.yml"
Raphael Müller's avatar
Raphael Müller committed
43
44
45
46
47
48
49
50
51
52
53
  benchmark: repeat("benchmarks/nextflow/{}.tsv".format(NAME), config["benchmark_repeats"])
  log:
    stdout = perl2nf(rules.assembly_nanopore_perl.log.stdout),
    stderr = perl2nf(rules.assembly_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} --nanopore {input.nanopore} 1> {log.stdout} 2> {log.stderr}
    """