Snakefile 1.44 KB
Newer Older
Yoann Dufresne's avatar
Yoann Dufresne committed
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

WORKDIR = "snake_tests"
DATA = "data"

rule all:
    input:
        f"{WORKDIR}/small_bar.tar.gz"


rule compress_data:
    input:
        barcode_graph=f"{WORKDIR}/{{barcode_file}}.gexf",
        d2_raw=f"{WORKDIR}/{{barcode_file}}_d2_raw.gexf",
        simplified_d2=f"{WORKDIR}/{{barcode_file}}_d2_simplified.gexf"
    output:
        zip=f"{WORKDIR}/{{barcode_file}}.tar.gz"
    shell:
        f"mkdir {WORKDIR}/{{wildcards.barcode_file}};"
        f"mv {WORKDIR}/*.gexf {WORKDIR}/{{wildcards.barcode_file}}/ ;"
        f"tar czf {{output.zip}} {WORKDIR}/{{wildcards.barcode_file}}/ ;"
        f"rm -rf {WORKDIR}/{{wildcards.barcode_file}}/ ;"


rule d2_simplification:
    input:
        barcode_graph="{barcode_path}.gexf",
        d2_raw="{barcode_path}_d2_raw.gexf"
    output:
        simplified_d2="{barcode_path}_d2_simplified.gexf"
    shell:
        "python3 deconvolution/d2_reduction.py -o {output.simplified_d2} {input.barcode_graph} {input.d2_raw}"


rule d2_generation:
    input:
        barcode_graph=f"{WORKDIR}/{{file}}.gexf"
    output:
        d2_file=f"{WORKDIR}/{{file}}_d2_raw.gexf"
    shell:
        f"python3 deconvolution/to_d2_graph.py {{input.barcode_graph}} -o {WORKDIR}/{{wildcards.file}}_d2_raw"


rule setup_workdir:
    input:
        barcode_graph=f"{DATA}/{{file}}.gexf"
    output:
        f"{WORKDIR}/{{file}}.gexf"
    shell:
        f"if [ ! -d {WORKDIR} ]; then mkdir {WORKDIR}; fi;"
        f"cp {{input.barcode_graph}} {WORKDIR}"