forked from nh2tran/DeepNovo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deepnovo_main.py
83 lines (73 loc) · 2.79 KB
/
deepnovo_main.py
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
# Copyright 2017 Hieu Tran. All Rights Reserved.
#
# DeepNovo is publicly available for non-commercial uses.
# ==============================================================================
"""TODO(nh2tran): docstring."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import deepnovo_config
import deepnovo_model
import deepnovo_worker_db
import deepnovo_worker_denovo
import deepnovo_worker_io
import deepnovo_worker_test
import deepnovo_main_modules
def main(_):
"""TODO(nh2tran): docstring."""
print("main()")
if deepnovo_config.FLAGS.knapsack_build:
deepnovo_main_modules.knapsack_build()
elif deepnovo_config.FLAGS.train:
deepnovo_main_modules.train()
elif deepnovo_config.FLAGS.test_true_feeding:
deepnovo_main_modules.test_true_feeding()
elif deepnovo_config.FLAGS.decode:
deepnovo_main_modules.decode()
elif deepnovo_config.FLAGS.search_denovo:
model = deepnovo_model.ModelInference()
model.build_model()
worker_io = deepnovo_worker_io.WorkerIO(
input_file=deepnovo_config.denovo_input_file,
output_file=deepnovo_config.denovo_output_file)
worker_denovo = deepnovo_worker_denovo.WorkerDenovo()
worker_denovo.search_denovo(model, worker_io)
elif deepnovo_config.FLAGS.search_db:
model = deepnovo_model.ModelInference()
model.build_model()
worker_io = deepnovo_worker_io.WorkerIO(
input_file=deepnovo_config.db_input_file,
output_file=deepnovo_config.db_output_file)
worker_db = deepnovo_worker_db.WorkerDB()
worker_db.build_db()
worker_db.search_db(model, worker_io)
elif deepnovo_config.FLAGS.search_hybrid:
model = deepnovo_model.ModelInference()
model.build_model()
# denovo search
worker_io = deepnovo_worker_io.WorkerIO(
input_file=deepnovo_config.hybrid_input_file,
output_file=deepnovo_config.hybrid_denovo_file)
worker_denovo = deepnovo_worker_denovo.WorkerDenovo()
predicted_denovo_list = worker_denovo.search_denovo(model, worker_io)
# db search with predicted_denovo_list
worker_io = deepnovo_worker_io.WorkerIO(
input_file=deepnovo_config.hybrid_input_file,
output_file=deepnovo_config.hybrid_output_file)
worker_db = deepnovo_worker_db.WorkerDB()
worker_db.build_db()
worker_db.search_db(model, worker_io, predicted_denovo_list)
elif deepnovo_config.FLAGS.test:
# test 1%FDR
#~ worker_db = deepnovo_worker_db.WorkerDB()
#~ worker_db.build_db()
#~ worker_test = deepnovo_worker_test.WorkerTest()
#~ worker_test.test_accuracy(worker_db.peptide_list)
worker_test = deepnovo_worker_test.WorkerTest()
worker_test.test_accuracy()
else:
print("ERROR: wrong option!")
sys.exit()
if __name__ == "__main__":
tf.app.run()