-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
65 lines (57 loc) · 1.7 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
GENOMES=['bosTau9', 'canFam6', 'equCab3', 'felCat9', 'galGal6',
'mm39', 'oviAri4', 'susScr11', 'hg38']
KSIZES=[21, 31, 51]
rule all:
input:
expand('output/{g}.sig.zip', g=GENOMES),
expand('output/k51.s10_000/{g}.sig.zip', g=GENOMES),
rule sketch:
input:
'genomes/{g}.fa.gz',
output:
json=temporary('output/{g}.sig'),
zip='output/{g}.sig.zip',
params:
p=",".join([ f'k={k}' for k in KSIZES ]),
shell: """
sourmash scripts singlesketch {input} -o {output.json} \
--name {wildcards.g} -p {params.p}
sourmash sig cat {output.json} -o {output.zip}
"""
rule downsample_k51_s100_000:
input:
'output/{g}.sig.zip',
output:
'output/k51.s10_000/{g}.sig.zip',
shell: """
sourmash sig downsample {input} -o {output} -k 51 --scaled=100_000
"""
rule hg38_download:
output:
# last mod on FTP server: Jan 24, 2014; size 983726049 bytes.
'downloads/hg38.chromFa.tar.gz',
shell: """
curl -JL ftp://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.chromFa.tar.gz -o {output}
"""
rule hg38_chroms:
input:
'downloads/hg38.chromFa.tar.gz',
output:
temporary(directory('downloads/hg38')),
shell: """
mkdir -p {output}
tar xvf {input} -C {output}
"""
rule hg38_sketch:
input:
dir="downloads/hg38",
output:
"output/hg38.sig.zip",
params:
fasta = "downloads/hg38/chroms/*",
p=",".join([ f'k={k}' for k in KSIZES ]),
shell: """
sourmash sketch dna -o {output} -p {params.p} {params.fasta} \
--name "hg38+alt"
"""
ruleorder: hg38_sketch > sketch