Mercurial > repos > bimib > cobraxy
comparison COBRAxy/custom_data_generator.py @ 361:ca5d82f9075f draft
Uploaded
| author | francesco_lapi | 
|---|---|
| date | Thu, 04 Sep 2025 23:34:15 +0000 | 
| parents | 820befcfb42f | 
| children | 941ff9b896e4 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 360:6ab85843c255 | 361:ca5d82f9075f | 
|---|---|
| 200 # get args from frontend (related xml) | 200 # get args from frontend (related xml) | 
| 201 global ARGS | 201 global ARGS | 
| 202 ARGS = process_args(args) | 202 ARGS = process_args(args) | 
| 203 | 203 | 
| 204 # this is the worst thing I've seen so far, congrats to the former MaREA devs for suggesting this! | 204 # this is the worst thing I've seen so far, congrats to the former MaREA devs for suggesting this! | 
| 205 if os.path.isdir(ARGS.output_path) == False: | 205 #if os.path.isdir(ARGS.output_path) == False: | 
| 206 os.makedirs(ARGS.output_path) | 206 # os.makedirs(ARGS.output_path) | 
| 207 | 207 | 
| 208 if ARGS.input: | 208 if ARGS.input: | 
| 209 # load custom model | 209 # load custom model | 
| 210 model = load_custom_model( | 210 model = load_custom_model( | 
| 211 utils.FilePath.fromStrPath(ARGS.input), utils.FilePath.fromStrPath(ARGS.name).ext) | 211 utils.FilePath.fromStrPath(ARGS.input), utils.FilePath.fromStrPath(ARGS.name).ext) | 
| 253 | 253 | 
| 254 #merged.to_csv(out_file, sep = '\t', index = False) | 254 #merged.to_csv(out_file, sep = '\t', index = False) | 
| 255 | 255 | 
| 256 | 256 | 
| 257 #### | 257 #### | 
| 258 out_data_path = ARGS.output_path | 258 out_data_path = ARGS.output_path # Galaxy provides a filepath | 
| 259 | 259 | 
| 260 if ARGS.output_format == "xlsx": | 260 if ARGS.output_format == "xlsx": | 
| 261 merged.to_excel(out_data_path, index=False) | 261 merged.to_excel(out_data_path, index=False) | 
| 262 else: | 262 else: | 
| 263 merged.to_csv(out_data_path, sep="\t", index=False) | 263 merged.to_csv(out_data_path, sep="\t", index=False) | 
| 264 | 264 | 
| 265 | |
| 266 print(f"Custom data generated for model '{model_name}' and saved to '{out_data_path}'") | 265 print(f"Custom data generated for model '{model_name}' and saved to '{out_data_path}'") | 
| 266 | |
| 267 | 267 | 
| 268 if __name__ == '__main__': | 268 if __name__ == '__main__': | 
| 269 main() | 269 main() | 
