comparison COBRAxy/flux_simulation_beta.py @ 480:ecaf3c9852b3 draft

Uploaded
author luca_milaz
date Mon, 22 Sep 2025 16:29:01 +0000
parents a036b8d3642f
children 1c6fcf97cabe
comparison
equal deleted inserted replaced
479:a036b8d3642f 480:ecaf3c9852b3
210 # Merge all batches into a single DataFrame 210 # Merge all batches into a single DataFrame
211 all_samples = [] 211 all_samples = []
212 212
213 for i in range(n_batches): 213 for i in range(n_batches):
214 batch_filename = f"{ARGS.output_path}/{model_name}_{i}_OPTGP.npy" 214 batch_filename = f"{ARGS.output_path}/{model_name}_{i}_OPTGP.npy"
215 batch_data = np.load(batch_filename) 215 batch_data = np.load(batch_filename, allow_pickle=True)
216 all_samples.append(batch_data) 216 all_samples.append(batch_data)
217 217
218 # Concatenate all batches 218 # Concatenate all batches
219 samplesTotal_array = np.vstack(all_samples) 219 samplesTotal_array = np.vstack(all_samples)
220 220
287 # Merge all batches into a single DataFrame 287 # Merge all batches into a single DataFrame
288 all_samples = [] 288 all_samples = []
289 289
290 for i in range(n_batches): 290 for i in range(n_batches):
291 batch_filename = f"{ARGS.output_path}/{model_name}_{i}_CBS.npy" 291 batch_filename = f"{ARGS.output_path}/{model_name}_{i}_CBS.npy"
292 batch_data = np.load(batch_filename) 292 batch_data = np.load(batch_filename, allow_pickle=True)
293 all_samples.append(batch_data) 293 all_samples.append(batch_data)
294 294
295 # Concatenate all batches 295 # Concatenate all batches
296 samplesTotal_array = np.vstack(all_samples) 296 samplesTotal_array = np.vstack(all_samples)
297 297
298 # Convert back to DataFrame with proper column names 298 # Convert back to DataFrame with proper column namesq
299 samplesTotal = pd.DataFrame(samplesTotal_array, columns=reaction_ids) 299 samplesTotal = pd.DataFrame(samplesTotal_array, columns=reaction_ids)
300 300
301 # Save the final merged result as CSV 301 # Save the final merged result as CSV
302 write_to_file(samplesTotal.T, model_name, True) 302 write_to_file(samplesTotal.T, model_name, True)
303 303