-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
79 lines (71 loc) · 1.64 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
configfile: "config.yaml"
rule all:
input:
"out/clusters.json",
"out/transcripts.csv",
"out/embeddings.csv",
"out/metadata.csv",
"out/expressions.bin.gz",
"out/cluster_dge.json"
if "seurat_object" in config:
rule seurat_object:
input:
config["seurat_object"]
output:
"out/seurat.rds"
shell:
"cp {input} {output}"
elif "count_matrix" in config:
rule seurat_object:
input:
config["count_matrix"]
output:
"out/seurat.rds"
script:
"scripts/seurat_create.R"
else:
raise Exception('No configuration method specified. Please set either `seurat_object` or `count_matrix` in config.yaml')
sys.exit(1)
rule seurat_extract:
input:
"out/seurat.rds"
output:
clusters="out/clusters.json",
transcripts="out/transcripts_raw.csv",
embeddings="out/embeddings.csv",
metadata="out/metadata.csv",
expressions="out/expressions.mtx",
differential_expressions="out/seurat_cluster_dge.json"
script:
"scripts/seurat.R"
rule pack_matrix:
input:
"out/expressions.mtx"
output:
"out/expressions.bin"
shell:
"./scripts/compress_matrix.py {input} {output}"
rule compress_matrix:
input:
"out/expressions.bin"
output:
"out/expressions.bin.gz"
shell:
"gzip -k {input}"
rule parse_transcripts:
input:
"out/transcripts_raw.csv"
output:
"out/transcripts.csv"
run:
if "transcript_id_prefix" in config:
shell("./scripts/parse_transcripts.py {input} -p=\"{config[transcript_id_prefix]}\" > {output}")
else:
shell("./scripts/parse_transcripts.py {input} > {output}")
rule merge_dges:
input:
"out/seurat_cluster_dge.json"
output:
"out/cluster_dge.json"
shell:
"./scripts/merge_dges.py {input} > {output}"