14
14
import org .apache .commons .cli .Options ;
15
15
import org .apache .commons .cli .ParseException ;
16
16
17
+ import com .google .common .base .Splitter ;
18
+
17
19
import fr .ens .biologie .genomique .aozan .aozan3 .Aozan3Exception ;
18
20
import fr .ens .biologie .genomique .aozan .aozan3 .Common ;
19
21
import fr .ens .biologie .genomique .aozan .aozan3 .Configuration ;
@@ -47,19 +49,11 @@ public void action(Configuration conf, List<String> arguments,
47
49
48
50
final Options options = makeOptions ();
49
51
final CommandLineParser parser = new DefaultParser ();
52
+ final Configuration doradoConf = new Configuration ();
50
53
51
- String flowcell = "" ;
52
- String kit = "" ;
53
- String barcodeKits = "" ;
54
- String modelName = "" ;
55
54
String runId = "" ;
56
- String doradoVersion = "" ;
57
55
String cudaDevice = "" ;
58
- int batchSize = -1 ;
59
- int chunkSize = -1 ;
60
- boolean trimBarcode = false ;
61
56
boolean keepTemporaryFiles = false ;
62
- String minQscore = "" ;
63
57
List <String > args = null ;
64
58
65
59
try {
@@ -73,69 +67,45 @@ public void action(Configuration conf, List<String> arguments,
73
67
help (options );
74
68
}
75
69
76
- // Trim barcodes option
77
- if (line .hasOption ("trim-barcodes" )) {
78
- trimBarcode = true ;
79
- }
70
+ // Set the configuration settings
71
+ if (line .hasOption ('s' )) {
80
72
81
- if (line .hasOption ("flowcell" )) {
82
- flowcell = line .getOptionValue ("flowcell" );
83
- }
73
+ List <String > settings = Arrays .asList (line .getOptionValues ('s' ));
84
74
85
- if (line .hasOption ("kit" )) {
86
- kit = line .getOptionValue ("kit" );
87
- }
75
+ Splitter splitter = Splitter .on ('=' ).trimResults ();
76
+ for (String s : settings ) {
77
+ List <String > elements = splitter .splitToList (s );
78
+ if (elements .size () != 2 ) {
79
+ throw new ParseException ("Invalid setting format: " + s );
80
+ }
81
+ doradoConf .set (elements .get (0 ).trim (), elements .get (1 ).trim ());
82
+ }
88
83
89
- if (line .hasOption ("barcode-kit" )) {
90
- barcodeKits = line .getOptionValue ("barcode-kit" );
91
84
}
92
85
93
86
if (line .hasOption ("run-id" )) {
94
87
runId = line .getOptionValue ("run-id" );
95
88
}
96
89
97
- if (line .hasOption ("dorado-version" )) {
98
- doradoVersion = line .getOptionValue ("dorado-version" );
99
- }
100
-
101
- if (line .hasOption ("config" )) {
102
- modelName = line .getOptionValue ("config" );
103
- }
104
-
105
- if (line .hasOption ("min-qscore" )) {
106
- minQscore = line .getOptionValue ("min-qscore" );
107
- }
108
-
109
90
if (line .hasOption ("device" )) {
110
91
cudaDevice = line .getOptionValue ("device" );
111
92
}
112
93
113
- if (line .hasOption ("batch-size" )) {
114
- batchSize = Integer .parseInt (line .getOptionValue ("batch-size" ));
115
- }
116
-
117
- if (line .hasOption ("chunk-size" )) {
118
- chunkSize = Integer .parseInt (line .getOptionValue ("chunk-size" ));
119
- }
120
-
121
94
if (line .hasOption ("keep-temporary-files" )) {
122
95
keepTemporaryFiles = true ;
123
96
}
124
97
args = Arrays .asList (line .getArgs ());
125
98
126
- if (args .size () < 4 ) {
99
+ if (args .size () < 3 ) {
127
100
help (options );
128
101
}
129
102
130
103
final Path inputTar = Paths .get (args .get (0 ));
131
104
final Path outputDir = Paths .get (args .get (1 ));
132
- final Path modelsPath = Paths .get (args .get (2 ));
133
- final Path tmpPath = Paths .get (args .get (3 ));
105
+ final Path tmpPath = Paths .get (args .get (2 ));
134
106
135
- DoradoONTBasecallingDataProcessor .run (inputTar , outputDir , modelsPath ,
136
- runId , doradoVersion , tmpPath , flowcell , kit , barcodeKits ,
137
- trimBarcode , minQscore , modelName , cudaDevice , batchSize , chunkSize ,
138
- keepTemporaryFiles , logger );
107
+ DoradoONTBasecallingDataProcessor .run (inputTar , outputDir , runId , tmpPath ,
108
+ cudaDevice , keepTemporaryFiles , doradoConf , logger );
139
109
140
110
} catch (ParseException e ) {
141
111
Common .errorExit (e ,
@@ -166,52 +136,23 @@ private static Options makeOptions() {
166
136
// create Options object
167
137
final Options options = new Options ();
168
138
169
- // Dorado version option
170
- options .addOption (builder ("g" ).longOpt ("dorado-version" ).hasArg ()
171
- .argName ("version" ).desc ("dorado version" ).build ());
172
-
173
- // Flowcell option
174
- options .addOption (builder ("f" ).longOpt ("flowcell" ).hasArg ().argName ("type" )
175
- .desc ("flow cell type" ).build ());
176
-
177
- // Kit option
178
- options .addOption (builder ("k" ).longOpt ("kit" ).hasArg ().argName ("kitname" )
179
- .desc ("kit name" ).build ());
180
-
181
- // Config option
182
- options .addOption (builder ("c" ).longOpt ("config" ).hasArg ()
183
- .argName ("configname" ).desc ("configuration filename" ).build ());
139
+ // Define setting
140
+ options .addOption (builder ("s" ).longOpt ("setting" ).hasArg ()
141
+ .argName ("property=value" ).desc ("set a configuration setting. This "
142
+ + "option can be used several times" )
143
+ .build ());
184
144
185
145
// GPU device option
186
146
options .addOption (builder ("d" ).longOpt ("device" ).hasArg ()
187
147
.argName ("cudadevice" ).desc ("Cuda device name" ).build ());
188
148
189
- // Batch size
190
- options .addOption (builder ("u" ).longOpt ("batch-size" ).hasArg ()
191
- .argName ("size" ).desc ("batch size" ).build ());
192
-
193
- // Chunks size
194
- options .addOption (builder ("p" ).longOpt ("chunk-size" ).hasArg ()
195
- .argName ("chunks" ).desc ("chunk size" ).build ());
196
-
197
149
// Run id option
198
150
options .addOption (builder ("r" ).longOpt ("run-id" ).hasArg ().argName ("id" )
199
151
.desc ("run id" ).build ());
200
152
201
- // Barcode kits option
202
- options .addOption (builder ("" ).longOpt ("barcode-kit" ).hasArg ()
203
- .argName ("kits" ).desc ("barcode kit" ).build ());
204
-
205
- // Trim barcode option
206
- options .addOption ("t" , "trim-barcodes" , false , "trim barcodes" );
207
-
208
153
// Fast5 output
209
154
options .addOption ("e" , "keep-temporary-files" , false , "Fast5 output" );
210
155
211
- // Barcode kits option
212
- options .addOption (builder ("m" ).longOpt ("min-qscore" ).hasArg ()
213
- .argName ("value" ).desc ("minimal qscore for pass reads" ).build ());
214
-
215
156
// Help option
216
157
options .addOption ("h" , "help" , false , "display this help" );
217
158
0 commit comments