# HG changeset patch # User luca_milaz # Date 1720032533 0 # Node ID ea089c02b73efaabdad7f1374b38705c53165e06 # Parent 1c244b999e1d26ae24b94d9a19d3c66136cb19e8 Uploaded diff -r 1c244b999e1d -r ea089c02b73e marea_2_0/flux_sampling.py --- a/marea_2_0/flux_sampling.py Wed Jul 03 18:37:19 2024 +0000 +++ b/marea_2_0/flux_sampling.py Wed Jul 03 18:48:53 2024 +0000 @@ -97,12 +97,13 @@ print(s) -def write_to_file(dataset: pd.DataFrame, dest: str)->None: +def write_to_file(dataset: pd.DataFrame, name: str)->None: if ARGS.output_format is utils.FileFormat.PICKLE: - utils.writePickle(os.path.normpath(dest), dataset) + save_path = utils.FilePath(name, ARGS.output_format, prefix = ARGS.output_folder) + utils.writePickle(save_path, dataset) elif ARGS.output_format is utils.FileFormat.CSV: - dataset.to_csv(dest, sep = '\t', index = False) + dataset.to_csv(ARGS.output_folder + name + ".csv", sep = '\t', index = False) def OPTGP_sampler(model:cobra.Model, model_name:str, n_samples:int=1000, thinning:int=100, n_batches:int=1, seed:int=0)-> None: @@ -148,7 +149,7 @@ samples_batch = pd.read_csv(ARGS.output_folder + model_name + '_'+ str(i)+'.csv') samplesTotal = pd.concat([samplesTotal, samples_batch], ignore_index = True) - write_to_file(samplesTotal, ARGS.output_folder + model_name) + write_to_file(samplesTotal, model_name) for i in range(0, n_batches): os.remove(ARGS.output_folder + model_name + '_'+ str(i)+'.csv')