File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -85,15 +85,15 @@ impl EpistasisTable {
85
85
. shape ( & shape)
86
86
. writer ( writer)
87
87
. begin_nd ( )
88
- . map_err ( |e| VirolutionError :: InitializationError ( format ! ( "{}" , e) ) ) ?;
88
+ . map_err ( |e| VirolutionError :: WriteError ( format ! ( "{}" , e) ) ) ?;
89
89
90
90
// Write entries to file
91
91
npy_writer
92
92
. extend ( entries)
93
- . map_err ( |e| VirolutionError :: InitializationError ( format ! ( "{}" , e) ) ) ?;
93
+ . map_err ( |e| VirolutionError :: WriteError ( format ! ( "{}" , e) ) ) ?;
94
94
npy_writer
95
95
. finish ( )
96
- . map_err ( |e| VirolutionError :: InitializationError ( format ! ( "{}" , e) ) ) ?;
96
+ . map_err ( |e| VirolutionError :: WriteError ( format ! ( "{}" , e) ) ) ?;
97
97
98
98
Ok ( ( ) )
99
99
}
Original file line number Diff line number Diff line change @@ -93,13 +93,13 @@ impl FitnessTable {
93
93
. shape ( shape)
94
94
. writer ( writer)
95
95
. begin_nd ( )
96
- . map_err ( |e| VirolutionError :: InitializationError ( format ! ( "{}" , e) ) ) ?;
96
+ . map_err ( |e| VirolutionError :: WriteError ( format ! ( "{}" , e) ) ) ?;
97
97
npy_writer
98
98
. extend ( self . table . clone ( ) )
99
- . map_err ( |e| VirolutionError :: InitializationError ( format ! ( "{}" , e) ) ) ?;
99
+ . map_err ( |e| VirolutionError :: WriteError ( format ! ( "{}" , e) ) ) ?;
100
100
npy_writer
101
101
. finish ( )
102
- . map_err ( |e| VirolutionError :: InitializationError ( format ! ( "{}" , e) ) ) ?;
102
+ . map_err ( |e| VirolutionError :: WriteError ( format ! ( "{}" , e) ) ) ?;
103
103
Ok ( ( ) )
104
104
}
105
105
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ pub enum VirolutionError {
9
9
ImplementationError ( String ) ,
10
10
InitializationError ( String ) ,
11
11
ReadError ( String ) ,
12
+ WriteError ( String ) ,
12
13
}
13
14
14
15
impl fmt:: Display for VirolutionError {
@@ -23,6 +24,9 @@ impl fmt::Display for VirolutionError {
23
24
VirolutionError :: ReadError ( message) => {
24
25
write ! ( f, "ReadError: {}" , message)
25
26
}
27
+ VirolutionError :: WriteError ( message) => {
28
+ write ! ( f, "WriteError: {}" , message)
29
+ }
26
30
}
27
31
}
28
32
}
Original file line number Diff line number Diff line change @@ -212,9 +212,17 @@ impl Runner {
212
212
}
213
213
214
214
fn write_fitness_tables ( providers : & [ & FitnessProvider ] , path : Option < & Path > ) {
215
- let sequence_path = path. unwrap_or_else ( || Path :: new ( "./" ) ) ;
215
+ let write_path = path. unwrap_or_else ( || Path :: new ( "./" ) ) ;
216
+
217
+ // create output directory
218
+ fs:: create_dir_all ( write_path) . unwrap_or_else ( |_| {
219
+ eprintln ! ( "Unable to create output directory." ) ;
220
+ std:: process:: exit ( 1 ) ;
221
+ } ) ;
222
+
223
+ // write fitness tables
216
224
providers. iter ( ) . for_each ( |provider| {
217
- provider. write ( sequence_path ) . unwrap ( ) ;
225
+ provider. write ( write_path ) . unwrap ( ) ;
218
226
} ) ;
219
227
}
220
228
You can’t perform that action at this time.
0 commit comments