ComparisonRegions.smk 2.69 KB
Newer Older
BeatriceTan's avatar
BeatriceTan committed
1
import ReportTools
2
import os.path
3
import datetime
Beatrice Tan's avatar
Beatrice Tan committed
4

Beatrice Tan's avatar
Beatrice Tan committed
5

6
rule report_tools:
7
    """Report the differences in calls between GISTIC2 and RUBIC."""
8
    input:
9
        gistic="GISTIC/all_lesions.conf_" + config["gistic_precision"] + ".txt",
10
        rubic_gain="RUBIC/gains.txt",
BeatriceTan's avatar
BeatriceTan committed
11
        rubic_loss="RUBIC/losses.txt",
12
        overlap="Reports/Regions_overlapping_other_tool.bed"
13
    output:
14
        tools="Reports/Tools.txt",
15
        table_regions="Reports/Recurrent_regions.txt",
Beatrice Tan's avatar
Beatrice Tan committed
16 17 18
        genes_both="Reports/Genes_both.txt",
        genes_gistic="Reports/Genes_GISTIC2.txt",
        genes_rubic="Reports/Genes_RUBIC.txt",
19
        venn="Reports/Venn_overlap_genes.png",
20
        size_plot="Reports/Comparison_sizes.png"
21 22 23
    params:                                                 #select input files from repository or own input files
        census=os.path.join(workflow.basedir, config["census_genes"]) if config["census_genes"].startswith("input_files") else config["census_genes"],
        known=os.path.join(workflow.basedir, config["prev_found_genes"]) if config["prev_found_genes"].startswith("input_files") else config["prev_found_genes"],
24
        biomart_info=os.path.join(workflow.basedir, config["biomart_genes"]) if config["biomart_genes"].startswith("input_files") else config["biomart_genes"],
25
        ref=config["reference"]
26
    run:
BeatriceTan's avatar
BeatriceTan committed
27 28
        ReportTools.make_report(input.gistic, input.rubic_gain, input.rubic_loss,
                                params.census, params.known, params.ref, params.biomart_info,
29
                                output.tools, output.table_regions, output.venn, output.size_plot,
BeatriceTan's avatar
BeatriceTan committed
30
                                output.genes_both, output.genes_gistic, output.genes_rubic,
31
                                input.overlap)
32

33
rule get_overlap_GISTIC_RUBIC:
34
    """Intersect the recurrent regions detected by RUBIC and GISTIC2.0."""
35
    input:
36 37
        gistic="GISTIC/regions_track.conf_" + config["gistic_precision"] + ".bed",
        rubic="RUBIC/regions_track.bed"
38
    output:
39
        "Reports/Regions_overlapping_other_tool.bed"
40 41
    conda:
        workflow.basedir + "/envs/bedtools.yaml"
42 43
    shell:
        "bedtools intersect -a {input.gistic} -b {input.rubic} -wo > {output}"
Beatrice Tan's avatar
Beatrice Tan committed
44

45
rule get_overlap_known_genes:
46 47 48 49 50 51 52 53 54 55 56
    """Intersect known genes and recurrent regions detected by RUBIC and GISTIC2.0."""
    input:
        known="Reports/Locations_known_genes.bed",
        gistic="GISTIC/regions_track.conf_" + config["gistic_precision"] + ".bed",
        rubic="RUBIC/regions_track.bed"
    output:
        "Reports/Overlap_known_genes.bed"
    conda:
        workflow.basedir + "/envs/bedtools.yaml"
    shell:
        "bedtools intersect -a {input.known} -b {input.gistic} {input.rubic} -names GISTIC RUBIC -wo > {output}"