@@ -200,7 +200,8 @@ def average_networks(in_files, ntwk_res_file, group_id):
200
200
201
201
# Writes the networks and returns the name
202
202
network_name = group_id + "_average.pck"
203
- nx .write_gpickle (avg_ntwk , op .abspath (network_name ))
203
+ with open (op .abspath (network_name ), 'wb' ) as f :
204
+ pickle .dump (avg_ntwk , f , pickle .HIGHEST_PROTOCOL )
204
205
iflogger .info ("Saving average network as %s" , op .abspath (network_name ))
205
206
avg_ntwk = fix_keys_for_gexf (avg_ntwk )
206
207
network_name = group_id + "_average.gexf"
@@ -483,7 +484,8 @@ def _run_interface(self, runtime):
483
484
for key in list (node_measures .keys ()):
484
485
newntwk = add_node_data (node_measures [key ], ntwk )
485
486
out_file = op .abspath (self ._gen_outfilename (key , "pck" ))
486
- nx .write_gpickle (newntwk , out_file )
487
+ with open (out_file , 'wb' ) as f :
488
+ pickle .dump (newntwk , f , pickle .HIGHEST_PROTOCOL )
487
489
nodentwks .append (out_file )
488
490
if isdefined (self .inputs .out_node_metrics_matlab ):
489
491
node_out_file = op .abspath (self .inputs .out_node_metrics_matlab )
@@ -497,7 +499,8 @@ def _run_interface(self, runtime):
497
499
for key in list (edge_measures .keys ()):
498
500
newntwk = add_edge_data (edge_measures [key ], ntwk )
499
501
out_file = op .abspath (self ._gen_outfilename (key , "pck" ))
500
- nx .write_gpickle (newntwk , out_file )
502
+ with open (out_file , 'wb' ) as f :
503
+ pickle .dump (newntwk , f , pickle .HIGHEST_PROTOCOL )
501
504
edgentwks .append (out_file )
502
505
if isdefined (self .inputs .out_edge_metrics_matlab ):
503
506
edge_out_file = op .abspath (self .inputs .out_edge_metrics_matlab )
@@ -521,7 +524,8 @@ def _run_interface(self, runtime):
521
524
out_file = op .abspath (
522
525
self ._gen_outfilename (self .inputs .out_k_crust , "pck" )
523
526
)
524
- nx .write_gpickle (ntwk_measures [key ], out_file )
527
+ with open (out_file , 'wb' ) as f :
528
+ pickle .dump (ntwk_measures [key ], f , pickle .HIGHEST_PROTOCOL )
525
529
kntwks .append (out_file )
526
530
gpickled .extend (kntwks )
527
531
0 commit comments