comparison COBRAxy/custom_data_generator.py @ 365:8a6da55f4e0e draft

Uploaded
author francesco_lapi
date Thu, 04 Sep 2025 23:44:03 +0000
parents 941ff9b896e4
children 0961c8a27939
comparison
equal deleted inserted replaced
364:ae3bb0caee30 365:8a6da55f4e0e
36 help="Custom medium file if medium_selector=Custom") 36 help="Custom medium file if medium_selector=Custom")
37 37
38 parser.add_argument("--output_format", type=str, choices=["tabular", "xlsx"], required=True, 38 parser.add_argument("--output_format", type=str, choices=["tabular", "xlsx"], required=True,
39 help="Output format: CSV (tabular) or Excel (xlsx)") 39 help="Output format: CSV (tabular) or Excel (xlsx)")
40 40
41 parser.add_argument("--out_data", type=str, required=True, 41 parser.add_argument("--out_tabular", type=str,
42 help="Output file for the merged dataset (CSV or XLSX)") 42 help="Output file for the merged dataset (CSV or XLSX)")
43 43
44 parser.add_argument("--out_xlsx", type=str,
45 help="Output file for the merged dataset (CSV or XLSX)")
44 46
45 parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__), 47 parser.add_argument("--tool_dir", type=str, default=os.path.dirname(__file__),
46 help="Tool directory (passed from Galaxy as $__tool_directory__)") 48 help="Tool directory (passed from Galaxy as $__tool_directory__)")
47 49
48 50
253 255
254 #merged.to_csv(out_file, sep = '\t', index = False) 256 #merged.to_csv(out_file, sep = '\t', index = False)
255 257
256 258
257 #### 259 ####
258 out_data_path = ARGS.out_data # Galaxy provides a filepath
259 260
260 if ARGS.output_format == "xlsx": 261 if ARGS.output_format == "xlsx":
261 merged.to_excel(out_data_path, index=False) 262 merged.to_excel(ARGS.out_xlsx, index=False)
262 else: 263 else:
263 merged.to_csv(out_data_path, sep="\t", index=False) 264 merged.to_csv(ARGS.out_tabular, sep="\t", index=False)
264 265
265 266
266 267
267 if __name__ == '__main__': 268 if __name__ == '__main__':
268 main() 269 main()