-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSnakefile
226 lines (208 loc) · 10.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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
configfile: "config.yaml"
NEO4J_ID = config['neo4j_id']
NEO4J_PASSWORD = config['neo4j_password']
DATABASE = config['database']
CLUSTERINGS_FOLDER = config['clusterings_folder']
OBJECT_NODES_NAME = config['object_nodes_name'],
CLUSTER_NODES_NAME = config['cluster_nodes_name']
WRITE_ALL = config['write_all']
REASSIGN = config['reassign_unclassified']
# Run ClustOmics
rule All:
input:
clust="out/{subject}.{rel_name}.FuseClusterings.log",
MQ_plot="out/plots/{subject}/wMQ_{subject}.{rel_name}.svg",
survival="out/survival/{subject}/{subject}.{rel_name}.ClustOmicsClustering.pval",
clinical="out/clinical/{subject}/{subject}.{rel_name}.ClustOmicsClustering.pval"
output:
"out/{subject}.{rel_name}.all.log"
shell:
"touch {output}"
# Build the graph from metadata file and raw clustering results
rule BuildGraph:
input:
metadata = "data/{subject}/{subject}_metadata.txt"
output:
"out/{subject}.BuildGraph.log"
shell:
"python dev/BuildGraph.py -id {NEO4J_ID} -pwd {NEO4J_PASSWORD} -host {DATABASE}\
-cls {CLUSTERINGS_FOLDER} -subj {wildcards.subject} -out {output}"
# Create edges between each pair of objects clustered together in at least one raw clustering results
rule SupportEdges:
input:
"out/{subject}.BuildGraph.log"
output:
"out/{subject}.SupportEdges.log"
shell:
"python dev/SupportEdges.py -id {NEO4J_ID} -pwd {NEO4J_PASSWORD} -host {DATABASE}\
-subj {wildcards.subject} -obj_name {OBJECT_NODES_NAME} -cls_name {CLUSTER_NODES_NAME} -out {output}"
# Create integration edges according to the specified methods and omics to integrate
rule IntegrationEdges:
input:
"out/{subject}.SupportEdges.log"
output:
"out/{subject}.{rel_name}.IntegrationEdges.log"
params:
datatypes=lambda wildcards: config['datatypes'][wildcards.rel_name],
methods=lambda wildcards: config['methods'][wildcards.rel_name]
shell:
"python dev/IntegrationEdges.py -id {NEO4J_ID} -pwd {NEO4J_PASSWORD} -host {DATABASE} \
-subj {wildcards.subject} -obj_name {OBJECT_NODES_NAME} -rel {wildcards.rel_name} \
-dt '{params.datatypes}' -met '{params.methods}' -op 'OR' -out {output}"
rule FuseClusterings:
input:
"out/{subject}.{rel_name}.IntegrationEdges.log"
output:
out_log="out/{subject}.{rel_name}.FuseClusterings.log",
out_clust="out/results/{subject}/{subject}.{rel_name}.ClustOmicsClustering"
params:
datatypes=lambda wildcards: config['datatypes'][wildcards.rel_name],
methods=lambda wildcards: config['methods'][wildcards.rel_name],
min_size_consensus=lambda wildcards: config['min_size_consensus'][wildcards.rel_name],
min_size_clust=lambda wildcards: config['min_size_clust'][wildcards.rel_name]
shell:
"mkdir -p out/results/{wildcards.subject};"
"python dev/FuseClusterings.py -out_cls {output.out_clust} -id {NEO4J_ID} -pwd {NEO4J_PASSWORD} -host {DATABASE} \
-subj {wildcards.subject} -obj_name {OBJECT_NODES_NAME} -cls_name {CLUSTER_NODES_NAME} -rel {wildcards.rel_name} \
-dt '{params.datatypes}' -met '{params.methods}' -min_clust {params.min_size_clust} \
-min_nodes {params.min_size_consensus} -out {output.out_log} -nb_sup False --writeAll {WRITE_ALL} --reassign {REASSIGN}"
rule FuseClusteringsWithNbSupp:
input:
"out/{subject}.{rel_name}.IntegrationEdges.log"
output:
out_log="out/{subject}.{rel_name}.FuseClusterings.{nb_supports}_supports.log",
out_clust="out/results/{subject}/{subject}.{rel_name}.ClustOmicsClustering.{nb_supports}_supports"
params:
datatypes=lambda wildcards: config['datatypes'][wildcards.rel_name],
methods=lambda wildcards: config['methods'][wildcards.rel_name],
min_size_consensus=lambda wildcards: config['min_size_consensus'][wildcards.rel_name],
min_size_clust=lambda wildcards: config['min_size_clust'][wildcards.rel_name]
shell:
"mkdir -p out/results/{wildcards.subject};"
"python dev/FuseClusterings.py -out_cls {output.out_clust} -id {NEO4J_ID} -pwd {NEO4J_PASSWORD} -host {DATABASE} \
-subj {wildcards.subject} -obj_name {OBJECT_NODES_NAME} -cls_name {CLUSTER_NODES_NAME} -rel {wildcards.rel_name} \
-dt '{params.datatypes}' -met '{params.methods}' -min_clust {params.min_size_clust} \
-min_nodes {params.min_size_consensus} -out {output.out_log} -nb_sup {wildcards.nb_supports} --writeAll {WRITE_ALL} --reassign {REASSIGN}"
# Compute and plot the Modularization Quality for each possible number of supports
rule PlotMQ:
input:
"out/{subject}.{rel_name}.IntegrationEdges.log",
output:
"out/plots/{subject}/wMQ_{subject}.{rel_name}.svg"
params:
datatypes=lambda wildcards: config['datatypes'][wildcards.rel_name],
methods=lambda wildcards: config['methods'][wildcards.rel_name],
min_size_clust=lambda wildcards: config['min_size_clust'][wildcards.rel_name],
min_size_consensus=lambda wildcards: config['min_size_consensus'][wildcards.rel_name]
shell:
"mkdir -p out/plots/{wildcards.subject};"
"python dev/PlotMQ.py -out {output} -id {NEO4J_ID} -pwd {NEO4J_PASSWORD} -host {DATABASE} \
-subj {wildcards.subject} -obj_name {OBJECT_NODES_NAME} -cls_name {CLUSTER_NODES_NAME} \
-rel {wildcards.rel_name} -dt '{params.datatypes}' -met '{params.methods}' \
-min_clust {params.min_size_clust} -min_nodes {params.min_size_consensus} "
# Compute Survival Analysis for ClustOmics clusterings
rule SurvivalClustOmics:
input:
surv="raw_data/{subject}/survival",
clust="out/results/{subject}/{subject}.{rel_name}.ClustOmicsClustering"
output:
out="out/survival/{subject}/{subject}.{rel_name}.ClustOmicsClustering.pval",
fig="out/survival/{subject}/{subject}.{rel_name}.ClustOmicsClustering.svg"
shell:
"mkdir -p out/survival/{wildcards.subject};"
"Rscript dev/analyse_results/SurvivalHeinze.R -c {input.clust} -s {input.surv} -o {output.out} -f {output.fig}"
# Compute Survival Analysis for COCA clusterings
rule SurvivalCOCA:
input:
surv="raw_data/{subject}/survival",
clust="data/coca/{subject}_{datatype}_COCA.clst"
output:
out="out/survival/coca/{subject}_{datatype}_COCA.pval",
fig="out/survival/coca/{subject}_{datatype}_COCA.svg"
shell:
"mkdir -p out/survival/coca;"
"Rscript dev/analyse_results/SurvivalHeinze.R -c {input.clust} -s {input.surv} -o {output.out} -f {output.fig}"
# Compute Survival Analysis for raw clusterings
rule SurvivalRaw:
input:
surv="raw_data/{subject}/survival",
clust="data/{subject}/{subject}_{datatype}_{method}.clst"
output:
out="out/survival/{subject}/{subject}_{datatype}_{method}.pval",
fig="out/survival/{subject}/{subject}_{datatype}_{method}.svg"
shell:
"mkdir -p out/survival/{wildcards.subject};"
"Rscript dev/analyse_results/SurvivalHeinze.R -c {input.clust} -s {input.surv} -o {output.out} -f {output.fig}"
# Compute Clinical Labels Enrichment Analysis for ClustOmics clusterings
rule ClinicalClustOmics:
input:
clin="raw_data/clinical/{subject}",
clust="out/results/{subject}/{subject}.{rel_name}.ClustOmicsClustering"
output:
"out/clinical/{subject}/{subject}.{rel_name}.ClustOmicsClustering.pval"
shell:
"mkdir -p out/clinical/{wildcards.subject};"
"Rscript dev/analyse_results/ClinicalLabelsEnrichment.R -s {wildcards.subject} -c {input.clust} -f {input.clin} -o {output}"
# Compute Clinical Labels Enrichment Analysis for COCA clusterings
rule ClinicalCOCA:
input:
clin="raw_data/clinical/{subject}",
clust="data/coca/{subject}_{datatype}_COCA.clst"
output:
"out/clinical/coca/{subject}_{datatype}_COCA.pval"
shell:
"mkdir -p out/clinical/{wildcards.subject};"
"Rscript dev/analyse_results/ClinicalLabelsEnrichment.R -s {wildcards.subject} -c {input.clust} -f {input.clin} -o {output}"
# Compute Clinical Labels Enrichment Analysis for raw clusterings
rule ClinicalRaw:
input:
clin="raw_data/clinical/{subject}",
clust="data/{subject}/{subject}_{datatype}_{method}.clst"
output:
"out/clinical/{subject}/{subject}_{datatype}_{method}.pval"
shell:
"mkdir -p out/clinical/{wildcards.subject};"
"Rscript dev/analyse_results/ClinicalLabelsEnrichment.R -s {wildcards.subject} -c {input.clust} -f {input.clin} -o {output}"
rule AllSurvClinMulti:
input:
survival_PINS="out/survival/{subject}/{subject}_multiomics_PINS.pval",
survival_MCCA="out/survival/{subject}/{subject}_multiomics_MCCA.pval",
survival_SNF="out/survival/{subject}/{subject}_multiomics_SNF.pval",
survival_rMKL="out/survival/{subject}/{subject}_multiomics_rMKL.pval",
survival_NEMO="out/survival/{subject}/{subject}_multiomics_NEMO.pval",
clinical_PINS="out/clinical/{subject}/{subject}_multiomics_PINS.pval",
clinical_MCCA="out/clinical/{subject}/{subject}_multiomics_MCCA.pval",
clinical_SNF="out/clinical/{subject}/{subject}_multiomics_SNF.pval",
clinical_rMKL="out/clinical/{subject}/{subject}_multiomics_rMKL.pval",
clinical_NEMO="out/clinical/{subject}/{subject}_multiomics_NEMO.pval",
output:
"out/{subject}.surv_clin_multi.log"
shell:
"touch {output}"
rule AllSurvClinSingle:
input:
survival_PINS="out/survival/{subject}/{subject}_{omic}_PINS.pval",
survival_SNF="out/survival/{subject}/{subject}_{omic}_SNF.pval",
survival_rMKL="out/survival/{subject}/{subject}_{omic}_rMKL.pval",
survival_NEMO="out/survival/{subject}/{subject}_{omic}_NEMO.pval",
survival_kmeans="out/survival/{subject}/{subject}_{omic}_kmeans.pval",
clinical_PINS="out/clinical/{subject}/{subject}_{omic}_PINS.pval",
clinical_SNF="out/clinical/{subject}/{subject}_{omic}_SNF.pval",
clinical_rMKL="out/clinical/{subject}/{subject}_{omic}_rMKL.pval",
clinical_NEMO="out/clinical/{subject}/{subject}_{omic}_NEMO.pval",
clinical_kmeans="out/clinical/{subject}/{subject}_{omic}_kmeans.pval"
output:
"out/{subject}_{omic}.surv_clin_single.log"
shell:
"touch {output}"
# Run Survival & Clinical analysis for input clusterings
rule AllSurvClin:
input:
surv_clin_multi="out/{subject}.surv_clin_multi.log",
surv_clin_exp="out/{subject}_expression.surv_clin_single.log",
surv_clin_mirna="out/{subject}_mirna.surv_clin_single.log",
surv_clin_met="out/{subject}_methylation.surv_clin_single.log"
output:
"out/{subject}.allSurvClin.log"
shell:
"touch {output}"