igv_session.smk 2.51 KB
Newer Older
AntonieV's avatar
AntonieV committed
1
2
3
4
rule create_igv_input_file:
    input:
        get_igv_input()
    output:
AntonieV's avatar
AntonieV committed
5
        temp("results/IGV/igv_files.txt")
AntonieV's avatar
AntonieV committed
6
7
8
9
10
    log:
        "logs/igv/merged_igv_files.log"
    shell:
        "cat {input} > {output} 2> {log}"

AntonieV's avatar
AntonieV committed
11
# igv session that can be started directly from the generated files of workflow
AntonieV's avatar
AntonieV committed
12
13
14
15
16
rule igv_files_to_session:
    input:
        igv="results/IGV/igv_files.txt",
        fasta="resources/ref/genome.fasta"
    output:
AntonieV's avatar
AntonieV committed
17
        "results/IGV/igv_session.xml"
AntonieV's avatar
AntonieV committed
18
19
20
21
22
23
    params:
        "--path_prefix '../../'"
    log:
        "logs/igv/igv_session_to_file.log"
    shell:
        " ../workflow/scripts/igv_files_to_session.py {output} {input.igv} ../../{input.fasta} {params} 2> {log}"
AntonieV's avatar
AntonieV committed
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

# remove paths for igv session to download from report.zip
rule igv_report_cleanup:
    input:
        "results/IGV/igv_files.txt"
    output:
        temp("results/IGV/report_igv_files.txt")
    log:
        "logs/igv/igv_files.log"
    script:
        "../scripts/igv_report_cleanup.py"

rule igv_files_to_report:
    input:
        igv="results/IGV/report_igv_files.txt",
        fasta="resources/ref/genome.fasta"
    output:
        temp("results/IGV/report_igv_session.xml")
    params:
        ""
    log:
        "logs/igv/igv_files_to_report.log"
    shell:
        " ../workflow/scripts/igv_files_to_session.py {output} {input.igv} $(basename {input.fasta}) {params} 2> {log}"

rule collect_igv_report_session_files:
    input:
        igv_data=get_files_for_igv(),
        deseq2_files=directory(expand("results/deseq2/FDR/bed_files/FDR_0.05_{antibody}.consensus_{peak}-peaks",
        antibody=get_unique_antibodies(), peak=config["params"]["peak-analysis"])),
        fasta="resources/ref/genome.fasta",
        igv_session="results/IGV/report_igv_session.xml"
    output:
        temp(directory("results/IGV/report_igv_session"))
    log:
        "logs/igv/collect_igv_report_session_files.log"
    shell:
        "mkdir -p {output}; cp {input.igv_data} {output}/; "
        "cp -R {input.deseq2_files}/* {output}/; cp {input.fasta} {output}/; "
        "cp {input.igv_session} {output}/"

# igv session that can be downloaded from generated report
rule zip_igv_report_session:
    input:
68
        rules.collect_igv_report_session_files.output
AntonieV's avatar
AntonieV committed
69
70
71
72
    output:
        report("results/IGV/report_igv_session.zip", caption = "../report/igv_session.rst", category="IGV session")
    log:
        "logs/igv/collect_igv_report_session_files.log"
73
    conda:
AntonieV's avatar
AntonieV committed
74
        "../envs/zip.yaml"
AntonieV's avatar
AntonieV committed
75
76
    shell:
        "cd $(dirname {input}); zip $(basename {output}) $(basename {input})/*"