pacbio_only.smk 1.99 KB
Newer Older
Raphael Müller's avatar
Raphael Müller committed
1
OF = WD+"assembly_pacbio_only/perl/"
Raphael Müller's avatar
Raphael Müller committed
2
perl2nf = lambda s: s.replace(r"/perl/",r"/nextflow/")
Raphael Müller's avatar
Raphael Müller committed
3
NAME = "pa"
Raphael Müller's avatar
Raphael Müller committed
4

Raphael Müller's avatar
Raphael Müller committed
5
rule assembly_pacbio_perl:
Raphael Müller's avatar
Raphael Müller committed
6
7
  input:
    assembly = ASSEMBLY,
Raphael Müller's avatar
Raphael Müller committed
8
    pacbio = "data_prep/pacbio.10000.1.fastq",
Raphael Müller's avatar
Raphael Müller committed
9
  output:
Raphael Müller's avatar
Raphael Müller committed
10
11
    sort_stats_pb = multiext(OF+NAME+".pb.sort_stats/", "genome_results.txt", "qualimapReport.html"),
    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"],
Raphael Müller's avatar
Raphael Müller committed
12
13
14
15
  params:
    prefix=NAME,
    outdir=OF,
    prgm=config["original_perl_script"]
Raphael Müller's avatar
Raphael Müller committed
16
  threads: 16
17
  conda: "../envs/perl.yml"
Raphael Müller's avatar
Raphael Müller committed
18
  benchmark: repeat("benchmarks/nextflow/{}.tsv".format(NAME), config["benchmark_repeats"])
Raphael Müller's avatar
Raphael Müller committed
19
  log:
Raphael Müller's avatar
Raphael Müller committed
20
21
    stdout = "{folder}{name}.stdout.log".format(folder=OF, name=NAME),
    stderr = "{folder}{name}.stderr.log".format(folder=OF, name=NAME)
Raphael Müller's avatar
Raphael Müller committed
22
23
  shell:
    """
Raphael Müller's avatar
Raphael Müller committed
24
25
26
    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} 1> {log.stdout} 2> {log.stderr}
Raphael Müller's avatar
Raphael Müller committed
27
28
    """

Raphael Müller's avatar
Raphael Müller committed
29
rule assembly_pacbio_nextflow:
Raphael Müller's avatar
Raphael Müller committed
30
  input:
Raphael Müller's avatar
Raphael Müller committed
31
32
    assembly = rules.assembly_pacbio_perl.input.assembly,
    pacbio= rules.assembly_pacbio_perl.input.pacbio,
Raphael Müller's avatar
Raphael Müller committed
33
  output:
Raphael Müller's avatar
Raphael Müller committed
34
    [perl2nf(x) for x in rules.assembly_pacbio_perl.output]
Raphael Müller's avatar
Raphael Müller committed
35
  params:
Raphael Müller's avatar
Raphael Müller committed
36
37
    prefix=rules.assembly_pacbio_perl.params.prefix,
    outdir=perl2nf(rules.assembly_pacbio_perl.params.outdir),
Raphael Müller's avatar
Raphael Müller committed
38
    prgm=config["nextflow_script"]
Raphael Müller's avatar
Raphael Müller committed
39
  threads: 16
40
  conda: "../envs/nextflow.yml"
Raphael Müller's avatar
Raphael Müller committed
41
  benchmark: repeat("benchmarks/nextflow/{}.tsv".format(NAME), config["benchmark_repeats"])
Raphael Müller's avatar
Raphael Müller committed
42
  log:
Raphael Müller's avatar
Raphael Müller committed
43
44
    stdout = perl2nf(rules.assembly_pacbio_perl.log.stdout),
    stderr = perl2nf(rules.assembly_pacbio_perl.log.stderr),
Raphael Müller's avatar
Raphael Müller committed
45
46
  shell:
    """
Raphael Müller's avatar
Raphael Müller committed
47
48
49
    rm -rf {params.outdir};
    mkdir -p {params.outdir};
    {params.prgm} --keep-temporary --assembly {input.assembly} --output {params.outdir} --prefix {params.prefix} --pacbio {input.pacbio} 1> {log.stdout} 2> {log.stderr}
Raphael Müller's avatar
Raphael Müller committed
50
51
    """