From a00561962fd6c3370f7fe40c61023bffe4d2b8d0 Mon Sep 17 00:00:00 2001 From: NilsFo Date: Mon, 12 Apr 2021 11:47:02 +0200 Subject: [PATCH] Updated paths and implemented preps for glia support --- predict_batch.py | 36 ++++++++++++++++++++++++++---------- train_model.py | 21 ++++++++++++--------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/predict_batch.py b/predict_batch.py index 3f3b6b7..2c6b758 100644 --- a/predict_batch.py +++ b/predict_batch.py @@ -276,12 +276,13 @@ def custom_paths_predict(): def prodi_gpu_predict(): print('Running Predictions.') - use_oligo = False - use_neuron = False - use_glia = True + use_oligo = True + use_neuron = True + use_glia = False + use_old = False use_debug = False - use_paper = False + use_paper = True skip_predicted = True n_jobs: int = 20 @@ -295,8 +296,12 @@ def prodi_gpu_predict(): # source_dir_redo_paper_neuron = '/prodi/bioinf/bioinfdata/work/omnisphero/CNN/final/neuron_paper/rosi/' # .h5 dirs to be predicted for efsa or endpoints - source_dir_redo_paper_oligo = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN/final/oligo_18/' - source_dir_redo_paper_neuron = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN/final/neuron_18/' + source_dir_paper_oligo = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN/final/oligo_endpoints5/' + source_dir_paper_neuron = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN/final/neuron_endpoints5/' + + source_dir_paper_oligo2 = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN/final/oligo_endpoints6/' + source_dir_paper_neuron2 = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN/final/neuron_endpoints6/' + source_dir_glia = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN/final/glia_01/' @@ -310,18 +315,29 @@ def prodi_gpu_predict(): if use_paper: if use_neuron: - predict_batch(model_source_path=model_source_path_neuron_paper, source_dir=source_dir_redo_paper_neuron, + predict_batch(model_source_path=model_source_path_neuron_paper, source_dir=source_dir_paper_neuron, + normalize_enum=4, + n_jobs=n_jobs, + skip_predicted=skip_predicted, + gpu_index_string="0") + + predict_batch(model_source_path=model_source_path_neuron_paper, source_dir=source_dir_paper_neuron2, normalize_enum=4, n_jobs=n_jobs, skip_predicted=skip_predicted, gpu_index_string="0") if use_oligo: - predict_batch(model_source_path=model_source_path_oligo_paper, source_dir=source_dir_redo_paper_oligo, + predict_batch(model_source_path=model_source_path_oligo_paper, source_dir=source_dir_paper_oligo, normalize_enum=4, n_jobs=n_jobs, skip_predicted=skip_predicted, - gpu_index_string="1") - else: + gpu_index_string="0") + predict_batch(model_source_path=model_source_path_oligo_paper, source_dir=source_dir_paper_oligo2, + normalize_enum=4, + n_jobs=n_jobs, + skip_predicted=skip_predicted, + gpu_index_string="0") + if use_old: if use_neuron: predict_batch(model_source_path=model_source_path_neuron, source_dir=source_dir_neuron, normalize_enum=1, diff --git a/train_model.py b/train_model.py index 7f5f092..4d28d02 100644 --- a/train_model.py +++ b/train_model.py @@ -1146,14 +1146,17 @@ def decode_history_key(key: str) -> str: glia_path_train = [ - '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN-glia-raw/training/glia/VJK135_trainingData_glia-raw', - '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN-glia-raw/training/glia/VJK136_trainingData_glia-raw' + '/home/nilfoe/bioinf/Omnisphero/CNN-glia/training/glia/JK247_ECM pretreated_trainingData_glia', + '/home/nilfoe/bioinf/Omnisphero/CNN-glia/training/glia/JK247_spheres pretreated_trainingData_glia', + '/home/nilfoe/bioinf/Omnisphero/CNN-glia/training/glia/JK274_normal_trainingData_glia', + '/home/nilfoe/bioinf/Omnisphero/CNN-glia/training/glia/VJK135_trainingData_glia', + '/home/nilfoe/bioinf/Omnisphero/CNN-glia/training/glia/VJK136_trainingData_glia' ] -glia_path_test='/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN-glia-raw/test/glia/' +glia_path_test='/home/nilfoe/bioinf/Omnisphero/CNN-glia/test/glia/' glia_path_val = [ - '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN-glia-raw/validation/glia/' + '/home/nilfoe/bioinf/Omnisphero/CNN-glia/validation/glia/' ] def main(): @@ -1161,7 +1164,7 @@ def main(): data_gen = get_default_augmenter() n_jobs = 20 - out_path = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN-glia-raw/models/glia/' + out_path = '/home/nilfoe/prodi/bioinfdata/work/Omnisphero/CNN-glia/models/glia-extendedData/' print('Sleeping....') # time.sleep(18000) @@ -1172,7 +1175,7 @@ def main(): test_data_path=glia_path_test, use_SMOTE=False, out_path=out_path + 'base' + os.sep, - gpu_index_string="1", + gpu_index_string="0", optimizer='SGD', n_jobs=n_jobs, epochs=5000 @@ -1184,7 +1187,7 @@ def main(): test_data_path=glia_path_test, use_SMOTE=False, out_path=out_path + 'datagen' + os.sep, - gpu_index_string="1", + gpu_index_string="0", optimizer='SGD', n_jobs=n_jobs, data_gen=data_gen, @@ -1197,7 +1200,7 @@ def main(): test_data_path=glia_path_test, use_SMOTE=True, out_path=out_path + 'smote' + os.sep, - gpu_index_string="1", + gpu_index_string="0", optimizer='SGD', n_jobs=n_jobs, epochs=5000 @@ -1209,7 +1212,7 @@ def main(): test_data_path=glia_path_test, use_SMOTE=True, out_path=out_path + 'datagen_and_smote' + os.sep, - gpu_index_string="1", + gpu_index_string="0", optimizer='SGD', n_jobs=n_jobs, data_gen=data_gen,