igv_session.smk 2.52 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
    params:
        "--path_prefix '../../'"
    log:
        "logs/igv/igv_session_to_file.log"
    shell:
Aurélien Ginolhac's avatar
Aurélien Ginolhac committed
23
        " 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

# 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:
Aurélien Ginolhac's avatar
Aurélien Ginolhac committed
47
        " workflow/scripts/igv_files_to_session.py {output} {input.igv} $(basename {input.fasta}) {params} 2> {log}"
AntonieV's avatar
AntonieV committed
48
49
50

rule collect_igv_report_session_files:
    input:
51
52
53
54
        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",
AntonieV's avatar
AntonieV committed
55
56
57
58
59
60
        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:
61
62
63
64
65
66
        """
        mkdir -p {output}; cp {input.igv_data} {output}/;
        cp {input.igv_session} {output}/
        """

#"cp -R {input.deseq2_files}/* {output}/; cp {input.fasta} {output}/; "
AntonieV's avatar
AntonieV committed
67
68
69
70

# igv session that can be downloaded from generated report
rule zip_igv_report_session:
    input:
71
        rules.collect_igv_report_session_files.output
AntonieV's avatar
AntonieV committed
72
73
74
75
    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"
76
    conda:
AntonieV's avatar
AntonieV committed
77
        "../envs/zip.yaml"
AntonieV's avatar
AntonieV committed
78
79
    shell:
        "cd $(dirname {input}); zip $(basename {output}) $(basename {input})/*"