-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
329 lines (276 loc) · 12.6 KB
/
Makefile
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# =============================================================================================== #
# SRC: Makefile #
# =============================================================================================== #
# =============================================================================================== #
# VARIABLES SECTION #
# =============================================================================================== #
REQUIREMNTES_FILE = requirements.txt
LOCAL_PIP = pip3
CONDA_PIP = '...'
PROJECT_CODEBASE = ./
ARCHIVE_PROJECT_NAME_COLAB = project-genes-fusions-classifier.zip
EXCLUDED_FILES = \
'*.vscode/*' \
'*.git/*' \
.gitignore \
'*__pycache__/*' \
./README.md \
./test_feature.py \
'*notebooks/*' \
'*tmp/*' \
'*data/*' \
'*tests/*' \
'*scripts/*' \
*.png
# Here - Specify which python interpreter to employ.
SCRIPT_INTERPETER = python3
# Here - Specify which is the root directory where all results
# from different analyses will be stored, for later investingations
# about results, logs and image files.
BASE_DIR_RESULTS = bioinfo_project
# Here - There are some variable exploited in order
# to run some local tests.
#
# See tasks related to test for more details.
SCRIPT_2_TEST = test_feature.py
TESTS_DIR = tests
# Here - There are two variable used to run the
# classifier tool for genes fusions recognizing:
# - SCRIPT_ANALYSIS, standas for the `main.py` file which is used to
# write the program;
# - PROGRAM_ANALYSIS, is a symbolic link that can be used to run
# the program written above without taking care about how it was implemented
# as weel as without knowing which kind of programming language has been adopted.
#
# See task named `run_analysis` for details how both them have been employed.
SCRIPT_ANALYSIS = main.py
PROGRAM_ANALYSIS = genes_fusions_classifier
# =============================================================================================== #
# VARIABLES DEFINED TO RUN TESTS WITHIN PROPER TASKS #
# =============================================================================================== #
# ---------------------------- #
# A Test #
# ---------------------------- #
NETWORK_NAME = ModelEmbeddingBidirect
ARGS_ANALYSIS = --validation --load_network $(NETWORK_NAME)
# ---------------------------- #
# Test Setup Project's subidrs #
# ---------------------------- #
SCRIPT_TEST_ENVIRONMENT_SETUP = script_environment_setup_test.py
ARGS_TEST_ENVIRONMENT_SETUP = --validation --train --network_parameters models/ModelEmbeddingBidirect.json --load_network ModelEmbeddingBidirect
# ---------------------------- #
# Test Load Project's data #
# ---------------------------- #
SCRIPT_TEST_FETCH_AND_PRE_PROCESS = script_fetch_and_preprocess_test.py
ARGS_TEST_FETCH_AND_PREPROCESS = --validation --train --sequence_type dna --network_parameters models/ModelEmbeddingBidirect.json --load_network ModelEmbeddingBidirect
# ---------------------------- #
# Test Pipeline for Analyses #
# ---------------------------- #
SCRIPT_TEST_PIPELINE = script_pipeline_test.py
ARGS_TEST_PIPELINE = --validation --network_parameters models/ModelEmbeddingBidirect.json --load_network ModelEmbeddingBidirect --sequence_type protein
# ---------------------------- #
# Test Spredsheet for Analyses #
# ---------------------------- #
SCRIPT_TEST_SPREDSHEET = script_create_spredsheet.py
ARGS_TEST_SPREDSHEET = --validation --network_parameters models/ModelEmbeddingBidirect.json --load_network ModelEmbeddingBidirect --sequence_type protein
# ---------------------------- ---------------------#
# Test Analys model embeddign bidirectional protein #
# ------------------------------------------------- #
PROGRAM_ENTRY_POINT_M1 = main.py
ARGS_VALIDATION_M1 = --validation --network_parameters models/ModelEmbeddingBidirect.json --load_network ModelEmbeddingBidirect --sequence_type protein --lr 5e-4
ARGS_VALIDATION_TRAIN_M1 =
ARGS_VALIDATION_TEST_M1 =
# ---------------------------- ---------------------#
# Test Analys model one hot encoding protein #
# ------------------------------------------------- #
PROGRAM_ENTRY_POINT_M2 = main.py
ARGS_VALIDATION_M2 = --validation --network_parameters models/ModelOneHotProtein.json --load_network ModelOneHotProtein --sequence_type protein --onehot_flag
ARGS_VALIDATION_M3 = --validation --network_parameters models/ModelConvBidirect.json --load_network ModelConvBidirect --sequence_type protein --onehot_flag
ARGS_VALIDATION_M4 = --validation --network_parameters models/ModelBidirectDNA.json --load_network ModelBidirectDNA --sequence_type dna --onehot_flag
ARGS_VALIDATION_TRAIN_M2 = --validation --train --network_parameters models/ModelOneHotProtein.json --load_network ModelOneHotProtein --sequence_type protein --onehot_flag
ARGS_TRAIN_M2 = --train --load_network --network_parameters models/ModelOneHotProtein.json --load_network ModelOneHotProtein --sequence_type protein steps 200 --onehot_flag
ARGS_VALIDATION_TRAIN_TEST_M2 = --validation --train --test --load_network ModelOneHotProtein --network_parameters models/ModelOneHotProtein.json --sequence_type protein --onehot_flag
ARGS_TRAIN_TEST_M2 = --train --test --load_network ModelOneHotProtein --sequence_type protein --network_parameters models/ModelOneHotProtein.json --early_stopping_epoch 100 --onehot_flag
# ---------------------------- ------------------------------ #
# Test Analys model one hot encoding dna (Frank-Added) #
# ----------------------------------------------------------- #
ULSTM = genes_fusions_classifier
ARGS_TRAIN_ULSTM = --train \
--load_network WrappedRawModel \
--sequence_type dna \
--network_parameters models/experimental_simple_models/model_dna_embedding_unidirect.json \
--num_epochs 2 \
--batch_size 32 \
# =============================================================================================== #
LSTM_FRANK = genes_fusions_classifier
ARGS_TRAIN_LSTM_FRANK_COMPILE_ = \
--output_dir tests \
--compile \
--validation \
--train \
--test \
--load_network WrappedRawModel \
--network_parameters models/sequence_oriented_model.json \
--sequence_type dna \
--num_epochs 1 \
--onehot_flag
ARGS_TRAIN_LSTM_FRANK_COMPILE___ = \
--output_dir tests \
--compile \
--validation \
--train \
--test \
--load_network ModelUnidirect \
--network_parameters models/sequence_oriented_model.json \
--sequence_type dna \
--num_epochs 1 \
--onehot_flag
ARGS_TRAIN_LSTM_FRANK_COMPILE = \
--output_dir tests \
--validation \
--train \
--test \
--load_network ModelConvBidirect \
--network_parameters models/ModelConvBidirect.json \
--sequence_type dna \
--num_epochs 1 \
--onehot_flag
LSTM_FRANK = genes_fusions_classifier
ARGS_TRAIN_LSTM_FRANK_RUN_ = \
--output_dir tests \
--validation \
--train \
--test \
--load_network ModelConvUnidirect \
--network_parameters models/sequence_oriented_model.json \
--sequence_type dna \
--num_epochs 1 \
--onehot_flag
ARGS_TRAIN_LSTM_FRANK_RUN = \
--output_dir tests \
--validation \
--train \
--test \
--load_network ModelUnidirect \
--network_parameters models/sequence_oriented_model.json \
--sequence_type dna \
--num_epochs 1 \
--dropout_level 0.3 \
--onehot_flag \
--seq_len 7000
ARGS_TRAIN_LSTM_FRANK_RUN__ = \
--output_dir tests \
--validation \
--train \
--test \
--load_network ModelConvUnidirect \
--network_parameters models/sequence_oriented_model.json \
--sequence_type dna \
--num_epochs 1 \
ARGS_TRAIN_LSTM_FRANK_RUN_TEST_ = \
--output_dir tests \
--test \
--load_network WrappedRawModel \
--network_parameters models/sequence_oriented_model.json \
--sequence_type dna \
--pretrained_model "./bioinfo_project/tests/2020_02_17/train_16_56_00/results_train/my_model_weights.h5" \
--onehot_flag
ARGS_TRAIN_LSTM_FRANK_RUN_TEST = \
--output_dir tests \
--test \
--load_network ModelConvUnidirect \
--network_parameters models/sequence_oriented_model.json \
--sequence_type dna \
--pretrained_model "./bioinfo_project/tests/2020_02_17/train_16_56_00/results_train/my_model_weights.h5" \
--onehot_flag
# =============================================================================================== #
# TASKS SECTION #
# =============================================================================================== #
install: install_libraries_for_graphviz
bash setup.sh
install_libraries_for_graphviz:
@pip install pydot
@pip install pydotplus
sudo apt-get install graphviz -y
# ---------------------------- ---------------------#
# RUN ANALYSES - SECTION #
# ------------------------------------------------- #
run_help_classifier_tool: setup_before_run_task
# cp $(TESTS_DIR)/$(SCRIPT_TEST_PIPELINE) $(SCRIPT_ANALYSIS)
ln -sfn $(SCRIPT_ANALYSIS) $(PROGRAM_ANALYSIS)
chmod u+x $(PROGRAM_ANALYSIS)
$(SCRIPT_INTERPETER) $(PROGRAM_ANALYSIS) -h
run_analysis: setup_before_run_task
# cp $(TESTS_DIR)/$(SCRIPT_TEST_PIPELINE) $(SCRIPT_ANALYSIS)
cp -sfn $(SCRIPT_ANALYSIS) $(PROGRAM_ANALYSIS)
chmod u+x $(PROGRAM_ANALYSIS)
$(SCRIPT_INTERPETER) $(SCRIPT_ANALYSIS) $(ARGS_ANALYSIS)
run_validation_on_model_embedding_bidirectional_protein:
$(SCRIPT_INTERPETER) $(PROGRAM_ENTRY_POINT_M1) $(ARGS_VALIDATION_M1)
run_validation_on_model_conv_bidirect:
$(SCRIPT_INTERPETER) $(PROGRAM_ENTRY_POINT_M1) $(ARGS_VALIDATION_M3)
run_validation_on_model_one_hot_encoding_protein:
$(SCRIPT_INTERPETER) $(PROGRAM_ENTRY_POINT_M2) $(ARGS_VALIDATION_M2)
run_validation_on_model_one_hot_dna_bidirect:
$(SCRIPT_INTERPETER) $(PROGRAM_ENTRY_POINT_M2) $(ARGS_VALIDATION_M4)
run_validation_train_on_model_one_hot_encoding_protein:
$(SCRIPT_INTERPETER) $(PROGRAM_ENTRY_POINT_M2) $(ARGS_VALIDATION_TRAIN_M2)
run_validation_train_test_on_model_one_hot_encoding_protein:
$(SCRIPT_INTERPETER) $(PROGRAM_ENTRY_POINT_M2) $(ARGS_VALIDATION_TRAIN_TEST_M2)
run_train_test_on_model_one_hot_encoding_protein:
$(SCRIPT_INTERPETER) $(PROGRAM_ENTRY_POINT_M2) $(ARGS_TRAIN_TEST_M2)
run_train_ULSTM:
$(SCRIPT_INTERPETER) $(ULSTM) $(ARGS_TRAIN_ULSTM)
# ---------------------------- ---------------------#
# TESTS - SECTION #
# ------------------------------------------------- #
test_setup_environment_for_analysis: setup_before_run_task
cp $(TESTS_DIR)/$(SCRIPT_TEST_ENVIRONMENT_SETUP) $(SCRIPT_2_TEST)
$(SCRIPT_INTERPETER) $(SCRIPT_2_TEST) $(ARGS_TEST_ENVIRONMENT_SETUP)
rm -f $(SCRIPT_2_TEST)
test_fetch_data_and_preprocess_for_analysis: setup_before_run_task
cp $(TESTS_DIR)/$(SCRIPT_TEST_FETCH_AND_PRE_PROCESS) $(SCRIPT_2_TEST)
$(SCRIPT_INTERPETER) $(SCRIPT_2_TEST) $(ARGS_TEST_FETCH_AND_PREPROCESS)
rm -f $(SCRIPT_2_TEST)
test_pipeline_for_analysis: setup_before_run_task
cp $(TESTS_DIR)/$(SCRIPT_TEST_PIPELINE) $(SCRIPT_2_TEST)
$(SCRIPT_INTERPETER) $(SCRIPT_2_TEST) $(ARGS_TEST_PIPELINE)
rm -f $(SCRIPT_2_TEST)
test_spredsheet_creation_for_analysis: setup_before_run_task
cp $(TESTS_DIR)/$(SCRIPT_TEST_SPREDSHEET) $(SCRIPT_2_TEST)
$(SCRIPT_INTERPETER) $(SCRIPT_2_TEST) $(ARGS_TEST_SPREDSHEET)
rm -f $(SCRIPT_2_TEST)
test_compile_frank:
$(SCRIPT_INTERPETER) $(LSTM_FRANK) $(ARGS_TRAIN_LSTM_FRANK_COMPILE)
test_run_frank:
$(SCRIPT_INTERPETER) $(LSTM_FRANK) $(ARGS_TRAIN_LSTM_FRANK_RUN)
test_run_frank_test_phase:
$(SCRIPT_INTERPETER) $(LSTM_FRANK) $(ARGS_TRAIN_LSTM_FRANK_RUN_TEST)
# ---------------------------- ---------------------#
# MANAGEMENT - SECTION #
# ------------------------------------------------- #
setup_before_run_task:
clear
install_requirements_via_pip:
$(LOCAL_PIP) install -r $(REQUIREMNTES_FILE)
install_requirements_via_conda:
$(CONDA_PIP) install -r $(REQUIREMNTES_FILE)
# Clear directory with subdirectories corresponind to
# different runs with their results.
clear_result_dirs: setup_before_run_task
rm -fr $(BASE_DIR_RESULTS)
# different runs with their results.
clear_result_dirs_from_tests: setup_before_run_task
bash ./scripts/script_clear_results_dir_from_tests.sh ./bioinfo_project --not-cancel
build_zip_to_run_on_colab: clear_result_dirs
rm -f ../$(ARCHIVE_PROJECT_NAME_COLAB)
zip -r ../$(ARCHIVE_PROJECT_NAME_COLAB) $(PROJECT_CODEBASE) -x $(EXCLUDED_FILES)
exec_all_tests:
make -f Makefile_FINAL_TESTS arch_1_holdout \
&& make -f Makefile_FINAL_TESTS arch_1_test \
&& make -f Makefile_FINAL_TESTS arch_2_holdout \
&& make -f Makefile_FINAL_TESTS arch_2_test \
&& make -f Makefile_FINAL_TESTS arch_3_holdout \
&& make -f Makefile_FINAL_TESTS arch_3_test \
&& make -f Makefile_FINAL_TESTS arch_4_A_holdout \
&& make -f Makefile_FINAL_TESTS arch_4_B_holdout \