-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSnakefile
91 lines (62 loc) · 1.67 KB
/
Snakefile
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import os
from snakemake.remote.HTTP import RemoteProvider
HTTP = RemoteProvider()
configfile: "config.json"
rule all:
input:
"correlation.png",
"ideogram.png",
"both.png"
rule download_hg19_size:
input:
hg19_size = HTTP.remote("hgdownload.soe.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes", keep_local=True, insecure=True)
output:
"hg19.clean.sizes"
shell:
"cat {input.hg19_size}|grep -we \"chr[0-9XY]*\" | awk 'BEGIN{{OFS=\"\t\"}}{{print $1,$2}}' > {output}"
rule create_binning:
input:
"hg19.clean.sizes"
output:
"windows.bed"
shell:
"bedtools makewindows -g {input} -w {config[bin_size]} > {output}"
rule download_genom:
input:
HTTP.remote("hgdownload.cse.ucsc.edu/goldenpath/hg19/database/{name}.txt.gz", keep_local=True, insecure=True),
output :
"{name}.bed.gz"
shell:
"zcat {input} | cut -f2,3,4 | bgzip > {output}"
rule count_per_bins:
input:
genom = "{name}.bed.gz" ,
window ="windows.bed"
output:
"{name}.coverage"
shell:
"bedtools coverage -a {input.window} -b {input.genom} -counts > {output}"
rule plot_correlation :
input :
config["first"] + ".coverage",
config["second"] + ".coverage",
output:
"correlation.png"
shell:
"Rscript --vanilla plot.r {input[0]} {input[1]} > /dev/null 2>&1"
rule plot_chromosome :
input :
config["first"] + ".coverage",
config["second"] + ".coverage",
output:
"ideogram.png"
shell:
"Rscript --vanilla plot_chrom_diff.r {input[0]} {input[1]} > /dev/null 2>&1"
rule plot_both:
input :
config["first"] + ".coverage",
config["second"] + ".coverage",
output:
"both.png"
shell:
"Rscript --vanilla plot_chrom.r {input[0]} {input[1]} > /dev/null 2>&1"