-
Notifications
You must be signed in to change notification settings - Fork 0
/
arguments.py
157 lines (146 loc) · 3.63 KB
/
arguments.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
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
import argparse
import os
def argparser():
parser = argparse.ArgumentParser()
# for model
parser.add_argument(
'--seq_filter_length',
type=int,
default=8,
help='Filter size for Conv1D layer for protein sequence codification'
)
parser.add_argument(
'--smi_filter_length',
type=int,
default=4,
help='Filter size for Conv1D layer for SMILES codification'
)
parser.add_argument(
'--dom_filter_length',
type=int,
default=4,
help='Filter size for Conv1D layer for Prosite domains codification'
)
parser.add_argument(
'--num_filters',
type=int,
default=32,
help='Number of filters in initial Conv1D layer\n\
Second layer: 2 * num_filters,\n\
Third layer: 3 * num_filters\n\
Default: 32'
)
parser.add_argument(
'--num_hidden',
type=int,
default=0,
help='Number of neurons in hidden layer.'
)
parser.add_argument(
'--num_classes',
type=int,
default=0,
help='Number of classes (families).'
)
parser.add_argument(
'--max_seq_len',
type=int,
default=0,
help='Length of input sequences.'
)
parser.add_argument(
'--max_smi_len',
type=int,
default=0,
help='Length of input sequences.'
)
parser.add_argument(
'--word_representation',
type=bool,
default=False,
help='Word representation of SMILES and sequences\n\
Default: False. Character representation'
)
parser.add_argument(
'--seq_wordlen',
type=int,
default=3,
help='Length of word in sequence word representation\n\
Default: 3'
)
parser.add_argument(
'--smi_wordlen',
type=int,
default=8,
help='Length of word in SMILES word representation\n\
Default: 8'
)
parser.add_argument(
'--deep_smiles',
type=bool,
default=True,
help='Use DeepSMILES representation of drug compounds'
)
# for learning
parser.add_argument(
'--learning_rate',
type=float,
default=0.001,
help='Initial learning rate.'
)
parser.add_argument(
'--num_epoch',
type=int,
default=100,
help='Number of epochs to train.\n\
Default: 100'
)
parser.add_argument(
'--batch_size',
type=int,
default=256,
help='Batch size. Must divide evenly into the dataset sizes.\n\
Default: 256'
)
parser.add_argument(
'--extract_domains',
type=bool,
default=True,
help='Whether to extract Prosite domains from protein sequences'
)
parser.add_argument(
'--provided_domains',
type=bool,
default=False,
help='Whether Prosite domains are externally available in data path.'
)
parser.add_argument(
'--dataset_path',
type=str,
default='/data/kiba/',
help='Directory for input data.'
)
parser.add_argument(
'--is_log',
type=int,
default=0,
help='use log transformation for Y'
)
parser.add_argument(
'--checkpoint_path',
type=str,
default='',
help='Path to write checkpoint file.'
)
parser.add_argument(
'--log_dir',
type=str,
default='/tmp',
help='Directory for log data.'
)
FLAGS, dummy_unparsed = parser.parse_known_args()
return FLAGS
def logging(msg, FLAGS):
fpath = os.path.join( FLAGS.log_dir, "log.txt" )
with open( fpath, "a" ) as fw:
fw.write("%s\n" % msg)